From e5572dd5be3097afae0dde2283d6155c3b3c7f2a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Honza=20Kr=C3=A1l?= Date: Fri, 17 Jan 2014 22:36:56 +0100 Subject: [PATCH] indices.exists_template - new api --- elasticsearch/client/indices.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/elasticsearch/client/indices.py b/elasticsearch/client/indices.py index e02961fb..c4f30f54 100644 --- a/elasticsearch/client/indices.py +++ b/elasticsearch/client/indices.py @@ -390,6 +390,21 @@ class IndicesClient(NamespacedClient): params=params, body=body) return data + @query_params() + def exists_template(self, name, params=None): + """ + Return a boolean indicating whether given template exists. + ``_ + + :arg name: The name of the template + """ + try: + self.transport.perform_request('HEAD', _make_path('_template', name), + params=params) + except NotFoundError: + return False + return True + @query_params('flat_settings') def get_template(self, name=None, params=None): """