在Kibana中过滤并找到唯一值(Elasticsearch)

时间:2016-05-11 14:54:25

标签: elasticsearch kibana kibana-4

我使用kibana。

我想过滤一些值并找到唯一计数。

离)

{ user_id: 1, type: "customer", action: "xxx" }
{ user_id: 1, type: "customer", action: "xxx" }
{ user_id: 1, type: "seller", action: "xxx" }   # user change type!!!
{ user_id: 2, type: "customer", action: "xxx" }
{ user_id: 2, type: "customer", action: "xxx" }
{ user_id: 3, type: "customer", action: "xxx" }

我如何只计算客户数量。 我想得到 customer_count: 2

例如,在SQL中:

SELECT COUNT(DISTINCT(user_id)) FROM users where user_id NOT IN (SELECT user_id FROM users WHERE type = "seller")

对这种情况有任何疑问吗?

0 个答案:

没有答案