我们可以在不指定Elasticsearch的文档ID的情况下执行批量索引吗?

Jon*_*Moo 18 elasticsearch

是否可以在不指定文档ID的情况下执行批量索引?我希望Elasticsearch在索引时为我生成一个随机ID,但可以这样做吗?

dad*_*net 22

是的你可以!

测试0.90.0.Beta1:

$ cat requests 
{ "index" : { "_index" : "test", "_type" : "type1" } }
{ "field1" : "value1" }

$ curl -s -XPOST localhost:9200/_bulk --data-binary @requests; echo
{"took":6,"items":[{"create":{"_index":"test","_type":"type1","_id":"IWqsRqyhRVq-F69OLIngTA","_version":1,"ok":true}}]}
Run Code Online (Sandbox Code Playgroud)