[英]Error on creation of a mapping for an index
我試圖更改索引的映射,但收到錯誤。 以下是我創建索引的步驟
使用以下代碼設置映射:
PUT /myidx/orderrow/_mapping { "orderrow": { "properties": { "item_code": { "type": "string", "index": "not_analyzed" } } } }
這是我收到的錯誤消息:
{
"error": "MergeMappingException[Merge failed with failures {[mapper [item_code] has different index values, mapper [item_code] has different `norms.enabled` values, mapper [item_code] has different tokenize values, mapper [item_code] has different index_analyzer]}]",
"status": 400
}
有任何想法嗎?
因為您首先將數據索引到索引中,所以Elasticsearch會根據加載的數據自動檢測item_code
字段的字段類型/映射。 然后,當您嘗試更新映射時,您將收到上面顯示的錯誤。
我建議在運行Python腳本之前創建索引並應用映射來填充索引。
PUT /myproj/
PUT /myproj/orderrow/_mapping
{
"orderrow": {
"properties": {
"item_code": {
"type": "string",
"index": "not_analyzed"
}
}
}
}
或者,您可以使用Put Mapping API文檔的合並和沖突部分中定義的ignore_conflicts
選項,將沖突映射強制轉換為索引。 但是,我不確定這將如何影響已編入索引的文檔。
我有同樣的問題並解決了它刪除映射並創建它(警告:刪除映射將刪除所有文檔(行)與該映射)
DELETE /myidx/orderrow/_mapping
PUT /myidx/orderrow/_mapping -d '
...
'
在那之后,我不得不關閉並打開索引:
POST /myidx/_close
POST /myidx/_open
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.