SELECT MAX(IF(<condition>,<value1>,<value2>)) FROM test is not currently supported in ES-SQL, but such a query is possible in Elasticsearch through the use of scripts.
For example:
{
"size":0,
"aggs" : {
"prices" : {
"sum" : {
"script" : {
"source": "if (doc['price'].size()>0) {if (doc.decider.value>0) return doc.price.value; else return 0;} else return 0;"
}
}
}
}
}
SELECT MAX(IF(<condition>,<value1>,<value2>)) FROM testis not currently supported in ES-SQL, but such a query is possible in Elasticsearch through the use of scripts.For example: