Search in ElasticSearch with where condition -
let's have documents following fields: {field1, field2, costprice, sellingprice}
i need run queries of conditions require difference between costprice
, sellingprice
in standard sql, example be:
select * table1 costprice-sellingprice>0
how can achieve in elasticsearch?
still scripts need:
{ "query": { "bool": { "must": [ { "match_all": {} } ], "filter": { "script": { "script": "doc['costprice'].value - doc['sellingprice'].value > 0" } } } } }
Comments
Post a Comment