We grep often the output of _cat API to find what we are looking for, why not add a parameter to do this directly?
curl http://localhost:9200/_cat/indices?grep=events-
This will make possible:
What exactly are you grepping for?
If that's just an index name (which seems likely given that the output of _cat/indices doesn't contain much in the way of grep'able text) then you can just include the index patten in the URL:
Per: https://www.elastic.co/guide/en/elasticsearch/reference/6.2/cat-indices.html#cat-indices
You can do
curl http://localhost:9200/_cat/indices/events-*
(or *events-* depending on what you're trying to match)
Ho it was a bad example ^^
What about finding all indices that are in yellow state? or using the _cat segments API.
@ebuildy
That very first example is given on the link...
Examplesedit
Which indices are yellow?GET /_cat/indices?v&health=yellow
Pinging @elastic/es-core-infra
I do not think that we should add this functionality. The cat APIs are by design meant for the command line where tools like grep are readily available. I do not want us to carry the weight of maintaining features like this nor that of complicating our APIs.
The cat APIs are intended to be used from the command line and we have never intended for them to be used from the browser. Therefore when we think about cat API functionality we tend towards implementing them in a way that makes them comfortable to use with traditional line-oriented command line tools. We do not want to take on the weight of maintaining features that are orthogonal to our intended use of the cat APIs. Regarding sharing relevant URL with the grep info, you can do this by sharing a relevant command line instead ("curl | grep").
We do however think there is a place in cat APIs for adding filtering/searching functionality that is specific to Elasticsearch (e.g., we will do wildcard expansion on /_cat/indices because how we do that is specific to Elasticsearch and we have the code in our codebase to do this). If there are APIs where we are missing this we are open to specifically targeted feature requests for them. As far as adding general grep functionality we are not going to do that.
Most helpful comment
I do not think that we should add this functionality. The cat APIs are by design meant for the command line where tools like
grepare readily available. I do not want us to carry the weight of maintaining features like this nor that of complicating our APIs.