Skip to content

Fixed illegal argument exception in indices.py as request_timeout is expected instead of timeout. #937

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 29, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 24 additions & 24 deletions elasticsearch/client/indices.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ def flush(self, index=None, params=None):
)

@query_params(
"master_timeout", "timeout", "wait_for_active_shards", "include_type_name"
"master_timeout", "request_timeout", "wait_for_active_shards", "include_type_name"
)
def create(self, index, body=None, params=None):
"""
Expand All @@ -89,7 +89,7 @@ def create(self, index, body=None, params=None):
:arg index: The name of the index
:arg body: The configuration for the index (`settings` and `mappings`)
:arg master_timeout: Specify timeout for connection to master
:arg timeout: Explicit operation timeout
:arg request_timeout: Explicit operation timeout
:arg wait_for_active_shards: Set the number of active shards to wait for
before the operation returns.
:arg include_type_name: Specify whether requests and responses should include a
Expand Down Expand Up @@ -141,7 +141,7 @@ def get(self, index, feature=None, params=None):
"expand_wildcards",
"ignore_unavailable",
"master_timeout",
"timeout",
"request_timeout",
)
def open(self, index, params=None):
"""
Expand All @@ -158,7 +158,7 @@ def open(self, index, params=None):
:arg ignore_unavailable: Whether specified concrete indices should be
ignored when unavailable (missing or closed)
:arg master_timeout: Specify timeout for connection to master
:arg timeout: Explicit operation timeout
:arg request_timeout: Explicit operation timeout
"""
if index in SKIP_IN_PATH:
raise ValueError("Empty value passed for a required argument 'index'.")
Expand All @@ -171,7 +171,7 @@ def open(self, index, params=None):
"expand_wildcards",
"ignore_unavailable",
"master_timeout",
"timeout",
"request_timeout",
)
def close(self, index, params=None):
"""
Expand All @@ -189,7 +189,7 @@ def close(self, index, params=None):
:arg ignore_unavailable: Whether specified concrete indices should be
ignored when unavailable (missing or closed)
:arg master_timeout: Specify timeout for connection to master
:arg timeout: Explicit operation timeout
:arg request_timeout: Explicit operation timeout
"""
if index in SKIP_IN_PATH:
raise ValueError("Empty value passed for a required argument 'index'.")
Expand All @@ -202,7 +202,7 @@ def close(self, index, params=None):
"expand_wildcards",
"ignore_unavailable",
"master_timeout",
"timeout",
"request_timeout",
)
def delete(self, index, params=None):
"""
Expand All @@ -218,7 +218,7 @@ def delete(self, index, params=None):
choices are: 'open', 'closed', 'none', 'all'
:arg ignore_unavailable: Ignore unavailable indexes (default: false)
:arg master_timeout: Specify timeout for connection to master
:arg timeout: Explicit operation timeout
:arg request_timeout: Explicit operation timeout
"""
if index in SKIP_IN_PATH:
raise ValueError("Empty value passed for a required argument 'index'.")
Expand Down Expand Up @@ -288,7 +288,7 @@ def exists_type(self, index, doc_type, params=None):
"expand_wildcards",
"ignore_unavailable",
"master_timeout",
"timeout",
"request_timeout",
"include_type_name",
)
def put_mapping(self, body, doc_type=None, index=None, params=None):
Expand All @@ -310,7 +310,7 @@ def put_mapping(self, body, doc_type=None, index=None, params=None):
:arg ignore_unavailable: Whether specified concrete indices should be
ignored when unavailable (missing or closed)
:arg master_timeout: Specify timeout for connection to master
:arg timeout: Explicit operation timeout
:arg request_timeout: Explicit operation timeout
:arg include_type_name: Specify whether requests and responses should include a
type name (default: depends on Elasticsearch version).
"""
Expand Down Expand Up @@ -391,7 +391,7 @@ def get_field_mapping(self, fields, index=None, doc_type=None, params=None):
params=params,
)

@query_params("master_timeout", "timeout")
@query_params("master_timeout", "request_timeout")
def put_alias(self, index, name, body=None, params=None):
"""
Create an alias for a specific index/indices.
Expand All @@ -403,7 +403,7 @@ def put_alias(self, index, name, body=None, params=None):
:arg name: The name of the alias to be created or updated
:arg body: The settings for the alias, such as `routing` or `filter`
:arg master_timeout: Specify timeout for connection to master
:arg timeout: Explicit timeout for the operation
:arg request_timeout: Explicit timeout for the operation
"""
for param in (index, name):
if param in SKIP_IN_PATH:
Expand Down Expand Up @@ -458,23 +458,23 @@ def get_alias(self, index=None, name=None, params=None):
"GET", _make_path(index, "_alias", name), params=params
)

