Add new params to search_template and clear_scroll APIs
This commit is contained in:
@@ -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.
|
||||
`<http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/search-request-scroll.html>`_
|
||||
|
||||
: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
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user