B T
B T

Reputation: 60875

Does ElasticSearch have the same _id functionality that mongodb does?

MongoDB has the ObjectId format (type, whatever you wanna call it), which has the features that:

Does ElasticSearch have the same functionality?

Upvotes: 1

Views: 133

Answers (1)

moliware
moliware

Reputation: 10278

As far as I know Elasticsearch does not have that functionality. When you index a document without specifying the id. The id is automatically generated and it is a hash, so you can't guess the date from it :( .

About the second question, you don't need a db hit to get the id because it is returned when you index the doc.

curl -XPOST  'http://localhost:9200/test/test/' -d '
{
    "test_field": 1
}'
{"ok":true,"_index":"test","_type":"test","_id":"T7KTroYsT86JlxCtclfScA","_version":1}

Upvotes: 1

Related Questions