再对索引的分片数量或者是字段分词器进行调整时,需要对索引进行重建迁移,对应操作API为reindex
。
创建索引
PUT performance_order_tmp
{
"settings" : {
"index" : {
"number_of_shards" : 32,
"number_of_replicas" : 1
}
}
}
创建Mapping mapping中给字段指定分词器
PUT performance_order_tmp/_mapping
{
"properties": {
"actual_end_date": {
"type": "date",
"format": "yyyy-MM-dd"
},
"address": {
"type": "text",
"analyzer": "ik_max_word"
}
}
}
index 迁移
POST _reindex
{
"source": {
"index": "performance_order"
},
"dest": {
"index": "performance_order_tmp"
}
}