I want to query similarly the following SQL query:
select countryName, count( distinct(countryId) ) as findCount from city group by countryName having findCount > 1
Who know how to implement in es ?
thanks for your answer !
I want to query similarly the following SQL query:
select countryName, count( distinct(countryId) ) as findCount from city group by countryName having findCount > 1
Who know how to implement in es ?
thanks for your answer !
You'd do this with a
terms
aggregation withmin_doc_count: 2
like thisNote that the
countryName
field should benot_analyzed
in order for this to work, or thecountryName
field is a multi-field with anot_analyzed
part.