背景:原始index名字是indexName,mapping設(shè)置錯(cuò)誤,且已經(jīng)有數(shù)據(jù)進(jìn)去,想要修改mapping結(jié)構(gòu)
一、修復(fù)索引mapping——新建索引
?
PUT http://IP:PORT/indexName_1
{
? ? "mappings": {
? ? ? ? "indexName": {
? ? ? ? ? ? "properties": {
? ? ? ? ? ? ? ? "nickname_phone": {
? ? ? ? ? ? ? ? ? ? "type": "keyword"
? ? ? ? ? ? ? ? }
? ? ? ? ? ? }
? ? ? ? }
? ? }
}
返回結(jié)果:表示新建索引成功文章來(lái)源:http://www.zghlxwxcb.cn/news/detail-515702.html
{
? ? "acknowledged": true,
? ? "shards_acknowledged": true,
? ? "index": "indexName_1"
}
二、修復(fù)索引mapping——同步數(shù)據(jù)遷移
下面表示把indexName的數(shù)據(jù)同步到indexName_1文章來(lái)源地址http://www.zghlxwxcb.cn/news/detail-515702.html
?PUT http://IP:PORT/_reindex
{
? "source": {
? ? "index": "indexName"
? },
?
到了這里,關(guān)于Elasticsearch 創(chuàng)建索引mapping修改、修復(fù)的文章就介紹完了。如果您還想了解更多內(nèi)容,請(qǐng)?jiān)谟疑辖撬阉鱐OY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!