# Unexpected result status for bulk if contained delete failed

**URL:** <https://discuss.elastic.co/t/unexpected-result-status-for-bulk-if-contained-delete-failed/43834>\
**Category:** Elasticsearch\
**Created:** [March 8, 2016, 9:40pm UTC](https://discuss.elastic.co/t/unexpected-result-status-for-bulk-if-contained-delete-failed/43834 "2016-03-08T21:40:11Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![gunnarmorling](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/gunnarmorling/32/6027_2.png) [@gunnarmorling](https://discuss.elastic.co/u/gunnarmorling)\
**Post date:** [March 8, 2016, 9:40pm UTC](https://discuss.elastic.co/t/unexpected-result-status-for-bulk-if-contained-delete-failed/43834/1 "2016-03-08T21:40:12Z")

</div>

Hi,

I am executing bulk requests which contain delete operations. When any of the deletes fails because I'm trying to delete a non-existing document, that item is reported in the response with status 404, but the overall status of the bulk request still is "errors" : false.

Is this an expected behavior? [Cheaper in bulk](https://www.elastic.co/guide/en/elasticsearch/guide/current/bulk.html) seems to indicate otherwise:

> If any of the requests fail, the top-level error flag is set to true

Interestingly, no error is set to the item itself, apart from the 404 status.

These are my requests:

```
curl -XPUT "http://localhost:9200/movies"
curl -XPUT "http://localhost:9200/movies/movie/1" -d '{}'
curl -XPUT "http://localhost:9200/movies/movie/2" -d '{}'

```

File "bulk.json" with following contents:

```
{ "delete": { "_index": "movies", "_type": "movie", "_id": "1" } }
{ "delete": { "_index": "movies", "_type": "movie", "_id": "3" } }

```

Running the bulk request:

```
curl -v -XPOST "http://localhost:9200/_bulk" --data-binary @bulk.json

```

And that's the reply from the bulk request:

```
{
  "took": 7,
  "errors": false,
  "items": [
    {
      "delete": {
        "_index": "movies",
        "_type": "movie",
        "_id": "1",
        "_version": 2,
        "_shards": {
          "total": 1,
          "successful": 1,
          "failed": 0
        },
        "status": 200,
        "found": true
      }
    },
    {
      "delete": {
        "_index": "movies",
        "_type": "movie",
        "_id": "3",
        "_version": 1,
        "_shards": {
          "total": 1,
          "successful": 1,
          "failed": 0
        },
        "status": 404,
        "found": false
      }
    }
  ]
}

```

It's working as expected for other kinds of errors, e.g. when provoking a 409 by trying to create an already existing document. In this case I see an error at the level of the concerned item and the overall errors flag is set to true. I am using Elasticsearch 2.2.

Any help is appreciated very much!

Thanks,

--Gunnar

---

<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:10pm UTC](https://discuss.elastic.co/t/unexpected-result-status-for-bulk-if-contained-delete-failed/43834/2 "2017-07-05T23:10:01Z")

</div>


