ドキュメントどおりindexでPUTしたらエラーになる
{"error":{"root_cause":[{"type":"index_already_exists_exception","reason":"already exists","index":"rettrmt"}],"type":"index_already_exists_exception","reason":"already exists","index":"rettrmt"},"status":400}
すでにあるやつはUpdate出来ないっぽい
更新したいタイプがなければ下記のようにしたら良さそう
curl -XPUT 'http://10.56.139.61:9200/rettrmt/_mapping/RETTRMT' -d '
{
"properties": {
"actor_id": { // or whichever properties you want to add
"type": "string",
"index": "not_analyzed"
}
}
}
curl -XPUT 'localhost:9200/twitter?pretty' -H 'Content-Type: application/json' -d'
{
"mappings": {
"tweet": {
"properties": {
"message": {
"type": "text"
}
}
}
}
}
'
curl -XPUT 'localhost:9200/twitter/_mapping/user?pretty' -H 'Content-Type: application/json' -d'
{
"properties": {
"name": {
"type": "text"
}
}
}
'
curl -XPUT 'localhost:9200/twitter/_mapping/tweet?pretty' -H 'Content-Type: application/json' -d'
{
"properties": {
"user_name": {
"type": "text"
}
}
}
'
- 例: account-suggest Typeを追加する
curl -XPUT "localhost:9200/bank/_mapping/account-suggest" -d '
{
"properties": {
"suggest": {
"type": "completion"
},
"address": {
"type": "text"
}
}
}
'
- 参考
https://stackoverflow.com/questions/35838208/recreation-of-mapping-elastic-search-
- 無停止でindexを張り替える技
https://www.elastic.co/blog/changing-mapping-with-zero-downtime
Cookpad blog http://techlife.cookpad.com/entry/2015/09/25/170000