Adding _id to JSON instead of URL when adding doc


(Jason Fill) #1

I have the use case for adding the id to the json doc instead of the URL -
basically the URL has to be static (so I cannot add the id each time).
Other than using the Bulk creation option, is this possible via the REST
API?

So I want to send

{"_id": "my-id", "first_name": "Jason"}

to

http://my-es-server/index/type

Is there any way to allow ES to pick up that _id as the id so I can add it
there instead of the URL - which like I said needs to remain static.

Thanks.

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/4d367230-30ea-4dae-ae9d-aedc85bbb570%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


(Jörg Prante) #2

You can send a bulk request

http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/docs-bulk.html

Jörg

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/CAKdsXoHJ6iWs3qEbEELD2ufJKwWsQFKJG0XHo%2B%2BbOpSwHD-Scw%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.


(Jason Fill) #3

Jörg,

Thanks for your response, I knew the bulk request was an option, however is
there any performance impact using that method to send one off updates? I
just don't want to call the bulk request for single item additions/updates
if it is going to adversely affect performance. Any thoughts on this? My
gut tells me it should not, but it is a question I have to ask.

Thanks!

On Wednesday, January 15, 2014 1:47:31 AM UTC-6, Jörg Prante wrote:

You can send a bulk request

http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/docs-bulk.html

Jörg

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/485cba3d-39e0-4a2a-8ded-d12f40f54a1c%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


(Jörg Prante) #4

Bulk request is in ES the same as single request, it is just concatenated
so a bulk can be sent from a client over the network in a single step,
saving a lot of roundtrips.

So if you send a single request, for ES it does not matter if you choose
single operation or bulk operation.

Jörg

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/CAKdsXoE5BtuZYGQFSxV5X%3DNwp%2BMdOoGbXrSu3%2BGFyczgVVUA3g%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.


(Jason Fill) #5

Excellent, thank you for the clarification. For some reason I was thinking
that the bulk operation might put a different type of load on the service
just to spin up that operation.

Again, thanks for your time!

On Wednesday, January 15, 2014 8:06:32 AM UTC-6, Jörg Prante wrote:

Bulk request is in ES the same as single request, it is just concatenated
so a bulk can be sent from a client over the network in a single step,
saving a lot of roundtrips.

So if you send a single request, for ES it does not matter if you choose
single operation or bulk operation.

Jörg

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/95d1d0fc-6521-4b7c-a05a-52ed4cba1de2%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


(system) #6