# Bulk API : inconsistent responses with update actions

**URL:** <https://discuss.elastic.co/t/bulk-api-inconsistent-responses-with-update-actions/18352>\
**Category:** Elasticsearch\
**Created:** [June 26, 2014, 11:52am UTC](https://discuss.elastic.co/t/bulk-api-inconsistent-responses-with-update-actions/18352 "2014-06-26T11:52:59Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Tanguy\_Moal](https://avatars.discourse-cdn.com/v4/letter/t/8e8cbc/32.png) [@Tanguy\_Moal](https://discuss.elastic.co/u/Tanguy_Moal)\
**Post date:** [June 26, 2014, 11:52am UTC](https://discuss.elastic.co/t/bulk-api-inconsistent-responses-with-update-actions/18352/1 "2014-06-26T11:52:59Z")

</div>

Dear group,

I'm experiencing an issue with Bulk API.  
Here is an example set of commands to be processed using the bulk API :  
{ "index" : { "\_index" : "test", "\_type" : "type1", "\_id" : "1" } }  
{ "title" : "Great Title of doc 1" }  
{ "index" : { "\_index" : "test", "\_type" : "type1", "\_id" : "2" } }  
{ "title" : "Great Title of doc 2" }  
{ "update" : { "\_index" : "test", "\_type" : "type1", "\_id" : "1" } }  
{ "doc" : { "date" : "2014-04-30T23:59:57" }}  
{ "update" : { "\_index" : "test", "\_type" : "type1", "\_id" : "2" } }  
{ "doc" : { "date" : "2014-04-31T00:00:01" }}  
{ "delete" : { "\_index" : "test", "\_type" : "type1", "\_id" : "1" } }  
{ "delete" : { "\_index" : "test", "\_type" : "type1", "\_id" : "2" } }

Here, the 4th command (update of document with \_id == 2) is expected to  
fail, and it does (The date is invalid, April's days are in the [1-30]  
range).  
Here is the response I get from the API :  
{  
"took" : 4,  
"errors" : true,  
"items" : [ {  
"index" : {  
"\_index" : "test",  
"\_type" : "type1",  
"\_id" : "1",  
"\_version" : 8,  
"status" : 201  
}  
}, {  
"index" : {  
"\_index" : "test",  
"\_type" : "type1",  
"\_id" : "2",  
"\_version" : 5,  
"status" : 201  
}  
}, {  
"update" : {  
"\_index" : "test",  
"\_type" : "type1",  
"\_id" : "1",  
"\_version" : 9,  
"status" : 200  
}  
}, {  
"index" : {  
"\_index" : "test",  
"\_type" : "type1",  
"\_id" : "2",  
"status" : 400,  
"error" : "MapperParsingException[failed to parse [date]]; nested:  
MapperParsingException[failed to parse date field [2014-04-31T00:00:01],  
tried both date format [dateOptionalTime], and timestamp number with locale  
[]]; nested: IllegalFieldValueException[Cannot parse  
"2014-04-31T00:00:01": Value 31 for dayOfMonth must be in the range  
[1,30]]; "  
}  
}, {  
"delete" : {  
"\_index" : "test",  
"\_type" : "type1",  
"\_id" : "1",  
"\_version" : 10,  
"status" : 200,  
"found" : true  
}  
}, {  
"delete" : {  
"\_index" : "test",  
"\_type" : "type1",  
"\_id" : "2",  
"\_version" : 6,  
"status" : 200,  
"found" : true  
}  
} ]  
}  
As we can see, the 4th item in the response is :  
{  
"index" : {  
"\_index" : "test",  
"\_type" : "type1",  
"\_id" : "2",  
"status" : 400,  
"error" : "MapperParsingException[failed to parse [date]]; nested:  
MapperParsingException[failed to parse date field [2014-04-31T00:00:01],  
tried both date format [dateOptionalTime], and timestamp number with locale  
[]]; nested: IllegalFieldValueException[Cannot parse  
"2014-04-31T00:00:01": Value 31 for dayOfMonth must be in the range  
[1,30]]; "  
}  
}  
I don't understand why the key for the item is "index" while the action was  
an update.  
I was expecting the response for item #4 to be:

{  
"update" : {  
"\_index" : "test",  
"\_type" : "type1",  
"\_id" : "2",  
"status" : 400,  
"error" : "MapperParsingException[failed to parse [date]]; nested:  
MapperParsingException[failed to parse date field [2014-04-31T00:00:01],  
tried both date format [dateOptionalTime], and timestamp number with locale  
[]]; nested: IllegalFieldValueException[Cannot parse  
"2014-04-31T00:00:01": Value 31 for dayOfMonth must be in the range  
[1,30]]; "  
}  
}

I looked into the source code, and I think the mismatch between the  
operation type in the result and in the command comes from the following line  
of code  
[https://github.com/elasticsearch/elasticsearch/blob/1.1/src/main/java/org/elasticsearch/action/bulk/TransportShardBulkAction.java#L317](https://github.com/elasticsearch/elasticsearch/blob/1.1/src/main/java/org/elasticsearch/action/bulk/TransportShardBulkAction.java#L317),  
but I can be wrong, I didn't edit it to verify.  
I could dig deeper, simply open an issue, or provide more details,  
depending on what do you guys actually prefer.

I'm using elasticsearch v1.1.1.

Thanks for your support,

--  
Tanguy

--  
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/4462c395-f403-4005-9c2c-336050ca7022%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/4462c395-f403-4005-9c2c-336050ca7022%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [June 26, 2014, 12:10pm UTC](https://discuss.elastic.co/t/bulk-api-inconsistent-responses-with-update-actions/18352/2 "2014-06-26T12:10:51Z")

</div>

It looks like a bug to me. I think you should open issue and add all those details in.

Best

--  
David Pilato | Technical Advocate | [Elasticsearch.com](http://Elasticsearch.com)  
@dadoonet | @elasticsearchfr

Le 26 juin 2014 à 13:53:03, Tanguy Moal ([tanguy.moal@gmail.com](mailto:tanguy.moal@gmail.com)) a écrit:

Dear group,

I'm experiencing an issue with Bulk API.  
Here is an example set of commands to be processed using the bulk API :  
{ "index" : { "\_index" : "test", "\_type" : "type1", "\_id" : "1" } }  
{ "title" : "Great Title of doc 1" }  
{ "index" : { "\_index" : "test", "\_type" : "type1", "\_id" : "2" } }  
{ "title" : "Great Title of doc 2" }  
{ "update" : { "\_index" : "test", "\_type" : "type1", "\_id" : "1" } }  
{ "doc" : { "date" : "2014-04-30T23:59:57" }}  
{ "update" : { "\_index" : "test", "\_type" : "type1", "\_id" : "2" } }  
{ "doc" : { "date" : "2014-04-31T00:00:01" }}  
{ "delete" : { "\_index" : "test", "\_type" : "type1", "\_id" : "1" } }  
{ "delete" : { "\_index" : "test", "\_type" : "type1", "\_id" : "2" } }

Here, the 4th command (update of document with \_id == 2) is expected to fail, and it does (The date is invalid, April's days are in the [1-30] range).  
Here is the response I get from the API :  
{  
"took" : 4,  
"errors" : true,  
"items" : [ {  
"index" : {  
"\_index" : "test",  
"\_type" : "type1",  
"\_id" : "1",  
"\_version" : 8,  
"status" : 201  
}  
}, {  
"index" : {  
"\_index" : "test",  
"\_type" : "type1",  
"\_id" : "2",  
"\_version" : 5,  
"status" : 201  
}  
}, {  
"update" : {  
"\_index" : "test",  
"\_type" : "type1",  
"\_id" : "1",  
"\_version" : 9,  
"status" : 200  
}  
}, {  
"index" : {  
"\_index" : "test",  
"\_type" : "type1",  
"\_id" : "2",  
"status" : 400,  
"error" : "MapperParsingException[failed to parse [date]]; nested: MapperParsingException[failed to parse date field [2014-04-31T00:00:01], tried both date format [dateOptionalTime], and timestamp number with locale []]; nested: IllegalFieldValueException[Cannot parse "2014-04-31T00:00:01": Value 31 for dayOfMonth must be in the range [1,30]]; "  
}  
}, {  
"delete" : {  
"\_index" : "test",  
"\_type" : "type1",  
"\_id" : "1",  
"\_version" : 10,  
"status" : 200,  
"found" : true  
}  
}, {  
"delete" : {  
"\_index" : "test",  
"\_type" : "type1",  
"\_id" : "2",  
"\_version" : 6,  
"status" : 200,  
"found" : true  
}  
} ]  
}  
As we can see, the 4th item in the response is :  
{  
"index" : {  
"\_index" : "test",  
"\_type" : "type1",  
"\_id" : "2",  
"status" : 400,  
"error" : "MapperParsingException[failed to parse [date]]; nested: MapperParsingException[failed to parse date field [2014-04-31T00:00:01], tried both date format [dateOptionalTime], and timestamp number with locale []]; nested: IllegalFieldValueException[Cannot parse "2014-04-31T00:00:01": Value 31 for dayOfMonth must be in the range [1,30]]; "  
}  
}  
I don't understand why the key for the item is "index" while the action was an update.  
I was expecting the response for item #4 to be:  
{  
"update" : {  
"\_index" : "test",  
"\_type" : "type1",  
"\_id" : "2",  
"status" : 400,  
"error" : "MapperParsingException[failed to parse [date]]; nested: MapperParsingException[failed to parse date field [2014-04-31T00:00:01], tried both date format [dateOptionalTime], and timestamp number with locale []]; nested: IllegalFieldValueException[Cannot parse "2014-04-31T00:00:01": Value 31 for dayOfMonth must be in the range [1,30]]; "  
}  
}

I looked into the source code, and I think the mismatch between the operation type in the result and in the command comes from the following line of code, but I can be wrong, I didn't edit it to verify.  
I could dig deeper, simply open an issue, or provide more details, depending on what do you guys actually prefer.

I'm using elasticsearch v1.1.1.

Thanks for your support,

## -- Tanguy

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/4462c395-f403-4005-9c2c-336050ca7022%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/4462c395-f403-4005-9c2c-336050ca7022%40googlegroups.com).  
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/etPan.53ac0dcb.1d4ed43b.9da9%40MacBook-Air-de-David.local](https://groups.google.com/d/msgid/elasticsearch/etPan.53ac0dcb.1d4ed43b.9da9%40MacBook-Air-de-David.local).  
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, 1:19am UTC](https://discuss.elastic.co/t/bulk-api-inconsistent-responses-with-update-actions/18352/3 "2017-07-06T01:19:31Z")

</div>


