# Elasticsearch Bulk Indexing with specified index, type in URL not working

**URL:** <https://discuss.elastic.co/t/elasticsearch-bulk-indexing-with-specified-index-type-in-url-not-working/39175>\
**Category:** Elasticsearch\
**Created:** [January 14, 2016, 12:28am UTC](https://discuss.elastic.co/t/elasticsearch-bulk-indexing-with-specified-index-type-in-url-not-working/39175 "2016-01-14T00:28:48Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![shamak](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/shamak/32/7142_2.png) [@shamak](https://discuss.elastic.co/u/shamak)\
**Post date:** [January 14, 2016, 12:28am UTC](https://discuss.elastic.co/t/elasticsearch-bulk-indexing-with-specified-index-type-in-url-not-working/39175/1 "2016-01-14T00:28:48Z")

</div>

I am trying to bulk index a 45 MB file using the bulk API on Elasticsearch. The docs say '_The endpoints are /\_bulk, /{index}/\_bulk, and {index}/{type}/\_bulk. When the index or the index/type are provided, they will be used by default on bulk items that don’t provide them explicitly._'. So, I tried this:

`curl -XPOST https://example-es-cluster.com/foo/bar/_bulk --data-binary @sample.json`

where _foo_ is the index, _bar_ is the type and sample.json holds the required data. sample.json follows all guidelines, here are the contents.

`cat sample.json {"foo": "bar", "baz": "qux"} {"foo": "bar1", "baz": "qux1"}`

It also has a new line at the end of the file. However, I get the error: `{"error":"ActionRequestValidationException[Validation Failed: 1: no requests added;]","status":400}`.

Any ideas or help please?

---

<div class="post-metadata">

**Author:** ![warkolm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/warkolm/32/39224_2.png) [@warkolm](https://discuss.elastic.co/u/warkolm)\
**Post date:** [January 14, 2016, 6:09am UTC](https://discuss.elastic.co/t/elasticsearch-bulk-indexing-with-specified-index-type-in-url-not-working/39175/2 "2016-01-14T06:09:57Z")

</div>

[The docs](https://www.elastic.co/guide/en/elasticsearch/reference/2.1/docs-bulk.html) also give the format you need to follow for bulk;

```auto
action_and_meta_data\n
optional_source\n
action_and_meta_data\n
optional_source\n
....
action_and_meta_data\n
optional_source\n

```

Which is not what you have.

---

<div class="post-metadata">

**Author:** ![shamak](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/shamak/32/7142_2.png) [@shamak](https://discuss.elastic.co/u/shamak)\
**Post date:** [January 14, 2016, 5:54pm UTC](https://discuss.elastic.co/t/elasticsearch-bulk-indexing-with-specified-index-type-in-url-not-working/39175/3 "2016-01-14T17:54:30Z")

</div>

_When the index or the index/type are provided, they will be used by default on bulk items that don’t provide them explicitly._ This is what the docs say, so I shouldn't have to specify the action/metadata, right?

---

<div class="post-metadata">

**Author:** ![warkolm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/warkolm/32/39224_2.png) [@warkolm](https://discuss.elastic.co/u/warkolm)\
**Post date:** [January 14, 2016, 9:43pm UTC](https://discuss.elastic.co/t/elasticsearch-bulk-indexing-with-specified-index-type-in-url-not-working/39175/4 "2016-01-14T21:43:14Z")

</div>

You still need the action though.

---

<div class="post-metadata">

**Author:** ![shamak](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/shamak/32/7142_2.png) [@shamak](https://discuss.elastic.co/u/shamak)\
**Post date:** [January 14, 2016, 10:33pm UTC](https://discuss.elastic.co/t/elasticsearch-bulk-indexing-with-specified-index-type-in-url-not-working/39175/5 "2016-01-14T22:33:33Z")

</div>

Thanks!

---

<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 5, 2017, 11:24pm UTC](https://discuss.elastic.co/t/elasticsearch-bulk-indexing-with-specified-index-type-in-url-not-working/39175/6 "2017-07-05T23:24:17Z")

</div>


