Reputation: 43
I am writing a shell script that will take back-ups. The problem is the argument should be cURL request and the parameter passed with URL should ignore a particular index. I read ES cat API document but was not able to figure out and the other answers give grep as the solution.
health status index green open abcd green open efgh green open ijkl green open mnop green open qrst
Commands Executed is: curl -X GET "http://hostname:port/_cat/indices/*,-efgh" curl -s http://hostname:port/_cat/indices | grep -v "efgh"
I want to ignore efgh while rest of the indices should be printed. Help would be appreciated
Error: {"error":{"root_cause":[{"type":"index_not_found_exception","reason":"no such index","resource.type":"index_or_alias","resource.id":"efgh","index_uuid":"na","index":"efgh"}],"type":"index_not_found_exception","reason":"no such index","resource.type":"index_or_alias","resource.id":"efgh","index_uuid":"na","index":"efgh"},"status":404}
Upvotes: 3
Views: 2939
Reputation: 217314
You can use the following syntax:
GET _cat/indices/*,-efgh
which means "include everything, but efgh
"
In curl, it would give this:
curl -s -XGET 'hostname:post/_cat/indices/*,-efgh*'
Upvotes: 10
Reputation: 821
GET /%2Bindex1,-index2/type1,type2/_search?q=programming
Look at :
Including and excluding indexes in Elasticsearch query
Upvotes: 0