Search code examples
elasticsearchloggingkibanaelastic-stack

How to get elasticsearch index in sorted order from kibana console?


I want to fetch all the indexed logs file from elastic search in descending order of date from kibana. Right now when I do:

GET _cate/indices 

It gives me indices in random order as given below:

yellow open index-7.10.1-front-ui-2021.02.02      AbT9OEM-RP6OYOvY1xE1PQ 1 1  6045      0   2.8mb   2.8mb
yellow open index-7.10.1-front-ui-2021.02.03      TXxJUyXdRiSK6S0RZtc3eQ 1 1  6057      0   2.7mb   2.7mb
yellow open index-7.10.1-front-ui-2021.01.31  

But I want it in the sorted order of date like given below:

yellow open index-7.10.1-front-ui-2021.02.03      TXxJUyXdRiSK6S0RZtc3eQ 1 1  6057      0   2.7mb   2.7mb
yellow open index-7.10.1-front-ui-2021.02.02      AbT9OEM-RP6OYOvY1xE1PQ 1 1  6045      0   2.8mb   2.8mb
yellow open index-7.10.1-front-ui-2021.01.31  

Please let me know if it is possible?


Solution

  • Sure, you can sort the lines using the s query string parameter with the column name on which you'd like to sort:

    GET _cat/indices?v&s=index:desc