先頭ハイフンなしのインデックス作成
$ curl -XPUT "http://es-test.bashishi.local/index001?pretty"
{
"acknowledged" : true
}
$ curl -XPUT "http://es-test.bashishi.local/index002?pretty"
{
"acknowledged" : true
}
$ curl -XPUT "http://es-test.bashishi.local/index003?pretty"
{
"acknowledged" : true
}
当然問題なく作成される。
先頭ハイフン付きのインデックスを作成
$ curl -XPUT "http://es-test.bashishi.local/-index999?pretty"
{
"acknowledged" : true
}
問題なく作成できる。
一応、一覧を表示してみる。
$ curl -XGET "http://es-test.bashishi.local/_alias?pretty"
{
"index001" : {
"aliases" : { }
},
"index002" : {
"aliases" : { }
},
"index003" : {
"aliases" : { }
},
"-index999" : {
"aliases" : { }
}
}
ちゃんとある。
先頭ハイフンのインデックスがある状態で、そのインデックスを削除してみる。
$ curl -XDELETE "http://es-test.bashishi.local/-index999?pretty"
{
"acknowledged" : true
}
$ curl -XGET "http://es-test.bashishi.local/_alias?pretty"
{
"index001" : {
"aliases" : { }
},
"index002" : {
"aliases" : { }
},
"index003" : {
"aliases" : { }
}
}
ちゃんと削除できる。
インデックスの先頭にハイフンを付けて削除してみる。
index003 が存在する状態で、削除するインデックス名として -index003を指定する。
$ curl -XDELETE "http://es-test.bashishi.local/-index003?pretty"
{
"acknowledged" : true
}
index003以外が削除される。
$ curl -XGET "http://es-test.bashishi.local/_alias?pretty"
{
"index003" : {
"aliases" : { }
}
}
存在しないインデックスの先頭にハイフン付けて削除しようとすると 404 NotFound になる。
$ curl -XDELETE "http://es-test.bashishi.local/-index004/?pretty"
{
"error" : "IndexMissingException[[index004] missing]",
"status" : 404
}