Skip to content

Commit 8542410

Browse files
committed
merge indices and xpack.indices
1 parent 5c3ff5a commit 8542410

File tree

3 files changed

+66
-68
lines changed

3 files changed

+66
-68
lines changed

elasticsearch/client/indices.py

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1143,3 +1143,68 @@ def rollover(self, alias, new_index=None, body=None, params=None):
11431143
return self.transport.perform_request(
11441144
"POST", _make_path(alias, "_rollover", new_index), params=params, body=body
11451145
)
1146+
1147+
# X-pack APIS
1148+
@query_params(
1149+
"allow_no_indices",
1150+
"expand_wildcards",
1151+
"ignore_unavailable",
1152+
"master_timeout",
1153+
"timeout",
1154+
"wait_for_active_shards",
1155+
)
1156+
def freeze(self, index, params=None):
1157+
"""
1158+
`<https://www.elastic.co/guide/en/elasticsearch/reference/current/frozen.html>`_
1159+
1160+
:arg index: The name of the index to freeze
1161+
:arg allow_no_indices: Whether to ignore if a wildcard indices
1162+
expression resolves into no concrete indices. (This includes `_all`
1163+
string or when no indices have been specified)
1164+
:arg expand_wildcards: Whether to expand wildcard expression to concrete
1165+
indices that are open, closed or both., default 'closed', valid
1166+
choices are: 'open', 'closed', 'none', 'all'
1167+
:arg ignore_unavailable: Whether specified concrete indices should be
1168+
ignored when unavailable (missing or closed)
1169+
:arg master_timeout: Specify timeout for connection to master
1170+
:arg timeout: Explicit operation timeout
1171+
:arg wait_for_active_shards: Sets the number of active shards to wait
1172+
for before the operation returns.
1173+
"""
1174+
if index in SKIP_IN_PATH:
1175+
raise ValueError("Empty value passed for a required argument 'index'.")
1176+
return self.transport.perform_request(
1177+
"POST", _make_path(index, "_freeze"), params=params
1178+
)
1179+
1180+
@query_params(
1181+
"allow_no_indices",
1182+
"expand_wildcards",
1183+
"ignore_unavailable",
1184+
"master_timeout",
1185+
"timeout",
1186+
"wait_for_active_shards",
1187+
)
1188+
def unfreeze(self, index, params=None):
1189+
"""
1190+
`<https://www.elastic.co/guide/en/elasticsearch/reference/current/frozen.html>`_
1191+
1192+
:arg index: The name of the index to unfreeze
1193+
:arg allow_no_indices: Whether to ignore if a wildcard indices
1194+
expression resolves into no concrete indices. (This includes `_all`
1195+
string or when no indices have been specified)
1196+
:arg expand_wildcards: Whether to expand wildcard expression to concrete
1197+
indices that are open, closed or both., default 'closed', valid
1198+
choices are: 'open', 'closed', 'none', 'all'
1199+
:arg ignore_unavailable: Whether specified concrete indices should be
1200+
ignored when unavailable (missing or closed)
1201+
:arg master_timeout: Specify timeout for connection to master
1202+
:arg timeout: Explicit operation timeout
1203+
:arg wait_for_active_shards: Sets the number of active shards to wait
1204+
for before the operation returns.
1205+
"""
1206+
if index in SKIP_IN_PATH:
1207+
raise ValueError("Empty value passed for a required argument 'index'.")
1208+
return self.transport.perform_request(
1209+
"POST", _make_path(index, "_unfreeze"), params=params
1210+
)

elasticsearch/client/xpack/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
from .deprecation import DeprecationClient
66
from .graph import GraphClient
77
from .ilm import IlmClient
8-
from .indices import IndicesClient
8+
from ..indices import IndicesClient
99
from .license import LicenseClient
1010
from .migration import MigrationClient
1111
from .ml import MlClient

elasticsearch/client/xpack/indices.py

Lines changed: 0 additions & 67 deletions
This file was deleted.

0 commit comments

Comments
 (0)