-
Notifications
You must be signed in to change notification settings - Fork 25.6k
Open
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
Our default dynamic mappings rules create both a text and a keyword field whenever they hit a JSON string:
{
"type": "text",
"fields": {
"keyword": {
"type": "keyword",
"ignore_above": 256
}
}
}
And over the years, many clients implemented similar logic:
- when an exact query is fired, use the
keywordfield, - when an aggregation is used, use the
keywordfield, - otherwise use the
textfield.
Is it logic that we should embed in Elasticsearch? Maybe we can find better ideas, but here is a proposal to get the discussion started:
- Create a new
exact_matchquery, which tries to match against the whole string. It fails fortextfields and has the same behavior asmatchonkeyword, numbers, ... - Create a new
text_keywordfield, which is essentially a wrapper around atextand akeywordfield. Running aggregations or anexact_matchquery against this field use the subkeywordfield whilematch,query_string,multi_matchandsimple_query_stringqueries use thetextfield. - Update default dynamic mappings to create this field for strings instead of the current
text+ subkeywordmapping.
a03nikki, javanna and graphaelli
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