由于elasticsearch索引创建之后分片个数、mapping定义等都不支持修改,只能通过重建索引来完成,所以这里需要用到API_reindex
创建一个新的索引new_index
,mapping按自己的需求去定义即可,包含节点、副本、分词器、mapping字段定义
PUT /new_index
{
"settings": {
"number_of_shards": 3,
"number_of_replicas": 2,
"analysis": {
"analyzer": {
"ik_smart_pinyin": {
"type": "custom",
"tokenizer": "ik_smart",
"filter": ["custom_pinyin", "word_delimiter"]
},
"ik_max_word_pinyin": {
"type": "custom",
"tokenizer": "ik_max_word",
"filter": ["custom_pinyin", "word_delimiter"]
},
"standard_pinyin": {
"type": "custom&