-
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>enhancementTeam:Search FoundationsMeta label for the Search Foundations team in ElasticsearchMeta label for the Search Foundations team in Elasticsearch
Description
As discussed in #11806, different queries handle unmapped fields differently. The nested, has_child, has_parent, geo_*, and function_score query throw exceptions, while all of the others match no docs instead.
We need to make the behaviour uniform across queries.
The solution we came up with in FixItFriday is:
- if a field doesn't exist in an index, then replace the query with a
FieldNotFoundquery, which matches no documents - if
explainis turned on, then thefield_not_foundquery will be part of the output - if the
strict_mappingsis passed, then the request will throw a field not found exception instead.
This preserves the ease of use of, eg:
GET _search?name=john
without making search requests even more verbose, but makes debugging bad field names easy.
Metadata
Metadata
Assignees
Labels
:Search Foundations/MappingIndex mappings, including merging and defining field typesIndex mappings, including merging and defining field types>enhancementTeam:Search FoundationsMeta label for the Search Foundations team in ElasticsearchMeta label for the Search Foundations team in Elasticsearch