1

I'm running an AWS Elasticsearch Service cluster with ES 5.5, and am trying to perform a delete document operation using the Python API.

When searching for the document using a document ID string, the API returns True.

doc_exists = esClient.exists(index='debug', doc_type='_all', id=doc_id)

However, when I try to delete it using the same document ID, I receive a NotFoundError.

esClient.delete(index='debug', doc_type='_all', id=doc_id)

exception received:

raise HTTP_EXCEPTIONS.get(status_code, TransportError)(status_code, error_message, additional_info)elasticsearch.exceptions.NotFoundError: TransportError(404, '
{
    "found": false,
    "_index": "debug",
    "_type": "_all",
    "_id": "some-id-with-dash_and_underscore",
    "_version": 1,
    "result": "not_found",
    "_shards": {
        "total": 2,
        "successful": 1,
        "failed": 0
    }
}
'): NotFoundError

Can't figure out what's wrong here.

1
  • Please post all of the python code that reproduces the problem. Commented Apr 17, 2018 at 2:55

1 Answer 1

1

That is expected. You are using _all for type which in exists query will return the first doc found in any of the types in index but in delete you need to specify the exact type where the doc is present, not all types in the index.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.