Search code examples
elasticsearchlogstashkibanaelastic-stackelk

How can I sort the date in the X axis properly on a Bar Chart in Kibana?


I'm trying to order the date ascendantly in the X axis of the chart. And I've set it up that way here:

Order

However, this happens:

Wrong order

Is there a way to work around this? 25 January should be the last bar. I've tried changing data formats to see if it would order properly but with no success.


Solution

  • You haven't specified how you are generating this graph, but it looks like you've done a Terms aggregation on the date field. The order by you are showing is then for the terms count. If you look right above that, it probably says order by: Metric count. What you want it to say is Order by: term.

    In any event, in general, you don't want to aggregate by date like that. Instead choose a Date Histogram aggregation. That will allow the time filter/aggregation bucket size to be changed.