Related to this discussion: Nested query and ignore_unmapped option problem
Hi,
Using ES 5.6.1, I am trying to make a single query to multiple indices that have slightly different index mappings for a field. One index uses a nested mapping, the other does not. I am using the ignore_unmapped option in my nested query but am getting failures due to: "[nested] nested object under path [enrichments.urls] is not of nested type"
Here is a partial mapping for index1 (field is not nested):
{ "top_level_field": { "properties": { "field": { "properties": { "sub_field": { "type": "keyword" } } } } } }
Here is a partial mapping for index2 (field is nested):
{ "top_level_field": { "properties": { "field": { "type": "nested", "properties": { "sub_field": { "type": "text", "analyzer": "custom_analyzer", "fields": { "analyzed1": { "type": "text", "analyzer": "custom_analyzer2" }, "analyzed2": { "type": "text", "analyzer": "another_analyzer" } } } } } } } }
Here is a sample query targeting /index1,index2/_search
{ "query": { "bool": { "should": [{ "query_string": { "fields": ["top_level_field.field.sub_field"], "query": "pizza" } }, { "nested": { "path": "top_level_field.field", "ignore_unmapped": true, "query": { "query_string": { "fields": ["top_level_field.field.sub_field", "top_level_field.field.sub_field.analyzed1", "top_level_field.field.sub_field.analyzed2"], "query": "pizza" } } } }] } } }
According to the docs, it seems like the ignore_unmapped option should allow this query to successfully execute against two fields in different indices with different mappings. Is that a correct assumption? Is there another way I should be structuring this query?
Thanks
Ying