索引最好起别名,方便索引调整
1.创建新索引
PUT index_v2
{
"settings": {
"number_of_shards":5,
"number_of_replicas":1
},
"mappings": {
"doc": {
"dynamic": "strict",
"properties": {
"signature": {
"type": "text",
"analyzer": "所需分词器",
"fields": {
"signature_keyword": {
"type":"keyword"
}
}
}
}
}
}
}
2.索引拷贝
POST _reindex
{
"source": {
"index": "index"
}, "dest": {
"index": "index_v2"
}
}
3.索引删除与重命名
delete index_v1
POST _aliases
{
"actions": [
{
"add": {
"index" : "index_v2",
"alias" : "index"
}
},
{
"remove": {
"index": "index_v1",
"alias" : "index"
}
}
]
}