Elasticsearch Phrase Prefix Results
I have two ES requests:
{match:{text:{query: "text box", type: "phrase"}}}
{match:{text:{query: "text bo", type: "phrase_prefix"}}}
The problem is that the second query returns fewer documents than the first, although I would expect the second query to return all the records from the first, plus something extra. What am I missing?
thank
+1
source to share
1 answer
This could be due to being max_expansions
set to the default 10
try it
{
"query": {
"match_phrase_prefix": {
"text": {
"query": "text bo",
"max_expansions": 100
}
}
}
}
This one will help you understand how the terms expand. do max_expansions
1000 and see the results.
Basically you have a lot of words that start with bo, like bond, boss, and since the "x" comes last in alphabetical order, you don't get what you expect.
Hope this helps!
+2
source to share