From 2eff1f0d9cb8e420583bac30cbb6e99d22297cd1 Mon Sep 17 00:00:00 2001 From: Honza Kral Date: Wed, 10 Jul 2013 16:49:07 +0200 Subject: [PATCH] Delete endpoint --- elasticsearch/client/__init__.py | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/elasticsearch/client/__init__.py b/elasticsearch/client/__init__.py index 68473381..8886eaa5 100644 --- a/elasticsearch/client/__init__.py +++ b/elasticsearch/client/__init__.py @@ -141,3 +141,25 @@ class Elasticsearch(object): index = '_all' status, data = self.transport.perform_request('GET', _make_path(index, doc_type, '_search'), params=params, body=body) return data + + @query_params('consistency', 'parent', 'refresh', 'replication', 'routing', 'timeout', 'version', 'version_type') + def delete(self, index, doc_type, id, params=None): + """ + The delete API allows to delete a typed JSON document from a specific index based on its id. + http://elasticsearch.org/guide/reference/api/delete/ + + :arg index: The name of the index + :arg doc_type: The type of the document + :arg id: The document ID + :arg consistency: Specific write consistency setting for the operation + :arg parent: ID of parent document + :arg refresh: Refresh the index after performing the operation + :arg replication: Specific replication type, default u'sync' + :arg routing: Specific routing value + :arg timeout: Explicit operation timeout + :arg version: Explicit version number for concurrency control + :arg version_type: Specific version type + """ + status, data = self.transport.perform_request('DELETE', _make_path(index, doc_type, id), params=params) + return data +