Skip to content

Commit ef30042

Browse files
committed
Updated the API interface to latest API specs
1 parent c5f91fa commit ef30042

File tree

4 files changed

+124
-50
lines changed

4 files changed

+124
-50
lines changed

elasticsearch/client/__init__.py

+22-11
Original file line numberDiff line numberDiff line change
@@ -663,28 +663,37 @@ def msearch(self, body, index=None, doc_type=None, params=None):
663663
params=params, body=self._bulk_body(body))
664664
return data
665665

666-
@query_params('consistency', 'allow_no_indices', 'expand_wildcards',
667-
'ignore_unavailable', 'replication', 'routing', 'source', 'timeout', 'q')
666+
@query_params('allow_no_indices', 'analyzer', 'consistency',
667+
'default_operator', 'df', 'expand_wildcards', 'ignore_unavailable', 'q',
668+
'replication', 'routing', 'source', 'timeout')
668669
def delete_by_query(self, index, doc_type=None, body=None, params=None):
669670
"""
670671
Delete documents from one or more indices and one or more types based on a query.
671672
`<http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/docs-delete-by-query.html>`_
672673
673-
:arg index: A comma-separated list of indices to restrict the operation
674+
:arg index: A comma-separated list of indices to restrict the operation;
675+
use `_all` to perform the operation on all indices
674676
:arg doc_type: A comma-separated list of types to restrict the operation
675-
:arg body: A query to restrict the operation
676-
:arg consistency: Specific write consistency setting for the operation
677+
:arg body: A query to restrict the operation specified with the Query
678+
DSL
677679
:arg allow_no_indices: Whether to ignore if a wildcard indices
678680
expression resolves into no concrete indices. (This includes `_all`
679681
string or when no indices have been specified)
682+
:arg analyzer: The analyzer to use for the query string
683+
:arg consistency: Specific write consistency setting for the operation
684+
:arg default_operator: The default operator for query string query (AND
685+
or OR), default u'OR'
686+
:arg df: The field to use as default where no field prefix is given in
687+
the query string
680688
:arg expand_wildcards: Whether to expand wildcard expression to concrete
681-
indices that are open, closed or both., default 'open'
689+
indices that are open, closed or both., default u'open'
682690
:arg ignore_unavailable: Whether specified concrete indices should be
683691
ignored when unavailable (missing or closed)
684-
:arg replication: Specific replication type (default: sync)
685-
:arg routing: Specific routing value
686-
:arg source: The URL-encoded query definition (instead of using the request body)
687692
:arg q: Query in the Lucene query string syntax
693+
:arg replication: Specific replication type, default u'sync'
694+
:arg routing: Specific routing value
695+
:arg source: The URL-encoded query definition (instead of using the
696+
request body)
688697
:arg timeout: Explicit operation timeout
689698
"""
690699
_, data = self.transport.perform_request('DELETE', _make_path(index, doc_type, '_query'),
@@ -719,8 +728,8 @@ def suggest(self, body, index=None, params=None):
719728
return data
720729

721730
@query_params('allow_no_indices', 'expand_wildcards', 'ignore_unavailable',
722-
'percolate_index', 'percolate_type', 'preference', 'routing', 'version',
723-
'version_type')
731+
'percolate_format', 'percolate_index', 'percolate_type', 'preference',
732+
'routing', 'version', 'version_type')
724733
def percolate(self, index, doc_type, id=None, body=None, params=None):
725734
"""
726735
The percolator allows to register queries against an index, and then
@@ -742,6 +751,8 @@ def percolate(self, index, doc_type, id=None, body=None, params=None):
742751
indices that are open, closed or both., default 'open'
743752
:arg ignore_unavailable: Whether specified concrete indices should be
744753
ignored when unavailable (missing or closed)
754+
:arg percolate_format: Return an array of matching query IDs instead of
755+
objects
745756
:arg percolate_index: The index to percolate the document into. Defaults
746757
to index.
747758
:arg percolate_type: The type to percolate document into. Defaults to

elasticsearch/client/cat.py

+18
Original file line numberDiff line numberDiff line change
@@ -276,3 +276,21 @@ def fielddata(self, fields=None, params=None):
276276
_, data = self.transport.perform_request('GET', _make_path('_cat',
277277
'fielddata', fields), params=params)
278278
return data
279+
280+
@query_params('h', 'help', 'local', 'master_timeout', 'v')
281+
def plugins(self, params=None):
282+
"""
283+
`<http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/cat-plugins.html>`_
284+
285+
:arg h: Comma-separated list of column names to display
286+
:arg help: Return help information, default False
287+
:arg local: Return local information, do not retrieve the state from
288+
master node (default: false)
289+
:arg master_timeout: Explicit operation timeout for connection to master
290+
node
291+
:arg v: Verbose mode. Display column headers, default False
292+
"""
293+
_, data = self.transport.perform_request('GET', '/_cat/plugins',
294+
params=params)
295+
return data
296+

elasticsearch/client/indices.py

+71-38
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
from ..exceptions import NotFoundError
33

44
class IndicesClient(NamespacedClient):
5-
@query_params('analyzer', 'field', 'filters', 'format', 'index',
6-
'prefer_local', 'text', 'tokenizer')
5+
@query_params('analyzer', 'char_filters', 'field', 'filters', 'format',
6+
'index', 'prefer_local', 'text', 'tokenizer')
77
def analyze(self, index=None, body=None, params=None):
88
"""
99
Perform the analysis process on a text and return the tokens breakdown of the text.
@@ -12,6 +12,8 @@ def analyze(self, index=None, body=None, params=None):
1212
:arg index: The name of the index to scope the operation
1313
:arg body: The text on which the analysis should be performed
1414
:arg analyzer: The name of the analyzer to use
15+
:arg char_filters: A comma-separated list of character filters to use
16+
for the analysis
1517
:arg field: Use the analyzer configured for this field (instead of
1618
passing the analyzer name)
1719
:arg filters: A comma-separated list of filters to use for the analysis
@@ -116,15 +118,23 @@ def open(self, index, params=None):
116118
params=params)
117119
return data
118120

