Reputation: 3
I have a problem when i make a match_phrase_query with a string containing space, but not always =/
3 examples :
1/
{
"query" : {
"match_phrase_prefix" : {
"username" : {
"query":"maury"
}
}
}
}
This first example works and give me results.
2/
{
"query" : {
"match_phrase_prefix" : {
"username" : {
"query":"maury chelsea"
}
}
}
}
This second example, with full name works too.
3/
{
"query" : {
"match_phrase_prefix" : {
"username" : {
"query":"maury ch"
}
}
}
}
This exemple didn't work, i have no result return. I didn't understand because it's working with 1 word, and 2 words, with the 2nd word having minimum 3-4 characters, depending of the name of the person i search.
Have you already encounter this problem ?
Thanks you, Ludovic
Upvotes: 0
Views: 129
Reputation: 217274
This is because you have a lot of terms starting with ch
. Try adding the max_expansions
parameter (which defaults to 50) and increase it to (e.g.) 100 to see if you get a result or not.
{
"query" : {
"match_phrase_prefix" : {
"username" : {
"query":"maury ch",
"max_expansions": 100 <--- add this
}
}
}
}
The official doc explains why you're running into this issue.
Upvotes: 1