Create a table counting the number of buckets having same count (count pipeline ?)

I have an index with a line for each customer order.
I am trying to get a visualization table listing the number of customers ordering several times, with one line per number of recurrent orders.

Number of orders Number of customers
1 10
2 5
4 3

Didn't find a solution with aggregation pipelines... What did I miss ?
Thank you for your help !

Hi, I think this is possible by changing the structure of your data to be customer-oriented instead of order-oriented. This is part of the functionality we offer as data transforms.

Basically you can create a transformation that aggregates this way:

  • Group by customer ID
  • Count the orders per customer

Then you can easily create the visualization you want on top of the pre-aggregated data

Thank you fio your quick answer Wylie !
So it seems there is no simple Kibana based solution.

Sort of equivalent to :

select count(*) from (select count(*) as qty from orderIndex group by customer_name) group by qty

Exactly. Kibana is (with a few exceptions) limited by what you can express using a single Elasticsearch query, which is why I recommended changing the structure of the data.

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.