119-
@query_params('timeout', 'master_timeout')
121+
@query_params('allow_no_indices', 'expand_wildcards', 'ignore_unavailable',
122+
'master_timeout', 'timeout')
120123
def close(self, index, params=None):
121124
"""
122125
Close an index to remove it's overhead from the cluster. Closed index
123126
is blocked for read/write operations.
124127
`<http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/indices-open-close.html>`_
125128
126-
:arg index: A comma-separated list of indices to delete; use `_all` or
127-
'*' to delete all indices
129+
:arg index: A comma-separated list of indices to close; use `_all` or
130+
'*' to close all indices
131+
:arg allow_no_indices: Whether to ignore if a wildcard indices
132+
expression resolves into no concrete indices. (This includes `_all`
133+
string or when no indices have been specified)
134+
:arg expand_wildcards: Whether to expand wildcard expression to concrete
135+
indices that are open, closed or both., default u'open'
136+
:arg ignore_unavailable: Whether specified concrete indices should be
137+
ignored when unavailable (missing or closed)
128138
:arg master_timeout: Specify timeout for connection to master
129139
:arg timeout: Explicit operation timeout
130140
"""
@@ -147,13 +157,21 @@ def delete(self, index, params=None):
147157
params=params)
148158
return data
149159

150-
@query_params('local')
160+
@query_params('allow_no_indices', 'expand_wildcards', 'ignore_unavailable',
161+
'local')
151162
def exists(self, index, params=None):
152163
"""
153164
Return a boolean indicating whether given index exists.
154165
`<http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/indices-indices-exists.html>`_
155166
156167
:arg index: A list of indices to check
168+
:arg allow_no_indices: Whether to ignore if a wildcard indices
169+
expression resolves into no concrete indices. (This includes `_all`
170+
string or when no indices have been specified)
171+
:arg expand_wildcards: Whether to expand wildcard expression to concrete
172+
indices that are open, closed or both., default u'open'
173+
:arg ignore_unavailable: Whether specified concrete indices should be
174+
ignored when unavailable (missing or closed)
157175
:arg local: Return local information, do not retrieve the state from
158176
master node (default: false)
159177
"""
@@ -191,29 +209,8 @@ def exists_type(self, index, doc_type, params=None):
191209
return False
192210
return True
193211

