elastic / elasticsearch

Free and Open Source, Distributed, RESTful Search Engine
https://www.elastic.co/products/elasticsearch
Other
777 stars 24.79k forks source link

Add sorting support to diagnostic APIs #88094

Open dakrone opened 2 years ago

dakrone commented 2 years ago

Description

Some of our APIs can be quite large depending on the number of indices or shards in the cluster. To assist a user (or ourselves) finding what they need from some of these APIs, it would be beneficial if we could sort the output of some of these APIs by certain criteria.

An example of this could look like:

GET /_stats?sort=indices.status:desc,indices.uuid:asc
{
  "_shards": {...},
  "_all": {...},
  "indices": {
    "my-index-001920": {
      "uuid": "b-uuid",
      "status": "open",
      …
    },
    "my-index-002812": {
      "uuid": "d-uuid",
      "status": "open",
      …
    },
    "my-index-000120": {
      "uuid": "a-uuid",
      "status": "closed",
      … 
    }
}

This would also be very helpful for pagination (#87555) and filtering (#88095).

Some APIs that could support sorting:

elasticmachine commented 2 years ago

Pinging @elastic/es-data-management (Team:Data Management)