elasticsearch 8.17.1__py3-none-any.whl → 9.0.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- elasticsearch/__init__.py +2 -2
- elasticsearch/_async/client/__init__.py +2125 -1053
- elasticsearch/_async/client/_base.py +1 -2
- elasticsearch/_async/client/async_search.py +46 -35
- elasticsearch/_async/client/autoscaling.py +32 -26
- elasticsearch/_async/client/cat.py +244 -176
- elasticsearch/_async/client/ccr.py +268 -128
- elasticsearch/_async/client/cluster.py +191 -164
- elasticsearch/_async/client/connector.py +226 -116
- elasticsearch/_async/client/dangling_indices.py +22 -16
- elasticsearch/_async/client/enrich.py +51 -11
- elasticsearch/_async/client/eql.py +54 -13
- elasticsearch/_async/client/esql.py +351 -7
- elasticsearch/_async/client/features.py +37 -27
- elasticsearch/_async/client/fleet.py +32 -22
- elasticsearch/_async/client/graph.py +10 -9
- elasticsearch/_async/client/ilm.py +115 -77
- elasticsearch/_async/client/indices.py +1119 -772
- elasticsearch/_async/client/inference.py +1933 -84
- elasticsearch/_async/client/ingest.py +83 -50
- elasticsearch/_async/client/license.py +90 -38
- elasticsearch/_async/client/logstash.py +20 -9
- elasticsearch/_async/client/migration.py +26 -17
- elasticsearch/_async/client/ml.py +646 -374
- elasticsearch/_async/client/monitoring.py +6 -3
- elasticsearch/_async/client/nodes.py +52 -54
- elasticsearch/_async/client/query_rules.py +59 -33
- elasticsearch/_async/client/rollup.py +124 -86
- elasticsearch/_async/client/search_application.py +60 -32
- elasticsearch/_async/client/searchable_snapshots.py +25 -12
- elasticsearch/_async/client/security.py +903 -562
- elasticsearch/_async/client/shutdown.py +34 -36
- elasticsearch/_async/client/simulate.py +22 -28
- elasticsearch/_async/client/slm.py +65 -40
- elasticsearch/_async/client/snapshot.py +454 -327
- elasticsearch/_async/client/sql.py +43 -22
- elasticsearch/_async/client/ssl.py +17 -18
- elasticsearch/_async/client/synonyms.py +58 -37
- elasticsearch/_async/client/tasks.py +77 -48
- elasticsearch/_async/client/text_structure.py +65 -56
- elasticsearch/_async/client/transform.py +124 -93
- elasticsearch/_async/client/watcher.py +117 -73
- elasticsearch/_async/client/xpack.py +18 -9
- elasticsearch/_async/helpers.py +1 -2
- elasticsearch/_sync/client/__init__.py +2125 -1053
- elasticsearch/_sync/client/_base.py +1 -2
- elasticsearch/_sync/client/async_search.py +46 -35
- elasticsearch/_sync/client/autoscaling.py +32 -26
- elasticsearch/_sync/client/cat.py +244 -176
- elasticsearch/_sync/client/ccr.py +268 -128
- elasticsearch/_sync/client/cluster.py +191 -164
- elasticsearch/_sync/client/connector.py +226 -116
- elasticsearch/_sync/client/dangling_indices.py +22 -16
- elasticsearch/_sync/client/enrich.py +51 -11
- elasticsearch/_sync/client/eql.py +54 -13
- elasticsearch/_sync/client/esql.py +351 -7
- elasticsearch/_sync/client/features.py +37 -27
- elasticsearch/_sync/client/fleet.py +32 -22
- elasticsearch/_sync/client/graph.py +10 -9
- elasticsearch/_sync/client/ilm.py +115 -77
- elasticsearch/_sync/client/indices.py +1119 -772
- elasticsearch/_sync/client/inference.py +1933 -84
- elasticsearch/_sync/client/ingest.py +83 -50
- elasticsearch/_sync/client/license.py +90 -38
- elasticsearch/_sync/client/logstash.py +20 -9
- elasticsearch/_sync/client/migration.py +26 -17
- elasticsearch/_sync/client/ml.py +646 -374
- elasticsearch/_sync/client/monitoring.py +6 -3
- elasticsearch/_sync/client/nodes.py +52 -54
- elasticsearch/_sync/client/query_rules.py +59 -33
- elasticsearch/_sync/client/rollup.py +124 -86
- elasticsearch/_sync/client/search_application.py +60 -32
- elasticsearch/_sync/client/searchable_snapshots.py +25 -12
- elasticsearch/_sync/client/security.py +903 -562
- elasticsearch/_sync/client/shutdown.py +34 -36
- elasticsearch/_sync/client/simulate.py +22 -28
- elasticsearch/_sync/client/slm.py +65 -40
- elasticsearch/_sync/client/snapshot.py +454 -327
- elasticsearch/_sync/client/sql.py +43 -22
- elasticsearch/_sync/client/ssl.py +17 -18
- elasticsearch/_sync/client/synonyms.py +58 -37
- elasticsearch/_sync/client/tasks.py +77 -48
- elasticsearch/_sync/client/text_structure.py +65 -56
- elasticsearch/_sync/client/transform.py +124 -93
- elasticsearch/_sync/client/utils.py +1 -41
- elasticsearch/_sync/client/watcher.py +117 -73
- elasticsearch/_sync/client/xpack.py +18 -9
- elasticsearch/_version.py +1 -1
- elasticsearch/client.py +2 -0
- elasticsearch/dsl/__init__.py +203 -0
- elasticsearch/dsl/_async/__init__.py +16 -0
- elasticsearch/dsl/_async/document.py +522 -0
- elasticsearch/dsl/_async/faceted_search.py +50 -0
- elasticsearch/dsl/_async/index.py +639 -0
- elasticsearch/dsl/_async/mapping.py +49 -0
- elasticsearch/dsl/_async/search.py +237 -0
- elasticsearch/dsl/_async/update_by_query.py +47 -0
- elasticsearch/dsl/_sync/__init__.py +16 -0
- elasticsearch/dsl/_sync/document.py +514 -0
- elasticsearch/dsl/_sync/faceted_search.py +50 -0
- elasticsearch/dsl/_sync/index.py +597 -0
- elasticsearch/dsl/_sync/mapping.py +49 -0
- elasticsearch/dsl/_sync/search.py +230 -0
- elasticsearch/dsl/_sync/update_by_query.py +45 -0
- elasticsearch/dsl/aggs.py +3734 -0
- elasticsearch/dsl/analysis.py +341 -0
- elasticsearch/dsl/async_connections.py +37 -0
- elasticsearch/dsl/connections.py +142 -0
- elasticsearch/dsl/document.py +20 -0
- elasticsearch/dsl/document_base.py +444 -0
- elasticsearch/dsl/exceptions.py +32 -0
- elasticsearch/dsl/faceted_search.py +28 -0
- elasticsearch/dsl/faceted_search_base.py +489 -0
- elasticsearch/dsl/field.py +4392 -0
- elasticsearch/dsl/function.py +180 -0
- elasticsearch/dsl/index.py +23 -0
- elasticsearch/dsl/index_base.py +178 -0
- elasticsearch/dsl/mapping.py +19 -0
- elasticsearch/dsl/mapping_base.py +219 -0
- elasticsearch/dsl/query.py +2822 -0
- elasticsearch/dsl/response/__init__.py +388 -0
- elasticsearch/dsl/response/aggs.py +100 -0
- elasticsearch/dsl/response/hit.py +53 -0
- elasticsearch/dsl/search.py +20 -0
- elasticsearch/dsl/search_base.py +1053 -0
- elasticsearch/dsl/serializer.py +34 -0
- elasticsearch/dsl/types.py +6453 -0
- elasticsearch/dsl/update_by_query.py +19 -0
- elasticsearch/dsl/update_by_query_base.py +149 -0
- elasticsearch/dsl/utils.py +687 -0
- elasticsearch/dsl/wrappers.py +144 -0
- elasticsearch/helpers/actions.py +1 -1
- elasticsearch/helpers/vectorstore/_async/strategies.py +12 -12
- elasticsearch/helpers/vectorstore/_sync/strategies.py +12 -12
- elasticsearch/helpers/vectorstore/_sync/vectorstore.py +4 -1
- {elasticsearch-8.17.1.dist-info → elasticsearch-9.0.0.dist-info}/METADATA +12 -15
- elasticsearch-9.0.0.dist-info/RECORD +160 -0
- elasticsearch/transport.py +0 -57
- elasticsearch-8.17.1.dist-info/RECORD +0 -119
- {elasticsearch-8.17.1.dist-info → elasticsearch-9.0.0.dist-info}/WHEEL +0 -0
- {elasticsearch-8.17.1.dist-info → elasticsearch-9.0.0.dist-info}/licenses/LICENSE +0 -0
- {elasticsearch-8.17.1.dist-info → elasticsearch-9.0.0.dist-info}/licenses/NOTICE +0 -0
|
@@ -55,22 +55,42 @@ class IndicesClient(NamespacedClient):
|
|
|
55
55
|
timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None,
|
|
56
56
|
) -> ObjectApiResponse[t.Any]:
|
|
57
57
|
"""
|
|
58
|
-
|
|
59
|
-
operation types.
|
|
58
|
+
.. raw:: html
|
|
60
59
|
|
|
61
|
-
|
|
60
|
+
<p>Add an index block.</p>
|
|
61
|
+
<p>Add an index block to an index.
|
|
62
|
+
Index blocks limit the operations allowed on an index by blocking specific operation types.</p>
|
|
62
63
|
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
:param
|
|
73
|
-
:param
|
|
64
|
+
|
|
65
|
+
`<https://www.elastic.co/docs/api/doc/elasticsearch/v9/operation/operation-indices-add-block>`_
|
|
66
|
+
|
|
67
|
+
:param index: A comma-separated list or wildcard expression of index names used
|
|
68
|
+
to limit the request. By default, you must explicitly name the indices you
|
|
69
|
+
are adding blocks to. To allow the adding of blocks to indices with `_all`,
|
|
70
|
+
`*`, or other wildcard expressions, change the `action.destructive_requires_name`
|
|
71
|
+
setting to `false`. You can update this setting in the `elasticsearch.yml`
|
|
72
|
+
file or by using the cluster update settings API.
|
|
73
|
+
:param block: The block type to add to the index.
|
|
74
|
+
:param allow_no_indices: If `false`, the request returns an error if any wildcard
|
|
75
|
+
expression, index alias, or `_all` value targets only missing or closed indices.
|
|
76
|
+
This behavior applies even if the request targets other open indices. For
|
|
77
|
+
example, a request targeting `foo*,bar*` returns an error if an index starts
|
|
78
|
+
with `foo` but no index starts with `bar`.
|
|
79
|
+
:param expand_wildcards: The type of index that wildcard patterns can match.
|
|
80
|
+
If the request can target data streams, this argument determines whether
|
|
81
|
+
wildcard expressions match hidden data streams. It supports comma-separated
|
|
82
|
+
values, such as `open,hidden`.
|
|
83
|
+
:param ignore_unavailable: If `false`, the request returns an error if it targets
|
|
84
|
+
a missing or closed index.
|
|
85
|
+
:param master_timeout: The period to wait for the master node. If the master
|
|
86
|
+
node is not available before the timeout expires, the request fails and returns
|
|
87
|
+
an error. It can also be set to `-1` to indicate that the request should
|
|
88
|
+
never timeout.
|
|
89
|
+
:param timeout: The period to wait for a response from all relevant nodes in
|
|
90
|
+
the cluster after updating the cluster metadata. If no response is received
|
|
91
|
+
before the timeout expires, the cluster metadata update still applies but
|
|
92
|
+
the response will indicate that it was not completely acknowledged. It can
|
|
93
|
+
also be set to `-1` to indicate that the request should never timeout.
|
|
74
94
|
"""
|
|
75
95
|
if index in SKIP_IN_PATH:
|
|
76
96
|
raise ValueError("Empty value passed for parameter 'index'")
|
|
@@ -143,14 +163,17 @@ class IndicesClient(NamespacedClient):
|
|
|
143
163
|
body: t.Optional[t.Dict[str, t.Any]] = None,
|
|
144
164
|
) -> ObjectApiResponse[t.Any]:
|
|
145
165
|
"""
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
166
|
+
.. raw:: html
|
|
167
|
+
|
|
168
|
+
<p>Get tokens from text analysis.
|
|
169
|
+
The analyze API performs analysis on a text string and returns the resulting tokens.</p>
|
|
170
|
+
<p>Generating excessive amount of tokens may cause a node to run out of memory.
|
|
171
|
+
The <code>index.analyze.max_token_count</code> setting enables you to limit the number of tokens that can be produced.
|
|
172
|
+
If more than this limit of tokens gets generated, an error occurs.
|
|
173
|
+
The <code>_analyze</code> endpoint without a specified index will always use <code>10000</code> as its limit.</p>
|
|
174
|
+
|
|
152
175
|
|
|
153
|
-
`<https://www.elastic.co/
|
|
176
|
+
`<https://www.elastic.co/docs/api/doc/elasticsearch/v9/operation/operation-indices-analyze>`_
|
|
154
177
|
|
|
155
178
|
:param index: Index used to derive the analyzer. If specified, the `analyzer`
|
|
156
179
|
or field parameter overrides this value. If no index is specified or the
|
|
@@ -224,6 +247,51 @@ class IndicesClient(NamespacedClient):
|
|
|
224
247
|
path_parts=__path_parts,
|
|
225
248
|
)
|
|
226
249
|
|
|
250
|
+
@_rewrite_parameters()
|
|
251
|
+
@_stability_warning(Stability.EXPERIMENTAL)
|
|
252
|
+
async def cancel_migrate_reindex(
|
|
253
|
+
self,
|
|
254
|
+
*,
|
|
255
|
+
index: t.Union[str, t.Sequence[str]],
|
|
256
|
+
error_trace: t.Optional[bool] = None,
|
|
257
|
+
filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None,
|
|
258
|
+
human: t.Optional[bool] = None,
|
|
259
|
+
pretty: t.Optional[bool] = None,
|
|
260
|
+
) -> ObjectApiResponse[t.Any]:
|
|
261
|
+
"""
|
|
262
|
+
.. raw:: html
|
|
263
|
+
|
|
264
|
+
<p>Cancel a migration reindex operation.</p>
|
|
265
|
+
<p>Cancel a migration reindex attempt for a data stream or index.</p>
|
|
266
|
+
|
|
267
|
+
|
|
268
|
+
`<https://www.elastic.co/docs/api/doc/elasticsearch/v9/group/endpoint-migration>`_
|
|
269
|
+
|
|
270
|
+
:param index: The index or data stream name
|
|
271
|
+
"""
|
|
272
|
+
if index in SKIP_IN_PATH:
|
|
273
|
+
raise ValueError("Empty value passed for parameter 'index'")
|
|
274
|
+
__path_parts: t.Dict[str, str] = {"index": _quote(index)}
|
|
275
|
+
__path = f'/_migration/reindex/{__path_parts["index"]}/_cancel'
|
|
276
|
+
__query: t.Dict[str, t.Any] = {}
|
|
277
|
+
if error_trace is not None:
|
|
278
|
+
__query["error_trace"] = error_trace
|
|
279
|
+
if filter_path is not None:
|
|
280
|
+
__query["filter_path"] = filter_path
|
|
281
|
+
if human is not None:
|
|
282
|
+
__query["human"] = human
|
|
283
|
+
if pretty is not None:
|
|
284
|
+
__query["pretty"] = pretty
|
|
285
|
+
__headers = {"accept": "application/json"}
|
|
286
|
+
return await self.perform_request( # type: ignore[return-value]
|
|
287
|
+
"POST",
|
|
288
|
+
__path,
|
|
289
|
+
params=__query,
|
|
290
|
+
headers=__headers,
|
|
291
|
+
endpoint_id="indices.cancel_migrate_reindex",
|
|
292
|
+
path_parts=__path_parts,
|
|
293
|
+
)
|
|
294
|
+
|
|
227
295
|
@_rewrite_parameters()
|
|
228
296
|
async def clear_cache(
|
|
229
297
|
self,
|
|
@@ -249,13 +317,17 @@ class IndicesClient(NamespacedClient):
|
|
|
249
317
|
request: t.Optional[bool] = None,
|
|
250
318
|
) -> ObjectApiResponse[t.Any]:
|
|
251
319
|
"""
|
|
252
|
-
|
|
253
|
-
API clears the caches of the stream's backing indices. By default, the clear
|
|
254
|
-
cache API clears all caches. To clear only specific caches, use the `fielddata`,
|
|
255
|
-
`query`, or `request` parameters. To clear the cache only of specific fields,
|
|
256
|
-
use the `fields` parameter.
|
|
320
|
+
.. raw:: html
|
|
257
321
|
|
|
258
|
-
|
|
322
|
+
<p>Clear the cache.
|
|
323
|
+
Clear the cache of one or more indices.
|
|
324
|
+
For data streams, the API clears the caches of the stream's backing indices.</p>
|
|
325
|
+
<p>By default, the clear cache API clears all caches.
|
|
326
|
+
To clear only specific caches, use the <code>fielddata</code>, <code>query</code>, or <code>request</code> parameters.
|
|
327
|
+
To clear the cache only of specific fields, use the <code>fields</code> parameter.</p>
|
|
328
|
+
|
|
329
|
+
|
|
330
|
+
`<https://www.elastic.co/docs/api/doc/elasticsearch/v9/operation/operation-indices-clear-cache>`_
|
|
259
331
|
|
|
260
332
|
:param index: Comma-separated list of data streams, indices, and aliases used
|
|
261
333
|
to limit the request. Supports wildcards (`*`). To target all data streams
|
|
@@ -338,46 +410,46 @@ class IndicesClient(NamespacedClient):
|
|
|
338
410
|
body: t.Optional[t.Dict[str, t.Any]] = None,
|
|
339
411
|
) -> ObjectApiResponse[t.Any]:
|
|
340
412
|
"""
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
`<https://www.elastic.co/
|
|
413
|
+
.. raw:: html
|
|
414
|
+
|
|
415
|
+
<p>Clone an index.
|
|
416
|
+
Clone an existing index into a new index.
|
|
417
|
+
Each original primary shard is cloned into a new primary shard in the new index.</p>
|
|
418
|
+
<p>IMPORTANT: Elasticsearch does not apply index templates to the resulting index.
|
|
419
|
+
The API also does not copy index metadata from the original index.
|
|
420
|
+
Index metadata includes aliases, index lifecycle management phase definitions, and cross-cluster replication (CCR) follower information.
|
|
421
|
+
For example, if you clone a CCR follower index, the resulting clone will not be a follower index.</p>
|
|
422
|
+
<p>The clone API copies most index settings from the source index to the resulting index, with the exception of <code>index.number_of_replicas</code> and <code>index.auto_expand_replicas</code>.
|
|
423
|
+
To set the number of replicas in the resulting index, configure these settings in the clone request.</p>
|
|
424
|
+
<p>Cloning works as follows:</p>
|
|
425
|
+
<ul>
|
|
426
|
+
<li>First, it creates a new target index with the same definition as the source index.</li>
|
|
427
|
+
<li>Then it hard-links segments from the source index into the target index. If the file system does not support hard-linking, all segments are copied into the new index, which is a much more time consuming process.</li>
|
|
428
|
+
<li>Finally, it recovers the target index as though it were a closed index which had just been re-opened.</li>
|
|
429
|
+
</ul>
|
|
430
|
+
<p>IMPORTANT: Indices can only be cloned if they meet the following requirements:</p>
|
|
431
|
+
<ul>
|
|
432
|
+
<li>The index must be marked as read-only and have a cluster health status of green.</li>
|
|
433
|
+
<li>The target index must not exist.</li>
|
|
434
|
+
<li>The source index must have the same number of primary shards as the target index.</li>
|
|
435
|
+
<li>The node handling the clone process must have sufficient free disk space to accommodate a second copy of the existing index.</li>
|
|
436
|
+
</ul>
|
|
437
|
+
<p>The current write index on a data stream cannot be cloned.
|
|
438
|
+
In order to clone the current write index, the data stream must first be rolled over so that a new write index is created and then the previous write index can be cloned.</p>
|
|
439
|
+
<p>NOTE: Mappings cannot be specified in the <code>_clone</code> request. The mappings of the source index will be used for the target index.</p>
|
|
440
|
+
<p><strong>Monitor the cloning process</strong></p>
|
|
441
|
+
<p>The cloning process can be monitored with the cat recovery API or the cluster health API can be used to wait until all primary shards have been allocated by setting the <code>wait_for_status</code> parameter to <code>yellow</code>.</p>
|
|
442
|
+
<p>The <code>_clone</code> API returns as soon as the target index has been added to the cluster state, before any shards have been allocated.
|
|
443
|
+
At this point, all shards are in the state unassigned.
|
|
444
|
+
If, for any reason, the target index can't be allocated, its primary shard will remain unassigned until it can be allocated on that node.</p>
|
|
445
|
+
<p>Once the primary shard is allocated, it moves to state initializing, and the clone process begins.
|
|
446
|
+
When the clone operation completes, the shard will become active.
|
|
447
|
+
At that point, Elasticsearch will try to allocate any replicas and may decide to relocate the primary shard to another node.</p>
|
|
448
|
+
<p><strong>Wait for active shards</strong></p>
|
|
449
|
+
<p>Because the clone operation creates a new index to clone the shards to, the wait for active shards setting on index creation applies to the clone index action as well.</p>
|
|
450
|
+
|
|
451
|
+
|
|
452
|
+
`<https://www.elastic.co/docs/api/doc/elasticsearch/v9/operation/operation-indices-clone>`_
|
|
381
453
|
|
|
382
454
|
:param index: Name of the source index to clone.
|
|
383
455
|
:param target: Name of the target index to create.
|
|
@@ -463,26 +535,25 @@ class IndicesClient(NamespacedClient):
|
|
|
463
535
|
] = None,
|
|
464
536
|
) -> ObjectApiResponse[t.Any]:
|
|
465
537
|
"""
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
`<https://www.elastic.co/guide/en/elasticsearch/reference/8.17/indices-close.html>`_
|
|
538
|
+
.. raw:: html
|
|
539
|
+
|
|
540
|
+
<p>Close an index.
|
|
541
|
+
A closed index is blocked for read or write operations and does not allow all operations that opened indices allow.
|
|
542
|
+
It is not possible to index documents or to search for documents in a closed index.
|
|
543
|
+
Closed indices do not have to maintain internal data structures for indexing or searching documents, which results in a smaller overhead on the cluster.</p>
|
|
544
|
+
<p>When opening or closing an index, the master node is responsible for restarting the index shards to reflect the new state of the index.
|
|
545
|
+
The shards will then go through the normal recovery process.
|
|
546
|
+
The data of opened and closed indices is automatically replicated by the cluster to ensure that enough shard copies are safely kept around at all times.</p>
|
|
547
|
+
<p>You can open and close multiple indices.
|
|
548
|
+
An error is thrown if the request explicitly refers to a missing index.
|
|
549
|
+
This behaviour can be turned off using the <code>ignore_unavailable=true</code> parameter.</p>
|
|
550
|
+
<p>By default, you must explicitly name the indices you are opening or closing.
|
|
551
|
+
To open or close indices with <code>_all</code>, <code>*</code>, or other wildcard expressions, change the<code> action.destructive_requires_name</code> setting to <code>false</code>. This setting can also be changed with the cluster update settings API.</p>
|
|
552
|
+
<p>Closed indices consume a significant amount of disk-space which can cause problems in managed environments.
|
|
553
|
+
Closing indices can be turned off with the cluster settings API by setting <code>cluster.indices.close.enable</code> to <code>false</code>.</p>
|
|
554
|
+
|
|
555
|
+
|
|
556
|
+
`<https://www.elastic.co/docs/api/doc/elasticsearch/v9/operation/operation-indices-close>`_
|
|
486
557
|
|
|
487
558
|
:param index: Comma-separated list or wildcard expression of index names used
|
|
488
559
|
to limit the request.
|
|
@@ -561,28 +632,29 @@ class IndicesClient(NamespacedClient):
|
|
|
561
632
|
body: t.Optional[t.Dict[str, t.Any]] = None,
|
|
562
633
|
) -> ObjectApiResponse[t.Any]:
|
|
563
634
|
"""
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
635
|
+
.. raw:: html
|
|
636
|
+
|
|
637
|
+
<p>Create an index.
|
|
638
|
+
You can use the create index API to add a new index to an Elasticsearch cluster.
|
|
639
|
+
When creating an index, you can specify the following:</p>
|
|
640
|
+
<ul>
|
|
641
|
+
<li>Settings for the index.</li>
|
|
642
|
+
<li>Mappings for fields in the index.</li>
|
|
643
|
+
<li>Index aliases</li>
|
|
644
|
+
</ul>
|
|
645
|
+
<p><strong>Wait for active shards</strong></p>
|
|
646
|
+
<p>By default, index creation will only return a response to the client when the primary copies of each shard have been started, or the request times out.
|
|
647
|
+
The index creation response will indicate what happened.
|
|
648
|
+
For example, <code>acknowledged</code> indicates whether the index was successfully created in the cluster, <code>while shards_acknowledged</code> indicates whether the requisite number of shard copies were started for each shard in the index before timing out.
|
|
649
|
+
Note that it is still possible for either <code>acknowledged</code> or <code>shards_acknowledged</code> to be <code>false</code>, but for the index creation to be successful.
|
|
650
|
+
These values simply indicate whether the operation completed before the timeout.
|
|
651
|
+
If <code>acknowledged</code> is false, the request timed out before the cluster state was updated with the newly created index, but it probably will be created sometime soon.
|
|
652
|
+
If <code>shards_acknowledged</code> is false, then the request timed out before the requisite number of shards were started (by default just the primaries), even if the cluster state was successfully updated to reflect the newly created index (that is to say, <code>acknowledged</code> is <code>true</code>).</p>
|
|
653
|
+
<p>You can change the default of only waiting for the primary shards to start through the index setting <code>index.write.wait_for_active_shards</code>.
|
|
654
|
+
Note that changing this setting will also affect the <code>wait_for_active_shards</code> value on all subsequent write operations.</p>
|
|
655
|
+
|
|
656
|
+
|
|
657
|
+
`<https://www.elastic.co/docs/api/doc/elasticsearch/v9/operation/operation-indices-create>`_
|
|
586
658
|
|
|
587
659
|
:param index: Name of the index you wish to create.
|
|
588
660
|
:param aliases: Aliases for the index.
|
|
@@ -653,10 +725,13 @@ class IndicesClient(NamespacedClient):
|
|
|
653
725
|
timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None,
|
|
654
726
|
) -> ObjectApiResponse[t.Any]:
|
|
655
727
|
"""
|
|
656
|
-
|
|
657
|
-
|
|
728
|
+
.. raw:: html
|
|
729
|
+
|
|
730
|
+
<p>Create a data stream.</p>
|
|
731
|
+
<p>You must have a matching index template with data stream enabled.</p>
|
|
658
732
|
|
|
659
|
-
|
|
733
|
+
|
|
734
|
+
`<https://www.elastic.co/docs/api/doc/elasticsearch/v9/operation/operation-indices-create-data-stream>`_
|
|
660
735
|
|
|
661
736
|
:param name: Name of the data stream, which must meet the following criteria:
|
|
662
737
|
Lowercase only; Cannot include `\\`, `/`, `*`, `?`, `"`, `<`, `>`, `|`, `,`,
|
|
@@ -696,6 +771,71 @@ class IndicesClient(NamespacedClient):
|
|
|
696
771
|
path_parts=__path_parts,
|
|
697
772
|
)
|
|
698
773
|
|
|
774
|
+
@_rewrite_parameters(
|
|
775
|
+
body_name="create_from",
|
|
776
|
+
)
|
|
777
|
+
@_stability_warning(Stability.EXPERIMENTAL)
|
|
778
|
+
async def create_from(
|
|
779
|
+
self,
|
|
780
|
+
*,
|
|
781
|
+
source: str,
|
|
782
|
+
dest: str,
|
|
783
|
+
create_from: t.Optional[t.Mapping[str, t.Any]] = None,
|
|
784
|
+
body: t.Optional[t.Mapping[str, t.Any]] = None,
|
|
785
|
+
error_trace: t.Optional[bool] = None,
|
|
786
|
+
filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None,
|
|
787
|
+
human: t.Optional[bool] = None,
|
|
788
|
+
pretty: t.Optional[bool] = None,
|
|
789
|
+
) -> ObjectApiResponse[t.Any]:
|
|
790
|
+
"""
|
|
791
|
+
.. raw:: html
|
|
792
|
+
|
|
793
|
+
<p>Create an index from a source index.</p>
|
|
794
|
+
<p>Copy the mappings and settings from the source index to a destination index while allowing request settings and mappings to override the source values.</p>
|
|
795
|
+
|
|
796
|
+
|
|
797
|
+
`<https://www.elastic.co/docs/api/doc/elasticsearch/v9/group/endpoint-migration>`_
|
|
798
|
+
|
|
799
|
+
:param source: The source index or data stream name
|
|
800
|
+
:param dest: The destination index or data stream name
|
|
801
|
+
:param create_from:
|
|
802
|
+
"""
|
|
803
|
+
if source in SKIP_IN_PATH:
|
|
804
|
+
raise ValueError("Empty value passed for parameter 'source'")
|
|
805
|
+
if dest in SKIP_IN_PATH:
|
|
806
|
+
raise ValueError("Empty value passed for parameter 'dest'")
|
|
807
|
+
if create_from is None and body is None:
|
|
808
|
+
raise ValueError(
|
|
809
|
+
"Empty value passed for parameters 'create_from' and 'body', one of them should be set."
|
|
810
|
+
)
|
|
811
|
+
elif create_from is not None and body is not None:
|
|
812
|
+
raise ValueError("Cannot set both 'create_from' and 'body'")
|
|
813
|
+
__path_parts: t.Dict[str, str] = {
|
|
814
|
+
"source": _quote(source),
|
|
815
|
+
"dest": _quote(dest),
|
|
816
|
+
}
|
|
817
|
+
__path = f'/_create_from/{__path_parts["source"]}/{__path_parts["dest"]}'
|
|
818
|
+
__query: t.Dict[str, t.Any] = {}
|
|
819
|
+
if error_trace is not None:
|
|
820
|
+
__query["error_trace"] = error_trace
|
|
821
|
+
if filter_path is not None:
|
|
822
|
+
__query["filter_path"] = filter_path
|
|
823
|
+
if human is not None:
|
|
824
|
+
__query["human"] = human
|
|
825
|
+
if pretty is not None:
|
|
826
|
+
__query["pretty"] = pretty
|
|
827
|
+
__body = create_from if create_from is not None else body
|
|
828
|
+
__headers = {"accept": "application/json", "content-type": "application/json"}
|
|
829
|
+
return await self.perform_request( # type: ignore[return-value]
|
|
830
|
+
"PUT",
|
|
831
|
+
__path,
|
|
832
|
+
params=__query,
|
|
833
|
+
headers=__headers,
|
|
834
|
+
body=__body,
|
|
835
|
+
endpoint_id="indices.create_from",
|
|
836
|
+
path_parts=__path_parts,
|
|
837
|
+
)
|
|
838
|
+
|
|
699
839
|
@_rewrite_parameters()
|
|
700
840
|
async def data_streams_stats(
|
|
701
841
|
self,
|
|
@@ -715,9 +855,13 @@ class IndicesClient(NamespacedClient):
|
|
|
715
855
|
pretty: t.Optional[bool] = None,
|
|
716
856
|
) -> ObjectApiResponse[t.Any]:
|
|
717
857
|
"""
|
|
718
|
-
|
|
858
|
+
.. raw:: html
|
|
859
|
+
|
|
860
|
+
<p>Get data stream stats.</p>
|
|
861
|
+
<p>Get statistics for one or more data streams.</p>
|
|
862
|
+
|
|
719
863
|
|
|
720
|
-
`<https://www.elastic.co/
|
|
864
|
+
`<https://www.elastic.co/docs/api/doc/elasticsearch/v9/operation/operation-indices-data-streams-stats-1>`_
|
|
721
865
|
|
|
722
866
|
:param name: Comma-separated list of data streams used to limit the request.
|
|
723
867
|
Wildcard expressions (`*`) are supported. To target all data streams in a
|
|
@@ -776,13 +920,17 @@ class IndicesClient(NamespacedClient):
|
|
|
776
920
|
timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None,
|
|
777
921
|
) -> ObjectApiResponse[t.Any]:
|
|
778
922
|
"""
|
|
779
|
-
|
|
780
|
-
It does not delete related Kibana components, such as data views, visualizations,
|
|
781
|
-
or dashboards. You cannot delete the current write index of a data stream. To
|
|
782
|
-
delete the index, you must roll over the data stream so a new write index is
|
|
783
|
-
created. You can then use the delete index API to delete the previous write index.
|
|
923
|
+
.. raw:: html
|
|
784
924
|
|
|
785
|
-
|
|
925
|
+
<p>Delete indices.
|
|
926
|
+
Deleting an index deletes its documents, shards, and metadata.
|
|
927
|
+
It does not delete related Kibana components, such as data views, visualizations, or dashboards.</p>
|
|
928
|
+
<p>You cannot delete the current write index of a data stream.
|
|
929
|
+
To delete the index, you must roll over the data stream so a new write index is created.
|
|
930
|
+
You can then use the delete index API to delete the previous write index.</p>
|
|
931
|
+
|
|
932
|
+
|
|
933
|
+
`<https://www.elastic.co/docs/api/doc/elasticsearch/v9/operation/operation-indices-delete>`_
|
|
786
934
|
|
|
787
935
|
:param index: Comma-separated list of indices to delete. You cannot specify index
|
|
788
936
|
aliases. By default, this parameter does not support wildcards (`*`) or `_all`.
|
|
@@ -850,9 +998,13 @@ class IndicesClient(NamespacedClient):
|
|
|
850
998
|
timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None,
|
|
851
999
|
) -> ObjectApiResponse[t.Any]:
|
|
852
1000
|
"""
|
|
853
|
-
|
|
1001
|
+
.. raw:: html
|
|
1002
|
+
|
|
1003
|
+
<p>Delete an alias.
|
|
1004
|
+
Removes a data stream or index from an alias.</p>
|
|
854
1005
|
|
|
855
|
-
|
|
1006
|
+
|
|
1007
|
+
`<https://www.elastic.co/docs/api/doc/elasticsearch/v9/operation/operation-indices-delete-alias>`_
|
|
856
1008
|
|
|
857
1009
|
:param index: Comma-separated list of data streams or indices used to limit the
|
|
858
1010
|
request. Supports wildcards (`*`).
|
|
@@ -914,10 +1066,13 @@ class IndicesClient(NamespacedClient):
|
|
|
914
1066
|
timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None,
|
|
915
1067
|
) -> ObjectApiResponse[t.Any]:
|
|
916
1068
|
"""
|
|
917
|
-
|
|
918
|
-
|
|
1069
|
+
.. raw:: html
|
|
1070
|
+
|
|
1071
|
+
<p>Delete data stream lifecycles.
|
|
1072
|
+
Removes the data stream lifecycle from a data stream, rendering it not managed by the data stream lifecycle.</p>
|
|
919
1073
|
|
|
920
|
-
|
|
1074
|
+
|
|
1075
|
+
`<https://www.elastic.co/docs/api/doc/elasticsearch/v9/operation/operation-indices-delete-data-lifecycle>`_
|
|
921
1076
|
|
|
922
1077
|
:param name: A comma-separated list of data streams of which the data stream
|
|
923
1078
|
lifecycle will be deleted; use `*` to get all data streams
|
|
@@ -975,9 +1130,13 @@ class IndicesClient(NamespacedClient):
|
|
|
975
1130
|
pretty: t.Optional[bool] = None,
|
|
976
1131
|
) -> ObjectApiResponse[t.Any]:
|
|
977
1132
|
"""
|
|
978
|
-
|
|
1133
|
+
.. raw:: html
|
|
1134
|
+
|
|
1135
|
+
<p>Delete data streams.
|
|
1136
|
+
Deletes one or more data streams and their backing indices.</p>
|
|
979
1137
|
|
|
980
|
-
|
|
1138
|
+
|
|
1139
|
+
`<https://www.elastic.co/docs/api/doc/elasticsearch/v9/operation/operation-indices-delete-data-stream>`_
|
|
981
1140
|
|
|
982
1141
|
:param name: Comma-separated list of data streams to delete. Wildcard (`*`) expressions
|
|
983
1142
|
are supported.
|
|
@@ -1027,12 +1186,15 @@ class IndicesClient(NamespacedClient):
|
|
|
1027
1186
|
timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None,
|
|
1028
1187
|
) -> ObjectApiResponse[t.Any]:
|
|
1029
1188
|
"""
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1189
|
+
.. raw:: html
|
|
1190
|
+
|
|
1191
|
+
<p>Delete an index template.
|
|
1192
|
+
The provided <!-- raw HTML omitted --> may contain multiple template names separated by a comma. If multiple template
|
|
1193
|
+
names are specified then there is no wildcard support and the provided names should match completely with
|
|
1194
|
+
existing templates.</p>
|
|
1195
|
+
|
|
1034
1196
|
|
|
1035
|
-
`<https://www.elastic.co/
|
|
1197
|
+
`<https://www.elastic.co/docs/api/doc/elasticsearch/v9/operation/operation-indices-delete-index-template>`_
|
|
1036
1198
|
|
|
1037
1199
|
:param name: Comma-separated list of index template names used to limit the request.
|
|
1038
1200
|
Wildcard (*) expressions are supported.
|
|
@@ -1082,9 +1244,12 @@ class IndicesClient(NamespacedClient):
|
|
|
1082
1244
|
timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None,
|
|
1083
1245
|
) -> ObjectApiResponse[t.Any]:
|
|
1084
1246
|
"""
|
|
1085
|
-
|
|
1247
|
+
.. raw:: html
|
|
1086
1248
|
|
|
1087
|
-
|
|
1249
|
+
<p>Delete a legacy index template.</p>
|
|
1250
|
+
|
|
1251
|
+
|
|
1252
|
+
`<https://www.elastic.co/docs/api/doc/elasticsearch/v9/operation/operation-indices-delete-template>`_
|
|
1088
1253
|
|
|
1089
1254
|
:param name: The name of the legacy index template to delete. Wildcard (`*`)
|
|
1090
1255
|
expressions are supported.
|
|
@@ -1145,18 +1310,18 @@ class IndicesClient(NamespacedClient):
|
|
|
1145
1310
|
run_expensive_tasks: t.Optional[bool] = None,
|
|
1146
1311
|
) -> ObjectApiResponse[t.Any]:
|
|
1147
1312
|
"""
|
|
1148
|
-
|
|
1149
|
-
|
|
1150
|
-
|
|
1151
|
-
|
|
1152
|
-
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
|
|
1157
|
-
|
|
1158
|
-
|
|
1159
|
-
`<https://www.elastic.co/
|
|
1313
|
+
.. raw:: html
|
|
1314
|
+
|
|
1315
|
+
<p>Analyze the index disk usage.
|
|
1316
|
+
Analyze the disk usage of each field of an index or data stream.
|
|
1317
|
+
This API might not support indices created in previous Elasticsearch versions.
|
|
1318
|
+
The result of a small index can be inaccurate as some parts of an index might not be analyzed by the API.</p>
|
|
1319
|
+
<p>NOTE: The total size of fields of the analyzed shards of the index in the response is usually smaller than the index <code>store_size</code> value because some small metadata files are ignored and some parts of data files might not be scanned by the API.
|
|
1320
|
+
Since stored fields are stored together in a compressed format, the sizes of stored fields are also estimates and can be inaccurate.
|
|
1321
|
+
The stored size of the <code>_id</code> field is likely underestimated while the <code>_source</code> field is overestimated.</p>
|
|
1322
|
+
|
|
1323
|
+
|
|
1324
|
+
`<https://www.elastic.co/docs/api/doc/elasticsearch/v9/operation/operation-indices-disk-usage>`_
|
|
1160
1325
|
|
|
1161
1326
|
:param index: Comma-separated list of data streams, indices, and aliases used
|
|
1162
1327
|
to limit the request. It’s recommended to execute this API with a single
|
|
@@ -1228,16 +1393,18 @@ class IndicesClient(NamespacedClient):
|
|
|
1228
1393
|
pretty: t.Optional[bool] = None,
|
|
1229
1394
|
) -> ObjectApiResponse[t.Any]:
|
|
1230
1395
|
"""
|
|
1231
|
-
|
|
1232
|
-
|
|
1233
|
-
|
|
1234
|
-
|
|
1235
|
-
|
|
1236
|
-
|
|
1237
|
-
|
|
1238
|
-
|
|
1396
|
+
.. raw:: html
|
|
1397
|
+
|
|
1398
|
+
<p>Downsample an index.
|
|
1399
|
+
Aggregate a time series (TSDS) index and store pre-computed statistical summaries (<code>min</code>, <code>max</code>, <code>sum</code>, <code>value_count</code> and <code>avg</code>) for each metric field grouped by a configured time interval.
|
|
1400
|
+
For example, a TSDS index that contains metrics sampled every 10 seconds can be downsampled to an hourly index.
|
|
1401
|
+
All documents within an hour interval are summarized and stored as a single document in the downsample index.</p>
|
|
1402
|
+
<p>NOTE: Only indices in a time series data stream are supported.
|
|
1403
|
+
Neither field nor document level security can be defined on the source index.
|
|
1404
|
+
The source index must be read only (<code>index.blocks.write: true</code>).</p>
|
|
1405
|
+
|
|
1239
1406
|
|
|
1240
|
-
`<https://www.elastic.co/
|
|
1407
|
+
`<https://www.elastic.co/docs/api/doc/elasticsearch/v9/operation/operation-indices-downsample>`_
|
|
1241
1408
|
|
|
1242
1409
|
:param index: Name of the time series index to downsample.
|
|
1243
1410
|
:param target_index: Name of the index to create.
|
|
@@ -1303,9 +1470,13 @@ class IndicesClient(NamespacedClient):
|
|
|
1303
1470
|
pretty: t.Optional[bool] = None,
|
|
1304
1471
|
) -> HeadApiResponse:
|
|
1305
1472
|
"""
|
|
1306
|
-
|
|
1473
|
+
.. raw:: html
|
|
1307
1474
|
|
|
1308
|
-
|
|
1475
|
+
<p>Check indices.
|
|
1476
|
+
Check if one or more indices, index aliases, or data streams exist.</p>
|
|
1477
|
+
|
|
1478
|
+
|
|
1479
|
+
`<https://www.elastic.co/docs/api/doc/elasticsearch/v9/operation/operation-indices-exists>`_
|
|
1309
1480
|
|
|
1310
1481
|
:param index: Comma-separated list of data streams, indices, and aliases. Supports
|
|
1311
1482
|
wildcards (`*`).
|
|
@@ -1377,13 +1548,17 @@ class IndicesClient(NamespacedClient):
|
|
|
1377
1548
|
filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None,
|
|
1378
1549
|
human: t.Optional[bool] = None,
|
|
1379
1550
|
ignore_unavailable: t.Optional[bool] = None,
|
|
1380
|
-
|
|
1551
|
+
master_timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None,
|
|
1381
1552
|
pretty: t.Optional[bool] = None,
|
|
1382
1553
|
) -> HeadApiResponse:
|
|
1383
1554
|
"""
|
|
1384
|
-
|
|
1555
|
+
.. raw:: html
|
|
1385
1556
|
|
|
1386
|
-
|
|
1557
|
+
<p>Check aliases.</p>
|
|
1558
|
+
<p>Check if one or more data stream or index aliases exist.</p>
|
|
1559
|
+
|
|
1560
|
+
|
|
1561
|
+
`<https://www.elastic.co/docs/api/doc/elasticsearch/v9/operation/operation-indices-exists-alias>`_
|
|
1387
1562
|
|
|
1388
1563
|
:param name: Comma-separated list of aliases to check. Supports wildcards (`*`).
|
|
1389
1564
|
:param index: Comma-separated list of data streams or indices used to limit the
|
|
@@ -1398,8 +1573,9 @@ class IndicesClient(NamespacedClient):
|
|
|
1398
1573
|
as `open,hidden`. Valid values are: `all`, `open`, `closed`, `hidden`, `none`.
|
|
1399
1574
|
:param ignore_unavailable: If `false`, requests that include a missing data stream
|
|
1400
1575
|
or index in the target indices or data streams return an error.
|
|
1401
|
-
:param
|
|
1402
|
-
|
|
1576
|
+
:param master_timeout: Period to wait for a connection to the master node. If
|
|
1577
|
+
no response is received before the timeout expires, the request fails and
|
|
1578
|
+
returns an error.
|
|
1403
1579
|
"""
|
|
1404
1580
|
if name in SKIP_IN_PATH:
|
|
1405
1581
|
raise ValueError("Empty value passed for parameter 'name'")
|
|
@@ -1425,8 +1601,8 @@ class IndicesClient(NamespacedClient):
|
|
|
1425
1601
|
__query["human"] = human
|
|
1426
1602
|
if ignore_unavailable is not None:
|
|
1427
1603
|
__query["ignore_unavailable"] = ignore_unavailable
|
|
1428
|
-
if
|
|
1429
|
-
__query["
|
|
1604
|
+
if master_timeout is not None:
|
|
1605
|
+
__query["master_timeout"] = master_timeout
|
|
1430
1606
|
if pretty is not None:
|
|
1431
1607
|
__query["pretty"] = pretty
|
|
1432
1608
|
__headers = {"accept": "application/json"}
|
|
@@ -1446,17 +1622,27 @@ class IndicesClient(NamespacedClient):
|
|
|
1446
1622
|
name: str,
|
|
1447
1623
|
error_trace: t.Optional[bool] = None,
|
|
1448
1624
|
filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None,
|
|
1625
|
+
flat_settings: t.Optional[bool] = None,
|
|
1449
1626
|
human: t.Optional[bool] = None,
|
|
1627
|
+
local: t.Optional[bool] = None,
|
|
1450
1628
|
master_timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None,
|
|
1451
1629
|
pretty: t.Optional[bool] = None,
|
|
1452
1630
|
) -> HeadApiResponse:
|
|
1453
1631
|
"""
|
|
1454
|
-
|
|
1632
|
+
.. raw:: html
|
|
1455
1633
|
|
|
1456
|
-
|
|
1634
|
+
<p>Check index templates.</p>
|
|
1635
|
+
<p>Check whether index templates exist.</p>
|
|
1636
|
+
|
|
1637
|
+
|
|
1638
|
+
`<https://www.elastic.co/docs/api/doc/elasticsearch/v9/operation/operation-indices-exists-index-template>`_
|
|
1457
1639
|
|
|
1458
1640
|
:param name: Comma-separated list of index template names used to limit the request.
|
|
1459
1641
|
Wildcard (*) expressions are supported.
|
|
1642
|
+
:param flat_settings: If true, returns settings in flat format.
|
|
1643
|
+
:param local: If true, the request retrieves information from the local node
|
|
1644
|
+
only. Defaults to false, which means information is retrieved from the master
|
|
1645
|
+
node.
|
|
1460
1646
|
:param master_timeout: Period to wait for a connection to the master node. If
|
|
1461
1647
|
no response is received before the timeout expires, the request fails and
|
|
1462
1648
|
returns an error.
|
|
@@ -1470,8 +1656,12 @@ class IndicesClient(NamespacedClient):
|
|
|
1470
1656
|
__query["error_trace"] = error_trace
|
|
1471
1657
|
if filter_path is not None:
|
|
1472
1658
|
__query["filter_path"] = filter_path
|
|
1659
|
+
if flat_settings is not None:
|
|
1660
|
+
__query["flat_settings"] = flat_settings
|
|
1473
1661
|
if human is not None:
|
|
1474
1662
|
__query["human"] = human
|
|
1663
|
+
if local is not None:
|
|
1664
|
+
__query["local"] = local
|
|
1475
1665
|
if master_timeout is not None:
|
|
1476
1666
|
__query["master_timeout"] = master_timeout
|
|
1477
1667
|
if pretty is not None:
|
|
@@ -1500,13 +1690,15 @@ class IndicesClient(NamespacedClient):
|
|
|
1500
1690
|
pretty: t.Optional[bool] = None,
|
|
1501
1691
|
) -> HeadApiResponse:
|
|
1502
1692
|
"""
|
|
1503
|
-
|
|
1504
|
-
exist. Index templates define settings, mappings, and aliases that can be applied
|
|
1505
|
-
automatically to new indices. IMPORTANT: This documentation is about legacy index
|
|
1506
|
-
templates, which are deprecated and will be replaced by the composable templates
|
|
1507
|
-
introduced in Elasticsearch 7.8.
|
|
1693
|
+
.. raw:: html
|
|
1508
1694
|
|
|
1509
|
-
|
|
1695
|
+
<p>Check existence of index templates.
|
|
1696
|
+
Get information about whether index templates exist.
|
|
1697
|
+
Index templates define settings, mappings, and aliases that can be applied automatically to new indices.</p>
|
|
1698
|
+
<p>IMPORTANT: This documentation is about legacy index templates, which are deprecated and will be replaced by the composable templates introduced in Elasticsearch 7.8.</p>
|
|
1699
|
+
|
|
1700
|
+
|
|
1701
|
+
`<https://www.elastic.co/docs/api/doc/elasticsearch/v9/operation/operation-indices-exists-template>`_
|
|
1510
1702
|
|
|
1511
1703
|
:param name: A comma-separated list of index template names used to limit the
|
|
1512
1704
|
request. Wildcard (`*`) expressions are supported.
|
|
@@ -1558,12 +1750,13 @@ class IndicesClient(NamespacedClient):
|
|
|
1558
1750
|
pretty: t.Optional[bool] = None,
|
|
1559
1751
|
) -> ObjectApiResponse[t.Any]:
|
|
1560
1752
|
"""
|
|
1561
|
-
|
|
1562
|
-
|
|
1563
|
-
|
|
1564
|
-
|
|
1753
|
+
.. raw:: html
|
|
1754
|
+
|
|
1755
|
+
<p>Get the status for a data stream lifecycle.
|
|
1756
|
+
Get information about an index or data stream's current data stream lifecycle status, such as time since index creation, time since rollover, the lifecycle configuration managing the index, or any errors encountered during lifecycle execution.</p>
|
|
1757
|
+
|
|
1565
1758
|
|
|
1566
|
-
`<https://www.elastic.co/
|
|
1759
|
+
`<https://www.elastic.co/docs/api/doc/elasticsearch/v9/operation/operation-indices-explain-data-lifecycle>`_
|
|
1567
1760
|
|
|
1568
1761
|
:param index: The name of the index to explain
|
|
1569
1762
|
:param include_defaults: indicates if the API should return the default values
|
|
@@ -1617,23 +1810,20 @@ class IndicesClient(NamespacedClient):
|
|
|
1617
1810
|
filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None,
|
|
1618
1811
|
human: t.Optional[bool] = None,
|
|
1619
1812
|
ignore_unavailable: t.Optional[bool] = None,
|
|
1620
|
-
master_timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None,
|
|
1621
1813
|
pretty: t.Optional[bool] = None,
|
|
1622
|
-
timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None,
|
|
1623
|
-
wait_for_active_shards: t.Optional[
|
|
1624
|
-
t.Union[int, t.Union[str, t.Literal["all", "index-setting"]]]
|
|
1625
|
-
] = None,
|
|
1626
1814
|
) -> ObjectApiResponse[t.Any]:
|
|
1627
1815
|
"""
|
|
1628
|
-
|
|
1629
|
-
|
|
1630
|
-
|
|
1631
|
-
|
|
1632
|
-
|
|
1633
|
-
|
|
1634
|
-
|
|
1816
|
+
.. raw:: html
|
|
1817
|
+
|
|
1818
|
+
<p>Get field usage stats.
|
|
1819
|
+
Get field usage information for each shard and field of an index.
|
|
1820
|
+
Field usage statistics are automatically captured when queries are running on a cluster.
|
|
1821
|
+
A shard-level search request that accesses a given field, even if multiple times during that request, is counted as a single use.</p>
|
|
1822
|
+
<p>The response body reports the per-shard usage count of the data structures that back the fields in the index.
|
|
1823
|
+
A given request will increment each count by a maximum value of 1, even if the request accesses the same field multiple times.</p>
|
|
1635
1824
|
|
|
1636
|
-
|
|
1825
|
+
|
|
1826
|
+
`<https://www.elastic.co/docs/api/doc/elasticsearch/v9/operation/operation-indices-field-usage-stats>`_
|
|
1637
1827
|
|
|
1638
1828
|
:param index: Comma-separated list or wildcard expression of index names used
|
|
1639
1829
|
to limit the request.
|
|
@@ -1650,14 +1840,6 @@ class IndicesClient(NamespacedClient):
|
|
|
1650
1840
|
in the statistics.
|
|
1651
1841
|
:param ignore_unavailable: If `true`, missing or closed indices are not included
|
|
1652
1842
|
in the response.
|
|
1653
|
-
:param master_timeout: Period to wait for a connection to the master node. If
|
|
1654
|
-
no response is received before the timeout expires, the request fails and
|
|
1655
|
-
returns an error.
|
|
1656
|
-
:param timeout: Period to wait for a response. If no response is received before
|
|
1657
|
-
the timeout expires, the request fails and returns an error.
|
|
1658
|
-
:param wait_for_active_shards: The number of shard copies that must be active
|
|
1659
|
-
before proceeding with the operation. Set to all or any positive integer
|
|
1660
|
-
up to the total number of shards in the index (`number_of_replicas+1`).
|
|
1661
1843
|
"""
|
|
1662
1844
|
if index in SKIP_IN_PATH:
|
|
1663
1845
|
raise ValueError("Empty value passed for parameter 'index'")
|
|
@@ -1678,14 +1860,8 @@ class IndicesClient(NamespacedClient):
|
|
|
1678
1860
|
__query["human"] = human
|
|
1679
1861
|
if ignore_unavailable is not None:
|
|
1680
1862
|
__query["ignore_unavailable"] = ignore_unavailable
|
|
1681
|
-
if master_timeout is not None:
|
|
1682
|
-
__query["master_timeout"] = master_timeout
|
|
1683
1863
|
if pretty is not None:
|
|
1684
1864
|
__query["pretty"] = pretty
|
|
1685
|
-
if timeout is not None:
|
|
1686
|
-
__query["timeout"] = timeout
|
|
1687
|
-
if wait_for_active_shards is not None:
|
|
1688
|
-
__query["wait_for_active_shards"] = wait_for_active_shards
|
|
1689
1865
|
__headers = {"accept": "application/json"}
|
|
1690
1866
|
return await self.perform_request( # type: ignore[return-value]
|
|
1691
1867
|
"GET",
|
|
@@ -1719,24 +1895,20 @@ class IndicesClient(NamespacedClient):
|
|
|
1719
1895
|
wait_if_ongoing: t.Optional[bool] = None,
|
|
1720
1896
|
) -> ObjectApiResponse[t.Any]:
|
|
1721
1897
|
"""
|
|
1722
|
-
|
|
1723
|
-
|
|
1724
|
-
|
|
1725
|
-
|
|
1726
|
-
|
|
1727
|
-
|
|
1728
|
-
|
|
1729
|
-
|
|
1730
|
-
|
|
1731
|
-
|
|
1732
|
-
|
|
1733
|
-
|
|
1734
|
-
|
|
1735
|
-
|
|
1736
|
-
documents then a successful response indicates that Elasticsearch has flushed
|
|
1737
|
-
all the documents that were indexed before the flush API was called.
|
|
1738
|
-
|
|
1739
|
-
`<https://www.elastic.co/guide/en/elasticsearch/reference/8.17/indices-flush.html>`_
|
|
1898
|
+
.. raw:: html
|
|
1899
|
+
|
|
1900
|
+
<p>Flush data streams or indices.
|
|
1901
|
+
Flushing a data stream or index is the process of making sure that any data that is currently only stored in the transaction log is also permanently stored in the Lucene index.
|
|
1902
|
+
When restarting, Elasticsearch replays any unflushed operations from the transaction log into the Lucene index to bring it back into the state that it was in before the restart.
|
|
1903
|
+
Elasticsearch automatically triggers flushes as needed, using heuristics that trade off the size of the unflushed transaction log against the cost of performing each flush.</p>
|
|
1904
|
+
<p>After each operation has been flushed it is permanently stored in the Lucene index.
|
|
1905
|
+
This may mean that there is no need to maintain an additional copy of it in the transaction log.
|
|
1906
|
+
The transaction log is made up of multiple files, called generations, and Elasticsearch will delete any generation files when they are no longer needed, freeing up disk space.</p>
|
|
1907
|
+
<p>It is also possible to trigger a flush on one or more indices using the flush API, although it is rare for users to need to call this API directly.
|
|
1908
|
+
If you call the flush API after indexing some documents then a successful response indicates that Elasticsearch has flushed all the documents that were indexed before the flush API was called.</p>
|
|
1909
|
+
|
|
1910
|
+
|
|
1911
|
+
`<https://www.elastic.co/docs/api/doc/elasticsearch/v9/operation/operation-indices-flush>`_
|
|
1740
1912
|
|
|
1741
1913
|
:param index: Comma-separated list of data streams, indices, and aliases to flush.
|
|
1742
1914
|
Supports wildcards (`*`). To flush all data streams and indices, omit this
|
|
@@ -1817,51 +1989,51 @@ class IndicesClient(NamespacedClient):
|
|
|
1817
1989
|
wait_for_completion: t.Optional[bool] = None,
|
|
1818
1990
|
) -> ObjectApiResponse[t.Any]:
|
|
1819
1991
|
"""
|
|
1820
|
-
|
|
1821
|
-
|
|
1822
|
-
|
|
1823
|
-
|
|
1824
|
-
|
|
1825
|
-
|
|
1826
|
-
|
|
1827
|
-
|
|
1828
|
-
|
|
1829
|
-
|
|
1830
|
-
|
|
1831
|
-
|
|
1832
|
-
|
|
1833
|
-
|
|
1834
|
-
|
|
1835
|
-
|
|
1836
|
-
|
|
1837
|
-
|
|
1838
|
-
|
|
1839
|
-
|
|
1840
|
-
|
|
1841
|
-
|
|
1842
|
-
|
|
1843
|
-
|
|
1844
|
-
|
|
1845
|
-
|
|
1846
|
-
|
|
1847
|
-
|
|
1848
|
-
|
|
1849
|
-
|
|
1850
|
-
|
|
1851
|
-
|
|
1852
|
-
|
|
1853
|
-
|
|
1854
|
-
|
|
1855
|
-
|
|
1856
|
-
|
|
1857
|
-
|
|
1858
|
-
|
|
1859
|
-
|
|
1860
|
-
|
|
1861
|
-
|
|
1862
|
-
|
|
1863
|
-
|
|
1864
|
-
`<https://www.elastic.co/
|
|
1992
|
+
.. raw:: html
|
|
1993
|
+
|
|
1994
|
+
<p>Force a merge.
|
|
1995
|
+
Perform the force merge operation on the shards of one or more indices.
|
|
1996
|
+
For data streams, the API forces a merge on the shards of the stream's backing indices.</p>
|
|
1997
|
+
<p>Merging reduces the number of segments in each shard by merging some of them together and also frees up the space used by deleted documents.
|
|
1998
|
+
Merging normally happens automatically, but sometimes it is useful to trigger a merge manually.</p>
|
|
1999
|
+
<p>WARNING: We recommend force merging only a read-only index (meaning the index is no longer receiving writes).
|
|
2000
|
+
When documents are updated or deleted, the old version is not immediately removed but instead soft-deleted and marked with a "tombstone".
|
|
2001
|
+
These soft-deleted documents are automatically cleaned up during regular segment merges.
|
|
2002
|
+
But force merge can cause very large (greater than 5 GB) segments to be produced, which are not eligible for regular merges.
|
|
2003
|
+
So the number of soft-deleted documents can then grow rapidly, resulting in higher disk usage and worse search performance.
|
|
2004
|
+
If you regularly force merge an index receiving writes, this can also make snapshots more expensive, since the new documents can't be backed up incrementally.</p>
|
|
2005
|
+
<p><strong>Blocks during a force merge</strong></p>
|
|
2006
|
+
<p>Calls to this API block until the merge is complete (unless request contains <code>wait_for_completion=false</code>).
|
|
2007
|
+
If the client connection is lost before completion then the force merge process will continue in the background.
|
|
2008
|
+
Any new requests to force merge the same indices will also block until the ongoing force merge is complete.</p>
|
|
2009
|
+
<p><strong>Running force merge asynchronously</strong></p>
|
|
2010
|
+
<p>If the request contains <code>wait_for_completion=false</code>, Elasticsearch performs some preflight checks, launches the request, and returns a task you can use to get the status of the task.
|
|
2011
|
+
However, you can not cancel this task as the force merge task is not cancelable.
|
|
2012
|
+
Elasticsearch creates a record of this task as a document at <code>_tasks/<task_id></code>.
|
|
2013
|
+
When you are done with a task, you should delete the task document so Elasticsearch can reclaim the space.</p>
|
|
2014
|
+
<p><strong>Force merging multiple indices</strong></p>
|
|
2015
|
+
<p>You can force merge multiple indices with a single request by targeting:</p>
|
|
2016
|
+
<ul>
|
|
2017
|
+
<li>One or more data streams that contain multiple backing indices</li>
|
|
2018
|
+
<li>Multiple indices</li>
|
|
2019
|
+
<li>One or more aliases</li>
|
|
2020
|
+
<li>All data streams and indices in a cluster</li>
|
|
2021
|
+
</ul>
|
|
2022
|
+
<p>Each targeted shard is force-merged separately using the force_merge threadpool.
|
|
2023
|
+
By default each node only has a single <code>force_merge</code> thread which means that the shards on that node are force-merged one at a time.
|
|
2024
|
+
If you expand the <code>force_merge</code> threadpool on a node then it will force merge its shards in parallel</p>
|
|
2025
|
+
<p>Force merge makes the storage for the shard being merged temporarily increase, as it may require free space up to triple its size in case <code>max_num_segments parameter</code> is set to <code>1</code>, to rewrite all segments into a new one.</p>
|
|
2026
|
+
<p><strong>Data streams and time-based indices</strong></p>
|
|
2027
|
+
<p>Force-merging is useful for managing a data stream's older backing indices and other time-based indices, particularly after a rollover.
|
|
2028
|
+
In these cases, each index only receives indexing traffic for a certain period of time.
|
|
2029
|
+
Once an index receive no more writes, its shards can be force-merged to a single segment.
|
|
2030
|
+
This can be a good idea because single-segment shards can sometimes use simpler and more efficient data structures to perform searches.
|
|
2031
|
+
For example:</p>
|
|
2032
|
+
<pre><code>POST /.ds-my-data-stream-2099.03.07-000001/_forcemerge?max_num_segments=1
|
|
2033
|
+
</code></pre>
|
|
2034
|
+
|
|
2035
|
+
|
|
2036
|
+
`<https://www.elastic.co/docs/api/doc/elasticsearch/v9/operation/operation-indices-forcemerge>`_
|
|
1865
2037
|
|
|
1866
2038
|
:param index: A comma-separated list of index names; use `_all` or empty string
|
|
1867
2039
|
to perform the operation on all indices
|
|
@@ -1952,10 +2124,14 @@ class IndicesClient(NamespacedClient):
|
|
|
1952
2124
|
pretty: t.Optional[bool] = None,
|
|
1953
2125
|
) -> ObjectApiResponse[t.Any]:
|
|
1954
2126
|
"""
|
|
1955
|
-
|
|
1956
|
-
|
|
2127
|
+
.. raw:: html
|
|
2128
|
+
|
|
2129
|
+
<p>Get index information.
|
|
2130
|
+
Get information about one or more indices. For data streams, the API returns information about the
|
|
2131
|
+
stream’s backing indices.</p>
|
|
1957
2132
|
|
|
1958
|
-
|
|
2133
|
+
|
|
2134
|
+
`<https://www.elastic.co/docs/api/doc/elasticsearch/v9/operation/operation-indices-get>`_
|
|
1959
2135
|
|
|
1960
2136
|
:param index: Comma-separated list of data streams, indices, and index aliases
|
|
1961
2137
|
used to limit the request. Wildcard expressions (*) are supported.
|
|
@@ -2038,13 +2214,17 @@ class IndicesClient(NamespacedClient):
|
|
|
2038
2214
|
filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None,
|
|
2039
2215
|
human: t.Optional[bool] = None,
|
|
2040
2216
|
ignore_unavailable: t.Optional[bool] = None,
|
|
2041
|
-
|
|
2217
|
+
master_timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None,
|
|
2042
2218
|
pretty: t.Optional[bool] = None,
|
|
2043
2219
|
) -> ObjectApiResponse[t.Any]:
|
|
2044
2220
|
"""
|
|
2045
|
-
|
|
2221
|
+
.. raw:: html
|
|
2222
|
+
|
|
2223
|
+
<p>Get aliases.
|
|
2224
|
+
Retrieves information for one or more data stream or index aliases.</p>
|
|
2225
|
+
|
|
2046
2226
|
|
|
2047
|
-
`<https://www.elastic.co/
|
|
2227
|
+
`<https://www.elastic.co/docs/api/doc/elasticsearch/v9/operation/operation-indices-get-alias>`_
|
|
2048
2228
|
|
|
2049
2229
|
:param index: Comma-separated list of data streams or indices used to limit the
|
|
2050
2230
|
request. Supports wildcards (`*`). To target all data streams and indices,
|
|
@@ -2060,8 +2240,9 @@ class IndicesClient(NamespacedClient):
|
|
|
2060
2240
|
as `open,hidden`. Valid values are: `all`, `open`, `closed`, `hidden`, `none`.
|
|
2061
2241
|
:param ignore_unavailable: If `false`, the request returns an error if it targets
|
|
2062
2242
|
a missing or closed index.
|
|
2063
|
-
:param
|
|
2064
|
-
|
|
2243
|
+
:param master_timeout: Period to wait for a connection to the master node. If
|
|
2244
|
+
no response is received before the timeout expires, the request fails and
|
|
2245
|
+
returns an error.
|
|
2065
2246
|
"""
|
|
2066
2247
|
__path_parts: t.Dict[str, str]
|
|
2067
2248
|
if index not in SKIP_IN_PATH and name not in SKIP_IN_PATH:
|
|
@@ -2089,8 +2270,8 @@ class IndicesClient(NamespacedClient):
|
|
|
2089
2270
|
__query["human"] = human
|
|
2090
2271
|
if ignore_unavailable is not None:
|
|
2091
2272
|
__query["ignore_unavailable"] = ignore_unavailable
|
|
2092
|
-
if
|
|
2093
|
-
__query["
|
|
2273
|
+
if master_timeout is not None:
|
|
2274
|
+
__query["master_timeout"] = master_timeout
|
|
2094
2275
|
if pretty is not None:
|
|
2095
2276
|
__query["pretty"] = pretty
|
|
2096
2277
|
__headers = {"accept": "application/json"}
|
|
@@ -2124,10 +2305,13 @@ class IndicesClient(NamespacedClient):
|
|
|
2124
2305
|
pretty: t.Optional[bool] = None,
|
|
2125
2306
|
) -> ObjectApiResponse[t.Any]:
|
|
2126
2307
|
"""
|
|
2127
|
-
|
|
2128
|
-
|
|
2308
|
+
.. raw:: html
|
|
2309
|
+
|
|
2310
|
+
<p>Get data stream lifecycles.</p>
|
|
2311
|
+
<p>Get the data stream lifecycle configuration of one or more data streams.</p>
|
|
2129
2312
|
|
|
2130
|
-
|
|
2313
|
+
|
|
2314
|
+
`<https://www.elastic.co/docs/api/doc/elasticsearch/v9/operation/operation-indices-get-data-lifecycle>`_
|
|
2131
2315
|
|
|
2132
2316
|
:param name: Comma-separated list of data streams to limit the request. Supports
|
|
2133
2317
|
wildcards (`*`). To target all data streams, omit this parameter or use `*`
|
|
@@ -2179,10 +2363,13 @@ class IndicesClient(NamespacedClient):
|
|
|
2179
2363
|
pretty: t.Optional[bool] = None,
|
|
2180
2364
|
) -> ObjectApiResponse[t.Any]:
|
|
2181
2365
|
"""
|
|
2182
|
-
|
|
2183
|
-
|
|
2366
|
+
.. raw:: html
|
|
2367
|
+
|
|
2368
|
+
<p>Get data stream lifecycle stats.
|
|
2369
|
+
Get statistics about the data streams that are managed by a data stream lifecycle.</p>
|
|
2370
|
+
|
|
2184
2371
|
|
|
2185
|
-
`<https://www.elastic.co/
|
|
2372
|
+
`<https://www.elastic.co/docs/api/doc/elasticsearch/v9/operation/operation-indices-get-data-lifecycle-stats>`_
|
|
2186
2373
|
"""
|
|
2187
2374
|
__path_parts: t.Dict[str, str] = {}
|
|
2188
2375
|
__path = "/_lifecycle/stats"
|
|
@@ -2227,9 +2414,13 @@ class IndicesClient(NamespacedClient):
|
|
|
2227
2414
|
verbose: t.Optional[bool] = None,
|
|
2228
2415
|
) -> ObjectApiResponse[t.Any]:
|
|
2229
2416
|
"""
|
|
2230
|
-
|
|
2417
|
+
.. raw:: html
|
|
2231
2418
|
|
|
2232
|
-
|
|
2419
|
+
<p>Get data streams.</p>
|
|
2420
|
+
<p>Get information about one or more data streams.</p>
|
|
2421
|
+
|
|
2422
|
+
|
|
2423
|
+
`<https://www.elastic.co/docs/api/doc/elasticsearch/v9/operation/operation-indices-get-data-stream>`_
|
|
2233
2424
|
|
|
2234
2425
|
:param name: Comma-separated list of data stream names used to limit the request.
|
|
2235
2426
|
Wildcard (`*`) expressions are supported. If omitted, all data streams are
|
|
@@ -2302,12 +2493,15 @@ class IndicesClient(NamespacedClient):
|
|
|
2302
2493
|
pretty: t.Optional[bool] = None,
|
|
2303
2494
|
) -> ObjectApiResponse[t.Any]:
|
|
2304
2495
|
"""
|
|
2305
|
-
|
|
2306
|
-
|
|
2307
|
-
|
|
2308
|
-
|
|
2496
|
+
.. raw:: html
|
|
2497
|
+
|
|
2498
|
+
<p>Get mapping definitions.
|
|
2499
|
+
Retrieves mapping definitions for one or more fields.
|
|
2500
|
+
For data streams, the API retrieves field mappings for the stream’s backing indices.</p>
|
|
2501
|
+
<p>This API is useful if you don't need a complete mapping or if an index mapping contains a large number of fields.</p>
|
|
2309
2502
|
|
|
2310
|
-
|
|
2503
|
+
|
|
2504
|
+
`<https://www.elastic.co/docs/api/doc/elasticsearch/v9/operation/operation-indices-get-mapping>`_
|
|
2311
2505
|
|
|
2312
2506
|
:param fields: Comma-separated list or wildcard expression of fields used to
|
|
2313
2507
|
limit returned information. Supports wildcards (`*`).
|
|
@@ -2382,9 +2576,13 @@ class IndicesClient(NamespacedClient):
|
|
|
2382
2576
|
pretty: t.Optional[bool] = None,
|
|
2383
2577
|
) -> ObjectApiResponse[t.Any]:
|
|
2384
2578
|
"""
|
|
2385
|
-
|
|
2579
|
+
.. raw:: html
|
|
2580
|
+
|
|
2581
|
+
<p>Get index templates.
|
|
2582
|
+
Get information about one or more index templates.</p>
|
|
2583
|
+
|
|
2386
2584
|
|
|
2387
|
-
`<https://www.elastic.co/
|
|
2585
|
+
`<https://www.elastic.co/docs/api/doc/elasticsearch/v9/operation/operation-indices-get-index-template>`_
|
|
2388
2586
|
|
|
2389
2587
|
:param name: Comma-separated list of index template names used to limit the request.
|
|
2390
2588
|
Wildcard (*) expressions are supported.
|
|
@@ -2455,10 +2653,13 @@ class IndicesClient(NamespacedClient):
|
|
|
2455
2653
|
pretty: t.Optional[bool] = None,
|
|
2456
2654
|
) -> ObjectApiResponse[t.Any]:
|
|
2457
2655
|
"""
|
|
2458
|
-
|
|
2459
|
-
stream’s backing indices.
|
|
2656
|
+
.. raw:: html
|
|
2460
2657
|
|
|
2461
|
-
|
|
2658
|
+
<p>Get mapping definitions.
|
|
2659
|
+
For data streams, the API retrieves mappings for the stream’s backing indices.</p>
|
|
2660
|
+
|
|
2661
|
+
|
|
2662
|
+
`<https://www.elastic.co/docs/api/doc/elasticsearch/v9/operation/operation-indices-get-mapping>`_
|
|
2462
2663
|
|
|
2463
2664
|
:param index: Comma-separated list of data streams, indices, and aliases used
|
|
2464
2665
|
to limit the request. Supports wildcards (`*`). To target all data streams
|
|
@@ -2514,6 +2715,51 @@ class IndicesClient(NamespacedClient):
|
|
|
2514
2715
|
path_parts=__path_parts,
|
|
2515
2716
|
)
|
|
2516
2717
|
|
|
2718
|
+
@_rewrite_parameters()
|
|
2719
|
+
@_stability_warning(Stability.EXPERIMENTAL)
|
|
2720
|
+
async def get_migrate_reindex_status(
|
|
2721
|
+
self,
|
|
2722
|
+
*,
|
|
2723
|
+
index: t.Union[str, t.Sequence[str]],
|
|
2724
|
+
error_trace: t.Optional[bool] = None,
|
|
2725
|
+
filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None,
|
|
2726
|
+
human: t.Optional[bool] = None,
|
|
2727
|
+
pretty: t.Optional[bool] = None,
|
|
2728
|
+
) -> ObjectApiResponse[t.Any]:
|
|
2729
|
+
"""
|
|
2730
|
+
.. raw:: html
|
|
2731
|
+
|
|
2732
|
+
<p>Get the migration reindexing status.</p>
|
|
2733
|
+
<p>Get the status of a migration reindex attempt for a data stream or index.</p>
|
|
2734
|
+
|
|
2735
|
+
|
|
2736
|
+
`<https://www.elastic.co/docs/api/doc/elasticsearch/v9/group/endpoint-migration>`_
|
|
2737
|
+
|
|
2738
|
+
:param index: The index or data stream name.
|
|
2739
|
+
"""
|
|
2740
|
+
if index in SKIP_IN_PATH:
|
|
2741
|
+
raise ValueError("Empty value passed for parameter 'index'")
|
|
2742
|
+
__path_parts: t.Dict[str, str] = {"index": _quote(index)}
|
|
2743
|
+
__path = f'/_migration/reindex/{__path_parts["index"]}/_status'
|
|
2744
|
+
__query: t.Dict[str, t.Any] = {}
|
|
2745
|
+
if error_trace is not None:
|
|
2746
|
+
__query["error_trace"] = error_trace
|
|
2747
|
+
if filter_path is not None:
|
|
2748
|
+
__query["filter_path"] = filter_path
|
|
2749
|
+
if human is not None:
|
|
2750
|
+
__query["human"] = human
|
|
2751
|
+
if pretty is not None:
|
|
2752
|
+
__query["pretty"] = pretty
|
|
2753
|
+
__headers = {"accept": "application/json"}
|
|
2754
|
+
return await self.perform_request( # type: ignore[return-value]
|
|
2755
|
+
"GET",
|
|
2756
|
+
__path,
|
|
2757
|
+
params=__query,
|
|
2758
|
+
headers=__headers,
|
|
2759
|
+
endpoint_id="indices.get_migrate_reindex_status",
|
|
2760
|
+
path_parts=__path_parts,
|
|
2761
|
+
)
|
|
2762
|
+
|
|
2517
2763
|
@_rewrite_parameters()
|
|
2518
2764
|
async def get_settings(
|
|
2519
2765
|
self,
|
|
@@ -2540,10 +2786,14 @@ class IndicesClient(NamespacedClient):
|
|
|
2540
2786
|
pretty: t.Optional[bool] = None,
|
|
2541
2787
|
) -> ObjectApiResponse[t.Any]:
|
|
2542
2788
|
"""
|
|
2543
|
-
|
|
2544
|
-
|
|
2789
|
+
.. raw:: html
|
|
2790
|
+
|
|
2791
|
+
<p>Get index settings.
|
|
2792
|
+
Get setting information for one or more indices.
|
|
2793
|
+
For data streams, it returns setting information for the stream's backing indices.</p>
|
|
2545
2794
|
|
|
2546
|
-
|
|
2795
|
+
|
|
2796
|
+
`<https://www.elastic.co/docs/api/doc/elasticsearch/v9/operation/operation-indices-get-settings>`_
|
|
2547
2797
|
|
|
2548
2798
|
:param index: Comma-separated list of data streams, indices, and aliases used
|
|
2549
2799
|
to limit the request. Supports wildcards (`*`). To target all data streams
|
|
@@ -2628,11 +2878,14 @@ class IndicesClient(NamespacedClient):
|
|
|
2628
2878
|
pretty: t.Optional[bool] = None,
|
|
2629
2879
|
) -> ObjectApiResponse[t.Any]:
|
|
2630
2880
|
"""
|
|
2631
|
-
|
|
2632
|
-
|
|
2633
|
-
|
|
2881
|
+
.. raw:: html
|
|
2882
|
+
|
|
2883
|
+
<p>Get index templates.
|
|
2884
|
+
Get information about one or more index templates.</p>
|
|
2885
|
+
<p>IMPORTANT: This documentation is about legacy index templates, which are deprecated and will be replaced by the composable templates introduced in Elasticsearch 7.8.</p>
|
|
2634
2886
|
|
|
2635
|
-
|
|
2887
|
+
|
|
2888
|
+
`<https://www.elastic.co/docs/api/doc/elasticsearch/v9/operation/operation-indices-get-template>`_
|
|
2636
2889
|
|
|
2637
2890
|
:param name: Comma-separated list of index template names used to limit the request.
|
|
2638
2891
|
Wildcard (`*`) expressions are supported. To return all index templates,
|
|
@@ -2676,6 +2929,62 @@ class IndicesClient(NamespacedClient):
|
|
|
2676
2929
|
path_parts=__path_parts,
|
|
2677
2930
|
)
|
|
2678
2931
|
|
|
2932
|
+
@_rewrite_parameters(
|
|
2933
|
+
body_name="reindex",
|
|
2934
|
+
)
|
|
2935
|
+
@_stability_warning(Stability.EXPERIMENTAL)
|
|
2936
|
+
async def migrate_reindex(
|
|
2937
|
+
self,
|
|
2938
|
+
*,
|
|
2939
|
+
reindex: t.Optional[t.Mapping[str, t.Any]] = None,
|
|
2940
|
+
body: t.Optional[t.Mapping[str, t.Any]] = None,
|
|
2941
|
+
error_trace: t.Optional[bool] = None,
|
|
2942
|
+
filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None,
|
|
2943
|
+
human: t.Optional[bool] = None,
|
|
2944
|
+
pretty: t.Optional[bool] = None,
|
|
2945
|
+
) -> ObjectApiResponse[t.Any]:
|
|
2946
|
+
"""
|
|
2947
|
+
.. raw:: html
|
|
2948
|
+
|
|
2949
|
+
<p>Reindex legacy backing indices.</p>
|
|
2950
|
+
<p>Reindex all legacy backing indices for a data stream.
|
|
2951
|
+
This operation occurs in a persistent task.
|
|
2952
|
+
The persistent task ID is returned immediately and the reindexing work is completed in that task.</p>
|
|
2953
|
+
|
|
2954
|
+
|
|
2955
|
+
`<https://www.elastic.co/docs/api/doc/elasticsearch/v9/group/endpoint-migration>`_
|
|
2956
|
+
|
|
2957
|
+
:param reindex:
|
|
2958
|
+
"""
|
|
2959
|
+
if reindex is None and body is None:
|
|
2960
|
+
raise ValueError(
|
|
2961
|
+
"Empty value passed for parameters 'reindex' and 'body', one of them should be set."
|
|
2962
|
+
)
|
|
2963
|
+
elif reindex is not None and body is not None:
|
|
2964
|
+
raise ValueError("Cannot set both 'reindex' and 'body'")
|
|
2965
|
+
__path_parts: t.Dict[str, str] = {}
|
|
2966
|
+
__path = "/_migration/reindex"
|
|
2967
|
+
__query: t.Dict[str, t.Any] = {}
|
|
2968
|
+
if error_trace is not None:
|
|
2969
|
+
__query["error_trace"] = error_trace
|
|
2970
|
+
if filter_path is not None:
|
|
2971
|
+
__query["filter_path"] = filter_path
|
|
2972
|
+
if human is not None:
|
|
2973
|
+
__query["human"] = human
|
|
2974
|
+
if pretty is not None:
|
|
2975
|
+
__query["pretty"] = pretty
|
|
2976
|
+
__body = reindex if reindex is not None else body
|
|
2977
|
+
__headers = {"accept": "application/json", "content-type": "application/json"}
|
|
2978
|
+
return await self.perform_request( # type: ignore[return-value]
|
|
2979
|
+
"POST",
|
|
2980
|
+
__path,
|
|
2981
|
+
params=__query,
|
|
2982
|
+
headers=__headers,
|
|
2983
|
+
body=__body,
|
|
2984
|
+
endpoint_id="indices.migrate_reindex",
|
|
2985
|
+
path_parts=__path_parts,
|
|
2986
|
+
)
|
|
2987
|
+
|
|
2679
2988
|
@_rewrite_parameters()
|
|
2680
2989
|
async def migrate_to_data_stream(
|
|
2681
2990
|
self,
|
|
@@ -2689,16 +2998,22 @@ class IndicesClient(NamespacedClient):
|
|
|
2689
2998
|
timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None,
|
|
2690
2999
|
) -> ObjectApiResponse[t.Any]:
|
|
2691
3000
|
"""
|
|
2692
|
-
|
|
2693
|
-
|
|
2694
|
-
|
|
2695
|
-
|
|
2696
|
-
|
|
2697
|
-
|
|
2698
|
-
|
|
2699
|
-
|
|
3001
|
+
.. raw:: html
|
|
3002
|
+
|
|
3003
|
+
<p>Convert an index alias to a data stream.
|
|
3004
|
+
Converts an index alias to a data stream.
|
|
3005
|
+
You must have a matching index template that is data stream enabled.
|
|
3006
|
+
The alias must meet the following criteria:
|
|
3007
|
+
The alias must have a write index;
|
|
3008
|
+
All indices for the alias must have a <code>@timestamp</code> field mapping of a <code>date</code> or <code>date_nanos</code> field type;
|
|
3009
|
+
The alias must not have any filters;
|
|
3010
|
+
The alias must not use custom routing.
|
|
3011
|
+
If successful, the request removes the alias and creates a data stream with the same name.
|
|
3012
|
+
The indices for the alias become hidden backing indices for the stream.
|
|
3013
|
+
The write index for the alias becomes the write index for the stream.</p>
|
|
2700
3014
|
|
|
2701
|
-
|
|
3015
|
+
|
|
3016
|
+
`<https://www.elastic.co/docs/api/doc/elasticsearch/v9/operation/operation-indices-migrate-to-data-stream>`_
|
|
2702
3017
|
|
|
2703
3018
|
:param name: Name of the index alias to convert to a data stream.
|
|
2704
3019
|
:param master_timeout: Period to wait for a connection to the master node. If
|
|
@@ -2748,10 +3063,13 @@ class IndicesClient(NamespacedClient):
|
|
|
2748
3063
|
body: t.Optional[t.Dict[str, t.Any]] = None,
|
|
2749
3064
|
) -> ObjectApiResponse[t.Any]:
|
|
2750
3065
|
"""
|
|
2751
|
-
|
|
2752
|
-
|
|
3066
|
+
.. raw:: html
|
|
3067
|
+
|
|
3068
|
+
<p>Update data streams.
|
|
3069
|
+
Performs one or more data stream modification actions in a single atomic operation.</p>
|
|
2753
3070
|
|
|
2754
|
-
|
|
3071
|
+
|
|
3072
|
+
`<https://www.elastic.co/docs/api/doc/elasticsearch/v9/operation/operation-indices-modify-data-stream>`_
|
|
2755
3073
|
|
|
2756
3074
|
:param actions: Actions to perform.
|
|
2757
3075
|
"""
|
|
@@ -2809,29 +3127,28 @@ class IndicesClient(NamespacedClient):
|
|
|
2809
3127
|
] = None,
|
|
2810
3128
|
) -> ObjectApiResponse[t.Any]:
|
|
2811
3129
|
"""
|
|
2812
|
-
|
|
2813
|
-
|
|
2814
|
-
|
|
2815
|
-
|
|
2816
|
-
|
|
2817
|
-
|
|
2818
|
-
|
|
2819
|
-
|
|
2820
|
-
|
|
2821
|
-
|
|
2822
|
-
|
|
2823
|
-
|
|
2824
|
-
|
|
2825
|
-
|
|
2826
|
-
|
|
2827
|
-
|
|
2828
|
-
|
|
2829
|
-
|
|
2830
|
-
|
|
2831
|
-
|
|
2832
|
-
|
|
2833
|
-
|
|
2834
|
-
`<https://www.elastic.co/guide/en/elasticsearch/reference/8.17/indices-open-close.html>`_
|
|
3130
|
+
.. raw:: html
|
|
3131
|
+
|
|
3132
|
+
<p>Open a closed index.
|
|
3133
|
+
For data streams, the API opens any closed backing indices.</p>
|
|
3134
|
+
<p>A closed index is blocked for read/write operations and does not allow all operations that opened indices allow.
|
|
3135
|
+
It is not possible to index documents or to search for documents in a closed index.
|
|
3136
|
+
This allows closed indices to not have to maintain internal data structures for indexing or searching documents, resulting in a smaller overhead on the cluster.</p>
|
|
3137
|
+
<p>When opening or closing an index, the master is responsible for restarting the index shards to reflect the new state of the index.
|
|
3138
|
+
The shards will then go through the normal recovery process.
|
|
3139
|
+
The data of opened or closed indices is automatically replicated by the cluster to ensure that enough shard copies are safely kept around at all times.</p>
|
|
3140
|
+
<p>You can open and close multiple indices.
|
|
3141
|
+
An error is thrown if the request explicitly refers to a missing index.
|
|
3142
|
+
This behavior can be turned off by using the <code>ignore_unavailable=true</code> parameter.</p>
|
|
3143
|
+
<p>By default, you must explicitly name the indices you are opening or closing.
|
|
3144
|
+
To open or close indices with <code>_all</code>, <code>*</code>, or other wildcard expressions, change the <code>action.destructive_requires_name</code> setting to <code>false</code>.
|
|
3145
|
+
This setting can also be changed with the cluster update settings API.</p>
|
|
3146
|
+
<p>Closed indices consume a significant amount of disk-space which can cause problems in managed environments.
|
|
3147
|
+
Closing indices can be turned off with the cluster settings API by setting <code>cluster.indices.close.enable</code> to <code>false</code>.</p>
|
|
3148
|
+
<p>Because opening or closing an index allocates its shards, the <code>wait_for_active_shards</code> setting on index creation applies to the <code>_open</code> and <code>_close</code> index actions as well.</p>
|
|
3149
|
+
|
|
3150
|
+
|
|
3151
|
+
`<https://www.elastic.co/docs/api/doc/elasticsearch/v9/operation/operation-indices-open>`_
|
|
2835
3152
|
|
|
2836
3153
|
:param index: Comma-separated list of data streams, indices, and aliases used
|
|
2837
3154
|
to limit the request. Supports wildcards (`*`). By default, you must explicitly
|
|
@@ -2904,20 +3221,20 @@ class IndicesClient(NamespacedClient):
|
|
|
2904
3221
|
pretty: t.Optional[bool] = None,
|
|
2905
3222
|
) -> ObjectApiResponse[t.Any]:
|
|
2906
3223
|
"""
|
|
2907
|
-
|
|
2908
|
-
|
|
2909
|
-
|
|
2910
|
-
|
|
2911
|
-
|
|
2912
|
-
|
|
2913
|
-
|
|
2914
|
-
|
|
2915
|
-
|
|
2916
|
-
|
|
2917
|
-
|
|
2918
|
-
|
|
2919
|
-
|
|
2920
|
-
`<https://www.elastic.co/
|
|
3224
|
+
.. raw:: html
|
|
3225
|
+
|
|
3226
|
+
<p>Promote a data stream.
|
|
3227
|
+
Promote a data stream from a replicated data stream managed by cross-cluster replication (CCR) to a regular data stream.</p>
|
|
3228
|
+
<p>With CCR auto following, a data stream from a remote cluster can be replicated to the local cluster.
|
|
3229
|
+
These data streams can't be rolled over in the local cluster.
|
|
3230
|
+
These replicated data streams roll over only if the upstream data stream rolls over.
|
|
3231
|
+
In the event that the remote cluster is no longer available, the data stream in the local cluster can be promoted to a regular data stream, which allows these data streams to be rolled over in the local cluster.</p>
|
|
3232
|
+
<p>NOTE: When promoting a data stream, ensure the local cluster has a data stream enabled index template that matches the data stream.
|
|
3233
|
+
If this is missing, the data stream will not be able to roll over until a matching index template is created.
|
|
3234
|
+
This will affect the lifecycle management of the data stream and interfere with the data stream size and retention.</p>
|
|
3235
|
+
|
|
3236
|
+
|
|
3237
|
+
`<https://www.elastic.co/docs/api/doc/elasticsearch/v9/operation/operation-indices-promote-data-stream>`_
|
|
2921
3238
|
|
|
2922
3239
|
:param name: The name of the data stream
|
|
2923
3240
|
:param master_timeout: Period to wait for a connection to the master node. If
|
|
@@ -2977,9 +3294,13 @@ class IndicesClient(NamespacedClient):
|
|
|
2977
3294
|
body: t.Optional[t.Dict[str, t.Any]] = None,
|
|
2978
3295
|
) -> ObjectApiResponse[t.Any]:
|
|
2979
3296
|
"""
|
|
2980
|
-
|
|
3297
|
+
.. raw:: html
|
|
3298
|
+
|
|
3299
|
+
<p>Create or update an alias.
|
|
3300
|
+
Adds a data stream or index to an alias.</p>
|
|
3301
|
+
|
|
2981
3302
|
|
|
2982
|
-
`<https://www.elastic.co/
|
|
3303
|
+
`<https://www.elastic.co/docs/api/doc/elasticsearch/v9/operation/operation-indices-put-alias>`_
|
|
2983
3304
|
|
|
2984
3305
|
:param index: Comma-separated list of data streams or indices to add. Supports
|
|
2985
3306
|
wildcards (`*`). Wildcard patterns that match both data streams and indices
|
|
@@ -3054,7 +3375,7 @@ class IndicesClient(NamespacedClient):
|
|
|
3054
3375
|
)
|
|
3055
3376
|
|
|
3056
3377
|
@_rewrite_parameters(
|
|
3057
|
-
body_fields=("data_retention", "downsampling"),
|
|
3378
|
+
body_fields=("data_retention", "downsampling", "enabled"),
|
|
3058
3379
|
)
|
|
3059
3380
|
async def put_data_lifecycle(
|
|
3060
3381
|
self,
|
|
@@ -3062,6 +3383,7 @@ class IndicesClient(NamespacedClient):
|
|
|
3062
3383
|
name: t.Union[str, t.Sequence[str]],
|
|
3063
3384
|
data_retention: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None,
|
|
3064
3385
|
downsampling: t.Optional[t.Mapping[str, t.Any]] = None,
|
|
3386
|
+
enabled: t.Optional[bool] = None,
|
|
3065
3387
|
error_trace: t.Optional[bool] = None,
|
|
3066
3388
|
expand_wildcards: t.Optional[
|
|
3067
3389
|
t.Union[
|
|
@@ -3079,10 +3401,13 @@ class IndicesClient(NamespacedClient):
|
|
|
3079
3401
|
body: t.Optional[t.Dict[str, t.Any]] = None,
|
|
3080
3402
|
) -> ObjectApiResponse[t.Any]:
|
|
3081
3403
|
"""
|
|
3082
|
-
|
|
3083
|
-
data streams.
|
|
3404
|
+
.. raw:: html
|
|
3084
3405
|
|
|
3085
|
-
|
|
3406
|
+
<p>Update data stream lifecycles.
|
|
3407
|
+
Update the data stream lifecycle of the specified data streams.</p>
|
|
3408
|
+
|
|
3409
|
+
|
|
3410
|
+
`<https://www.elastic.co/docs/api/doc/elasticsearch/v9/operation/operation-indices-put-data-lifecycle>`_
|
|
3086
3411
|
|
|
3087
3412
|
:param name: Comma-separated list of data streams used to limit the request.
|
|
3088
3413
|
Supports wildcards (`*`). To target all data streams use `*` or `_all`.
|
|
@@ -3090,9 +3415,11 @@ class IndicesClient(NamespacedClient):
|
|
|
3090
3415
|
be stored at least for this time frame. Any time after this duration the
|
|
3091
3416
|
document could be deleted. When empty, every document in this data stream
|
|
3092
3417
|
will be stored indefinitely.
|
|
3093
|
-
:param downsampling:
|
|
3094
|
-
|
|
3095
|
-
|
|
3418
|
+
:param downsampling: The downsampling configuration to execute for the managed
|
|
3419
|
+
backing index after rollover.
|
|
3420
|
+
:param enabled: If defined, it turns data stream lifecycle on/off (`true`/`false`)
|
|
3421
|
+
for this data stream. A data stream lifecycle that's disabled (enabled: `false`)
|
|
3422
|
+
will have no effect on the data stream.
|
|
3096
3423
|
:param expand_wildcards: Type of data stream that wildcard patterns can match.
|
|
3097
3424
|
Supports comma-separated values, such as `open,hidden`. Valid values are:
|
|
3098
3425
|
`all`, `hidden`, `open`, `closed`, `none`.
|
|
@@ -3127,6 +3454,8 @@ class IndicesClient(NamespacedClient):
|
|
|
3127
3454
|
__body["data_retention"] = data_retention
|
|
3128
3455
|
if downsampling is not None:
|
|
3129
3456
|
__body["downsampling"] = downsampling
|
|
3457
|
+
if enabled is not None:
|
|
3458
|
+
__body["enabled"] = enabled
|
|
3130
3459
|
if not __body:
|
|
3131
3460
|
__body = None # type: ignore[assignment]
|
|
3132
3461
|
__headers = {"accept": "application/json"}
|
|
@@ -3181,36 +3510,32 @@ class IndicesClient(NamespacedClient):
|
|
|
3181
3510
|
body: t.Optional[t.Dict[str, t.Any]] = None,
|
|
3182
3511
|
) -> ObjectApiResponse[t.Any]:
|
|
3183
3512
|
"""
|
|
3184
|
-
|
|
3185
|
-
|
|
3186
|
-
|
|
3187
|
-
|
|
3188
|
-
|
|
3189
|
-
|
|
3190
|
-
|
|
3191
|
-
|
|
3192
|
-
|
|
3193
|
-
|
|
3194
|
-
|
|
3195
|
-
|
|
3196
|
-
|
|
3197
|
-
|
|
3198
|
-
|
|
3199
|
-
|
|
3200
|
-
|
|
3201
|
-
|
|
3202
|
-
|
|
3203
|
-
|
|
3204
|
-
|
|
3205
|
-
|
|
3206
|
-
|
|
3207
|
-
|
|
3208
|
-
|
|
3209
|
-
|
|
3210
|
-
default new `dynamic_templates` entries are appended onto the end. If an entry
|
|
3211
|
-
already exists with the same key, then it is overwritten by the new definition.
|
|
3212
|
-
|
|
3213
|
-
`<https://www.elastic.co/guide/en/elasticsearch/reference/8.17/indices-put-template.html>`_
|
|
3513
|
+
.. raw:: html
|
|
3514
|
+
|
|
3515
|
+
<p>Create or update an index template.
|
|
3516
|
+
Index templates define settings, mappings, and aliases that can be applied automatically to new indices.</p>
|
|
3517
|
+
<p>Elasticsearch applies templates to new indices based on an wildcard pattern that matches the index name.
|
|
3518
|
+
Index templates are applied during data stream or index creation.
|
|
3519
|
+
For data streams, these settings and mappings are applied when the stream's backing indices are created.
|
|
3520
|
+
Settings and mappings specified in a create index API request override any settings or mappings specified in an index template.
|
|
3521
|
+
Changes to index templates do not affect existing indices, including the existing backing indices of a data stream.</p>
|
|
3522
|
+
<p>You can use C-style <code>/* *\\/</code> block comments in index templates.
|
|
3523
|
+
You can include comments anywhere in the request body, except before the opening curly bracket.</p>
|
|
3524
|
+
<p><strong>Multiple matching templates</strong></p>
|
|
3525
|
+
<p>If multiple index templates match the name of a new index or data stream, the template with the highest priority is used.</p>
|
|
3526
|
+
<p>Multiple templates with overlapping index patterns at the same priority are not allowed and an error will be thrown when attempting to create a template matching an existing index template at identical priorities.</p>
|
|
3527
|
+
<p><strong>Composing aliases, mappings, and settings</strong></p>
|
|
3528
|
+
<p>When multiple component templates are specified in the <code>composed_of</code> field for an index template, they are merged in the order specified, meaning that later component templates override earlier component templates.
|
|
3529
|
+
Any mappings, settings, or aliases from the parent index template are merged in next.
|
|
3530
|
+
Finally, any configuration on the index request itself is merged.
|
|
3531
|
+
Mapping definitions are merged recursively, which means that later mapping components can introduce new field mappings and update the mapping configuration.
|
|
3532
|
+
If a field mapping is already contained in an earlier component, its definition will be completely overwritten by the later one.
|
|
3533
|
+
This recursive merging strategy applies not only to field mappings, but also root options like <code>dynamic_templates</code> and <code>meta</code>.
|
|
3534
|
+
If an earlier component contains a <code>dynamic_templates</code> block, then by default new <code>dynamic_templates</code> entries are appended onto the end.
|
|
3535
|
+
If an entry already exists with the same key, then it is overwritten by the new definition.</p>
|
|
3536
|
+
|
|
3537
|
+
|
|
3538
|
+
`<https://www.elastic.co/docs/api/doc/elasticsearch/v9/operation/operation-indices-put-index-template>`_
|
|
3214
3539
|
|
|
3215
3540
|
:param name: Index or template name
|
|
3216
3541
|
:param allow_auto_create: This setting overrides the value of the `action.auto_create_index`
|
|
@@ -3341,10 +3666,7 @@ class IndicesClient(NamespacedClient):
|
|
|
3341
3666
|
] = None,
|
|
3342
3667
|
dynamic_date_formats: t.Optional[t.Sequence[str]] = None,
|
|
3343
3668
|
dynamic_templates: t.Optional[
|
|
3344
|
-
t.
|
|
3345
|
-
t.Mapping[str, t.Mapping[str, t.Any]],
|
|
3346
|
-
t.Sequence[t.Mapping[str, t.Mapping[str, t.Any]]],
|
|
3347
|
-
]
|
|
3669
|
+
t.Sequence[t.Mapping[str, t.Mapping[str, t.Any]]]
|
|
3348
3670
|
] = None,
|
|
3349
3671
|
error_trace: t.Optional[bool] = None,
|
|
3350
3672
|
expand_wildcards: t.Optional[
|
|
@@ -3372,29 +3694,31 @@ class IndicesClient(NamespacedClient):
|
|
|
3372
3694
|
body: t.Optional[t.Dict[str, t.Any]] = None,
|
|
3373
3695
|
) -> ObjectApiResponse[t.Any]:
|
|
3374
3696
|
"""
|
|
3375
|
-
|
|
3376
|
-
|
|
3377
|
-
|
|
3378
|
-
|
|
3379
|
-
|
|
3380
|
-
|
|
3381
|
-
|
|
3382
|
-
|
|
3383
|
-
|
|
3384
|
-
|
|
3385
|
-
|
|
3386
|
-
|
|
3387
|
-
|
|
3388
|
-
|
|
3389
|
-
|
|
3390
|
-
|
|
3391
|
-
|
|
3392
|
-
|
|
3393
|
-
|
|
3394
|
-
|
|
3395
|
-
|
|
3396
|
-
|
|
3397
|
-
|
|
3697
|
+
.. raw:: html
|
|
3698
|
+
|
|
3699
|
+
<p>Update field mappings.
|
|
3700
|
+
Add new fields to an existing data stream or index.
|
|
3701
|
+
You can also use this API to change the search settings of existing fields and add new properties to existing object fields.
|
|
3702
|
+
For data streams, these changes are applied to all backing indices by default.</p>
|
|
3703
|
+
<p><strong>Add multi-fields to an existing field</strong></p>
|
|
3704
|
+
<p>Multi-fields let you index the same field in different ways.
|
|
3705
|
+
You can use this API to update the fields mapping parameter and enable multi-fields for an existing field.
|
|
3706
|
+
WARNING: If an index (or data stream) contains documents when you add a multi-field, those documents will not have values for the new multi-field.
|
|
3707
|
+
You can populate the new multi-field with the update by query API.</p>
|
|
3708
|
+
<p><strong>Change supported mapping parameters for an existing field</strong></p>
|
|
3709
|
+
<p>The documentation for each mapping parameter indicates whether you can update it for an existing field using this API.
|
|
3710
|
+
For example, you can use the update mapping API to update the <code>ignore_above</code> parameter.</p>
|
|
3711
|
+
<p><strong>Change the mapping of an existing field</strong></p>
|
|
3712
|
+
<p>Except for supported mapping parameters, you can't change the mapping or field type of an existing field.
|
|
3713
|
+
Changing an existing field could invalidate data that's already indexed.</p>
|
|
3714
|
+
<p>If you need to change the mapping of a field in a data stream's backing indices, refer to documentation about modifying data streams.
|
|
3715
|
+
If you need to change the mapping of a field in other indices, create a new index with the correct mapping and reindex your data into that index.</p>
|
|
3716
|
+
<p><strong>Rename a field</strong></p>
|
|
3717
|
+
<p>Renaming a field would invalidate data already indexed under the old field name.
|
|
3718
|
+
Instead, add an alias field to create an alternate field name.</p>
|
|
3719
|
+
|
|
3720
|
+
|
|
3721
|
+
`<https://www.elastic.co/docs/api/doc/elasticsearch/v9/operation/operation-indices-put-mapping>`_
|
|
3398
3722
|
|
|
3399
3723
|
:param index: A comma-separated list of index names the mapping should be added
|
|
3400
3724
|
to (supports wildcards); use `_all` or omit to add the mapping on all indices.
|
|
@@ -3518,26 +3842,29 @@ class IndicesClient(NamespacedClient):
|
|
|
3518
3842
|
master_timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None,
|
|
3519
3843
|
preserve_existing: t.Optional[bool] = None,
|
|
3520
3844
|
pretty: t.Optional[bool] = None,
|
|
3845
|
+
reopen: t.Optional[bool] = None,
|
|
3521
3846
|
timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None,
|
|
3522
3847
|
) -> ObjectApiResponse[t.Any]:
|
|
3523
3848
|
"""
|
|
3524
|
-
|
|
3525
|
-
|
|
3526
|
-
|
|
3527
|
-
|
|
3528
|
-
|
|
3529
|
-
|
|
3530
|
-
|
|
3531
|
-
|
|
3532
|
-
|
|
3533
|
-
|
|
3534
|
-
|
|
3535
|
-
|
|
3536
|
-
|
|
3537
|
-
|
|
3538
|
-
|
|
3539
|
-
|
|
3540
|
-
|
|
3849
|
+
.. raw:: html
|
|
3850
|
+
|
|
3851
|
+
<p>Update index settings.
|
|
3852
|
+
Changes dynamic index settings in real time.
|
|
3853
|
+
For data streams, index setting changes are applied to all backing indices by default.</p>
|
|
3854
|
+
<p>To revert a setting to the default value, use a null value.
|
|
3855
|
+
The list of per-index settings that can be updated dynamically on live indices can be found in index module documentation.
|
|
3856
|
+
To preserve existing settings from being updated, set the <code>preserve_existing</code> parameter to <code>true</code>.</p>
|
|
3857
|
+
<p>NOTE: You can only define new analyzers on closed indices.
|
|
3858
|
+
To add an analyzer, you must close the index, define the analyzer, and reopen the index.
|
|
3859
|
+
You cannot close the write index of a data stream.
|
|
3860
|
+
To update the analyzer for a data stream's write index and future backing indices, update the analyzer in the index template used by the stream.
|
|
3861
|
+
Then roll over the data stream to apply the new analyzer to the stream's write index and future backing indices.
|
|
3862
|
+
This affects searches and any new data added to the stream after the rollover.
|
|
3863
|
+
However, it does not affect the data stream's backing indices or their existing data.
|
|
3864
|
+
To change the analyzer for existing backing indices, you must create a new data stream and reindex your data into it.</p>
|
|
3865
|
+
|
|
3866
|
+
|
|
3867
|
+
`<https://www.elastic.co/docs/api/doc/elasticsearch/v9/operation/operation-indices-put-settings>`_
|
|
3541
3868
|
|
|
3542
3869
|
:param settings:
|
|
3543
3870
|
:param index: Comma-separated list of data streams, indices, and aliases used
|
|
@@ -3558,6 +3885,9 @@ class IndicesClient(NamespacedClient):
|
|
|
3558
3885
|
no response is received before the timeout expires, the request fails and
|
|
3559
3886
|
returns an error.
|
|
3560
3887
|
:param preserve_existing: If `true`, existing index settings remain unchanged.
|
|
3888
|
+
:param reopen: Whether to close and reopen the index to apply non-dynamic settings.
|
|
3889
|
+
If set to `true` the indices to which the settings are being applied will
|
|
3890
|
+
be closed temporarily and then reopened in order to apply the changes.
|
|
3561
3891
|
:param timeout: Period to wait for a response. If no response is received before
|
|
3562
3892
|
the timeout expires, the request fails and returns an error.
|
|
3563
3893
|
"""
|
|
@@ -3595,6 +3925,8 @@ class IndicesClient(NamespacedClient):
|
|
|
3595
3925
|
__query["preserve_existing"] = preserve_existing
|
|
3596
3926
|
if pretty is not None:
|
|
3597
3927
|
__query["pretty"] = pretty
|
|
3928
|
+
if reopen is not None:
|
|
3929
|
+
__query["reopen"] = reopen
|
|
3598
3930
|
if timeout is not None:
|
|
3599
3931
|
__query["timeout"] = timeout
|
|
3600
3932
|
__body = settings if settings is not None else body
|
|
@@ -3639,30 +3971,30 @@ class IndicesClient(NamespacedClient):
|
|
|
3639
3971
|
body: t.Optional[t.Dict[str, t.Any]] = None,
|
|
3640
3972
|
) -> ObjectApiResponse[t.Any]:
|
|
3641
3973
|
"""
|
|
3642
|
-
|
|
3643
|
-
|
|
3644
|
-
|
|
3645
|
-
|
|
3646
|
-
|
|
3647
|
-
|
|
3648
|
-
|
|
3649
|
-
|
|
3650
|
-
|
|
3651
|
-
|
|
3652
|
-
|
|
3653
|
-
|
|
3654
|
-
|
|
3655
|
-
|
|
3656
|
-
|
|
3657
|
-
|
|
3658
|
-
|
|
3659
|
-
|
|
3660
|
-
|
|
3661
|
-
`<https://www.elastic.co/
|
|
3974
|
+
.. raw:: html
|
|
3975
|
+
|
|
3976
|
+
<p>Create or update an index template.
|
|
3977
|
+
Index templates define settings, mappings, and aliases that can be applied automatically to new indices.
|
|
3978
|
+
Elasticsearch applies templates to new indices based on an index pattern that matches the index name.</p>
|
|
3979
|
+
<p>IMPORTANT: This documentation is about legacy index templates, which are deprecated and will be replaced by the composable templates introduced in Elasticsearch 7.8.</p>
|
|
3980
|
+
<p>Composable templates always take precedence over legacy templates.
|
|
3981
|
+
If no composable template matches a new index, matching legacy templates are applied according to their order.</p>
|
|
3982
|
+
<p>Index templates are only applied during index creation.
|
|
3983
|
+
Changes to index templates do not affect existing indices.
|
|
3984
|
+
Settings and mappings specified in create index API requests override any settings or mappings specified in an index template.</p>
|
|
3985
|
+
<p>You can use C-style <code>/* *\\/</code> block comments in index templates.
|
|
3986
|
+
You can include comments anywhere in the request body, except before the opening curly bracket.</p>
|
|
3987
|
+
<p><strong>Indices matching multiple templates</strong></p>
|
|
3988
|
+
<p>Multiple index templates can potentially match an index, in this case, both the settings and mappings are merged into the final configuration of the index.
|
|
3989
|
+
The order of the merging can be controlled using the order parameter, with lower order being applied first, and higher orders overriding them.
|
|
3990
|
+
NOTE: Multiple matching templates with the same order value will result in a non-deterministic merging order.</p>
|
|
3991
|
+
|
|
3992
|
+
|
|
3993
|
+
`<https://www.elastic.co/docs/api/doc/elasticsearch/v9/operation/operation-indices-put-template>`_
|
|
3662
3994
|
|
|
3663
3995
|
:param name: The name of the template
|
|
3664
3996
|
:param aliases: Aliases for the index.
|
|
3665
|
-
:param cause:
|
|
3997
|
+
:param cause: User defined reason for creating/updating the index template
|
|
3666
3998
|
:param create: If true, this request cannot replace or update existing index
|
|
3667
3999
|
templates.
|
|
3668
4000
|
:param index_patterns: Array of wildcard expressions used to match the names
|
|
@@ -3737,29 +4069,30 @@ class IndicesClient(NamespacedClient):
|
|
|
3737
4069
|
pretty: t.Optional[bool] = None,
|
|
3738
4070
|
) -> ObjectApiResponse[t.Any]:
|
|
3739
4071
|
"""
|
|
3740
|
-
|
|
3741
|
-
|
|
3742
|
-
|
|
3743
|
-
|
|
3744
|
-
|
|
3745
|
-
|
|
3746
|
-
|
|
3747
|
-
|
|
3748
|
-
|
|
3749
|
-
|
|
3750
|
-
|
|
3751
|
-
|
|
3752
|
-
|
|
3753
|
-
|
|
3754
|
-
|
|
3755
|
-
|
|
3756
|
-
|
|
3757
|
-
|
|
3758
|
-
|
|
3759
|
-
|
|
3760
|
-
|
|
3761
|
-
|
|
3762
|
-
|
|
4072
|
+
.. raw:: html
|
|
4073
|
+
|
|
4074
|
+
<p>Get index recovery information.
|
|
4075
|
+
Get information about ongoing and completed shard recoveries for one or more indices.
|
|
4076
|
+
For data streams, the API returns information for the stream's backing indices.</p>
|
|
4077
|
+
<p>All recoveries, whether ongoing or complete, are kept in the cluster state and may be reported on at any time.</p>
|
|
4078
|
+
<p>Shard recovery is the process of initializing a shard copy, such as restoring a primary shard from a snapshot or creating a replica shard from a primary shard.
|
|
4079
|
+
When a shard recovery completes, the recovered shard is available for search and indexing.</p>
|
|
4080
|
+
<p>Recovery automatically occurs during the following processes:</p>
|
|
4081
|
+
<ul>
|
|
4082
|
+
<li>When creating an index for the first time.</li>
|
|
4083
|
+
<li>When a node rejoins the cluster and starts up any missing primary shard copies using the data that it holds in its data path.</li>
|
|
4084
|
+
<li>Creation of new replica shard copies from the primary.</li>
|
|
4085
|
+
<li>Relocation of a shard copy to a different node in the same cluster.</li>
|
|
4086
|
+
<li>A snapshot restore operation.</li>
|
|
4087
|
+
<li>A clone, shrink, or split operation.</li>
|
|
4088
|
+
</ul>
|
|
4089
|
+
<p>You can determine the cause of a shard recovery using the recovery or cat recovery APIs.</p>
|
|
4090
|
+
<p>The index recovery API reports information about completed recoveries only for shard copies that currently exist in the cluster.
|
|
4091
|
+
It only reports the last recovery for each shard copy and does not report historical information about earlier recoveries, nor does it report information about the recoveries of shard copies that no longer exist.
|
|
4092
|
+
This means that if a shard copy completes a recovery and then Elasticsearch relocates it onto a different node then the information about the original recovery will not be shown in the recovery API.</p>
|
|
4093
|
+
|
|
4094
|
+
|
|
4095
|
+
`<https://www.elastic.co/docs/api/doc/elasticsearch/v9/operation/operation-indices-recovery>`_
|
|
3763
4096
|
|
|
3764
4097
|
:param index: Comma-separated list of data streams, indices, and aliases used
|
|
3765
4098
|
to limit the request. Supports wildcards (`*`). To target all data streams
|
|
@@ -3819,21 +4152,21 @@ class IndicesClient(NamespacedClient):
|
|
|
3819
4152
|
pretty: t.Optional[bool] = None,
|
|
3820
4153
|
) -> ObjectApiResponse[t.Any]:
|
|
3821
4154
|
"""
|
|
3822
|
-
|
|
3823
|
-
|
|
3824
|
-
|
|
3825
|
-
|
|
3826
|
-
|
|
3827
|
-
|
|
3828
|
-
|
|
3829
|
-
|
|
3830
|
-
|
|
3831
|
-
|
|
3832
|
-
|
|
3833
|
-
|
|
3834
|
-
|
|
3835
|
-
|
|
3836
|
-
`<https://www.elastic.co/
|
|
4155
|
+
.. raw:: html
|
|
4156
|
+
|
|
4157
|
+
<p>Refresh an index.
|
|
4158
|
+
A refresh makes recent operations performed on one or more indices available for search.
|
|
4159
|
+
For data streams, the API runs the refresh operation on the stream’s backing indices.</p>
|
|
4160
|
+
<p>By default, Elasticsearch periodically refreshes indices every second, but only on indices that have received one search request or more in the last 30 seconds.
|
|
4161
|
+
You can change this default interval with the <code>index.refresh_interval</code> setting.</p>
|
|
4162
|
+
<p>Refresh requests are synchronous and do not return a response until the refresh operation completes.</p>
|
|
4163
|
+
<p>Refreshes are resource-intensive.
|
|
4164
|
+
To ensure good cluster performance, it's recommended to wait for Elasticsearch's periodic refresh rather than performing an explicit refresh when possible.</p>
|
|
4165
|
+
<p>If your application workflow indexes documents and then runs a search to retrieve the indexed document, it's recommended to use the index API's <code>refresh=wait_for</code> query parameter option.
|
|
4166
|
+
This option ensures the indexing operation waits for a periodic refresh before running the search.</p>
|
|
4167
|
+
|
|
4168
|
+
|
|
4169
|
+
`<https://www.elastic.co/docs/api/doc/elasticsearch/v9/operation/operation-indices-refresh>`_
|
|
3837
4170
|
|
|
3838
4171
|
:param index: Comma-separated list of data streams, indices, and aliases used
|
|
3839
4172
|
to limit the request. Supports wildcards (`*`). To target all data streams
|
|
@@ -3899,25 +4232,25 @@ class IndicesClient(NamespacedClient):
|
|
|
3899
4232
|
human: t.Optional[bool] = None,
|
|
3900
4233
|
ignore_unavailable: t.Optional[bool] = None,
|
|
3901
4234
|
pretty: t.Optional[bool] = None,
|
|
4235
|
+
resource: t.Optional[str] = None,
|
|
3902
4236
|
) -> ObjectApiResponse[t.Any]:
|
|
3903
4237
|
"""
|
|
3904
|
-
|
|
3905
|
-
|
|
3906
|
-
|
|
3907
|
-
|
|
3908
|
-
|
|
3909
|
-
|
|
3910
|
-
|
|
3911
|
-
|
|
3912
|
-
|
|
3913
|
-
|
|
3914
|
-
|
|
3915
|
-
|
|
3916
|
-
|
|
3917
|
-
|
|
3918
|
-
|
|
3919
|
-
|
|
3920
|
-
`<https://www.elastic.co/guide/en/elasticsearch/reference/8.17/indices-reload-analyzers.html>`_
|
|
4238
|
+
.. raw:: html
|
|
4239
|
+
|
|
4240
|
+
<p>Reload search analyzers.
|
|
4241
|
+
Reload an index's search analyzers and their resources.
|
|
4242
|
+
For data streams, the API reloads search analyzers and resources for the stream's backing indices.</p>
|
|
4243
|
+
<p>IMPORTANT: After reloading the search analyzers you should clear the request cache to make sure it doesn't contain responses derived from the previous versions of the analyzer.</p>
|
|
4244
|
+
<p>You can use the reload search analyzers API to pick up changes to synonym files used in the <code>synonym_graph</code> or <code>synonym</code> token filter of a search analyzer.
|
|
4245
|
+
To be eligible, the token filter must have an <code>updateable</code> flag of <code>true</code> and only be used in search analyzers.</p>
|
|
4246
|
+
<p>NOTE: This API does not perform a reload for each shard of an index.
|
|
4247
|
+
Instead, it performs a reload for each node containing index shards.
|
|
4248
|
+
As a result, the total shard count returned by the API can differ from the number of index shards.
|
|
4249
|
+
Because reloading affects every node with an index shard, it is important to update the synonym file on every data node in the cluster--including nodes that don't contain a shard replica--before using this API.
|
|
4250
|
+
This ensures the synonym file is updated everywhere in the cluster in case shards are relocated in the future.</p>
|
|
4251
|
+
|
|
4252
|
+
|
|
4253
|
+
`<https://www.elastic.co/docs/api/doc/elasticsearch/v9/operation/operation-indices-reload-search-analyzers>`_
|
|
3921
4254
|
|
|
3922
4255
|
:param index: A comma-separated list of index names to reload analyzers for
|
|
3923
4256
|
:param allow_no_indices: Whether to ignore if a wildcard indices expression resolves
|
|
@@ -3927,6 +4260,7 @@ class IndicesClient(NamespacedClient):
|
|
|
3927
4260
|
that are open, closed or both.
|
|
3928
4261
|
:param ignore_unavailable: Whether specified concrete indices should be ignored
|
|
3929
4262
|
when unavailable (missing or closed)
|
|
4263
|
+
:param resource: Changed resource to reload analyzers from if applicable
|
|
3930
4264
|
"""
|
|
3931
4265
|
if index in SKIP_IN_PATH:
|
|
3932
4266
|
raise ValueError("Empty value passed for parameter 'index'")
|
|
@@ -3947,6 +4281,8 @@ class IndicesClient(NamespacedClient):
|
|
|
3947
4281
|
__query["ignore_unavailable"] = ignore_unavailable
|
|
3948
4282
|
if pretty is not None:
|
|
3949
4283
|
__query["pretty"] = pretty
|
|
4284
|
+
if resource is not None:
|
|
4285
|
+
__query["resource"] = resource
|
|
3950
4286
|
__headers = {"accept": "application/json"}
|
|
3951
4287
|
return await self.perform_request( # type: ignore[return-value]
|
|
3952
4288
|
"POST",
|
|
@@ -3961,7 +4297,7 @@ class IndicesClient(NamespacedClient):
|
|
|
3961
4297
|
async def resolve_cluster(
|
|
3962
4298
|
self,
|
|
3963
4299
|
*,
|
|
3964
|
-
name: t.Union[str, t.Sequence[str]],
|
|
4300
|
+
name: t.Optional[t.Union[str, t.Sequence[str]]] = None,
|
|
3965
4301
|
allow_no_indices: t.Optional[bool] = None,
|
|
3966
4302
|
error_trace: t.Optional[bool] = None,
|
|
3967
4303
|
expand_wildcards: t.Optional[
|
|
@@ -3977,64 +4313,95 @@ class IndicesClient(NamespacedClient):
|
|
|
3977
4313
|
ignore_throttled: t.Optional[bool] = None,
|
|
3978
4314
|
ignore_unavailable: t.Optional[bool] = None,
|
|
3979
4315
|
pretty: t.Optional[bool] = None,
|
|
4316
|
+
timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None,
|
|
3980
4317
|
) -> ObjectApiResponse[t.Any]:
|
|
3981
4318
|
"""
|
|
3982
|
-
|
|
3983
|
-
|
|
3984
|
-
|
|
3985
|
-
|
|
3986
|
-
|
|
3987
|
-
|
|
3988
|
-
|
|
3989
|
-
|
|
3990
|
-
|
|
3991
|
-
|
|
3992
|
-
|
|
3993
|
-
|
|
3994
|
-
|
|
3995
|
-
|
|
3996
|
-
|
|
3997
|
-
|
|
3998
|
-
|
|
3999
|
-
|
|
4000
|
-
|
|
4001
|
-
|
|
4002
|
-
|
|
4003
|
-
|
|
4004
|
-
|
|
4005
|
-
|
|
4006
|
-
|
|
4007
|
-
|
|
4008
|
-
|
|
4009
|
-
|
|
4010
|
-
|
|
4011
|
-
|
|
4012
|
-
|
|
4013
|
-
|
|
4014
|
-
|
|
4015
|
-
|
|
4016
|
-
|
|
4017
|
-
|
|
4018
|
-
|
|
4019
|
-
|
|
4319
|
+
.. raw:: html
|
|
4320
|
+
|
|
4321
|
+
<p>Resolve the cluster.</p>
|
|
4322
|
+
<p>Resolve the specified index expressions to return information about each cluster, including the local "querying" cluster, if included.
|
|
4323
|
+
If no index expression is provided, the API will return information about all the remote clusters that are configured on the querying cluster.</p>
|
|
4324
|
+
<p>This endpoint is useful before doing a cross-cluster search in order to determine which remote clusters should be included in a search.</p>
|
|
4325
|
+
<p>You use the same index expression with this endpoint as you would for cross-cluster search.
|
|
4326
|
+
Index and cluster exclusions are also supported with this endpoint.</p>
|
|
4327
|
+
<p>For each cluster in the index expression, information is returned about:</p>
|
|
4328
|
+
<ul>
|
|
4329
|
+
<li>Whether the querying ("local") cluster is currently connected to each remote cluster specified in the index expression. Note that this endpoint actively attempts to contact the remote clusters, unlike the <code>remote/info</code> endpoint.</li>
|
|
4330
|
+
<li>Whether each remote cluster is configured with <code>skip_unavailable</code> as <code>true</code> or <code>false</code>.</li>
|
|
4331
|
+
<li>Whether there are any indices, aliases, or data streams on that cluster that match the index expression.</li>
|
|
4332
|
+
<li>Whether the search is likely to have errors returned when you do the cross-cluster search (including any authorization errors if you do not have permission to query the index).</li>
|
|
4333
|
+
<li>Cluster version information, including the Elasticsearch server version.</li>
|
|
4334
|
+
</ul>
|
|
4335
|
+
<p>For example, <code>GET /_resolve/cluster/my-index-*,cluster*:my-index-*</code> returns information about the local cluster and all remotely configured clusters that start with the alias <code>cluster*</code>.
|
|
4336
|
+
Each cluster returns information about whether it has any indices, aliases or data streams that match <code>my-index-*</code>.</p>
|
|
4337
|
+
<h2>Note on backwards compatibility</h2>
|
|
4338
|
+
<p>The ability to query without an index expression was added in version 8.18, so when
|
|
4339
|
+
querying remote clusters older than that, the local cluster will send the index
|
|
4340
|
+
expression <code>dummy*</code> to those remote clusters. Thus, if an errors occur, you may see a reference
|
|
4341
|
+
to that index expression even though you didn't request it. If it causes a problem, you can
|
|
4342
|
+
instead include an index expression like <code>*:*</code> to bypass the issue.</p>
|
|
4343
|
+
<h2>Advantages of using this endpoint before a cross-cluster search</h2>
|
|
4344
|
+
<p>You may want to exclude a cluster or index from a search when:</p>
|
|
4345
|
+
<ul>
|
|
4346
|
+
<li>A remote cluster is not currently connected and is configured with <code>skip_unavailable=false</code>. Running a cross-cluster search under those conditions will cause the entire search to fail.</li>
|
|
4347
|
+
<li>A cluster has no matching indices, aliases or data streams for the index expression (or your user does not have permissions to search them). For example, suppose your index expression is <code>logs*,remote1:logs*</code> and the remote1 cluster has no indices, aliases or data streams that match <code>logs*</code>. In that case, that cluster will return no results from that cluster if you include it in a cross-cluster search.</li>
|
|
4348
|
+
<li>The index expression (combined with any query parameters you specify) will likely cause an exception to be thrown when you do the search. In these cases, the "error" field in the <code>_resolve/cluster</code> response will be present. (This is also where security/permission errors will be shown.)</li>
|
|
4349
|
+
<li>A remote cluster is an older version that does not support the feature you want to use in your search.</li>
|
|
4350
|
+
</ul>
|
|
4351
|
+
<h2>Test availability of remote clusters</h2>
|
|
4352
|
+
<p>The <code>remote/info</code> endpoint is commonly used to test whether the "local" cluster (the cluster being queried) is connected to its remote clusters, but it does not necessarily reflect whether the remote cluster is available or not.
|
|
4353
|
+
The remote cluster may be available, while the local cluster is not currently connected to it.</p>
|
|
4354
|
+
<p>You can use the <code>_resolve/cluster</code> API to attempt to reconnect to remote clusters.
|
|
4355
|
+
For example with <code>GET _resolve/cluster</code> or <code>GET _resolve/cluster/*:*</code>.
|
|
4356
|
+
The <code>connected</code> field in the response will indicate whether it was successful.
|
|
4357
|
+
If a connection was (re-)established, this will also cause the <code>remote/info</code> endpoint to now indicate a connected status.</p>
|
|
4358
|
+
|
|
4359
|
+
|
|
4360
|
+
`<https://www.elastic.co/docs/api/doc/elasticsearch/v9/operation/operation-indices-resolve-cluster>`_
|
|
4361
|
+
|
|
4362
|
+
:param name: A comma-separated list of names or index patterns for the indices,
|
|
4363
|
+
aliases, and data streams to resolve. Resources on remote clusters can be
|
|
4364
|
+
specified using the `<cluster>`:`<name>` syntax. Index and cluster exclusions
|
|
4365
|
+
(e.g., `-cluster1:*`) are also supported. If no index expression is specified,
|
|
4366
|
+
information about all remote clusters configured on the local cluster is
|
|
4367
|
+
returned without doing any index matching
|
|
4020
4368
|
:param allow_no_indices: If false, the request returns an error if any wildcard
|
|
4021
|
-
expression, index alias, or _all value targets only missing or closed indices.
|
|
4369
|
+
expression, index alias, or `_all` value targets only missing or closed indices.
|
|
4022
4370
|
This behavior applies even if the request targets other open indices. For
|
|
4023
|
-
example, a request targeting foo*,bar
|
|
4024
|
-
with foo but no index starts with bar
|
|
4371
|
+
example, a request targeting `foo*,bar*` returns an error if an index starts
|
|
4372
|
+
with `foo` but no index starts with `bar`. NOTE: This option is only supported
|
|
4373
|
+
when specifying an index expression. You will get an error if you specify
|
|
4374
|
+
index options to the `_resolve/cluster` API endpoint that takes no index
|
|
4375
|
+
expression.
|
|
4025
4376
|
:param expand_wildcards: Type of index that wildcard patterns can match. If the
|
|
4026
4377
|
request can target data streams, this argument determines whether wildcard
|
|
4027
4378
|
expressions match hidden data streams. Supports comma-separated values, such
|
|
4028
4379
|
as `open,hidden`. Valid values are: `all`, `open`, `closed`, `hidden`, `none`.
|
|
4029
|
-
|
|
4030
|
-
|
|
4380
|
+
NOTE: This option is only supported when specifying an index expression.
|
|
4381
|
+
You will get an error if you specify index options to the `_resolve/cluster`
|
|
4382
|
+
API endpoint that takes no index expression.
|
|
4383
|
+
:param ignore_throttled: If true, concrete, expanded, or aliased indices are
|
|
4384
|
+
ignored when frozen. NOTE: This option is only supported when specifying
|
|
4385
|
+
an index expression. You will get an error if you specify index options to
|
|
4386
|
+
the `_resolve/cluster` API endpoint that takes no index expression.
|
|
4031
4387
|
:param ignore_unavailable: If false, the request returns an error if it targets
|
|
4032
|
-
a missing or closed index.
|
|
4388
|
+
a missing or closed index. NOTE: This option is only supported when specifying
|
|
4389
|
+
an index expression. You will get an error if you specify index options to
|
|
4390
|
+
the `_resolve/cluster` API endpoint that takes no index expression.
|
|
4391
|
+
:param timeout: The maximum time to wait for remote clusters to respond. If a
|
|
4392
|
+
remote cluster does not respond within this timeout period, the API response
|
|
4393
|
+
will show the cluster as not connected and include an error message that
|
|
4394
|
+
the request timed out. The default timeout is unset and the query can take
|
|
4395
|
+
as long as the networking layer is configured to wait for remote clusters
|
|
4396
|
+
that are not responding (typically 30 seconds).
|
|
4033
4397
|
"""
|
|
4034
|
-
|
|
4035
|
-
|
|
4036
|
-
|
|
4037
|
-
|
|
4398
|
+
__path_parts: t.Dict[str, str]
|
|
4399
|
+
if name not in SKIP_IN_PATH:
|
|
4400
|
+
__path_parts = {"name": _quote(name)}
|
|
4401
|
+
__path = f'/_resolve/cluster/{__path_parts["name"]}'
|
|
4402
|
+
else:
|
|
4403
|
+
__path_parts = {}
|
|
4404
|
+
__path = "/_resolve/cluster"
|
|
4038
4405
|
__query: t.Dict[str, t.Any] = {}
|
|
4039
4406
|
if allow_no_indices is not None:
|
|
4040
4407
|
__query["allow_no_indices"] = allow_no_indices
|
|
@@ -4052,6 +4419,8 @@ class IndicesClient(NamespacedClient):
|
|
|
4052
4419
|
__query["ignore_unavailable"] = ignore_unavailable
|
|
4053
4420
|
if pretty is not None:
|
|
4054
4421
|
__query["pretty"] = pretty
|
|
4422
|
+
if timeout is not None:
|
|
4423
|
+
__query["timeout"] = timeout
|
|
4055
4424
|
__headers = {"accept": "application/json"}
|
|
4056
4425
|
return await self.perform_request( # type: ignore[return-value]
|
|
4057
4426
|
"GET",
|
|
@@ -4083,10 +4452,14 @@ class IndicesClient(NamespacedClient):
|
|
|
4083
4452
|
pretty: t.Optional[bool] = None,
|
|
4084
4453
|
) -> ObjectApiResponse[t.Any]:
|
|
4085
4454
|
"""
|
|
4086
|
-
|
|
4087
|
-
and data streams. Multiple patterns and remote clusters are supported.
|
|
4455
|
+
.. raw:: html
|
|
4088
4456
|
|
|
4089
|
-
|
|
4457
|
+
<p>Resolve indices.
|
|
4458
|
+
Resolve the names and/or index patterns for indices, aliases, and data streams.
|
|
4459
|
+
Multiple patterns and remote clusters are supported.</p>
|
|
4460
|
+
|
|
4461
|
+
|
|
4462
|
+
`<https://www.elastic.co/docs/api/doc/elasticsearch/v9/operation/operation-indices-resolve-index>`_
|
|
4090
4463
|
|
|
4091
4464
|
:param name: Comma-separated name(s) or index pattern(s) of the indices, aliases,
|
|
4092
4465
|
and data streams to resolve. Resources on remote clusters can be specified
|
|
@@ -4146,6 +4519,7 @@ class IndicesClient(NamespacedClient):
|
|
|
4146
4519
|
error_trace: t.Optional[bool] = None,
|
|
4147
4520
|
filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None,
|
|
4148
4521
|
human: t.Optional[bool] = None,
|
|
4522
|
+
lazy: t.Optional[bool] = None,
|
|
4149
4523
|
mappings: t.Optional[t.Mapping[str, t.Any]] = None,
|
|
4150
4524
|
master_timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None,
|
|
4151
4525
|
pretty: t.Optional[bool] = None,
|
|
@@ -4157,35 +4531,37 @@ class IndicesClient(NamespacedClient):
|
|
|
4157
4531
|
body: t.Optional[t.Dict[str, t.Any]] = None,
|
|
4158
4532
|
) -> ObjectApiResponse[t.Any]:
|
|
4159
4533
|
"""
|
|
4160
|
-
|
|
4161
|
-
|
|
4162
|
-
|
|
4163
|
-
|
|
4164
|
-
|
|
4165
|
-
|
|
4166
|
-
|
|
4167
|
-
|
|
4168
|
-
|
|
4169
|
-
|
|
4170
|
-
|
|
4171
|
-
|
|
4172
|
-
|
|
4173
|
-
|
|
4174
|
-
|
|
4175
|
-
|
|
4176
|
-
|
|
4177
|
-
|
|
4178
|
-
|
|
4179
|
-
|
|
4180
|
-
|
|
4181
|
-
|
|
4182
|
-
|
|
4183
|
-
|
|
4184
|
-
|
|
4185
|
-
|
|
4186
|
-
|
|
4187
|
-
|
|
4188
|
-
|
|
4534
|
+
.. raw:: html
|
|
4535
|
+
|
|
4536
|
+
<p>Roll over to a new index.
|
|
4537
|
+
TIP: It is recommended to use the index lifecycle rollover action to automate rollovers.</p>
|
|
4538
|
+
<p>The rollover API creates a new index for a data stream or index alias.
|
|
4539
|
+
The API behavior depends on the rollover target.</p>
|
|
4540
|
+
<p><strong>Roll over a data stream</strong></p>
|
|
4541
|
+
<p>If you roll over a data stream, the API creates a new write index for the stream.
|
|
4542
|
+
The stream's previous write index becomes a regular backing index.
|
|
4543
|
+
A rollover also increments the data stream's generation.</p>
|
|
4544
|
+
<p><strong>Roll over an index alias with a write index</strong></p>
|
|
4545
|
+
<p>TIP: Prior to Elasticsearch 7.9, you'd typically use an index alias with a write index to manage time series data.
|
|
4546
|
+
Data streams replace this functionality, require less maintenance, and automatically integrate with data tiers.</p>
|
|
4547
|
+
<p>If an index alias points to multiple indices, one of the indices must be a write index.
|
|
4548
|
+
The rollover API creates a new write index for the alias with <code>is_write_index</code> set to <code>true</code>.
|
|
4549
|
+
The API also <code>sets is_write_index</code> to <code>false</code> for the previous write index.</p>
|
|
4550
|
+
<p><strong>Roll over an index alias with one index</strong></p>
|
|
4551
|
+
<p>If you roll over an index alias that points to only one index, the API creates a new index for the alias and removes the original index from the alias.</p>
|
|
4552
|
+
<p>NOTE: A rollover creates a new index and is subject to the <code>wait_for_active_shards</code> setting.</p>
|
|
4553
|
+
<p><strong>Increment index names for an alias</strong></p>
|
|
4554
|
+
<p>When you roll over an index alias, you can specify a name for the new index.
|
|
4555
|
+
If you don't specify a name and the current index ends with <code>-</code> and a number, such as <code>my-index-000001</code> or <code>my-index-3</code>, the new index name increments that number.
|
|
4556
|
+
For example, if you roll over an alias with a current index of <code>my-index-000001</code>, the rollover creates a new index named <code>my-index-000002</code>.
|
|
4557
|
+
This number is always six characters and zero-padded, regardless of the previous index's name.</p>
|
|
4558
|
+
<p>If you use an index alias for time series data, you can use date math in the index name to track the rollover date.
|
|
4559
|
+
For example, you can create an alias that points to an index named <code><my-index-{now/d}-000001></code>.
|
|
4560
|
+
If you create the index on May 6, 2099, the index's name is <code>my-index-2099.05.06-000001</code>.
|
|
4561
|
+
If you roll over the alias on May 7, 2099, the new index's name is <code>my-index-2099.05.07-000002</code>.</p>
|
|
4562
|
+
|
|
4563
|
+
|
|
4564
|
+
`<https://www.elastic.co/docs/api/doc/elasticsearch/v9/operation/operation-indices-rollover>`_
|
|
4189
4565
|
|
|
4190
4566
|
:param alias: Name of the data stream or index alias to roll over.
|
|
4191
4567
|
:param new_index: Name of the index to create. Supports date math. Data streams
|
|
@@ -4200,6 +4576,9 @@ class IndicesClient(NamespacedClient):
|
|
|
4200
4576
|
conditions are satisfied.
|
|
4201
4577
|
:param dry_run: If `true`, checks whether the current index satisfies the specified
|
|
4202
4578
|
conditions but does not perform a rollover.
|
|
4579
|
+
:param lazy: If set to true, the rollover action will only mark a data stream
|
|
4580
|
+
to signal that it needs to be rolled over at the next write. Only allowed
|
|
4581
|
+
on data streams.
|
|
4203
4582
|
:param mappings: Mapping for fields in the index. If specified, this mapping
|
|
4204
4583
|
can include field names, field data types, and mapping paramaters.
|
|
4205
4584
|
:param master_timeout: Period to wait for a connection to the master node. If
|
|
@@ -4234,6 +4613,8 @@ class IndicesClient(NamespacedClient):
|
|
|
4234
4613
|
__query["filter_path"] = filter_path
|
|
4235
4614
|
if human is not None:
|
|
4236
4615
|
__query["human"] = human
|
|
4616
|
+
if lazy is not None:
|
|
4617
|
+
__query["lazy"] = lazy
|
|
4237
4618
|
if master_timeout is not None:
|
|
4238
4619
|
__query["master_timeout"] = master_timeout
|
|
4239
4620
|
if pretty is not None:
|
|
@@ -4285,14 +4666,16 @@ class IndicesClient(NamespacedClient):
|
|
|
4285
4666
|
human: t.Optional[bool] = None,
|
|
4286
4667
|
ignore_unavailable: t.Optional[bool] = None,
|
|
4287
4668
|
pretty: t.Optional[bool] = None,
|
|
4288
|
-
verbose: t.Optional[bool] = None,
|
|
4289
4669
|
) -> ObjectApiResponse[t.Any]:
|
|
4290
4670
|
"""
|
|
4291
|
-
|
|
4292
|
-
shards. For data streams, the API returns information about the stream's backing
|
|
4293
|
-
indices.
|
|
4671
|
+
.. raw:: html
|
|
4294
4672
|
|
|
4295
|
-
|
|
4673
|
+
<p>Get index segments.
|
|
4674
|
+
Get low-level information about the Lucene segments in index shards.
|
|
4675
|
+
For data streams, the API returns information about the stream's backing indices.</p>
|
|
4676
|
+
|
|
4677
|
+
|
|
4678
|
+
`<https://www.elastic.co/docs/api/doc/elasticsearch/v9/operation/operation-indices-segments>`_
|
|
4296
4679
|
|
|
4297
4680
|
:param index: Comma-separated list of data streams, indices, and aliases used
|
|
4298
4681
|
to limit the request. Supports wildcards (`*`). To target all data streams
|
|
@@ -4306,7 +4689,6 @@ class IndicesClient(NamespacedClient):
|
|
|
4306
4689
|
as `open,hidden`. Valid values are: `all`, `open`, `closed`, `hidden`, `none`.
|
|
4307
4690
|
:param ignore_unavailable: If `false`, the request returns an error if it targets
|
|
4308
4691
|
a missing or closed index.
|
|
4309
|
-
:param verbose: If `true`, the request returns a verbose response.
|
|
4310
4692
|
"""
|
|
4311
4693
|
__path_parts: t.Dict[str, str]
|
|
4312
4694
|
if index not in SKIP_IN_PATH:
|
|
@@ -4330,8 +4712,6 @@ class IndicesClient(NamespacedClient):
|
|
|
4330
4712
|
__query["ignore_unavailable"] = ignore_unavailable
|
|
4331
4713
|
if pretty is not None:
|
|
4332
4714
|
__query["pretty"] = pretty
|
|
4333
|
-
if verbose is not None:
|
|
4334
|
-
__query["verbose"] = verbose
|
|
4335
4715
|
__headers = {"accept": "application/json"}
|
|
4336
4716
|
return await self.perform_request( # type: ignore[return-value]
|
|
4337
4717
|
"GET",
|
|
@@ -4369,16 +4749,22 @@ class IndicesClient(NamespacedClient):
|
|
|
4369
4749
|
] = None,
|
|
4370
4750
|
) -> ObjectApiResponse[t.Any]:
|
|
4371
4751
|
"""
|
|
4372
|
-
|
|
4373
|
-
more indices. For data streams, the API retrieves store information for the stream's
|
|
4374
|
-
backing indices. The index shard stores API returns the following information:
|
|
4375
|
-
* The node on which each replica shard exists. * The allocation ID for each replica
|
|
4376
|
-
shard. * A unique ID for each replica shard. * Any errors encountered while opening
|
|
4377
|
-
the shard index or from an earlier failure. By default, the API returns store
|
|
4378
|
-
information only for primary shards that are unassigned or have one or more unassigned
|
|
4379
|
-
replica shards.
|
|
4752
|
+
.. raw:: html
|
|
4380
4753
|
|
|
4381
|
-
|
|
4754
|
+
<p>Get index shard stores.
|
|
4755
|
+
Get store information about replica shards in one or more indices.
|
|
4756
|
+
For data streams, the API retrieves store information for the stream's backing indices.</p>
|
|
4757
|
+
<p>The index shard stores API returns the following information:</p>
|
|
4758
|
+
<ul>
|
|
4759
|
+
<li>The node on which each replica shard exists.</li>
|
|
4760
|
+
<li>The allocation ID for each replica shard.</li>
|
|
4761
|
+
<li>A unique ID for each replica shard.</li>
|
|
4762
|
+
<li>Any errors encountered while opening the shard index or from an earlier failure.</li>
|
|
4763
|
+
</ul>
|
|
4764
|
+
<p>By default, the API returns store information only for primary shards that are unassigned or have one or more unassigned replica shards.</p>
|
|
4765
|
+
|
|
4766
|
+
|
|
4767
|
+
`<https://www.elastic.co/docs/api/doc/elasticsearch/v9/operation/operation-indices-shard-stores>`_
|
|
4382
4768
|
|
|
4383
4769
|
:param index: List of data streams, indices, and aliases used to limit the request.
|
|
4384
4770
|
:param allow_no_indices: If false, the request returns an error if any wildcard
|
|
@@ -4447,41 +4833,40 @@ class IndicesClient(NamespacedClient):
|
|
|
4447
4833
|
body: t.Optional[t.Dict[str, t.Any]] = None,
|
|
4448
4834
|
) -> ObjectApiResponse[t.Any]:
|
|
4449
4835
|
"""
|
|
4450
|
-
|
|
4451
|
-
|
|
4452
|
-
|
|
4453
|
-
|
|
4454
|
-
|
|
4455
|
-
|
|
4456
|
-
|
|
4457
|
-
|
|
4458
|
-
|
|
4459
|
-
|
|
4460
|
-
|
|
4461
|
-
|
|
4462
|
-
|
|
4463
|
-
|
|
4464
|
-
|
|
4465
|
-
|
|
4466
|
-
|
|
4467
|
-
|
|
4468
|
-
|
|
4469
|
-
|
|
4470
|
-
|
|
4471
|
-
|
|
4472
|
-
|
|
4473
|
-
|
|
4474
|
-
|
|
4475
|
-
|
|
4476
|
-
|
|
4477
|
-
|
|
4478
|
-
|
|
4479
|
-
|
|
4480
|
-
|
|
4481
|
-
|
|
4482
|
-
|
|
4483
|
-
|
|
4484
|
-
`<https://www.elastic.co/guide/en/elasticsearch/reference/8.17/indices-shrink-index.html>`_
|
|
4836
|
+
.. raw:: html
|
|
4837
|
+
|
|
4838
|
+
<p>Shrink an index.
|
|
4839
|
+
Shrink an index into a new index with fewer primary shards.</p>
|
|
4840
|
+
<p>Before you can shrink an index:</p>
|
|
4841
|
+
<ul>
|
|
4842
|
+
<li>The index must be read-only.</li>
|
|
4843
|
+
<li>A copy of every shard in the index must reside on the same node.</li>
|
|
4844
|
+
<li>The index must have a green health status.</li>
|
|
4845
|
+
</ul>
|
|
4846
|
+
<p>To make shard allocation easier, we recommend you also remove the index's replica shards.
|
|
4847
|
+
You can later re-add replica shards as part of the shrink operation.</p>
|
|
4848
|
+
<p>The requested number of primary shards in the target index must be a factor of the number of shards in the source index.
|
|
4849
|
+
For example an index with 8 primary shards can be shrunk into 4, 2 or 1 primary shards or an index with 15 primary shards can be shrunk into 5, 3 or 1.
|
|
4850
|
+
If the number of shards in the index is a prime number it can only be shrunk into a single primary shard
|
|
4851
|
+
Before shrinking, a (primary or replica) copy of every shard in the index must be present on the same node.</p>
|
|
4852
|
+
<p>The current write index on a data stream cannot be shrunk. In order to shrink the current write index, the data stream must first be rolled over so that a new write index is created and then the previous write index can be shrunk.</p>
|
|
4853
|
+
<p>A shrink operation:</p>
|
|
4854
|
+
<ul>
|
|
4855
|
+
<li>Creates a new target index with the same definition as the source index, but with a smaller number of primary shards.</li>
|
|
4856
|
+
<li>Hard-links segments from the source index into the target index. If the file system does not support hard-linking, then all segments are copied into the new index, which is a much more time consuming process. Also if using multiple data paths, shards on different data paths require a full copy of segment files if they are not on the same disk since hardlinks do not work across disks.</li>
|
|
4857
|
+
<li>Recovers the target index as though it were a closed index which had just been re-opened. Recovers shards to the <code>.routing.allocation.initial_recovery._id</code> index setting.</li>
|
|
4858
|
+
</ul>
|
|
4859
|
+
<p>IMPORTANT: Indices can only be shrunk if they satisfy the following requirements:</p>
|
|
4860
|
+
<ul>
|
|
4861
|
+
<li>The target index must not exist.</li>
|
|
4862
|
+
<li>The source index must have more primary shards than the target index.</li>
|
|
4863
|
+
<li>The number of primary shards in the target index must be a factor of the number of primary shards in the source index. The source index must have more primary shards than the target index.</li>
|
|
4864
|
+
<li>The index must not contain more than 2,147,483,519 documents in total across all shards that will be shrunk into a single shard on the target index as this is the maximum number of docs that can fit into a single shard.</li>
|
|
4865
|
+
<li>The node handling the shrink process must have sufficient free disk space to accommodate a second copy of the existing index.</li>
|
|
4866
|
+
</ul>
|
|
4867
|
+
|
|
4868
|
+
|
|
4869
|
+
`<https://www.elastic.co/docs/api/doc/elasticsearch/v9/operation/operation-indices-shrink>`_
|
|
4485
4870
|
|
|
4486
4871
|
:param index: Name of the source index to shrink.
|
|
4487
4872
|
:param target: Name of the target index to create.
|
|
@@ -4546,6 +4931,8 @@ class IndicesClient(NamespacedClient):
|
|
|
4546
4931
|
self,
|
|
4547
4932
|
*,
|
|
4548
4933
|
name: str,
|
|
4934
|
+
cause: t.Optional[str] = None,
|
|
4935
|
+
create: t.Optional[bool] = None,
|
|
4549
4936
|
error_trace: t.Optional[bool] = None,
|
|
4550
4937
|
filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None,
|
|
4551
4938
|
human: t.Optional[bool] = None,
|
|
@@ -4554,12 +4941,19 @@ class IndicesClient(NamespacedClient):
|
|
|
4554
4941
|
pretty: t.Optional[bool] = None,
|
|
4555
4942
|
) -> ObjectApiResponse[t.Any]:
|
|
4556
4943
|
"""
|
|
4557
|
-
|
|
4558
|
-
|
|
4944
|
+
.. raw:: html
|
|
4945
|
+
|
|
4946
|
+
<p>Simulate an index.
|
|
4947
|
+
Get the index configuration that would be applied to the specified index from an existing index template.</p>
|
|
4559
4948
|
|
|
4560
|
-
|
|
4949
|
+
|
|
4950
|
+
`<https://www.elastic.co/docs/api/doc/elasticsearch/v9/operation/operation-indices-simulate-index-template>`_
|
|
4561
4951
|
|
|
4562
4952
|
:param name: Name of the index to simulate
|
|
4953
|
+
:param cause: User defined reason for dry-run creating the new template for simulation
|
|
4954
|
+
purposes
|
|
4955
|
+
:param create: Whether the index template we optionally defined in the body should
|
|
4956
|
+
only be dry-run added if new or can also replace an existing one
|
|
4563
4957
|
:param include_defaults: If true, returns all relevant default configurations
|
|
4564
4958
|
for the index template.
|
|
4565
4959
|
:param master_timeout: Period to wait for a connection to the master node. If
|
|
@@ -4571,6 +4965,10 @@ class IndicesClient(NamespacedClient):
|
|
|
4571
4965
|
__path_parts: t.Dict[str, str] = {"name": _quote(name)}
|
|
4572
4966
|
__path = f'/_index_template/_simulate_index/{__path_parts["name"]}'
|
|
4573
4967
|
__query: t.Dict[str, t.Any] = {}
|
|
4968
|
+
if cause is not None:
|
|
4969
|
+
__query["cause"] = cause
|
|
4970
|
+
if create is not None:
|
|
4971
|
+
__query["create"] = create
|
|
4574
4972
|
if error_trace is not None:
|
|
4575
4973
|
__query["error_trace"] = error_trace
|
|
4576
4974
|
if filter_path is not None:
|
|
@@ -4613,6 +5011,7 @@ class IndicesClient(NamespacedClient):
|
|
|
4613
5011
|
*,
|
|
4614
5012
|
name: t.Optional[str] = None,
|
|
4615
5013
|
allow_auto_create: t.Optional[bool] = None,
|
|
5014
|
+
cause: t.Optional[str] = None,
|
|
4616
5015
|
composed_of: t.Optional[t.Sequence[str]] = None,
|
|
4617
5016
|
create: t.Optional[bool] = None,
|
|
4618
5017
|
data_stream: t.Optional[t.Mapping[str, t.Any]] = None,
|
|
@@ -4632,10 +5031,13 @@ class IndicesClient(NamespacedClient):
|
|
|
4632
5031
|
body: t.Optional[t.Dict[str, t.Any]] = None,
|
|
4633
5032
|
) -> ObjectApiResponse[t.Any]:
|
|
4634
5033
|
"""
|
|
4635
|
-
|
|
4636
|
-
|
|
5034
|
+
.. raw:: html
|
|
5035
|
+
|
|
5036
|
+
<p>Simulate an index template.
|
|
5037
|
+
Get the index configuration that would be applied by a particular index template.</p>
|
|
5038
|
+
|
|
4637
5039
|
|
|
4638
|
-
`<https://www.elastic.co/
|
|
5040
|
+
`<https://www.elastic.co/docs/api/doc/elasticsearch/v9/operation/operation-indices-simulate-template>`_
|
|
4639
5041
|
|
|
4640
5042
|
:param name: Name of the index template to simulate. To test a template configuration
|
|
4641
5043
|
before you add it to the cluster, omit this parameter and specify the template
|
|
@@ -4646,6 +5048,8 @@ class IndicesClient(NamespacedClient):
|
|
|
4646
5048
|
via `actions.auto_create_index`. If set to `false`, then indices or data
|
|
4647
5049
|
streams matching the template must always be explicitly created, and may
|
|
4648
5050
|
never be automatically created.
|
|
5051
|
+
:param cause: User defined reason for dry-run creating the new template for simulation
|
|
5052
|
+
purposes
|
|
4649
5053
|
:param composed_of: An ordered list of component template names. Component templates
|
|
4650
5054
|
are merged in the order specified, meaning that the last component template
|
|
4651
5055
|
specified has the highest precedence.
|
|
@@ -4690,6 +5094,8 @@ class IndicesClient(NamespacedClient):
|
|
|
4690
5094
|
__path = "/_index_template/_simulate"
|
|
4691
5095
|
__query: t.Dict[str, t.Any] = {}
|
|
4692
5096
|
__body: t.Dict[str, t.Any] = body if body is not None else {}
|
|
5097
|
+
if cause is not None:
|
|
5098
|
+
__query["cause"] = cause
|
|
4693
5099
|
if create is not None:
|
|
4694
5100
|
__query["create"] = create
|
|
4695
5101
|
if error_trace is not None:
|
|
@@ -4764,33 +5170,46 @@ class IndicesClient(NamespacedClient):
|
|
|
4764
5170
|
body: t.Optional[t.Dict[str, t.Any]] = None,
|
|
4765
5171
|
) -> ObjectApiResponse[t.Any]:
|
|
4766
5172
|
"""
|
|
4767
|
-
|
|
4768
|
-
|
|
4769
|
-
|
|
4770
|
-
|
|
4771
|
-
|
|
4772
|
-
|
|
4773
|
-
|
|
4774
|
-
|
|
4775
|
-
|
|
4776
|
-
|
|
4777
|
-
|
|
4778
|
-
|
|
4779
|
-
|
|
4780
|
-
|
|
4781
|
-
|
|
4782
|
-
|
|
4783
|
-
|
|
4784
|
-
|
|
4785
|
-
|
|
4786
|
-
|
|
4787
|
-
|
|
4788
|
-
|
|
4789
|
-
|
|
4790
|
-
|
|
4791
|
-
|
|
4792
|
-
|
|
4793
|
-
|
|
5173
|
+
.. raw:: html
|
|
5174
|
+
|
|
5175
|
+
<p>Split an index.
|
|
5176
|
+
Split an index into a new index with more primary shards.</p>
|
|
5177
|
+
<ul>
|
|
5178
|
+
<li>
|
|
5179
|
+
<p>Before you can split an index:</p>
|
|
5180
|
+
</li>
|
|
5181
|
+
<li>
|
|
5182
|
+
<p>The index must be read-only.</p>
|
|
5183
|
+
</li>
|
|
5184
|
+
<li>
|
|
5185
|
+
<p>The cluster health status must be green.</p>
|
|
5186
|
+
</li>
|
|
5187
|
+
</ul>
|
|
5188
|
+
<p>You can do make an index read-only with the following request using the add index block API:</p>
|
|
5189
|
+
<pre><code>PUT /my_source_index/_block/write
|
|
5190
|
+
</code></pre>
|
|
5191
|
+
<p>The current write index on a data stream cannot be split.
|
|
5192
|
+
In order to split the current write index, the data stream must first be rolled over so that a new write index is created and then the previous write index can be split.</p>
|
|
5193
|
+
<p>The number of times the index can be split (and the number of shards that each original shard can be split into) is determined by the <code>index.number_of_routing_shards</code> setting.
|
|
5194
|
+
The number of routing shards specifies the hashing space that is used internally to distribute documents across shards with consistent hashing.
|
|
5195
|
+
For instance, a 5 shard index with <code>number_of_routing_shards</code> set to 30 (5 x 2 x 3) could be split by a factor of 2 or 3.</p>
|
|
5196
|
+
<p>A split operation:</p>
|
|
5197
|
+
<ul>
|
|
5198
|
+
<li>Creates a new target index with the same definition as the source index, but with a larger number of primary shards.</li>
|
|
5199
|
+
<li>Hard-links segments from the source index into the target index. If the file system doesn't support hard-linking, all segments are copied into the new index, which is a much more time consuming process.</li>
|
|
5200
|
+
<li>Hashes all documents again, after low level files are created, to delete documents that belong to a different shard.</li>
|
|
5201
|
+
<li>Recovers the target index as though it were a closed index which had just been re-opened.</li>
|
|
5202
|
+
</ul>
|
|
5203
|
+
<p>IMPORTANT: Indices can only be split if they satisfy the following requirements:</p>
|
|
5204
|
+
<ul>
|
|
5205
|
+
<li>The target index must not exist.</li>
|
|
5206
|
+
<li>The source index must have fewer primary shards than the target index.</li>
|
|
5207
|
+
<li>The number of primary shards in the target index must be a multiple of the number of primary shards in the source index.</li>
|
|
5208
|
+
<li>The node handling the split process must have sufficient free disk space to accommodate a second copy of the existing index.</li>
|
|
5209
|
+
</ul>
|
|
5210
|
+
|
|
5211
|
+
|
|
5212
|
+
`<https://www.elastic.co/docs/api/doc/elasticsearch/v9/operation/operation-indices-split>`_
|
|
4794
5213
|
|
|
4795
5214
|
:param index: Name of the source index to split.
|
|
4796
5215
|
:param target: Name of the target index to create.
|
|
@@ -4880,16 +5299,19 @@ class IndicesClient(NamespacedClient):
|
|
|
4880
5299
|
pretty: t.Optional[bool] = None,
|
|
4881
5300
|
) -> ObjectApiResponse[t.Any]:
|
|
4882
5301
|
"""
|
|
4883
|
-
|
|
4884
|
-
|
|
4885
|
-
|
|
4886
|
-
|
|
4887
|
-
|
|
4888
|
-
|
|
4889
|
-
|
|
4890
|
-
|
|
5302
|
+
.. raw:: html
|
|
5303
|
+
|
|
5304
|
+
<p>Get index statistics.
|
|
5305
|
+
For data streams, the API retrieves statistics for the stream's backing indices.</p>
|
|
5306
|
+
<p>By default, the returned statistics are index-level with <code>primaries</code> and <code>total</code> aggregations.
|
|
5307
|
+
<code>primaries</code> are the values for only the primary shards.
|
|
5308
|
+
<code>total</code> are the accumulated values for both primary and replica shards.</p>
|
|
5309
|
+
<p>To get shard-level statistics, set the <code>level</code> parameter to <code>shards</code>.</p>
|
|
5310
|
+
<p>NOTE: When moving to another node, the shard-level statistics for a shard are cleared.
|
|
5311
|
+
Although the shard is no longer part of the node, that node retains any node-level statistics to which the shard contributed.</p>
|
|
4891
5312
|
|
|
4892
|
-
|
|
5313
|
+
|
|
5314
|
+
`<https://www.elastic.co/docs/api/doc/elasticsearch/v9/operation/operation-indices-stats>`_
|
|
4893
5315
|
|
|
4894
5316
|
:param index: A comma-separated list of index names; use `_all` or empty string
|
|
4895
5317
|
to perform the operation on all indices
|
|
@@ -4966,89 +5388,6 @@ class IndicesClient(NamespacedClient):
|
|
|
4966
5388
|
path_parts=__path_parts,
|
|
4967
5389
|
)
|
|
4968
5390
|
|
|
4969
|
-
@_rewrite_parameters()
|
|
4970
|
-
async def unfreeze(
|
|
4971
|
-
self,
|
|
4972
|
-
*,
|
|
4973
|
-
index: str,
|
|
4974
|
-
allow_no_indices: t.Optional[bool] = None,
|
|
4975
|
-
error_trace: t.Optional[bool] = None,
|
|
4976
|
-
expand_wildcards: t.Optional[
|
|
4977
|
-
t.Union[
|
|
4978
|
-
t.Sequence[
|
|
4979
|
-
t.Union[str, t.Literal["all", "closed", "hidden", "none", "open"]]
|
|
4980
|
-
],
|
|
4981
|
-
t.Union[str, t.Literal["all", "closed", "hidden", "none", "open"]],
|
|
4982
|
-
]
|
|
4983
|
-
] = None,
|
|
4984
|
-
filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None,
|
|
4985
|
-
human: t.Optional[bool] = None,
|
|
4986
|
-
ignore_unavailable: t.Optional[bool] = None,
|
|
4987
|
-
master_timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None,
|
|
4988
|
-
pretty: t.Optional[bool] = None,
|
|
4989
|
-
timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None,
|
|
4990
|
-
wait_for_active_shards: t.Optional[str] = None,
|
|
4991
|
-
) -> ObjectApiResponse[t.Any]:
|
|
4992
|
-
"""
|
|
4993
|
-
Unfreeze an index. When a frozen index is unfrozen, the index goes through the
|
|
4994
|
-
normal recovery process and becomes writeable again.
|
|
4995
|
-
|
|
4996
|
-
`<https://www.elastic.co/guide/en/elasticsearch/reference/8.17/unfreeze-index-api.html>`_
|
|
4997
|
-
|
|
4998
|
-
:param index: Identifier for the index.
|
|
4999
|
-
:param allow_no_indices: If `false`, the request returns an error if any wildcard
|
|
5000
|
-
expression, index alias, or `_all` value targets only missing or closed indices.
|
|
5001
|
-
This behavior applies even if the request targets other open indices.
|
|
5002
|
-
:param expand_wildcards: Type of index that wildcard patterns can match. If the
|
|
5003
|
-
request can target data streams, this argument determines whether wildcard
|
|
5004
|
-
expressions match hidden data streams. Supports comma-separated values, such
|
|
5005
|
-
as `open,hidden`. Valid values are: `all`, `open`, `closed`, `hidden`, `none`.
|
|
5006
|
-
:param ignore_unavailable: If `false`, the request returns an error if it targets
|
|
5007
|
-
a missing or closed index.
|
|
5008
|
-
:param master_timeout: Period to wait for a connection to the master node. If
|
|
5009
|
-
no response is received before the timeout expires, the request fails and
|
|
5010
|
-
returns an error.
|
|
5011
|
-
:param timeout: Period to wait for a response. If no response is received before
|
|
5012
|
-
the timeout expires, the request fails and returns an error.
|
|
5013
|
-
:param wait_for_active_shards: The number of shard copies that must be active
|
|
5014
|
-
before proceeding with the operation. Set to `all` or any positive integer
|
|
5015
|
-
up to the total number of shards in the index (`number_of_replicas+1`).
|
|
5016
|
-
"""
|
|
5017
|
-
if index in SKIP_IN_PATH:
|
|
5018
|
-
raise ValueError("Empty value passed for parameter 'index'")
|
|
5019
|
-
__path_parts: t.Dict[str, str] = {"index": _quote(index)}
|
|
5020
|
-
__path = f'/{__path_parts["index"]}/_unfreeze'
|
|
5021
|
-
__query: t.Dict[str, t.Any] = {}
|
|
5022
|
-
if allow_no_indices is not None:
|
|
5023
|
-
__query["allow_no_indices"] = allow_no_indices
|
|
5024
|
-
if error_trace is not None:
|
|
5025
|
-
__query["error_trace"] = error_trace
|
|
5026
|
-
if expand_wildcards is not None:
|
|
5027
|
-
__query["expand_wildcards"] = expand_wildcards
|
|
5028
|
-
if filter_path is not None:
|
|
5029
|
-
__query["filter_path"] = filter_path
|
|
5030
|
-
if human is not None:
|
|
5031
|
-
__query["human"] = human
|
|
5032
|
-
if ignore_unavailable is not None:
|
|
5033
|
-
__query["ignore_unavailable"] = ignore_unavailable
|
|
5034
|
-
if master_timeout is not None:
|
|
5035
|
-
__query["master_timeout"] = master_timeout
|
|
5036
|
-
if pretty is not None:
|
|
5037
|
-
__query["pretty"] = pretty
|
|
5038
|
-
if timeout is not None:
|
|
5039
|
-
__query["timeout"] = timeout
|
|
5040
|
-
if wait_for_active_shards is not None:
|
|
5041
|
-
__query["wait_for_active_shards"] = wait_for_active_shards
|
|
5042
|
-
__headers = {"accept": "application/json"}
|
|
5043
|
-
return await self.perform_request( # type: ignore[return-value]
|
|
5044
|
-
"POST",
|
|
5045
|
-
__path,
|
|
5046
|
-
params=__query,
|
|
5047
|
-
headers=__headers,
|
|
5048
|
-
endpoint_id="indices.unfreeze",
|
|
5049
|
-
path_parts=__path_parts,
|
|
5050
|
-
)
|
|
5051
|
-
|
|
5052
5391
|
@_rewrite_parameters(
|
|
5053
5392
|
body_fields=("actions",),
|
|
5054
5393
|
)
|
|
@@ -5065,9 +5404,13 @@ class IndicesClient(NamespacedClient):
|
|
|
5065
5404
|
body: t.Optional[t.Dict[str, t.Any]] = None,
|
|
5066
5405
|
) -> ObjectApiResponse[t.Any]:
|
|
5067
5406
|
"""
|
|
5068
|
-
|
|
5407
|
+
.. raw:: html
|
|
5408
|
+
|
|
5409
|
+
<p>Create or update an alias.
|
|
5410
|
+
Adds a data stream or index to an alias.</p>
|
|
5069
5411
|
|
|
5070
|
-
|
|
5412
|
+
|
|
5413
|
+
`<https://www.elastic.co/docs/api/doc/elasticsearch/v9/operation/operation-indices-update-aliases>`_
|
|
5071
5414
|
|
|
5072
5415
|
:param actions: Actions to perform.
|
|
5073
5416
|
:param master_timeout: Period to wait for a connection to the master node. If
|
|
@@ -5140,9 +5483,13 @@ class IndicesClient(NamespacedClient):
|
|
|
5140
5483
|
body: t.Optional[t.Dict[str, t.Any]] = None,
|
|
5141
5484
|
) -> ObjectApiResponse[t.Any]:
|
|
5142
5485
|
"""
|
|
5143
|
-
|
|
5486
|
+
.. raw:: html
|
|
5487
|
+
|
|
5488
|
+
<p>Validate a query.
|
|
5489
|
+
Validates a query without running it.</p>
|
|
5490
|
+
|
|
5144
5491
|
|
|
5145
|
-
`<https://www.elastic.co/
|
|
5492
|
+
`<https://www.elastic.co/docs/api/doc/elasticsearch/v9/operation/operation-indices-validate-query>`_
|
|
5146
5493
|
|
|
5147
5494
|
:param index: Comma-separated list of data streams, indices, and aliases to search.
|
|
5148
5495
|
Supports wildcards (`*`). To search all data streams or indices, omit this
|