194-
@query_params('allow_no_indices', 'expand_wildcards', 'ignore_indices', 'ignore_unavailable')
195-
def snapshot_index(self, index=None, params=None):
196-
"""
197-
Explicitly perform a snapshot through the gateway of one or more indices (backup them).
198-
`<http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/indices-gateway-snapshot.html>`_
199-
200-
:arg index: A comma-separated list of index names; use `_all` or empty
201-
string for all indices
202-
:arg allow_no_indices: Whether to ignore if a wildcard indices
203-
expression resolves into no concrete indices. (This includes `_all` string or
204-
when no indices have been specified)
205-
:arg expand_wildcards: Whether to expand wildcard expression to concrete indices
206-
that are open, closed or both.
207-
:arg ignore_indices: When performed on multiple indices, allows to
208-
ignore `missing` ones (default: none)
209-
:arg ignore_unavailable: Whether specified concrete indices should be ignored
210-
when unavailable (missing or closed)
211-
"""
212-
_, data = self.transport.perform_request('POST',
213-
_make_path(index, '_gateway', 'snapshot'), params=params)
214-
return data
215-
216-
@query_params('ignore_conflicts', 'timeout', 'master_timeout')
212+
@query_params('allow_no_indices', 'expand_wildcards', 'ignore_conflicts',
213+
'ignore_unavailable', 'master_timeout', 'timeout')
217214
def put_mapping(self, doc_type, body, index=None, params=None):
218215
"""
219216
Register specific mapping definition for a specific type.
@@ -224,8 +221,15 @@ def put_mapping(self, doc_type, body, index=None, params=None):
224221
operation on all indices.
225222
:arg doc_type: The name of the document type
226223
:arg body: The mapping definition
224+
:arg allow_no_indices: Whether to ignore if a wildcard indices
225+
expression resolves into no concrete indices. (This includes `_all`
226+
string or when no indices have been specified)
227+
:arg expand_wildcards: Whether to expand wildcard expression to concrete
228+
indices that are open, closed or both., default u'open'
227229
:arg ignore_conflicts: Specify whether to ignore conflicts while
228230
updating the mapping (default: false)
231+
:arg ignore_unavailable: Whether specified concrete indices should be
232+
ignored when unavailable (missing or closed)
229233
:arg master_timeout: Specify timeout for connection to master
230234
:arg timeout: Explicit operation timeout
231235
"""
@@ -508,35 +512,55 @@ def get_settings(self, index=None, name=None, params=None):
508512
params=params)
509513
return data
510514

511-
@query_params('master_timeout', 'flat_settings')
515+
@query_params('allow_no_indices', 'expand_wildcards', 'flat_settings',
516+
'ignore_unavailable', 'master_timeout')
512517
def put_settings(self, body, index=None, params=None):
513518
"""
514519
Change specific index level settings in real time.
515520
`<http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/indices-update-settings.html>`_
516521
522+
:arg body: The index settings to be updated
517523
:arg index: A comma-separated list of index names; use `_all` or empty
518524
string to perform the operation on all indices
519-
:arg master_timeout: Specify timeout for connection to master
520-
:arg body: The index settings to be updated
525+
:arg allow_no_indices: Whether to ignore if a wildcard indices
526+
expression resolves into no concrete indices. (This includes `_all`
527+
string or when no indices have been specified)
528+
:arg expand_wildcards: Whether to expand wildcard expression to concrete
529+
indices that are open, closed or both., default u'open'
521530
:arg flat_settings: Return settings in flat format (default: false)
531+
:arg ignore_unavailable: Whether specified concrete indices should be
532+
ignored when unavailable (missing or closed)
533+
:arg master_timeout: Specify timeout for connection to master
522534
"""
523535
_, data = self.transport.perform_request('PUT', _make_path(index, '_settings'),
524536
params=params, body=body)
525537
return data
526538

