# Adding \_id to JSON instead of URL when adding doc

**URL:** <https://discuss.elastic.co/t/adding--id-to-json-instead-of-url-when-adding-doc/15238>\
**Category:** Elasticsearch\
**Created:** [January 15, 2014, 3:22am UTC](https://discuss.elastic.co/t/adding--id-to-json-instead-of-url-when-adding-doc/15238 "2014-01-15T03:22:42Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jason\_Fill](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jason_fill/32/1861_2.png) [@Jason\_Fill](https://discuss.elastic.co/u/Jason_Fill)\
**Post date:** [January 15, 2014, 3:22am UTC](https://discuss.elastic.co/t/adding--id-to-json-instead-of-url-when-adding-doc/15238/1 "2014-01-15T03:22:42Z")

</div>

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](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](mailto: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](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](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![jprante](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jprante/32/44941_2.png) [@jprante](https://discuss.elastic.co/u/jprante)\
**Post date:** [January 15, 2014, 7:47am UTC](https://discuss.elastic.co/t/adding--id-to-json-instead-of-url-when-adding-doc/15238/2 "2014-01-15T07:47:31Z")

</div>

You can send a bulk request

[http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/docs-bulk.html](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](mailto: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](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](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![Jason\_Fill](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jason_fill/32/1861_2.png) [@Jason\_Fill](https://discuss.elastic.co/u/Jason_Fill)\
**Post date:** [January 15, 2014, 10:52am UTC](https://discuss.elastic.co/t/adding--id-to-json-instead-of-url-when-adding-doc/15238/3 "2014-01-15T10:52:58Z")

</div>

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
> 
> [Elasticsearch Platform — Find real-time answers at scale | Elastic](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](mailto: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](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](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![jprante](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jprante/32/44941_2.png) [@jprante](https://discuss.elastic.co/u/jprante)\
**Post date:** [January 15, 2014, 2:06pm UTC](https://discuss.elastic.co/t/adding--id-to-json-instead-of-url-when-adding-doc/15238/4 "2014-01-15T14:06:32Z")

</div>

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](mailto: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](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](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![Jason\_Fill](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jason_fill/32/1861_2.png) [@Jason\_Fill](https://discuss.elastic.co/u/Jason_Fill)\
**Post date:** [January 16, 2014, 5:07pm UTC](https://discuss.elastic.co/t/adding--id-to-json-instead-of-url-when-adding-doc/15238/5 "2014-01-16T17:07:21Z")

</div>

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](mailto: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](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](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [July 6, 2017, 1:56am UTC](https://discuss.elastic.co/t/adding--id-to-json-instead-of-url-when-adding-doc/15238/6 "2017-07-06T01:56:21Z")

</div>


