merge indices and xpack.indices

This commit is contained in:
Honza Král
2019-10-30 19:06:39 +01:00
parent 5c3ff5a718
commit 8542410c3c
3 changed files with 66 additions and 68 deletions
+65
View File
@@ -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):
"""
`<https://www.elastic.co/guide/en/elasticsearch/reference/current/frozen.html>`_
: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):
"""
`<https://www.elastic.co/guide/en/elasticsearch/reference/current/frozen.html>`_
: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
)
+1 -1
View File
@@ -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
-67
View File
@@ -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):
"""
`<https://www.elastic.co/guide/en/elasticsearch/reference/current/frozen.html>`_
: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):
"""
`<https://www.elastic.co/guide/en/elasticsearch/reference/current/frozen.html>`_
: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
)