# Error when doing bulk index: \[illegal\_argument\_exception\] explicit index in bulk is not allowed

**URL:** <https://discuss.elastic.co/t/error-when-doing-bulk-index-illegal-argument-exception-explicit-index-in-bulk-is-not-allowed/74703>\
**Category:** Elasticsearch\
**Created:** [February 10, 2017, 7:16pm UTC](https://discuss.elastic.co/t/error-when-doing-bulk-index-illegal-argument-exception-explicit-index-in-bulk-is-not-allowed/74703 "2017-02-10T19:16:04Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![orthecreedence](https://avatars.discourse-cdn.com/v4/letter/o/71c47a/32.png) [@orthecreedence](https://discuss.elastic.co/u/orthecreedence)\
**Post date:** [February 10, 2017, 7:16pm UTC](https://discuss.elastic.co/t/error-when-doing-bulk-index-illegal-argument-exception-explicit-index-in-bulk-is-not-allowed/74703/1 "2017-02-10T19:16:04Z")

</div>

Hello. I am using elasticsearch 5.1.1 on the AWS hosted elasticsearch (meaning, I have no ability to change the configuration in a material way).

We recently moved our architecture from a single-server ES 1.7 to the hosted 5.1.1 and my job is to get everything running on the new version.

So far, things have been running smoothly, however we have a script (nodejs) that uses the official javascript driver to move data from our database to elasticsearch. It uses bulk index commands. I am getting the error:

```auto
{ [Error: [illegal_argument_exception] explicit index in bulk is not allowed]
  status: 400,
  displayName: 'BadRequest',
  message: '[illegal_argument_exception] explicit index in bulk is not allowed',
  path: '/_bulk',
  query: {},
  body: '{"index":{"_index":"cards.2017-02-08","_type":"card","_id":23891342}}\n{"id":23891342,"entity_id":28400,"type":"news"}\n',
  statusCode: 400,
  response: '{"error":{"root_cause":[{"type":"illegal_argument_exception","reason":"explicit index in bulk is not allowed"}],"type":"illegal_argument_exception","reason":"explicit index in bulk is not allowed"},"status":400}',
  toString: [Function],
  toJSON: [Function] }

```

I've searched a lot of places before posting here and I can't seem to figure out what this error is actually saying. Am I doing something wrong? Does this have something to do with the `allow_explicit_index` (which I'm guessing I can't change since I have no access to elasticsearch.yml)?

What does this error mean, and is there any way to fix it or work around it given the circumstances?

Thanks for any help!

---

<div class="post-metadata">

**Author:** ![orthecreedence](https://avatars.discourse-cdn.com/v4/letter/o/71c47a/32.png) [@orthecreedence](https://discuss.elastic.co/u/orthecreedence)\
**Post date:** [February 21, 2017, 6:34pm UTC](https://discuss.elastic.co/t/error-when-doing-bulk-index-illegal-argument-exception-explicit-index-in-bulk-is-not-allowed/74703/2 "2017-02-21T18:34:25Z")

</div>

Fixed it, the solution was:

- Log into AWS
- Go to Elasticsearch service
- Go into the domain
- Click `Configure cluster`
- Scroll to bottom, open "Advanced options..." menu
- Make sure `rest.action.multi.allow_explicit_index` is set to `true`
- Save, wait the 15 minutes it takes to propagate, profit.

---

<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:** [March 21, 2017, 6:34pm UTC](https://discuss.elastic.co/t/error-when-doing-bulk-index-illegal-argument-exception-explicit-index-in-bulk-is-not-allowed/74703/3 "2017-03-21T18:34:39Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
