Description
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 filter the output of some of these APIs by certain criteria.
An initial thought is to support something akin to filter_path with very basic conditionals (:, >, <, >:, <:, !:
). This would use something like the "filter" query string parameter.
An example of this could look like:
GET /_stats?filter=indices.status:open,indices.total.docs.count:>1
{
"_shards": {...},
"_all": {...},
"indices": {
"my-index-001920": {
"status": "open",
"total": {
"docs": {
"count": 1238919,
…
}
},
…
},
"my-index-002812": {
"status": "open",
"total": {
"docs": {
"count": 1238919,
…
}
},
…
}
}
There is slightly more complexity here, as this example does not show any to easily handle combining multiple filters in different ways (AND
, OR
, or nesting).
This would also be very helpful for pagination (#87555) and sorting (#88094).
Some APIs that could support sorting:
- Indices stats
- ILM explain
- Get indices (settings/mappings/aliases)
- Index shard stores