I have two docs:
POST /support/docs/1
{
"title": "product 1",
"description": "...get support for your device, how to videos, troubleshooting. Find out the warranty status...",
}
Then I query the docs with term "how to find my RAM"
{
"query": {
"match": {
"description": "how to find my RAM"
}
}
}
The doc # 1 will get higher score since it matches more words in query term (how , find). But I would like doc #2 get higher score, since it contains the most meaningful word (RAM) in query string.
So the general question is, how to boost doc which contains specific words? I can build a keyword list which contains all words I want to boost.
Since you mentioned you can build a keyword list, then you can have your regular query in the must clause and boost particular terms with additional match queries in the should clause (with boosts).
Additionally, you could use the function_score query to do this, with the boost_factor function.
If I understand correctly, you mean I need firstly find the boosting words from the query string, e.g, loop the keyword list and check if any keyword contained in the query string, and then put the matched keyword to should clause. Right?
If so, I would say it works, but not perfect, I have to write some code in client.
Apache, Apache Lucene, Apache Hadoop, Hadoop, HDFS and the yellow elephant
logo are trademarks of the
Apache Software Foundation
in the United States and/or other countries.