From 6d44d33863dc4d14000e593937bf0938e59b4fb6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Honza=20Kr=C3=A1l?= Date: Mon, 10 Mar 2014 16:25:07 +0100 Subject: [PATCH] Adding a note in docs about the global ignore parameter --- docs/api.rst | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/docs/api.rst b/docs/api.rst index 2904abc2..76d92743 100644 --- a/docs/api.rst +++ b/docs/api.rst @@ -12,7 +12,19 @@ consistency and safety*. An API call is considered successful (and will return a response) if elasticsearch returns a 2XX response. Otherwise an instance of :class:`~elasticsearch.TransportError` (or a more specific subclass) will be -raised. You can see other exception and error states in :ref:`exceptions`. +raised. You can see other exception and error states in :ref:`exceptions`. If +you do not wish an exception to be raised you can always pass in an ``ignore`` +parameter with either a single status code that should be ignored or a list of +them:: + + from elasticsearch import Elasticsearch + es = Elasticsearch() + + # ignore 400 cause by IndexAlreadyExistsException when creating an index + es.indices.create(index='test-index', ignore=400) + + # ignore 404 and 400 + es.indices.delete(index='test-index', ignore=[400, 404]) .. note::