Hello, I'm trying to have a full-text query that boost results that starts with the entered query.
For instance i have 2 book titles: "Viva Harry Potter" and "Harry Potter and the whatever stone".
If the user search for "harry potter" i want the second one to have a better score.
This is my query:
GET _search
{
"query": {
"bool": {
"should": [
{
"multi_match": {
"analyzer": "italian",
"query": "harry potter",
"fields": [
"post_title",
"author"
]
}
},
{
"match_phrase": {
"post_title": {
"query": "harry potter",
"boost": 2
}
}
},
{
"match_phrase_prefix": {
"post_title": {
"query": "harry potter",
"boost": 50
}
}
},
{
"match_phrase": {
"author": {
"query": "harry potter",
"boost": 2
}
}
}
]
}
}
}
So, what am i doing wrong here?