Closed
Description
ES 7.11.1
When using dynamic:runtime
, I am able to continue "indexing" even when having encountered a runtime mapping conflict:
PUT test-index-1
{
"mappings": {
"dynamic": "runtime"
}
}
PUT test-index-1/_doc/1
{
"field1": 22
}
PUT test-index-1/_doc/2
{
"field1": "string"
}
Also, I can search the data if I know what type i'm looking for:
GET test-index-1/_search
{
"runtime_mappings": {
"my_field": {
"type": "keyword",
"script": {
"source": "emit(params._source.field1.toString())"
}
}
},
"query": {
"term": {
"my_field": {
"value": "string"
}
}
}
}
However when Elasticsearch encounters a runtime field conflict between object and non-object mappings, a rejection occurs:
PUT test-runtime
{
"mappings": {
"dynamic" : "runtime"
}
}
PUT test-runtime/_doc/1
{
"my-obj": {
"val": 1
}
}
PUT test-runtime/_doc/1
{
"my-obj": "not-object"
}
{
"error" : {
"root_cause" : [
{
"type" : "mapper_parsing_exception",
"reason" : "object mapping for [my-obj] tried to parse field [my-obj] as object, but found a concrete value"
}
],
"type" : "mapper_parsing_exception",
"reason" : "object mapping for [my-obj] tried to parse field [my-obj] as object, but found a concrete value"
},
"status" : 400
}