Skip to content

Commit cd8aaf2

Browse files
committed
5.0 compatibility
1 parent ca2dd24 commit cd8aaf2

File tree

7 files changed

+133
-85
lines changed

7 files changed

+133
-85
lines changed

elasticsearch/client/__init__.py

Lines changed: 110 additions & 59 deletions
Large diffs are not rendered by default.

elasticsearch/client/cat.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,8 @@ def help(self, params=None):
9090
"""
9191
return self.transport.perform_request('GET', '/_cat', params=params)
9292

93-
@query_params('bytes', 'h', 'help', 'local', 'master_timeout', 'pri', 'v')
93+
@query_params('bytes', 'format', 'h', 'health', 'help', 'local',
94+
'master_timeout', 'pri', 'v')
9495
def indices(self, index=None, params=None):
9596
"""
9697
The indices command provides a cross-section of each index.
@@ -101,6 +102,9 @@ def indices(self, index=None, params=None):
101102
:arg bytes: The unit in which to display byte values, valid choices are:
102103
'b', 'k', 'm', 'g'
103104
:arg h: Comma-separated list of column names to display
105+
:arg health: A health status ("green", "yellow", or "red" to filter only
106+
indices matching the specified health status, default None, valid
107+
choices are: 'green', 'yellow', 'red'
104108
:arg help: Return help information, default False
105109
:arg local: Return local information, do not retrieve the state from
106110
master node (default: false)
@@ -312,7 +316,7 @@ def repositories(self, params=None):
312316
params=params)
313317

314318
@query_params('h', 'help', 'ignore_unavailable', 'master_timeout', 'v')
315-
def snapshots(self, repository, params=None):
319+
def snapshots(self, repository=None, params=None):
316320
"""
317321
`<http://www.elastic.co/guide/en/elasticsearch/reference/current/cat-snapshots.html>`_
318322
@@ -326,8 +330,6 @@ def snapshots(self, repository, params=None):
326330
node
327331
:arg v: Verbose mode. Display column headers, default False
328332
"""
329-
if repository in SKIP_IN_PATH:
330-
raise ValueError("Empty value passed for a required argument 'repository'.")
331333
return self.transport.perform_request('GET', _make_path('_cat',
332334
'snapshots', repository), params=params)
333335

elasticsearch/client/cluster.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22

33
class ClusterClient(NamespacedClient):
44
@query_params('level', 'local', 'master_timeout', 'timeout',
5-
'wait_for_active_shards', 'wait_for_events', 'wait_for_nodes',
6-
'wait_for_relocating_shards', 'wait_for_status')
5+
'wait_for_active_shards', 'wait_for_events',
6+
'wait_for_no_relocating_shards', 'wait_for_nodes', 'wait_for_status')
77
def health(self, index=None, params=None):
88
"""
99
Get a very simple status on the health of the cluster.
@@ -22,10 +22,10 @@ def health(self, index=None, params=None):
2222
:arg wait_for_events: Wait until all currently queued events with the
2323
given priorty are processed, valid choices are: 'immediate',
2424
'urgent', 'high', 'normal', 'low', 'languid'
25+
:arg wait_for_no_relocating_shards: Whether to wait until there are no
26+
relocating shards in the cluster
2527
:arg wait_for_nodes: Wait until the specified number of nodes is
2628
available
27-
:arg wait_for_relocating_shards: Wait until the specified number of
28-
relocating shards is finished
2929
:arg wait_for_status: Wait until cluster is in a specific state, default
3030
None, valid choices are: 'green', 'yellow', 'red'
3131
"""

