ElasticSearch 2.0以后的改动导致旧的资料和书籍需要订正的部分
id原先是可以通過path指定字段的
"thread": {"_id" : {"path" : "thread_id"}, }但是現(xiàn)在不行了,具體見:
http://stackoverflow.com/questions/33428976/elasticsearch-2-0-id-is-not-configurable
https://www.elastic.co/blog/great-mapping-refactoring#meta-fields
文章指出,你需要通過url來指定id
curl -XPUT localhost:9200/your_index/your_type/YOUR_ID -d '{...}'^|set your id here //或者在批量操作的時候使用_id來指定 {"index":{_id:123}} {"contents":"內(nèi)容"}在Elasticsearch.The.Definitive.Guide還有對path相關(guān)介紹,在2.0已經(jīng)失效。
查詢腳本(groovy script)默認(rèn)已經(jīng)禁用了
由于用戶可能通過groovy腳本進行注入,從安全角度考慮,新版本的ES已經(jīng)默認(rèn)禁用了groovy
通過在配置文件增加下面的配置來開啟
script.engine.groovy.inline.search: on
使用文件方式運行
https://www.elastic.co/blog/running-groovy-scripts-without-dynamic-scripting
由于書上沒有介紹,可能導(dǎo)致很多人在運行demo的時候,看到類似 groovy disable的提示。
轉(zhuǎn)載于:https://www.cnblogs.com/didda/p/5005619.html
總結(jié)
以上是生活随笔為你收集整理的ElasticSearch 2.0以后的改动导致旧的资料和书籍需要订正的部分的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。