Reputation: 410
I have 2 entries
When I search "Rahim" with query_string with wildcard, I got 2 entires with same score. But as "Rahim" matches exactly, it will be great for me to have "Rahim" first with higher score, and "Rahima" later with lower score. The query is:
GET index/type/_search
{
"query": {
"query_string": {
"default_field": "fullNameEn",
"allow_leading_wildcard": false,
"analyze_wildcard": true,
"query": "Rahim*"
}
},
"from": 0,
"size": 10
}
Any help will be appreciated.
Upvotes: 1
Views: 397
Reputation: 1767
Use terms boosting in query string
GET index/type/_search
{
"query": {
"query_string": {
"default_field": "fullNameEn",
"allow_leading_wildcard": false,
"analyze_wildcard": true,
"query": "Rahim^2 OR Rahim*"
}
},
"from": 0,
"size": 10
}
Upvotes: 2