Elasticsearch

帶有特殊字元的 Elasticsearch 刪除索引

  • February 2, 2017

不幸的是,我在 Elasticsearch 中創建了一個索引,名稱為:“%{

$$ @metadata $$$$ beat $$}-2016.11.17" 任何想法如何刪除它,而不是遇到特殊字元的問題?

我嘗試了什麼 - 在控制台上:

curl -XDELETE -g '10.108.72.213:9200/%{[@metadata][beat]}-2016.11.18?pretty'
{
 "error" : {
   "root_cause" : [
     {
       "type" : "illegal_argument_exception",
       "reason" : "invalid escape sequence `%{[' at index 0 of: %{[@metadata][beat]}-2016.11.18"
     }
   ],
   "type" : "illegal_argument_exception",
   "reason" : "invalid escape sequence `%{[' at index 0 of: %{[@metadata][beat]}-2016.11.18"
 },
 "status" : 400
}

在 kibana 開發工具控制台上:

DELETE %{[@metadata][beat]}-2016.11.18/
{
 "error": {
   "root_cause": [
     {
       "type": "index_not_found_exception",
       "reason": "no such index",
       "index_uuid": "_na_",
       "resource.type": "index_or_alias",
       "resource.id": "%7B[@metadata][beat]}-2016.11.18",
       "index": "%7B[@metadata][beat]}-2016.11.18"
     }
   ],
   "type": "index_not_found_exception",
   "reason": "no such index",
   "index_uuid": "_na_",
   "resource.type": "index_or_alias",
   "resource.id": "%7B[@metadata][beat]}-2016.11.18",
   "index": "%7B[@metadata][beat]}-2016.11.18"
 },
 "status": 404
}

有任何想法嗎?

您可能會發現它的 URL 編碼版本更容易被接受:

curl -XDELETE -g '10.108.72.213:9200/%25%7b%5b%40metadata%5d%5bbeat%5d%7d-2016.11.18

引用自:https://serverfault.com/questions/830137