I need a ES Query equalent to sql count(if(somecondition))

Hello,
My Question is How to frame Query for 'SELECT EMPLOYEE,COUNT(IF(COUNTRY IN US)) FROM ORG WHERE SOMECRITERIA'

I suppose value count aggregation will help you.

yes , i should use value count but how can i achieve count(if(condition)) shall i use this in filter

"top-level filter query" besides the value count aggregation will be a good solution.

See Filter aggregation | Elasticsearch Guide [7.15] | Elastic

Thankyou @Tomo_M i will check this one and update once it works

1 Like

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