報錯原因
我使用的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