How to create Java query for a script

I have 2 attributes: price1 and price2.
I need to filter the result if price1 < price2

How to create Java code for it. I have written the following:
QueryBuilders.boolQuery()
.filter(QueryBuilders.scriptQuery("doc['lowestOurPrice'].value < doc['lowestBasePrice'].value"));

scriptQuery accepts Script object. How to create Script object with my query?

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.