4

Say I have an index of product sales where each document is an individual sale for a specific product. I can use Kibana to chart a date histogram of sales counts, bucketing by every month. This would be the frequency of product sales every month. Here is an example:

Sales per Month

I can also split that series using a terms aggregation on the product name, so I end up with the distribution of those sales across each product each month like so:

Sales across Products per Month

What I can't do, which seems straightforward, is sort that distribution by the product count in that specific month. I can sort it alphabetically, or by the overall sales of that product, but I can't do it using the sales during that month. This means that if the most popular product overall is at the bottom of the bar (like the green product in the above image), it remains at the bottom always even if the sales count of that product for a particular month is lower than everything else.

Is it possible to order this series by the product count in each month? In general, is there a way to order a split series by the value of each 'split'?

Akhil
  • 41
  • 2

0 Answers0