Anchormen / sql4es

sql4es: JDBC driver for Elasticsearch

Home Page:https://www.anchormen.nl

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Need cardinality aggregation to be supported

standino opened this issue · comments

Please help to implement cardinality-aggregation. Thanks.

Finding Distinct Countsedit
The first approximate aggregation provided by Elasticsearch is the cardinality metric. This provides the cardinality of a field, also called a distinct or unique count. You may be familiar with the SQL version:

SELECT COUNT(DISTINCT color)
FROM cars

https://www.elastic.co/guide/en/elasticsearch/guide/current/cardinality.html
https://www.elastic.co/guide/en/elasticsearch/reference/2.2/search-aggregations-metrics-cardinality-aggregation.html

Would be nice to include it in the driver indeed. It seems the Elastic side is relatively easy but it has to be parsed and interpreted correctly first. Feel free to give it a go and create a pull request for it.

Added support for cardinality aggregations in version 0.9.2.4 (works for Elasticsearch versions 2.X.X). I havent been able to test it thoroughly so let me know if anything is wrong with the current implementation.

Hi,
Thank you for the good work with this driver.
We'd like to use this feature with Pentaho. But we are getting a message in the logs:
Unable to combine COUNT DISTINCT with a normal SELECT within a single query
Is there any plan to enable these kind of queries?
select company, count(distinct empId) from payments group by company