527-
@query_params('master_timeout')
539+
@query_params('allow_no_indices', 'expand_wildcards', 'ignore_unavailable',
540+
'master_timeout')
528541
def put_warmer(self, name, body, index=None, doc_type=None, params=None):
529542
"""
530543
Create an index warmer to run registered search requests to warm up the
531544
index before it is available for search.
532545
`<http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/indices-warmers.html>`_
533546
534-
:arg index: A comma-separated list of index names to register the warmer for;
535-
use `_all` or empty string to perform the operation on all indices
536547
:arg name: The name of the warmer
548+
:arg body: The search request definition for the warmer (query, filters,
549+
facets, sorting, etc)
550+
:arg index: A comma-separated list of index names to register the warmer
551+
for; use `_all` or omit to perform the operation on all indices
537552
:arg doc_type: A comma-separated list of document types to register the
538553
warmer for; leave empty to perform the operation on all types
539-
:arg body: The search request definition for the warmer (query, filters, facets, sorting, etc)
554+
:arg allow_no_indices: Whether to ignore if a wildcard indices
555+
expression resolves into no concrete indices in the search request
556+
to warm. (This includes `_all` string or when no indices have been
557+
specified)
558+
:arg expand_wildcards: Whether to expand wildcard expression to concrete
559+
indices that are open, closed or both, in the search request to
560+
warm., default u'open'
561+
:arg ignore_unavailable: Whether specified concrete indices should be
562+
ignored when unavailable (missing or closed) in the search request
563+
to warm
540564
:arg master_timeout: Specify timeout for connection to master
541565
"""
542566
if doc_type and not index:
@@ -545,7 +569,8 @@ def put_warmer(self, name, body, index=None, doc_type=None, params=None):
545569
params=params, body=body)
546570
return data
547571

548-
@query_params('local')
572+
@query_params('allow_no_indices', 'expand_wildcards', 'ignore_unavailable',
573+
'local')
549574
def get_warmer(self, index=None, doc_type=None, name=None, params=None):
550575
"""
551576
Retreieve an index warmer.
@@ -555,7 +580,15 @@ def get_warmer(self, index=None, doc_type=None, name=None, params=None):
555580
operation; use `_all` to perform the operation on all indices
556581
:arg doc_type: A comma-separated list of document types to restrict the
557582
operation; leave empty to perform the operation on all types
558-
:arg name: The name of the warmer (supports wildcards); leave empty to get all warmers
583+
:arg name: The name of the warmer (supports wildcards); leave empty to
584+
get all warmers
585+
:arg allow_no_indices: Whether to ignore if a wildcard indices
586+
expression resolves into no concrete indices. (This includes `_all`
587+
string or when no indices have been specified)
588+
:arg expand_wildcards: Whether to expand wildcard expression to concrete
589+
indices that are open, closed or both., default u'open'
590+
:arg ignore_unavailable: Whether specified concrete indices should be
591+
ignored when unavailable (missing or closed)
559592
:arg local: Return local information, do not retrieve the state from
560593
master node (default: false)
561594
"""

elasticsearch/client/snapshot.py

+13-1
Original file line numberDiff line numberDiff line change
@@ -113,5 +113,17 @@ def restore(self, repository, snapshot, body=None, params=None):
113113
_, data = self.transport.perform_request('POST', _make_path('_snapshot',
114114
repository, snapshot, '_restore'), params=params, body=body)
115115
return data
116-
117116

117+
@query_params('master_timeout')
118+
def status(self, repository=None, snapshot=None, params=None):
119+
"""
120+
`<http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/modules-snapshots.html>`_
121+
122+
:arg repository: A repository name
123+
:arg snapshot: A comma-separated list of snapshot names
124+
:arg master_timeout: Explicit operation timeout for connection to master
125+
node
126+
"""
127+
_, data = self.transport.perform_request('GET', _make_path('_snapshot',
128+
repository, snapshot, '_status'), params=params)
129+
return data

0 commit comments

Comments
 (0)