@query_params("master_timeout", "timeout")
@query_params("master_timeout", "request_timeout")
def update_aliases(self, body, params=None):
"""
Update specified aliases.
`<http://www.elastic.co/guide/en/elasticsearch/reference/current/indices-aliases.html>`_

:arg body: The definition of `actions` to perform
:arg master_timeout: Specify timeout for connection to master
:arg timeout: Request timeout
:arg request_timeout: Request timeout
"""
if body in SKIP_IN_PATH:
raise ValueError("Empty value passed for a required argument 'body'.")
return self.transport.perform_request(
"POST", "/_aliases", params=params, body=body
)

@query_params("master_timeout", "timeout")
@query_params("master_timeout", "request_timeout")
def delete_alias(self, index, name, params=None):
"""
Delete specific alias.
Expand All @@ -486,7 +486,7 @@ def delete_alias(self, index, name, params=None):
wildcards); use `_all` to delete all aliases for the specified
indices.
:arg master_timeout: Specify timeout for connection to master
:arg timeout: Explicit timeout for the operation
:arg request_timeout: Explicit timeout for the operation
"""
for param in (index, name):
if param in SKIP_IN_PATH:
Expand All @@ -500,7 +500,7 @@ def delete_alias(self, index, name, params=None):
"flat_settings",
"master_timeout",
"order",
"timeout",
"request_timeout",
"include_type_name",
)
def put_template(self, name, body, params=None):
Expand All @@ -517,7 +517,7 @@ def put_template(self, name, body, params=None):
:arg master_timeout: Specify timeout for connection to master
:arg order: The order for this template when merging multiple matching
ones (higher numbers are merged later, overriding the lower numbers)
:arg timeout: Explicit operation timeout
:arg request_timeout: Explicit operation timeout
:arg include_type_name: Specify whether requests and responses should include a
type name (default: depends on Elasticsearch version).
"""
Expand Down Expand Up @@ -566,15 +566,15 @@ def get_template(self, name=None, params=None):
"GET", _make_path("_template", name), params=params
)

@query_params("master_timeout", "timeout")
@query_params("master_timeout", "request_timeout")
def delete_template(self, name, params=None):
"""
Delete an index template by its name.
`<http://www.elastic.co/guide/en/elasticsearch/reference/current/indices-templates.html>`_

:arg name: The name of the template
:arg master_timeout: Specify timeout for connection to master
:arg timeout: Explicit operation timeout
:arg request_timeout: Explicit operation timeout
"""
if name in SKIP_IN_PATH:
raise ValueError("Empty value passed for a required argument 'name'.")
Expand Down Expand Up @@ -984,7 +984,7 @@ def forcemerge(self, index=None, params=None):
"POST", _make_path(index, "_forcemerge"), params=params
)

@query_params("master_timeout", "timeout", "wait_for_active_shards")
@query_params("master_timeout", "request_timeout", "wait_for_active_shards")
def shrink(self, index, target, body=None, params=None):
"""
The shrink index API allows you to shrink an existing index into a new
Expand All @@ -1003,7 +1003,7 @@ def shrink(self, index, target, body=None, params=None):
:arg body: The configuration for the target index (`settings` and
`aliases`)
:arg master_timeout: Specify timeout for connection to master
:arg timeout: Explicit operation timeout
:arg request_timeout: Explicit operation timeout
:arg wait_for_active_shards: Set the number of active shards to wait for
on the shrunken index before the operation returns.
"""
Expand All @@ -1017,7 +1017,7 @@ def shrink(self, index, target, body=None, params=None):
@query_params(
"dry_run",
"master_timeout",
"timeout",
"request_timeout",
"wait_for_active_shards",
"include_type_name",
)
Expand All @@ -1039,7 +1039,7 @@ def rollover(self, alias, new_index=None, body=None, params=None):
but not actually performed even if a condition matches. The default
is false
:arg master_timeout: Specify timeout for connection to master
:arg timeout: Explicit operation timeout
:arg request_timeout: Explicit operation timeout
:arg wait_for_active_shards: Set the number of active shards to wait for
on the newly created rollover index before the operation returns.
:arg include_type_name: Specify whether requests and responses should include a
Expand Down