Elasticsearch:No handler for type [string] declared on field[XXX]的解決辦法


報錯原因
我使用的Elasticsearch是7.7.0版本,按照學習文檔創建字段時,使用了{"type":"string","index":"not_analyzed"}

原因分析
檢查拼寫無誤之后,我決定去查Elasticsearch新版本特性,因為之前也踩過head插件的安裝方法的坑,就是因為版本問題。
果不其然,Elasticsearch從5.X就引入了text和keyword,其中keyword適用於不分詞字段,搜索時只能完全匹配,這時string還保留着。
到了6.X就徹底移除string了。
另外,"index"的值只能是boolean變量了。

解決方法

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

 

 

參考文檔
https://segmentfault.com/a/1190000008897731
https://www.cnblogs.com/zlslch/p/6619089.html
https://www.elastic.co/guide/en/elasticsearch/reference/6.2/breaking-changes-6.0.html


免責聲明!

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



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