Since the configuration of path
on the _id
field of a specific mapping is deprecated (as noted in the documentation here),
How can I set the _id
field for a specific document in elasticsearch 2.0 ?
(In my specific use-case, I want to index all documents with my own id. I know they're all unique)
_id
being deprecated simply means that you have to specify the id explicitly and ES won't offer you to parse your document a first time just to retrieve the field you've specified as the id field.
So all the current ways of indexing your documents are still valid as long as you specify the id explicitly:
curl -XPUT localhost:9200/index/type/your_id -d '{"field1": "value1"}'
^
|
your id goes here
or in a bulk query
curl -XPOST localhost:9200/_bulk -d '
{"index": {"_index": "index", "_type": "type", "_id": "your_id"}}
{"field1": "value1"} ^
' |
your id goes here
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With