# Allow\_explicit\_index and \_bulk

**URL:** <https://discuss.elastic.co/t/allow-explicit-index-and--bulk/15154>\
**Category:** Elasticsearch\
**Created:** [January 8, 2014, 10:08pm UTC](https://discuss.elastic.co/t/allow-explicit-index-and--bulk/15154 "2014-01-08T22:08:17Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![Gabe\_Gorelick\_Feldma](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/gabe_gorelick_feldma/32/1423_2.png) [@Gabe\_Gorelick\_Feldma](https://discuss.elastic.co/u/Gabe_Gorelick_Feldma)\
**Post date:** [January 8, 2014, 10:08pm UTC](https://discuss.elastic.co/t/allow-explicit-index-and--bulk/15154/1 "2014-01-08T22:08:17Z")

</div>

The documentation on URL-based access control[http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/url-access-control.html](http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/url-access-control.html) implies  
that \_bulk still works if you set rest.action.multi.allow\_explicit\_index:  
false, as long as you specify the index in the URL. However, I can't get it  
to work.

POST /foo/bar/\_bulk  
{ "index": {} }  
{ "\_id": 1234, "baz": "foobar" }

returns

explicit index in bulk is not allowed

Should this work?

--  
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/a0d1fa2f-0c28-4142-9f6d-4b28a1695bb3%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/a0d1fa2f-0c28-4142-9f6d-4b28a1695bb3%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:** ![spinscale](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/spinscale/32/25011_2.png) [@spinscale](https://discuss.elastic.co/u/spinscale)\
**Post date:** [January 9, 2014, 8:39am UTC](https://discuss.elastic.co/t/allow-explicit-index-and--bulk/15154/2 "2014-01-09T08:39:39Z")

</div>

Hey,

after having a very quick look, it looks like a bug (or wrong  
documentation, need to check further). Can you create a github issue?

Thanks!

--Alex

On Wed, Jan 8, 2014 at 11:08 PM, Gabe Gorelick-Feldman \<  
[gabegorelick@gmail.com](mailto:gabegorelick@gmail.com)\> wrote:

> The documentation on URL-based access control[http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/url-access-control.html](http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/url-access-control.html) implies  
> that \_bulk still works if you set rest.action.multi.allow\_explicit\_index:  
> false, as long as you specify the index in the URL. However, I can't get  
> it to work.
> 
> POST /foo/bar/\_bulk  
> { "index": {} }  
> { "\_id": 1234, "baz": "foobar" }
> 
> returns
> 
> explicit index in bulk is not allowed
> 
> Should this work?
> 
> --  
> 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/a0d1fa2f-0c28-4142-9f6d-4b28a1695bb3%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/a0d1fa2f-0c28-4142-9f6d-4b28a1695bb3%40googlegroups.com)  
> .  
> For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

--  
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/CAGCwEM990rKacVv7DQ6eeJRciwLwGRiA8OezUYs8xqE17vrGgA%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CAGCwEM990rKacVv7DQ6eeJRciwLwGRiA8OezUYs8xqE17vrGgA%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:** ![Gabe\_Gorelick\_Feldma](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/gabe_gorelick_feldma/32/1423_2.png) [@Gabe\_Gorelick\_Feldma](https://discuss.elastic.co/u/Gabe_Gorelick_Feldma)\
**Post date:** [January 9, 2014, 3:38pm UTC](https://discuss.elastic.co/t/allow-explicit-index-and--bulk/15154/3 "2014-01-09T15:38:46Z")

</div>

Opened an issue: [Disabling allow\_explicit\_index breaks bulk · Issue #4668 · elastic/elasticsearch · GitHub](https://github.com/elasticsearch/elasticsearch/issues/4668)

On Thursday, January 9, 2014 3:39:39 AM UTC-5, Alexander Reelsen wrote:

> Hey,
> 
> after having a very quick look, it looks like a bug (or wrong  
> documentation, need to check further). Can you create a github issue?
> 
> Thanks!
> 
> --Alex
> 
> On Wed, Jan 8, 2014 at 11:08 PM, Gabe Gorelick-Feldman \<  
> [gabego...@gmail.com](mailto:gabego...@gmail.com) \<javascript:\>\> wrote:
> 
> > The documentation on URL-based access control[http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/url-access-control.html](http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/url-access-control.html) implies  
> > that \_bulk still works if you set rest.action.multi.allow\_explicit\_index:  
> > false, as long as you specify the index in the URL. However, I can't get  
> > it to work.
> > 
> > POST /foo/bar/\_bulk  
> > { "index": {} }  
> > { "\_id": 1234, "baz": "foobar" }
> > 
> > returns
> > 
> > explicit index in bulk is not allowed
> > 
> > Should this work?
> > 
> > --  
> > 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 [elasticsearc...@googlegroups.com](mailto:elasticsearc...@googlegroups.com) \<javascript:\>.  
> > To view this discussion on the web visit  
> > [https://groups.google.com/d/msgid/elasticsearch/a0d1fa2f-0c28-4142-9f6d-4b28a1695bb3%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/a0d1fa2f-0c28-4142-9f6d-4b28a1695bb3%40googlegroups.com)  
> > .  
> > For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

--  
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/f9fff41c-1b51-40dd-9291-c5bf4d73599c%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/f9fff41c-1b51-40dd-9291-c5bf4d73599c%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:** ![Niccolo\_Becchi](https://avatars.discourse-cdn.com/v4/letter/n/8edcca/32.png) [@Niccolo\_Becchi](https://discuss.elastic.co/u/Niccolo_Becchi)\
**Post date:** [October 22, 2014, 6:47pm UTC](https://discuss.elastic.co/t/allow-explicit-index-and--bulk/15154/4 "2014-10-22T18:47:17Z")

</div>

This issue looks to be fixed on

> <https://github.com/elastic/elasticsearch/issues/4668>
>
> The documentation on URL-based access control implies that bulk operations still… work if you set \`rest.action.multi.allow\_explicit\_index: false\`, as long as you specify the index in the URL. However, it doesn't work:
> 
> \`\`\`
> POST /foo/bar/\_bulk
> { "index": {} }
> { "\_id": 1234, "baz": "foobar" }
> \`\`\`
> 
> returns 
> 
> \`\`\`
> explicit index in bulk is not allowed
> \`\`\`
> 
> See https://groups.google.com/forum/#!topic/elasticsearch/TLaTkaJjGYg for the discussion.

However, on elasticsearch-1.3.4, running the example with  
rest.action.multi.allow\_explicit\_index: false:

```auto
POST /foo/bar/_bulk
{ "index": {} }
{ "_id" : "1", "baz": "foobar" }

```

I am getting the exception:

```auto
{
   "took": 1,
   "errors": true,
   "items": [
      {
         "create": {
            "_index": "foo",
            "_type": "bar",
            "_id": "oX0Xp8dzRbySZiKX8QI0zw",
            "status": 400,
            "error": "MapperParsingException[failed to parse [_id]]; 
nested: MapperParsingException[Provided id [oX0Xp8dzRbySZiKX8QI0zw] does 
not match the content one [1]]; "
         }
      }
   ]
}

```

Am I doing something wrong or something has changed?

Il giorno giovedì 9 gennaio 2014 15:38:46 UTC, Gabe Gorelick-Feldman ha  
scritto:

> Opened an issue:  
> [Disabling allow\_explicit\_index breaks bulk · Issue #4668 · elastic/elasticsearch · GitHub](https://github.com/elasticsearch/elasticsearch/issues/4668)
> 
> On Thursday, January 9, 2014 3:39:39 AM UTC-5, Alexander Reelsen wrote:
> 
> > Hey,
> > 
> > after having a very quick look, it looks like a bug (or wrong  
> > documentation, need to check further). Can you create a github issue?
> > 
> > Thanks!
> > 
> > --Alex
> > 
> > On Wed, Jan 8, 2014 at 11:08 PM, Gabe Gorelick-Feldman \<  
> > [gabego...@gmail.com](mailto:gabego...@gmail.com)\> wrote:
> > 
> > > The documentation on URL-based access control  
> > > [http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/url-access-control.html](http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/url-access-control.html) implies  
> > > that \_bulk still works if you set rest.action.multi.allow\_explicit\_index:  
> > > false, as long as you specify the index in the URL. However, I can't  
> > > get it to work.
> > > 
> > > POST /foo/bar/\_bulk  
> > > { "index": {} }  
> > > { "\_id": 1234, "baz": "foobar" }
> > > 
> > > returns
> > > 
> > > explicit index in bulk is not allowed
> > > 
> > > Should this work?
> > > 
> > > --  
> > > 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 [elasticsearc...@googlegroups.com](mailto:elasticsearc...@googlegroups.com).  
> > > To view this discussion on the web visit  
> > > [https://groups.google.com/d/msgid/elasticsearch/a0d1fa2f-0c28-4142-9f6d-4b28a1695bb3%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/a0d1fa2f-0c28-4142-9f6d-4b28a1695bb3%40googlegroups.com)  
> > > .  
> > > For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

--  
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/a9aff019-33c0-4743-9e14-fe3913bcda1c%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/a9aff019-33c0-4743-9e14-fe3913bcda1c%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:** [October 23, 2014, 9:27am UTC](https://discuss.elastic.co/t/allow-explicit-index-and--bulk/15154/5 "2014-10-23T09:27:26Z")

</div>

The bulk format does not allow \_id in the payload line, you confuse the  
indexer.

Use something like

POST /\_bulk  
{ "index" : { "\_index": "foo", "\_type": "bar", "\_id" : "1" } }  
{ "baz": "foobar" }

Jörg

On Wed, Oct 22, 2014 at 8:47 PM, Niccolò Becchi [niccolo.becchi@gmail.com](mailto:niccolo.becchi@gmail.com)  
wrote:

> This issue looks to be fixed on  
> [Disabling allow\_explicit\_index breaks bulk · Issue #4668 · elastic/elasticsearch · GitHub](https://github.com/elasticsearch/elasticsearch/issues/4668)
> 
> However, on elasticsearch-1.3.4, running the example with  
> rest.action.multi.allow\_explicit\_index: false:
> 
> ```auto
> POST /foo/bar/_bulk
> { "index": {} }
> { "_id" : "1", "baz": "foobar" }
> 
> ```
> 
> I am getting the exception:
> 
> ```auto
> {
> "took": 1,
> "errors": true,
> "items": [
> {
> "create": {
> "_index": "foo",
> "_type": "bar",
> "_id": "oX0Xp8dzRbySZiKX8QI0zw",
> "status": 400,
> "error": "MapperParsingException[failed to parse [_id]];
> nested: MapperParsingException[Provided id [oX0Xp8dzRbySZiKX8QI0zw] does
> not match the content one [1]]; "
> }
> }
> ]
> }
> 
> ```
> 
> Am I doing something wrong or something has changed?
> 
> Il giorno giovedì 9 gennaio 2014 15:38:46 UTC, Gabe Gorelick-Feldman ha  
> scritto:
> 
> > Opened an issue: [GitHub - elastic/elasticsearch: Free and Open, Distributed, RESTful Search Engine](https://github.com/elasticsearch/elasticsearch/)  
> > issues/4668
> > 
> > On Thursday, January 9, 2014 3:39:39 AM UTC-5, Alexander Reelsen wrote:
> > 
> > > Hey,
> > > 
> > > after having a very quick look, it looks like a bug (or wrong  
> > > documentation, need to check further). Can you create a github issue?
> > > 
> > > Thanks!
> > > 
> > > --Alex
> > > 
> > > On Wed, Jan 8, 2014 at 11:08 PM, Gabe Gorelick-Feldman \<  
> > > [gabego...@gmail.com](mailto:gabego...@gmail.com)\> wrote:
> > > 
> > > > The documentation on URL-based access control  
> > > > [http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/url-access-control.html](http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/url-access-control.html) implies  
> > > > that \_bulk still works if you set rest.action.multi.allow\_explicit\_index:  
> > > > false, as long as you specify the index in the URL. However, I can't  
> > > > get it to work.
> > > > 
> > > > POST /foo/bar/\_bulk  
> > > > { "index": {} }  
> > > > { "\_id": 1234, "baz": "foobar" }
> > > > 
> > > > returns
> > > > 
> > > > explicit index in bulk is not allowed
> > > > 
> > > > Should this work?
> > > > 
> > > > --  
> > > > 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 [elasticsearc...@googlegroups.com](mailto:elasticsearc...@googlegroups.com).  
> > > > To view this discussion on the web visit [https://groups.google.com/d/](https://groups.google.com/d/)  
> > > > msgid/elasticsearch/a0d1fa2f-0c28-4142-9f6d-4b28a1695bb3%  
> > > > [40googlegroups.com](http://40googlegroups.com).  
> > > > For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).
> > > 
> > > --  
> > > 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/a9aff019-33c0-4743-9e14-fe3913bcda1c%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/a9aff019-33c0-4743-9e14-fe3913bcda1c%40googlegroups.com)  
> > > [https://groups.google.com/d/msgid/elasticsearch/a9aff019-33c0-4743-9e14-fe3913bcda1c%40googlegroups.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/a9aff019-33c0-4743-9e14-fe3913bcda1c%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/CAKdsXoG3dCRYLeFu6Pg32SowsZJNunsAV-U\_LYHGBeArYPzgyA%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CAKdsXoG3dCRYLeFu6Pg32SowsZJNunsAV-U_LYHGBeArYPzgyA%40mail.gmail.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![Niccolo\_Becchi](https://avatars.discourse-cdn.com/v4/letter/n/8edcca/32.png) [@Niccolo\_Becchi](https://discuss.elastic.co/u/Niccolo_Becchi)\
**Post date:** [October 23, 2014, 3:23pm UTC](https://discuss.elastic.co/t/allow-explicit-index-and--bulk/15154/6 "2014-10-23T15:23:39Z")

</div>

Thanks Jörg for the prompt answer. However, for security reason with have  
disabled the option rest.action.multi.allow\_explicit\_index (

> **[Elasticsearch Platform — Find real-time answers at scale](https://www.elastic.co)**
>
> Power insights and outcomes with the Elasticsearch Platform and AI. See into your data and find answers that matter with enterprise solutions designed to help you build, observe, and protect. Try Elasticsearch free today.

).

So, in this case using:

POST /\_bulk  
{ "index" : { "\_index": "foo", "\_type": "bar", "\_id" : "1" } }  
{ "baz": "foobar" }

I am getting this exception:  
{  
"error": "ElasticsearchIllegalArgumentException[explicit index in bulk  
is not allowed]",  
"status": 400  
}

Is there any way to insert a document, specifying the id, in the bulk mode  
with "no explicit index in bulk", as this code doesn't work:

POST /foo/bar/\_bulk  
{ "index": {} }  
{ "\_id" : "1", "baz": "foobar" }

Is this a bug?

Il giorno giovedì 23 ottobre 2014 10:27:34 UTC+1, Jörg Prante ha scritto:

> The bulk format does not allow \_id in the payload line, you confuse the  
> indexer.
> 
> Use something like
> 
> POST /\_bulk  
> { "index" : { "\_index": "foo", "\_type": "bar", "\_id" : "1" } }  
> { "baz": "foobar" }
> 
> Jörg
> 
> On Wed, Oct 22, 2014 at 8:47 PM, Niccolò Becchi \<[niccolo...@gmail.com](mailto:niccolo...@gmail.com)  
> \<javascript:\>\> wrote:
> 
> > This issue looks to be fixed on  
> > [Disabling allow\_explicit\_index breaks bulk · Issue #4668 · elastic/elasticsearch · GitHub](https://github.com/elasticsearch/elasticsearch/issues/4668)
> > 
> > However, on elasticsearch-1.3.4, running the example with  
> > rest.action.multi.allow\_explicit\_index: false:
> > 
> > ```auto
> > POST /foo/bar/_bulk
> > { "index": {} }
> > { "_id" : "1", "baz": "foobar" }
> > 
> > ```
> > 
> > I am getting the exception:
> > 
> > ```auto
> > {
> > "took": 1,
> > "errors": true,
> > "items": [
> > {
> > "create": {
> > "_index": "foo",
> > "_type": "bar",
> > "_id": "oX0Xp8dzRbySZiKX8QI0zw",
> > "status": 400,
> > "error": "MapperParsingException[failed to parse [_id]]; 
> > nested: MapperParsingException[Provided id [oX0Xp8dzRbySZiKX8QI0zw] does 
> > not match the content one [1]]; "
> > }
> > }
> > ]
> > }
> > 
> > ```
> > 
> > Am I doing something wrong or something has changed?
> > 
> > Il giorno giovedì 9 gennaio 2014 15:38:46 UTC, Gabe Gorelick-Feldman ha  
> > scritto:
> > 
> > > Opened an issue: [GitHub - elastic/elasticsearch: Free and Open, Distributed, RESTful Search Engine](https://github.com/elasticsearch/elasticsearch/)  
> > > issues/4668
> > > 
> > > On Thursday, January 9, 2014 3:39:39 AM UTC-5, Alexander Reelsen wrote:
> > > 
> > > > Hey,
> > > > 
> > > > after having a very quick look, it looks like a bug (or wrong  
> > > > documentation, need to check further). Can you create a github issue?
> > > > 
> > > > Thanks!
> > > > 
> > > > --Alex
> > > > 
> > > > On Wed, Jan 8, 2014 at 11:08 PM, Gabe Gorelick-Feldman \<  
> > > > [gabego...@gmail.com](mailto:gabego...@gmail.com)\> wrote:
> > > > 
> > > > > The documentation on URL-based access control  
> > > > > [http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/url-access-control.html](http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/url-access-control.html) implies  
> > > > > that \_bulk still works if you set rest.action.multi.allow\_explicit\_index:  
> > > > > false, as long as you specify the index in the URL. However, I can't  
> > > > > get it to work.
> > > > > 
> > > > > POST /foo/bar/\_bulk  
> > > > > { "index": {} }  
> > > > > { "\_id": 1234, "baz": "foobar" }
> > > > > 
> > > > > returns
> > > > > 
> > > > > explicit index in bulk is not allowed
> > > > > 
> > > > > Should this work?
> > > > > 
> > > > > --  
> > > > > 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 [elasticsearc...@googlegroups.com](mailto:elasticsearc...@googlegroups.com).  
> > > > > To view this discussion on the web visit [https://groups.google.com/d/](https://groups.google.com/d/)  
> > > > > msgid/elasticsearch/a0d1fa2f-0c28-4142-9f6d-4b28a1695bb3%  
> > > > > [40googlegroups.com](http://40googlegroups.com).  
> > > > > For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).
> > > > 
> > > > --  
> > > > 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 [elasticsearc...@googlegroups.com](mailto:elasticsearc...@googlegroups.com) \<javascript:\>.  
> > > > To view this discussion on the web visit  
> > > > [https://groups.google.com/d/msgid/elasticsearch/a9aff019-33c0-4743-9e14-fe3913bcda1c%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/a9aff019-33c0-4743-9e14-fe3913bcda1c%40googlegroups.com)  
> > > > [https://groups.google.com/d/msgid/elasticsearch/a9aff019-33c0-4743-9e14-fe3913bcda1c%40googlegroups.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/a9aff019-33c0-4743-9e14-fe3913bcda1c%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/afc96e4b-0625-4cb6-b459-50a1bf560a0a%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/afc96e4b-0625-4cb6-b459-50a1bf560a0a%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![Niccolo\_Becchi](https://avatars.discourse-cdn.com/v4/letter/n/8edcca/32.png) [@Niccolo\_Becchi](https://discuss.elastic.co/u/Niccolo_Becchi)\
**Post date:** [October 23, 2014, 3:39pm UTC](https://discuss.elastic.co/t/allow-explicit-index-and--bulk/15154/7 "2014-10-23T15:39:39Z")

</div>

Thanks Jörg for the prompt answer. However, for security reason we have  
disabled the option rest.action.multi.allow\_  
explicit\_index (

> **[Elasticsearch Platform — Find real-time answers at scale](https://www.elastic.co)**
>
> Power insights and outcomes with the Elasticsearch Platform and AI. See into your data and find answers that matter with enterprise solutions designed to help you build, observe, and protect. Try Elasticsearch free today.

[http://www.google.com/url?q=http%3A%2F%2Fwww.elasticsearch.org%2Fguide%2Fen%2Felasticsearch%2Freference%2Fcurrent%2Furl-access-control.html&sa=D&sntz=1&usg=AFQjCNEtPcfFx\_JMPzCxDP2x2dyHm8T\_GA](http://www.google.com/url?q=http%3A%2F%2Fwww.elasticsearch.org%2Fguide%2Fen%2Felasticsearch%2Freference%2Fcurrent%2Furl-access-control.html&sa=D&sntz=1&usg=AFQjCNEtPcfFx_JMPzCxDP2x2dyHm8T_GA)  
).

So, in this case using:

POST /\_bulk  
{ "index" : { "\_index": "foo", "\_type": "bar", "\_id" : "1" } }  
{ "baz": "foobar" }

I am getting this exception:  
{  
"error": "ElasticsearchIllegalArgumentException[explicit index in bulk  
is not allowed]",  
"status": 400  
}

Is there any way to insert a document, specifying the id, in the bulk mode  
with "no explicit index in bulk", as this code doesn't work:

POST /foo/bar/\_bulk  
{ "index": {} }  
{ "\_id" : "1", "baz": "foobar" }

Else is this a bug/feature to be implemented?

Il giorno giovedì 23 ottobre 2014 10:27:34 UTC+1, Jörg Prante ha scritto:

> The bulk format does not allow \_id in the payload line, you confuse the  
> indexer.
> 
> Use something like
> 
> POST /\_bulk  
> { "index" : { "\_index": "foo", "\_type": "bar", "\_id" : "1" } }  
> { "baz": "foobar" }
> 
> Jörg
> 
> On Wed, Oct 22, 2014 at 8:47 PM, Niccolò Becchi \<[niccolo...@gmail.com](mailto:niccolo...@gmail.com)  
> \<javascript:\>\> wrote:
> 
> > This issue looks to be fixed on  
> > [Disabling allow\_explicit\_index breaks bulk · Issue #4668 · elastic/elasticsearch · GitHub](https://github.com/elasticsearch/elasticsearch/issues/4668)
> > 
> > However, on elasticsearch-1.3.4, running the example with  
> > rest.action.multi.allow\_explicit\_index: false:
> > 
> > ```auto
> > POST /foo/bar/_bulk
> > { "index": {} }
> > { "_id" : "1", "baz": "foobar" }
> > 
> > ```
> > 
> > I am getting the exception:
> > 
> > ```auto
> > {
> > "took": 1,
> > "errors": true,
> > "items": [
> > {
> > "create": {
> > "_index": "foo",
> > "_type": "bar",
> > "_id": "oX0Xp8dzRbySZiKX8QI0zw",
> > "status": 400,
> > "error": "MapperParsingException[failed to parse [_id]]; 
> > nested: MapperParsingException[Provided id [oX0Xp8dzRbySZiKX8QI0zw] does 
> > not match the content one [1]]; "
> > }
> > }
> > ]
> > }
> > 
> > ```
> > 
> > Am I doing something wrong or something has changed?
> > 
> > Il giorno giovedì 9 gennaio 2014 15:38:46 UTC, Gabe Gorelick-Feldman ha  
> > scritto:
> > 
> > > Opened an issue: [GitHub - elastic/elasticsearch: Free and Open, Distributed, RESTful Search Engine](https://github.com/elasticsearch/elasticsearch/)  
> > > issues/4668
> > > 
> > > On Thursday, January 9, 2014 3:39:39 AM UTC-5, Alexander Reelsen wrote:
> > > 
> > > > Hey,
> > > > 
> > > > after having a very quick look, it looks like a bug (or wrong  
> > > > documentation, need to check further). Can you create a github issue?
> > > > 
> > > > Thanks!
> > > > 
> > > > --Alex
> > > > 
> > > > On Wed, Jan 8, 2014 at 11:08 PM, Gabe Gorelick-Feldman \<  
> > > > [gabego...@gmail.com](mailto:gabego...@gmail.com)\> wrote:
> > > > 
> > > > > The documentation on URL-based access control  
> > > > > [http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/url-access-control.html](http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/url-access-control.html) implies  
> > > > > that \_bulk still works if you set rest.action.multi.allow\_explicit\_index:  
> > > > > false, as long as you specify the index in the URL. However, I can't  
> > > > > get it to work.
> > > > > 
> > > > > POST /foo/bar/\_bulk  
> > > > > { "index": {} }  
> > > > > { "\_id": 1234, "baz": "foobar" }
> > > > > 
> > > > > returns
> > > > > 
> > > > > explicit index in bulk is not allowed
> > > > > 
> > > > > Should this work?
> > > > > 
> > > > > --  
> > > > > 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 [elasticsearc...@googlegroups.com](mailto:elasticsearc...@googlegroups.com).  
> > > > > To view this discussion on the web visit [https://groups.google.com/d/](https://groups.google.com/d/)  
> > > > > msgid/elasticsearch/a0d1fa2f-0c28-4142-9f6d-4b28a1695bb3%  
> > > > > [40googlegroups.com](http://40googlegroups.com).  
> > > > > For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).
> > > > 
> > > > --  
> > > > 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 [elasticsearc...@googlegroups.com](mailto:elasticsearc...@googlegroups.com) \<javascript:\>.  
> > > > To view this discussion on the web visit  
> > > > [https://groups.google.com/d/msgid/elasticsearch/a9aff019-33c0-4743-9e14-fe3913bcda1c%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/a9aff019-33c0-4743-9e14-fe3913bcda1c%40googlegroups.com)  
> > > > [https://groups.google.com/d/msgid/elasticsearch/a9aff019-33c0-4743-9e14-fe3913bcda1c%40googlegroups.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/a9aff019-33c0-4743-9e14-fe3913bcda1c%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/c5b9977a-47dd-4445-bbc7-29326960f5f2%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/c5b9977a-47dd-4445-bbc7-29326960f5f2%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![Niccolo\_Becchi](https://avatars.discourse-cdn.com/v4/letter/n/8edcca/32.png) [@Niccolo\_Becchi](https://discuss.elastic.co/u/Niccolo_Becchi)\
**Post date:** [October 27, 2014, 9:43am UTC](https://discuss.elastic.co/t/allow-explicit-index-and--bulk/15154/8 "2014-10-27T09:43:56Z")

</div>

Sorry my friends,  
my mistake, after one week I have discovered that the correct syntax is:

POST /foo/bar/\_bulk  
{ "index": {"\_id" : "1"} }  
{"baz": "foobar" }

It works! Thanks  
Niccolo

Il giorno giovedì 23 ottobre 2014 16:39:39 UTC+1, Niccolò Becchi ha scritto:

> Thanks Jörg for the prompt answer. However, for security reason we have  
> disabled the option rest.action.multi.allow\_  
> explicit\_index (  
> [Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/url-access-control.html)  
> [http://www.google.com/url?q=http%3A%2F%2Fwww.elasticsearch.org%2Fguide%2Fen%2Felasticsearch%2Freference%2Fcurrent%2Furl-access-control.html&sa=D&sntz=1&usg=AFQjCNEtPcfFx\_JMPzCxDP2x2dyHm8T\_GA](http://www.google.com/url?q=http%3A%2F%2Fwww.elasticsearch.org%2Fguide%2Fen%2Felasticsearch%2Freference%2Fcurrent%2Furl-access-control.html&sa=D&sntz=1&usg=AFQjCNEtPcfFx_JMPzCxDP2x2dyHm8T_GA)  
> ).
> 
> So, in this case using:
> 
> POST /\_bulk  
> { "index" : { "\_index": "foo", "\_type": "bar", "\_id" : "1" } }  
> { "baz": "foobar" }
> 
> I am getting this exception:  
> {  
> "error": "ElasticsearchIllegalArgumentException[explicit index in bulk  
> is not allowed]",  
> "status": 400  
> }
> 
> Is there any way to insert a document, specifying the id, in the bulk mode  
> with "no explicit index in bulk", as this code doesn't work:
> 
> POST /foo/bar/\_bulk  
> { "index": {} }  
> { "\_id" : "1", "baz": "foobar" }
> 
> Else is this a bug/feature to be implemented?
> 
> Il giorno giovedì 23 ottobre 2014 10:27:34 UTC+1, Jörg Prante ha scritto:
> 
> > The bulk format does not allow \_id in the payload line, you confuse the  
> > indexer.
> > 
> > Use something like
> > 
> > POST /\_bulk  
> > { "index" : { "\_index": "foo", "\_type": "bar", "\_id" : "1" } }  
> > { "baz": "foobar" }
> > 
> > Jörg
> > 
> > On Wed, Oct 22, 2014 at 8:47 PM, Niccolò Becchi [niccolo...@gmail.com](mailto:niccolo...@gmail.com)  
> > wrote:
> > 
> > > This issue looks to be fixed on  
> > > [Disabling allow\_explicit\_index breaks bulk · Issue #4668 · elastic/elasticsearch · GitHub](https://github.com/elasticsearch/elasticsearch/issues/4668)
> > > 
> > > However, on elasticsearch-1.3.4, running the example with  
> > > rest.action.multi.allow\_explicit\_index: false:
> > > 
> > > ```auto
> > > POST /foo/bar/_bulk
> > > { "index": {} }
> > > { "_id" : "1", "baz": "foobar" }
> > > 
> > > ```
> > > 
> > > I am getting the exception:
> > > 
> > > ```auto
> > > {
> > > "took": 1,
> > > "errors": true,
> > > "items": [
> > > {
> > > "create": {
> > > "_index": "foo",
> > > "_type": "bar",
> > > "_id": "oX0Xp8dzRbySZiKX8QI0zw",
> > > "status": 400,
> > > "error": "MapperParsingException[failed to parse [_id]]; 
> > > nested: MapperParsingException[Provided id [oX0Xp8dzRbySZiKX8QI0zw] does 
> > > not match the content one [1]]; "
> > > }
> > > }
> > > ]
> > > }
> > > 
> > > ```
> > > 
> > > Am I doing something wrong or something has changed?
> > > 
> > > Il giorno giovedì 9 gennaio 2014 15:38:46 UTC, Gabe Gorelick-Feldman ha  
> > > scritto:
> > > 
> > > > Opened an issue: [GitHub - elastic/elasticsearch: Free and Open, Distributed, RESTful Search Engine](https://github.com/elasticsearch/elasticsearch/)  
> > > > issues/4668
> > > > 
> > > > On Thursday, January 9, 2014 3:39:39 AM UTC-5, Alexander Reelsen wrote:
> > > > 
> > > > > Hey,
> > > > > 
> > > > > after having a very quick look, it looks like a bug (or wrong  
> > > > > documentation, need to check further). Can you create a github issue?
> > > > > 
> > > > > Thanks!
> > > > > 
> > > > > --Alex
> > > > > 
> > > > > On Wed, Jan 8, 2014 at 11:08 PM, Gabe Gorelick-Feldman \<  
> > > > > [gabego...@gmail.com](mailto:gabego...@gmail.com)\> wrote:
> > > > > 
> > > > > > The documentation on URL-based access control  
> > > > > > [http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/url-access-control.html](http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/url-access-control.html) implies  
> > > > > > that \_bulk still works if you set rest.action.multi.allow\_explicit\_index:  
> > > > > > false, as long as you specify the index in the URL. However, I can't  
> > > > > > get it to work.
> > > > > > 
> > > > > > POST /foo/bar/\_bulk  
> > > > > > { "index": {} }  
> > > > > > { "\_id": 1234, "baz": "foobar" }
> > > > > > 
> > > > > > returns
> > > > > > 
> > > > > > explicit index in bulk is not allowed
> > > > > > 
> > > > > > Should this work?
> > > > > > 
> > > > > > --  
> > > > > > 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 [elasticsearc...@googlegroups.com](mailto:elasticsearc...@googlegroups.com).  
> > > > > > To view this discussion on the web visit [https://groups.google.com/d/](https://groups.google.com/d/)  
> > > > > > msgid/elasticsearch/a0d1fa2f-0c28-4142-9f6d-4b28a1695bb3%  
> > > > > > [40googlegroups.com](http://40googlegroups.com).  
> > > > > > For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).
> > > > > 
> > > > > --  
> > > > > 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 [elasticsearc...@googlegroups.com](mailto:elasticsearc...@googlegroups.com).  
> > > > > To view this discussion on the web visit  
> > > > > [https://groups.google.com/d/msgid/elasticsearch/a9aff019-33c0-4743-9e14-fe3913bcda1c%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/a9aff019-33c0-4743-9e14-fe3913bcda1c%40googlegroups.com)  
> > > > > [https://groups.google.com/d/msgid/elasticsearch/a9aff019-33c0-4743-9e14-fe3913bcda1c%40googlegroups.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/a9aff019-33c0-4743-9e14-fe3913bcda1c%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/b5f5d61c-93c5-4705-9d95-a84ef2a168e2%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/b5f5d61c-93c5-4705-9d95-a84ef2a168e2%40googlegroups.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:53am UTC](https://discuss.elastic.co/t/allow-explicit-index-and--bulk/15154/9 "2017-07-06T00:53:46Z")

</div>


