id原先是可以通过path指定字段的
"thread": {
"_id" : {
"path" : "thread_id"
},
}
但是现在不行了,具体见:
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":"内容"}
在Elasticsearch.The.Definitive.Guide还有对path相关介绍,在2.0已经失效。
查询脚本(groovy script)默认已经禁用了
由于用户可能通过groovy脚本进行注入,从安全角度考虑,新版本的ES已经默认禁用了groovy
通过在配置文件增加下面的配置来开启
script.engine.groovy.inline.search: on
使用文件方式运行
https://www.elastic.co/blog/running-groovy-scripts-without-dynamic-scripting
由于书上没有介绍,可能导致很多人在运行demo的时候,看到类似 groovy disable的提示。