-
Notifications
You must be signed in to change notification settings - Fork 25.8k
Support analyzer for keyword type #18064
Copy link
Copy link
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 Elasticsearchdiscuss
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 Elasticsearchdiscuss
Type
Fields
Give feedbackNo fields configured for issues without a type.
Sometimes you want to analyze text to make it consistent when running aggregations on top of it.
For example, let's say I have a
cityfield mapped as akeyword.This field can contain
San Francisco,SAN FRANCISCO,San francisco...If I build a terms aggregation on top of it, I will end up with
I'd like to be able to analyze this text before it gets indexed. Of course I could use a
textfield instead and setfielddata: truebut that would not create doc values for this field.I can imagine that we allow an analyzer at index time for this field.
We can restrict its usage if we wish and only allows analyzers which are using tokenizers like
lowercase,keyword,pathbut I would let the user decide.If we allow setting
analyzer: simplefor example, my aggregation will become:Same applies for path tokenizer.
Let say I'm building a dir tree like:
Applying a path tokenizer would help me to generate an aggregation like: