-
Notifications
You must be signed in to change notification settings - Fork 25.6k
Closed
Labels
:Search Foundations/MappingIndex mappings, including merging and defining field typesIndex mappings, including merging and defining field types>bugTeam:Search FoundationsMeta label for the Search Foundations team in ElasticsearchMeta label for the Search Foundations team in Elasticsearch
Description
... yet it is allowed. See this example
Elasticsearch version: 5.2.1
DELETE test
DELETE test2
PUT test
{
"mappings": {
"foo": {
"properties": {
"x": {
"type": "date",
"format": "yyyy-MM-dd"
}
}
}
}
}
PUT test2
{
"mappings": {
"foo": {
"properties": {
"x": {
"type": "date",
"format": [ "yyyy-MM-dd" ]
}
}
}
}
}
GET test/foo/_mapping
GET test2/foo/_mapping
PUT _bulk
{ "index" : {"_index" : "test", "_type" : "foo" } }
{ "x" : "2017-03-20" }
{ "index" : {"_index" : "test2", "_type" : "foo" } }
{ "x" : "2017-03-20" }
the mapping calls return
GET test/foo/_mapping
{
"test": {
"mappings": {
"foo": {
"properties": {
"x": {
"type": "date",
"format": "yyyy-MM-dd"
}
}
}
}
}
}
GET test2/foo/_mapping
{
"test2": {
"mappings": {
"foo": {
"properties": {
"x": {
"type": "date",
"format": "[yyyy-MM-dd]"
}
}
}
}
}
}
Trying to index the same document in both indices results in
PUT _bulk
{ "index" : {"_index" : "test", "_type" : "foo" } }
{ "x" : "2017-03-20" }
{ "index" : {"_index" : "test2", "_type" : "foo" } }
{ "x" : "2017-03-20" }
{
"took": 5,
"errors": true,
"items": [
{
"index": {
"_index": "test",
"_type": "foo",
"_id": "AVrq5TOq1NgG2ZBFgd-y",
"_version": 1,
"result": "created",
"_shards": {
"total": 2,
"successful": 1,
"failed": 0
},
"created": true,
"status": 201
}
},
{
"index": {
"_index": "test2",
"_type": "foo",
"_id": "AVrq5TOq1NgG2ZBFgd-z",
"status": 400,
"error": {
"type": "mapper_parsing_exception",
"reason": "failed to parse [x]",
"caused_by": {
"type": "illegal_argument_exception",
"reason": """Invalid format: "2017-03-20""""
}
}
}
}
]
}
ezamlee
Metadata
Metadata
Assignees
Labels
:Search Foundations/MappingIndex mappings, including merging and defining field typesIndex mappings, including merging and defining field types>bugTeam:Search FoundationsMeta label for the Search Foundations team in ElasticsearchMeta label for the Search Foundations team in Elasticsearch