Elasticsearch:No handler for type [string]...與Rejecting mapping update to [hn] as the final mapping would have more than 1 type異常處理


報錯原因

我的Elasticsearch是"6.4.0"版本,當我創建字段時

{
"domain":
        {
    "type": "string",
    "index": "not_analyzed"
    }
}

 

原因分析

查看官方文檔后發現是在新版本中已經移除該操作方式了

Elasticsearch從5.X就引入了textkeyword,其中keyword適用於不分詞字段,搜索時只能完全匹配,這時string還保留着。 
到了6.X就徹底移除string了。 
另外,"index"的值只能是boolean變量了。

解決方法

修改為

    {
    "domain":{
                    "type":"text",
                    "index":"false"
                },
    }        

 

出現的第二個問題

1. 此時拋出了另外一個error

            {
                "type": "illegal_argument_exception",
                "reason": "Rejecting mapping update to [hn] as the final mapping would have more than 1 type: [poll, job, story]"
            }

 

2. 這個異常引發的原因同樣是版本問題

  
  在Elasticsearch 6.0.0或更高版本中創建的索引可能只包含單個mapping type
在具有多種映射類型的5.x中創建的索引將繼續像以前一樣在Elasticsearch 6.x中運行。映射類型將在Elasticsearch 7.0.0中完全刪除。

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM