Skip to content

Commit 2aab285

Browse files
jubinsfxdgear
authored andcommitted
Fixed illegal argument exception in indices.py as request_timeout is expected instead of timeout. (#937)
The `timeout` parameter in docstring is misleading for following methods in elasticsearch.client.indices.py, renamed this param in query_params decorator and docstring to `request_timeout`: 1. create 2. open 3. close 4. delete 5. put_mapping 6. put_alias 7. update_aliases 8. delete_alias 9. put_template 10. delete_template 11. shrink 12. rollover
1 parent 45db46c commit 2aab285

File tree

1 file changed

+24
-24
lines changed

1 file changed

+24
-24
lines changed

elasticsearch/client/indices.py

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ def flush(self, index=None, params=None):
7979
)
8080

8181
@query_params(
82-
"master_timeout", "timeout", "wait_for_active_shards", "include_type_name"
82+
"master_timeout", "request_timeout", "wait_for_active_shards", "include_type_name"
8383
)
8484
def create(self, index, body=None, params=None):
8585
"""
@@ -89,7 +89,7 @@ def create(self, index, body=None, params=None):
8989
:arg index: The name of the index
9090
:arg body: The configuration for the index (`settings` and `mappings`)
9191
:arg master_timeout: Specify timeout for connection to master
92-
:arg timeout: Explicit operation timeout
92+
:arg request_timeout: Explicit operation timeout
9393
:arg wait_for_active_shards: Set the number of active shards to wait for
9494
before the operation returns.
9595
:arg include_type_name: Specify whether requests and responses should include a
@@ -141,7 +141,7 @@ def get(self, index, feature=None, params=None):
141141
"expand_wildcards",
142142
"ignore_unavailable",
143143
"master_timeout",
144-
"timeout",
144+
"request_timeout",
145145
)
146146
def open(self, index, params=None):
147147
"""
@@ -158,7 +158,7 @@ def open(self, index, params=None):
158158
:arg ignore_unavailable: Whether specified concrete indices should be
159159
ignored when unavailable (missing or closed)
160160
:arg master_timeout: Specify timeout for connection to master
161-
:arg timeout: Explicit operation timeout
161+
:arg request_timeout: Explicit operation timeout
162162
"""
163163
if index in SKIP_IN_PATH:
164164
raise ValueError("Empty value passed for a required argument 'index'.")
@@ -171,7 +171,7 @@ def open(self, index, params=None):
171171
"expand_wildcards",
172172
"ignore_unavailable",
173173
"master_timeout",
174-
"timeout",
174+
"request_timeout",
175175
)
176176
def close(self, index, params=None):
177177
"""
@@ -189,7 +189,7 @@ def close(self, index, params=None):
189189
:arg ignore_unavailable: Whether specified concrete indices should be
190190
ignored when unavailable (missing or closed)
191191
:arg master_timeout: Specify timeout for connection to master
192-
:arg timeout: Explicit operation timeout
192+
:arg request_timeout: Explicit operation timeout
193193
"""
194194
if index in SKIP_IN_PATH:
195195
raise ValueError("Empty value passed for a required argument 'index'.")
@@ -202,7 +202,7 @@ def close(self, index, params=None):
202202
"expand_wildcards",
203203
"ignore_unavailable",
204204
"master_timeout",
205-
"timeout",
205+
"request_timeout",
206206
)
207207
def delete(self, index, params=None):
208208
"""
@@ -218,7 +218,7 @@ def delete(self, index, params=None):
218218
choices are: 'open', 'closed', 'none', 'all'
219219
:arg ignore_unavailable: Ignore unavailable indexes (default: false)
220220
:arg master_timeout: Specify timeout for connection to master
221-
:arg timeout: Explicit operation timeout
221+
:arg request_timeout: Explicit operation timeout
222222
"""
223223
if index in SKIP_IN_PATH:
224224
raise ValueError("Empty value passed for a required argument 'index'.")
@@ -288,7 +288,7 @@ def exists_type(self, index, doc_type, params=None):
288288
"expand_wildcards",
289289
"ignore_unavailable",
290290
"master_timeout",
291-
"timeout",
291+
"request_timeout",
292292
"include_type_name",
293293
)
294294
def put_mapping(self, body, doc_type=None, index=None, params=None):
@@ -310,7 +310,7 @@ def put_mapping(self, body, doc_type=None, index=None, params=None):
310310
:arg ignore_unavailable: Whether specified concrete indices should be
311311
ignored when unavailable (missing or closed)
312312
:arg master_timeout: Specify timeout for connection to master
313-
:arg timeout: Explicit operation timeout
313+
:arg request_timeout: Explicit operation timeout
314314
:arg include_type_name: Specify whether requests and responses should include a
315315
type name (default: depends on Elasticsearch version).
316316
"""
@@ -391,7 +391,7 @@ def get_field_mapping(self, fields, index=None, doc_type=None, params=None):
391391
params=params,
392392
)
393393

