# Ordering of reponse elements when using bulk api in 5.X

**URL:** <https://discuss.elastic.co/t/ordering-of-reponse-elements-when-using-bulk-api-in-5-x/186508>\
**Category:** Elasticsearch\
**Created:** [June 19, 2019, 3:14pm UTC](https://discuss.elastic.co/t/ordering-of-reponse-elements-when-using-bulk-api-in-5-x/186508 "2019-06-19T15:14:19Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![ganparse](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ganparse/32/47012_2.png) [@ganparse](https://discuss.elastic.co/u/ganparse)\
**Post date:** [June 19, 2019, 3:14pm UTC](https://discuss.elastic.co/t/ordering-of-reponse-elements-when-using-bulk-api-in-5-x/186508/1 "2019-06-19T15:14:19Z")

</div>

I have found there seems to be inconsistency between various information sources about whether the response elements in the response to a bulk request should be returned in the same order as the elements in the request. The official documentation for version 5.4 which I am using does not specify anything about ordering of the response, but pieces of documentation and forum posts from older versions state that they are in order, and newer documentation for newer versions of elasticsearch clearly state they are in order. I was wondering if anyone had a definitive answer source for whether I would or would not expect to get response elements in order?

---

<div class="post-metadata">

**Author:** ![wangqinghuan](https://avatars.discourse-cdn.com/v4/letter/w/d26b3c/32.png) [@wangqinghuan](https://discuss.elastic.co/u/wangqinghuan)\
**Post date:** [June 19, 2019, 5:39pm UTC](https://discuss.elastic.co/t/ordering-of-reponse-elements-when-using-bulk-api-in-5-x/186508/2 "2019-06-19T17:39:08Z")

</div>

The response to a bulk action is a large JSON structure with the individual results of each action that was performed in the same order as the actions that appeared in the request.  
the source is from  
[https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-bulk.html](https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-bulk.html)

---

<div class="post-metadata">

**Author:** ![ganparse](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ganparse/32/47012_2.png) [@ganparse](https://discuss.elastic.co/u/ganparse)\
**Post date:** [June 19, 2019, 5:54pm UTC](https://discuss.elastic.co/t/ordering-of-reponse-elements-when-using-bulk-api-in-5-x/186508/3 "2019-06-19T17:54:12Z")

</div>

At that link I see this:  
"The response to a bulk action is a large JSON structure with the individual results of each action that was performed. The failure of a single action does not affect the remaining actions."  
which says nothing about the ordering. Newer (and also some older 2.X) documentation does include that bit about ordering however, which is why I am a bit confused.

---

<div class="post-metadata">

**Author:** ![wangqinghuan](https://avatars.discourse-cdn.com/v4/letter/w/d26b3c/32.png) [@wangqinghuan](https://discuss.elastic.co/u/wangqinghuan)\
**Post date:** [June 19, 2019, 6:10pm UTC](https://discuss.elastic.co/t/ordering-of-reponse-elements-when-using-bulk-api-in-5-x/186508/4 "2019-06-19T18:10:56Z")

</div>

sorry. i find that in current version not in 5.4 version.  
here is an issue that shows this omission was addressed in version 6.6.

> <https://github.com/elastic/elasticsearch/pull/36441>

  
I think it works for previous version.

---

<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 17, 2019, 6:11pm UTC](https://discuss.elastic.co/t/ordering-of-reponse-elements-when-using-bulk-api-in-5-x/186508/5 "2019-07-17T18:11:04Z")

</div>

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