[英]Elasticsearch curl query: List of indices having 0 documents
我正在嘗試獲取具有0個文檔的所有Elasticsearch索引的列表。
我的方法是查詢_cat/indices
curl -GET 'http://localhost:9200/_cat/indices' -d '{
"query": { "match": { "docs.count": "0" } }
}'
但這似乎不起作用,因為我看到列出的索引超過0個文檔。
可以在以下位置找到Cat indices
文檔: https : //www.elastic.co/guide/en/elasticsearch/reference/1.6/cat-indices.html
有什么建議么?
謝謝。
我覺得awk和cat API將是一個更好的選擇。 您可以使用以下命令獲取所需內容-
curl -GET 'http://localhost:9200/_cat/indices' 2>/dev/null | awk ' ($6 == 0) {print $3}'
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.