I have a SQL query for SELECT DISTINCT(USER_ID) FROM TABLENAME
Need help to frame the query on Kibana for elastic search
I have a SQL query for SELECT DISTINCT(USER_ID) FROM TABLENAME
Need help to frame the query on Kibana for elastic search
Hello,
I'm not certain Elasticsearch SQL supports the distinct
syntax, but you should be able to accomplish this using a terms aggregation. Something like the following:
GET /<your index>/_search
{
"size": 0,
"aggs": {
"distinct_userids": {
"terms": {
"field": "userid",
"size": 1000
}
}
}
}
Regards,
Aaron
This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
© 2020. All Rights Reserved - Elasticsearch
Apache, Apache Lucene, Apache Hadoop, Hadoop, HDFS and the yellow elephant logo are trademarks of the Apache Software Foundation in the United States and/or other countries.