elasticsearch/client/indices.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ def analyze(self, index=None, body=None, params=None):
1313
:arg analyzer: The name of the analyzer to use
1414
:arg attributes: A comma-separated list of token attributes to output,
1515
this parameter works only with `explain=true`
16-
:arg char_filter: A comma-separated list of character filters to use
17-
for the analysis
16+
:arg char_filter: A comma-separated list of character filters to use for
17+
the analysis
1818
:arg explain: With `true`, outputs more advanced details. (default:
1919
false)
2020
:arg field: Use the analyzer configured for this field (instead of
@@ -79,9 +79,8 @@ def flush(self, index=None, params=None):
7979
ignored when unavailable (missing or closed)
8080
:arg wait_if_ongoing: If set to true the flush operation will block
8181
until the flush can be executed if another flush operation is
82-
already executing. The default is false and will cause an exception
83-
to be thrown on the shard level if another flush operation is
84-
already running.
82+
already executing. The default is true. If set to false the flush
83+
will be skipped iff if another flush operation is already running.
8584
"""
8685
return self.transport.perform_request('POST', _make_path(index,
8786
'_flush'), params=params)

elasticsearch/client/ingest.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,14 @@
22

33
class IngestClient(NamespacedClient):
44
@query_params('master_timeout')
5-
def get_pipeline(self, id, params=None):
5+
def get_pipeline(self, id=None, params=None):
66
"""
77
`<https://www.elastic.co/guide/en/elasticsearch/plugins/current/ingest.html>`_
88
99
:arg id: Comma separated list of pipeline ids. Wildcards supported
1010
:arg master_timeout: Explicit operation timeout for connection to master
1111
node
1212
"""
13-
if id in SKIP_IN_PATH:
14-
raise ValueError("Empty value passed for a required argument 'id'.")
1513
return self.transport.perform_request('GET', _make_path('_ingest',
1614
'pipeline', id), params=params)
1715

elasticsearch/client/snapshot.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,14 +38,16 @@ def delete(self, repository, snapshot, params=None):
3838
return self.transport.perform_request('DELETE',
3939
_make_path('_snapshot', repository, snapshot), params=params)
4040

41-
@query_params('master_timeout')
41+
@query_params('ignore_unavailable', 'master_timeout')
4242
def get(self, repository, snapshot, params=None):
4343
"""
4444
Retrieve information about a snapshot.
4545
`<http://www.elastic.co/guide/en/elasticsearch/reference/current/modules-snapshots.html>`_
4646
4747
:arg repository: A repository name
4848
:arg snapshot: A comma-separated list of snapshot names
49+
:arg ignore_unavailable: Whether to ignore unavailable snapshots,
50+
defaults to false which means a SnapshotMissingException is thrown
4951
:arg master_timeout: Explicit operation timeout for connection to master
5052
node
5153
"""
@@ -125,7 +127,7 @@ def restore(self, repository, snapshot, body=None, params=None):
125127
return self.transport.perform_request('POST', _make_path('_snapshot',
126128
repository, snapshot, '_restore'), params=params, body=body)
127129

128-
@query_params('master_timeout')
130+
@query_params('ignore_unavailable', 'master_timeout')
129131
def status(self, repository=None, snapshot=None, params=None):
130132
"""
131133
Return information about all currently running snapshots. By specifying
@@ -135,6 +137,8 @@ def status(self, repository=None, snapshot=None, params=None):
135137
136138
:arg repository: A repository name
137139
:arg snapshot: A comma-separated list of snapshot names
140+
:arg ignore_unavailable: Whether to ignore unavailable snapshots,
141+
defaults to false which means a SnapshotMissingException is thrown
138142
:arg master_timeout: Explicit operation timeout for connection to master
139143
node
140144
"""

test_elasticsearch/test_server/test_helpers.py

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -285,11 +285,8 @@ def test_children_are_reindexed_correctly(self):
285285
q = self.client.get(
286286
index='real-index',
287287
doc_type='question',
288-
id=42,
289-
fields=['_source']
288+
id=42
290289
)
291-
if 'fields' in q:
292-
q.update(q.pop('fields'))
293290
self.assertEquals(
294291
{
295292
'_id': '42',
@@ -304,11 +301,8 @@ def test_children_are_reindexed_correctly(self):
304301
index='test-index',
305302
doc_type='answer',
306303
id=47,
307-
parent=42,
308-
fields=['_source', '_parent']
304+
parent=42
309305
)
310-
if 'fields' in q:
311-
q.update(q.pop('fields'))
312306
if '_routing' in q:
313307
self.assertEquals(q.pop('_routing'), '42')
314308
self.assertEquals(

0 commit comments

Comments
 (0)