I wish to do a primary sorting strictly on number of these terms matched, and secondarily on the total score of the three terms.
I know a way to sort by number of hits, ie. to use constant score, and score each termQuery as 1.
I also know that I can sort by scoring, ie. by having a bool query, where I add all three term queries to the should clause.
But when it comes to combining these, I get in trouble. I Hope someone in the community can help me on this problem, and give me some hint to how I can primary sort on one score, and secondarily sort on another score.
I wish to do a primary sorting strictly on number of these terms matched, and secondarily on the total score of the three terms.
That said, can't you do that with a bool query with multiple should clauses, one for each term which you boost by 10 for example and the last one for the whole text which you boost by 1 (default) or by 0.1?
Rescoring is interesting, it might be something like that I should use. Only problem with that solution is, that I potentially have a lot of docs matching equally well on the first scoring, which means my window has to be quite high.
The boosting is also a good idea, simply boosting the clauses with constant score so much, that it will always dominate the other part. That might be a feasible solution as well.
Thank you so much for your help/ideas!
P.S.
With regard to the 7.12.0, we have just gone from ES.1.7 to 7.5.2 a couple of months ago, so hoped that would stop people begging me to update - but I see that will never go away
Actually it has been probably a nightmare to go from 1.7 to 7.x. The cool news is that moving from 7.5 to 7.12 should be super easy. Specifically if you are running on cloud.elastic.co where the upgrade is like a one click operation...
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.