我想更改elasticsearch中现有索引的设置和映射。但是,我收到了错误。
curl -XPOST localhost:9200/myindex/_close
{"确认":真}
curl -XPUT localhost:9200/myindex/_settings -d '{
"index": {
"analysis": {
"analyzer": {
"custom_analyzer": {
"type": "custom",
"tokenizer": "keyword",
"filter": ["lowercase"]
}
}
}
}
}'
{"确认":真}
curl -XPUT localhost:9200/myindex/mytype/_mapping -d '{
"properties": {
"myfield": {
"type": "string",
"search_analyzer": "custom_analyzer",
"index_analyzer": "custom_analyzer"
}
}
}'
{"错误":" MergeMappingException [合并失败但失败{[mapper [myfield]有不同的index_analyzer]}]"," status":400 }
我做错了什么?
答案 0 :(得分:0)
所有索引都存储为不可变,因此您必须重新索引数据。
零停机时间版本。 1 强>
要重新索引,您可以按照以下步骤操作:
零停机时间版本。 2 强>
或者您可以使用所需的设置/映射创建新索引,并为新创建的索引创建别名(使用旧索引名称)。
需要停机时间
最后一种方法是关闭索引,进行更改并重新打开索引。