From 86b59d5d90530cc5cd46831763bc707e21663a65 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Honza=20Kr=C3=A1l?= Date: Tue, 22 Apr 2014 21:35:51 +0200 Subject: [PATCH] Add new params to search_template and clear_scroll APIs --- elasticsearch/client/__init__.py | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/elasticsearch/client/__init__.py b/elasticsearch/client/__init__.py index e70acc1e..1ac9d1c9 100644 --- a/elasticsearch/client/__init__.py +++ b/elasticsearch/client/__init__.py @@ -436,7 +436,8 @@ class Elasticsearch(object): params=params, body=body) return data - @query_params() + @query_params('allow_no_indices', 'expand_wildcards', 'ignore_unavailable', + 'preference', 'routing', 'scroll', 'search_type') def search_template(self, index=None, doc_type=None, body=None, params=None): """ A query that accepts a query template and a map of key/value pairs to @@ -448,6 +449,19 @@ class Elasticsearch(object): :arg doc_type: A comma-separated list of document types to search; leave empty to perform the operation on all types :arg body: The search definition template and its params + :arg allow_no_indices: Whether to ignore if a wildcard indices + expression resolves into no concrete indices. (This includes `_all` + string or when no indices have been specified) + :arg expand_wildcards: Whether to expand wildcard expression to concrete + indices that are open, closed or both., default 'open' + :arg ignore_unavailable: Whether specified concrete indices should be + ignored when unavailable (missing or closed) + :arg preference: Specify the node or shard the operation should be + performed on (default: random) + :arg routing: A comma-separated list of specific routing values + :arg scroll: Specify how long a consistent view of the index should be + maintained for scrolled search + :arg search_type: Search operation type """ _, data = self.transport.perform_request('GET', _make_path(index, doc_type, '_search', 'template'), params=params, body=body) @@ -511,16 +525,18 @@ class Elasticsearch(object): return data @query_params() - def clear_scroll(self, scroll_id, params=None): + def clear_scroll(self, scroll_id=None, body=None, params=None): """ Clear the scroll request created by specifying the scroll parameter to search. ``_ :arg scroll_id: The scroll ID or a list of scroll IDs + :arg body: A comma-separated list of scroll IDs to clear if none was + specified via the scroll_id parameter """ _, data = self.transport.perform_request('DELETE', _make_path('_search', 'scroll', scroll_id), - params=params) + body=body, params=params) return data