Hi I have a set of sub-queries that I first need to find the MAX score of sub-queries (using dis_max) then add together the SUM of the sub-queries scores as the final score. Is there a way to put them together in one POST API call without repeating the exact same set of sub-queries in two places? Thank you.
Bump. Hoping someone in the know could shed some light.
And I have looked at query template, but the sub-queries here are not some fixed queries that one just fill in the parameters. The sub-queries are from user input so query template is not going to help.
As far as I know there is no way to avoid this duplication, and the lack of response may indicate that there isn't anyone else that has a solution either. Usually queries are assembled programatically, so I do not understand why this duplication would be a problem. Could you please elaborate?
Thank you @Christian_Dahlqvist. I surely can take a No as the answer, I asked merely thinking I might have written my query poorly, as it just seemed unnecessarily pumping up the size of the POST request and I was hoping something like a function_score query that operates on _scores instead of _score, so that I can do Math.max(_scores) + Math.sum(_scores).
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.