We have a Ruby on Rails backend using Searchkick to interact with Elasticsearch.
Here is what our query looks like:
results = Runnable.search(search_term,
fields: ["application_name^10", "name^5"],
match: :word_middle,
order: {application_name: :asc, name: :asc},
operator: "or",
misspellings: false)
The problem is that when users search for a keyword, for example "Word1 word2", the results that contain only "word1" will be ranked better than the results that have both "word1" and "word2". Since we are also using pagination, users are not able to find what they are looking for on page 1, which is not what we desire.
I'm wondering if there is a way to rank the results by the number of words matched in a search term (i.e. 3 matches is better than 1 match) in ElasticSearch? If so, how to implement that with Searchkick?