394-
@query_params("master_timeout", "timeout")
394+
@query_params("master_timeout", "request_timeout")
395395
def put_alias(self, index, name, body=None, params=None):
396396
"""
397397
Create an alias for a specific index/indices.
@@ -403,7 +403,7 @@ def put_alias(self, index, name, body=None, params=None):
403403
:arg name: The name of the alias to be created or updated
404404
:arg body: The settings for the alias, such as `routing` or `filter`
405405
:arg master_timeout: Specify timeout for connection to master
406-
:arg timeout: Explicit timeout for the operation
406+
:arg request_timeout: Explicit timeout for the operation
407407
"""
408408
for param in (index, name):
409409
if param in SKIP_IN_PATH:
@@ -458,23 +458,23 @@ def get_alias(self, index=None, name=None, params=None):
458458
"GET", _make_path(index, "_alias", name), params=params
459459
)
460460

461-
@query_params("master_timeout", "timeout")
461+
@query_params("master_timeout", "request_timeout")
462462
def update_aliases(self, body, params=None):
463463
"""
464464
Update specified aliases.
465465
`<http://www.elastic.co/guide/en/elasticsearch/reference/current/indices-aliases.html>`_
466466
467467
:arg body: The definition of `actions` to perform
468468
:arg master_timeout: Specify timeout for connection to master
469-
:arg timeout: Request timeout
469+
:arg request_timeout: Request timeout
470470
"""
471471
if body in SKIP_IN_PATH:
472472
raise ValueError("Empty value passed for a required argument 'body'.")
473473
return self.transport.perform_request(
474474
"POST", "/_aliases", params=params, body=body
475475
)
476476

477-
@query_params("master_timeout", "timeout")
477+
@query_params("master_timeout", "request_timeout")
478478
def delete_alias(self, index, name, params=None):
479479
"""
480480
Delete specific alias.
@@ -486,7 +486,7 @@ def delete_alias(self, index, name, params=None):
486486
wildcards); use `_all` to delete all aliases for the specified
487487
indices.
488488
:arg master_timeout: Specify timeout for connection to master
489-
:arg timeout: Explicit timeout for the operation
489+
:arg request_timeout: Explicit timeout for the operation
490490
"""
491491
for param in (index, name):
492492
if param in SKIP_IN_PATH:
@@ -500,7 +500,7 @@ def delete_alias(self, index, name, params=None):
500500
"flat_settings",
501501
"master_timeout",
502502
"order",
503-
"timeout",
503+
"request_timeout",
504504
"include_type_name",
505505
)
506506
def put_template(self, name, body, params=None):
@@ -517,7 +517,7 @@ def put_template(self, name, body, params=None):
517517
:arg master_timeout: Specify timeout for connection to master
518518
:arg order: The order for this template when merging multiple matching
519519
ones (higher numbers are merged later, overriding the lower numbers)
520-
:arg timeout: Explicit operation timeout
520+
:arg request_timeout: Explicit operation timeout
521521
:arg include_type_name: Specify whether requests and responses should include a
522522
type name (default: depends on Elasticsearch version).
523523
"""
@@ -566,15 +566,15 @@ def get_template(self, name=None, params=None):
566566
"GET", _make_path("_template", name), params=params
567567
)
568568

569-
@query_params("master_timeout", "timeout")
569+
@query_params("master_timeout", "request_timeout")
570570
def delete_template(self, name, params=None):
571571
"""
572572
Delete an index template by its name.
573573
`<http://www.elastic.co/guide/en/elasticsearch/reference/current/indices-templates.html>`_
574574
575575
:arg name: The name of the template
576576
:arg master_timeout: Specify timeout for connection to master
577-
:arg timeout: Explicit operation timeout
577+
:arg request_timeout: Explicit operation timeout
578578
"""
579579
if name in SKIP_IN_PATH:
580580
raise ValueError("Empty value passed for a required argument 'name'.")
@@ -984,7 +984,7 @@ def forcemerge(self, index=None, params=None):
984984
"POST", _make_path(index, "_forcemerge"), params=params
985985
)
986986

987-
@query_params("master_timeout", "timeout", "wait_for_active_shards")
987+
@query_params("master_timeout", "request_timeout", "wait_for_active_shards")
988988
def shrink(self, index, target, body=None, params=None):
989989
"""
990990
The shrink index API allows you to shrink an existing index into a new
@@ -1003,7 +1003,7 @@ def shrink(self, index, target, body=None, params=None):
10031003
:arg body: The configuration for the target index (`settings` and
10041004
`aliases`)
10051005
:arg master_timeout: Specify timeout for connection to master
1006-
:arg timeout: Explicit operation timeout
1006+
:arg request_timeout: Explicit operation timeout
10071007
:arg wait_for_active_shards: Set the number of active shards to wait for
10081008
on the shrunken index before the operation returns.
10091009
"""
@@ -1017,7 +1017,7 @@ def shrink(self, index, target, body=None, params=None):
10171017
@query_params(
10181018
"dry_run",
10191019
"master_timeout",
1020-
"timeout",
1020+
"request_timeout",
10211021
"wait_for_active_shards",
10221022
"include_type_name",
10231023
)
@@ -1039,7 +1039,7 @@ def rollover(self, alias, new_index=None, body=None, params=None):
10391039
but not actually performed even if a condition matches. The default
10401040
is false
10411041
:arg master_timeout: Specify timeout for connection to master
1042-
:arg timeout: Explicit operation timeout
1042+
:arg request_timeout: Explicit operation timeout
10431043
:arg wait_for_active_shards: Set the number of active shards to wait for
10441044
on the newly created rollover index before the operation returns.
10451045
:arg include_type_name: Specify whether requests and responses should include a

0 commit comments

Comments
 (0)