弹性搜索计数不同 [英] Count distinct on elastic search

查看:95
本文介绍了弹性搜索计数不同的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何使用sql4es驱动程序在弹性搜索类型上实现计数不同的功能?

How to achieve count distinct function on elastic search type using sql4es driver?

Select distinct inv_number , count(1) from invoices;

但它返回特定发票编号的总计数。

But it returns the total count of the particular invoice number.

推荐答案

由于OP使用的是sql4es jdbc驱动程序,他正在为他的用例请求一个sql查询:

Since, the OP is using sql4es jdbc driver, he is asking for a sql query for his use-case :

SELECT COUNT(DISTINCT inv_number) from invoices;

它返回指定列的不同值的数量

it returns the number of distinct values of the specified column

这篇关于弹性搜索计数不同的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