Reputation: 69
I am trying to achieve the following scenario...
Within my elasticsearch index will be a number of specific records that i want to be the number 1 result if the query contains specific words within this field. This field is company name so for example if someone puts 'ford' into the search the company name field will have a boost over all other fields so this is highest score..... this seems to work for me with the single word... ford, nissan etc...
however... if the query is say 'ford car sales' then other pages are ranked higher than the one i want because of course many pages contain all these terms (the search operator is AND)... but is there a way to still rank my page top by being able to boost words in the company name field irrespective of how many words are in the query or found elsewhere.....
finally could i somehow set up variations of company names to the one in the field to boost these results... so where name is fiat-chrysler, set up other variations a user may search on such as 'fiat chrysler' without the hyphen....
thanks for any help....
Upvotes: 0
Views: 99
Reputation: 146
In your query when you use "field" to specify the fields you are searching in, add boosting to 'company name' field by using ^.
Example:
{
"fields": ["company_name^10","other_field_a", "other_field_b"],
"query" : {
"term" : { "company_name" : "ford" }
}
}
Upvotes: 0