I have a query like this
how I perform a query in Elasticsearch with this condition
if wager == 0 : payout/1 >= multiplier
else: payout/wager >= multiplier
filter multiplier according to this condition
I wrote this query but it's not working
"query": {
"bool": {
"filter": [
{
"script": {
"script": {
"params": {
"multiplier": "1"
},
"source": "if (doc['wager_usd'].value == 0) {return doc['payout_usd'].value / 1 >= params.multiplier;}return doc['payout_usd'].value / doc['wager_usd'].value >= params.multiplier;"
}
}
}
]
}
}
what I have wrong with this query, please help me!
Thanks!