Enable index_prefixes
by default
#51216
Labels
>enhancement
:Search/Mapping
Index mappings, including merging and defining field types
Team:Search
Meta label for search team
By default
text
fields expand aprefix
query to all matching terms in the dictionary. This makes the behavior consistent, all documents that should match are visited, at the cost of slow queries.However for positional queries such as
match_phrase_prefix
we have to limit the expansion to a small number of terms since each prefix match must be validated with the other terms in the phrase. The optionindex_prefixes
circumvents this issue by indexing 2-5 grams so that each prefix can be handle as a single inverted list. This allows to handle prefixes correctly in positional queries at the cost of slower indexing and bigger index. The trade-off is hard to find but users can be confused when amatch_phrase_query
doesn't return the expected documents by default.For correctness we should look at enabling
index_prefixes
by default. For instance we could:index_prefixes
by default ontext
field.string
(dynamic mapping) to:We should also look at the cost of enabling
index_prefixes
in terms of index size and indexation speed to get more insights.The text was updated successfully, but these errors were encountered: