# Bulk index document with \`\_id\` field inside

**URL:** https://discuss.elastic.co/t/bulk-index-document-with--id-field-inside/21181
**Category:** Elasticsearch
**Created:** [December 10, 2014, 9:36am UTC](https://discuss.elastic.co/t/bulk-index-document-with--id-field-inside/21181 "2014-12-10T09:36:48Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![Han\_JU](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/han_ju/32/962_2.png) [@Han\_JU](https://discuss.elastic.co/u/Han_JU)
#### Post date: [December 10, 2014, 9:36am UTC](https://discuss.elastic.co/t/bulk-index-document-with--id-field-inside/21181/1 "2014-12-10T09:36:48Z")

</div>

Hello,

We're trying to send raw string document to `_bulk` endpoint for bulk  
indexing and this will save us json serialization/deserialization time.  
But unfortunately in our document generation step, the custom `_id` field  
is generated inside the document string. And this seems to break the bulk  
endpoint.

```
{ "create" : { "_index" : "test", "_type" : "urls"} }
{ "url" : "abcde", "_id": 15 } # our document structure

```

This does not works.

```
{ "create" : { "_index" : "test", "_type" : "urls", "_id": 15} }
{ "url" : "abcde"}

```

This works well.

Is there anyway we can send documents with `_id` fields inside?

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/fe22133a-a116-4b7a-854b-825b8fb1fe9e%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/fe22133a-a116-4b7a-854b-825b8fb1fe9e%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<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: [December 10, 2014, 4:53pm UTC](https://discuss.elastic.co/t/bulk-index-document-with--id-field-inside/21181/2 "2014-12-10T16:53:20Z")

</div>

No.

Jörg

On Wed, Dec 10, 2014 at 10:36 AM, Han JU [ju.han.felix@gmail.com](mailto:ju.han.felix@gmail.com) wrote:

> Hello,
> 
> We're trying to send raw string document to `_bulk` endpoint for bulk  
> indexing and this will save us json serialization/deserialization time.  
> But unfortunately in our document generation step, the custom `_id` field  
> is generated inside the document string. And this seems to break the bulk  
> endpoint.
> 
> ```
> { "create" : { "_index" : "test", "_type" : "urls"} }
> { "url" : "abcde", "_id": 15 } # our document structure
> 
> ```
> 
> This does not works.
> 
> ```
> { "create" : { "_index" : "test", "_type" : "urls", "_id": 15} }
> { "url" : "abcde"}
> 
> ```
> 
> This works well.
> 
> Is there anyway we can send documents with `_id` fields inside?
> 
> 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/fe22133a-a116-4b7a-854b-825b8fb1fe9e%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/fe22133a-a116-4b7a-854b-825b8fb1fe9e%40googlegroups.com)  
> [https://groups.google.com/d/msgid/elasticsearch/fe22133a-a116-4b7a-854b-825b8fb1fe9e%40googlegroups.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/fe22133a-a116-4b7a-854b-825b8fb1fe9e%40googlegroups.com?utm_medium=email&utm_source=footer)  
> .  
> For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

--  
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/CAKdsXoEyr\_yDeW8K9ui8MnR%3Dkwo7-vkkHOn%2BOowe2O-%3DWXmcAw%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CAKdsXoEyr_yDeW8K9ui8MnR%3Dkwo7-vkkHOn%2BOowe2O-%3DWXmcAw%40mail.gmail.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<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, 12:44am UTC](https://discuss.elastic.co/t/bulk-index-document-with--id-field-inside/21181/3 "2017-07-06T00:44:24Z")

</div>


