diff --git a/elasticsearch/client/indices.py b/elasticsearch/client/indices.py index 6b9481c1..c93b32e5 100644 --- a/elasticsearch/client/indices.py +++ b/elasticsearch/client/indices.py @@ -1143,3 +1143,68 @@ class IndicesClient(NamespacedClient): return self.transport.perform_request( "POST", _make_path(alias, "_rollover", new_index), params=params, body=body ) + + # X-pack APIS + @query_params( + "allow_no_indices", + "expand_wildcards", + "ignore_unavailable", + "master_timeout", + "timeout", + "wait_for_active_shards", + ) + def freeze(self, index, params=None): + """ + ``_ + + :arg index: The name of the index to freeze + :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 'closed', valid + choices are: 'open', 'closed', 'none', 'all' + :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 wait_for_active_shards: Sets the number of active shards to wait + for before the operation returns. + """ + if index in SKIP_IN_PATH: + raise ValueError("Empty value passed for a required argument 'index'.") + return self.transport.perform_request( + "POST", _make_path(index, "_freeze"), params=params + ) + + @query_params( + "allow_no_indices", + "expand_wildcards", + "ignore_unavailable", + "master_timeout", + "timeout", + "wait_for_active_shards", + ) + def unfreeze(self, index, params=None): + """ + ``_ + + :arg index: The name of the index to unfreeze + :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 'closed', valid + choices are: 'open', 'closed', 'none', 'all' + :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 wait_for_active_shards: Sets the number of active shards to wait + for before the operation returns. + """ + if index in SKIP_IN_PATH: + raise ValueError("Empty value passed for a required argument 'index'.") + return self.transport.perform_request( + "POST", _make_path(index, "_unfreeze"), params=params + ) diff --git a/elasticsearch/client/xpack/__init__.py b/elasticsearch/client/xpack/__init__.py index b0c550ed..12d6f093 100644 --- a/elasticsearch/client/xpack/__init__.py +++ b/elasticsearch/client/xpack/__init__.py @@ -5,7 +5,7 @@ from .data_frame import Data_FrameClient from .deprecation import DeprecationClient from .graph import GraphClient from .ilm import IlmClient -from .indices import IndicesClient +from ..indices import IndicesClient from .license import LicenseClient from .migration import MigrationClient from .ml import MlClient diff --git a/elasticsearch/client/xpack/indices.py b/elasticsearch/client/xpack/indices.py deleted file mode 100644 index c4e48807..00000000 --- a/elasticsearch/client/xpack/indices.py +++ /dev/null @@ -1,67 +0,0 @@ -from ..utils import NamespacedClient, query_params, _make_path, SKIP_IN_PATH - - -class IndicesClient(NamespacedClient): - @query_params( - "allow_no_indices", - "expand_wildcards", - "ignore_unavailable", - "master_timeout", - "timeout", - "wait_for_active_shards", - ) - def freeze(self, index, params=None): - """ - ``_ - - :arg index: The name of the index to freeze - :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 'closed', valid - choices are: 'open', 'closed', 'none', 'all' - :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 wait_for_active_shards: Sets the number of active shards to wait - for before the operation returns. - """ - if index in SKIP_IN_PATH: - raise ValueError("Empty value passed for a required argument 'index'.") - return self.transport.perform_request( - "POST", _make_path(index, "_freeze"), params=params - ) - - @query_params( - "allow_no_indices", - "expand_wildcards", - "ignore_unavailable", - "master_timeout", - "timeout", - "wait_for_active_shards", - ) - def unfreeze(self, index, params=None): - """ - ``_ - - :arg index: The name of the index to unfreeze - :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 'closed', valid - choices are: 'open', 'closed', 'none', 'all' - :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 wait_for_active_shards: Sets the number of active shards to wait - for before the operation returns. - """ - if index in SKIP_IN_PATH: - raise ValueError("Empty value passed for a required argument 'index'.") - return self.transport.perform_request( - "POST", _make_path(index, "_unfreeze"), params=params - )