elasticsearch 9.0.1__py3-none-any.whl → 9.1.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 +3 -3
- elasticsearch/_async/client/__init__.py +93 -249
- elasticsearch/_async/client/async_search.py +4 -4
- elasticsearch/_async/client/autoscaling.py +4 -4
- elasticsearch/_async/client/cat.py +620 -58
- elasticsearch/_async/client/ccr.py +13 -13
- elasticsearch/_async/client/cluster.py +32 -22
- elasticsearch/_async/client/connector.py +30 -30
- elasticsearch/_async/client/dangling_indices.py +3 -3
- elasticsearch/_async/client/enrich.py +5 -5
- elasticsearch/_async/client/eql.py +14 -6
- elasticsearch/_async/client/esql.py +125 -9
- elasticsearch/_async/client/features.py +2 -2
- elasticsearch/_async/client/fleet.py +3 -3
- elasticsearch/_async/client/graph.py +1 -1
- elasticsearch/_async/client/ilm.py +11 -11
- elasticsearch/_async/client/indices.py +605 -117
- elasticsearch/_async/client/inference.py +523 -116
- elasticsearch/_async/client/ingest.py +9 -16
- elasticsearch/_async/client/license.py +11 -11
- elasticsearch/_async/client/logstash.py +3 -3
- elasticsearch/_async/client/migration.py +3 -3
- elasticsearch/_async/client/ml.py +75 -87
- elasticsearch/_async/client/monitoring.py +1 -1
- elasticsearch/_async/client/nodes.py +7 -7
- elasticsearch/_async/client/query_rules.py +8 -8
- elasticsearch/_async/client/rollup.py +9 -30
- elasticsearch/_async/client/search_application.py +10 -10
- elasticsearch/_async/client/searchable_snapshots.py +4 -4
- elasticsearch/_async/client/security.py +79 -81
- elasticsearch/_async/client/shutdown.py +3 -3
- elasticsearch/_async/client/simulate.py +1 -1
- elasticsearch/_async/client/slm.py +9 -9
- elasticsearch/_async/client/snapshot.py +64 -21
- elasticsearch/_async/client/sql.py +6 -6
- elasticsearch/_async/client/ssl.py +1 -1
- elasticsearch/_async/client/synonyms.py +26 -7
- elasticsearch/_async/client/tasks.py +4 -4
- elasticsearch/_async/client/text_structure.py +4 -4
- elasticsearch/_async/client/transform.py +11 -11
- elasticsearch/_async/client/watcher.py +17 -15
- elasticsearch/_async/client/xpack.py +2 -2
- elasticsearch/_otel.py +8 -8
- elasticsearch/_sync/client/__init__.py +93 -249
- elasticsearch/_sync/client/async_search.py +4 -4
- elasticsearch/_sync/client/autoscaling.py +4 -4
- elasticsearch/_sync/client/cat.py +620 -58
- elasticsearch/_sync/client/ccr.py +13 -13
- elasticsearch/_sync/client/cluster.py +32 -22
- elasticsearch/_sync/client/connector.py +30 -30
- elasticsearch/_sync/client/dangling_indices.py +3 -3
- elasticsearch/_sync/client/enrich.py +5 -5
- elasticsearch/_sync/client/eql.py +14 -6
- elasticsearch/_sync/client/esql.py +125 -9
- elasticsearch/_sync/client/features.py +2 -2
- elasticsearch/_sync/client/fleet.py +3 -3
- elasticsearch/_sync/client/graph.py +1 -1
- elasticsearch/_sync/client/ilm.py +11 -11
- elasticsearch/_sync/client/indices.py +605 -117
- elasticsearch/_sync/client/inference.py +523 -116
- elasticsearch/_sync/client/ingest.py +9 -16
- elasticsearch/_sync/client/license.py +11 -11
- elasticsearch/_sync/client/logstash.py +3 -3
- elasticsearch/_sync/client/migration.py +3 -3
- elasticsearch/_sync/client/ml.py +75 -87
- elasticsearch/_sync/client/monitoring.py +1 -1
- elasticsearch/_sync/client/nodes.py +7 -7
- elasticsearch/_sync/client/query_rules.py +8 -8
- elasticsearch/_sync/client/rollup.py +9 -30
- elasticsearch/_sync/client/search_application.py +10 -10
- elasticsearch/_sync/client/searchable_snapshots.py +4 -4
- elasticsearch/_sync/client/security.py +79 -81
- elasticsearch/_sync/client/shutdown.py +3 -3
- elasticsearch/_sync/client/simulate.py +1 -1
- elasticsearch/_sync/client/slm.py +9 -9
- elasticsearch/_sync/client/snapshot.py +64 -21
- elasticsearch/_sync/client/sql.py +6 -6
- elasticsearch/_sync/client/ssl.py +1 -1
- elasticsearch/_sync/client/synonyms.py +26 -7
- elasticsearch/_sync/client/tasks.py +4 -4
- elasticsearch/_sync/client/text_structure.py +4 -4
- elasticsearch/_sync/client/transform.py +11 -11
- elasticsearch/_sync/client/watcher.py +17 -15
- elasticsearch/_sync/client/xpack.py +2 -2
- elasticsearch/_version.py +1 -1
- elasticsearch/compat.py +5 -0
- elasticsearch/dsl/__init__.py +2 -1
- elasticsearch/dsl/_async/document.py +1 -1
- elasticsearch/dsl/_sync/document.py +1 -1
- elasticsearch/dsl/aggs.py +20 -0
- elasticsearch/dsl/document_base.py +177 -17
- elasticsearch/dsl/field.py +241 -38
- elasticsearch/dsl/query.py +50 -5
- elasticsearch/dsl/response/__init__.py +1 -1
- elasticsearch/dsl/types.py +245 -21
- elasticsearch/dsl/utils.py +1 -1
- elasticsearch/esql/__init__.py +18 -0
- elasticsearch/esql/esql.py +1105 -0
- elasticsearch/esql/esql1.py1 +307 -0
- elasticsearch/esql/functions.py +1738 -0
- {elasticsearch-9.0.1.dist-info → elasticsearch-9.1.0.dist-info}/METADATA +3 -6
- elasticsearch-9.1.0.dist-info/RECORD +164 -0
- elasticsearch-9.0.1.dist-info/RECORD +0 -162
- elasticsearch-9.0.1.dist-info/licenses/LICENSE.txt +0 -175
- elasticsearch-9.0.1.dist-info/licenses/NOTICE.txt +0 -559
- {elasticsearch-9.0.1.dist-info → elasticsearch-9.1.0.dist-info}/WHEEL +0 -0
- {elasticsearch-9.0.1.dist-info → elasticsearch-9.1.0.dist-info}/licenses/LICENSE +0 -0
- {elasticsearch-9.0.1.dist-info → elasticsearch-9.1.0.dist-info}/licenses/NOTICE +0 -0
|
@@ -635,9 +635,11 @@ class Elasticsearch(BaseClient):
|
|
|
635
635
|
Imagine a <code>_bulk?refresh=wait_for</code> request with three documents in it that happen to be routed to different shards in an index with five shards.
|
|
636
636
|
The request will only wait for those three shards to refresh.
|
|
637
637
|
The other two shards that make up the index do not participate in the <code>_bulk</code> request at all.</p>
|
|
638
|
+
<p>You might want to disable the refresh interval temporarily to improve indexing throughput for large bulk requests.
|
|
639
|
+
Refer to the linked documentation for step-by-step instructions using the index settings API.</p>
|
|
638
640
|
|
|
639
641
|
|
|
640
|
-
`<https://www.elastic.co/docs/api/doc/elasticsearch/
|
|
642
|
+
`<https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-bulk>`_
|
|
641
643
|
|
|
642
644
|
:param operations:
|
|
643
645
|
:param index: The name of the data stream, index, or index alias to perform bulk
|
|
@@ -762,7 +764,7 @@ class Elasticsearch(BaseClient):
|
|
|
762
764
|
Clear the search context and results for a scrolling search.</p>
|
|
763
765
|
|
|
764
766
|
|
|
765
|
-
`<https://www.elastic.co/docs/api/doc/elasticsearch/
|
|
767
|
+
`<https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-clear-scroll>`_
|
|
766
768
|
|
|
767
769
|
:param scroll_id: The scroll IDs to clear. To clear all scroll IDs, use `_all`.
|
|
768
770
|
"""
|
|
@@ -819,7 +821,7 @@ class Elasticsearch(BaseClient):
|
|
|
819
821
|
However, keeping points in time has a cost; close them as soon as they are no longer required for search requests.</p>
|
|
820
822
|
|
|
821
823
|
|
|
822
|
-
`<https://www.elastic.co/docs/api/doc/elasticsearch/
|
|
824
|
+
`<https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-open-point-in-time>`_
|
|
823
825
|
|
|
824
826
|
:param id: The ID of the point-in-time.
|
|
825
827
|
"""
|
|
@@ -903,7 +905,7 @@ class Elasticsearch(BaseClient):
|
|
|
903
905
|
This means that replicas increase the scalability of the count.</p>
|
|
904
906
|
|
|
905
907
|
|
|
906
|
-
`<https://www.elastic.co/docs/api/doc/elasticsearch/
|
|
908
|
+
`<https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-count>`_
|
|
907
909
|
|
|
908
910
|
:param index: A comma-separated list of data streams, indices, and aliases to
|
|
909
911
|
search. It supports wildcards (`*`). To search all data streams and indices,
|
|
@@ -1027,10 +1029,7 @@ class Elasticsearch(BaseClient):
|
|
|
1027
1029
|
error_trace: t.Optional[bool] = None,
|
|
1028
1030
|
filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None,
|
|
1029
1031
|
human: t.Optional[bool] = None,
|
|
1030
|
-
if_primary_term: t.Optional[int] = None,
|
|
1031
|
-
if_seq_no: t.Optional[int] = None,
|
|
1032
1032
|
include_source_on_error: t.Optional[bool] = None,
|
|
1033
|
-
op_type: t.Optional[t.Union[str, t.Literal["create", "index"]]] = None,
|
|
1034
1033
|
pipeline: t.Optional[str] = None,
|
|
1035
1034
|
pretty: t.Optional[bool] = None,
|
|
1036
1035
|
refresh: t.Optional[
|
|
@@ -1105,7 +1104,7 @@ class Elasticsearch(BaseClient):
|
|
|
1105
1104
|
The <code>_shards</code> section of the API response reveals the number of shard copies on which replication succeeded and failed.</p>
|
|
1106
1105
|
|
|
1107
1106
|
|
|
1108
|
-
`<https://www.elastic.co/docs/api/doc/elasticsearch/
|
|
1107
|
+
`<https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-create>`_
|
|
1109
1108
|
|
|
1110
1109
|
:param index: The name of the data stream or index to target. If the target doesn't
|
|
1111
1110
|
exist and matches the name or wildcard (`*`) pattern of an index template
|
|
@@ -1115,18 +1114,8 @@ class Elasticsearch(BaseClient):
|
|
|
1115
1114
|
:param id: A unique identifier for the document. To automatically generate a
|
|
1116
1115
|
document ID, use the `POST /<target>/_doc/` request format.
|
|
1117
1116
|
:param document:
|
|
1118
|
-
:param if_primary_term: Only perform the operation if the document has this primary
|
|
1119
|
-
term.
|
|
1120
|
-
:param if_seq_no: Only perform the operation if the document has this sequence
|
|
1121
|
-
number.
|
|
1122
1117
|
:param include_source_on_error: True or false if to include the document source
|
|
1123
1118
|
in the error message in case of parsing errors.
|
|
1124
|
-
:param op_type: Set to `create` to only index the document if it does not already
|
|
1125
|
-
exist (put if absent). If a document with the specified `_id` already exists,
|
|
1126
|
-
the indexing operation will fail. The behavior is the same as using the `<index>/_create`
|
|
1127
|
-
endpoint. If a document ID is specified, this paramater defaults to `index`.
|
|
1128
|
-
Otherwise, it defaults to `create`. If the request targets a data stream,
|
|
1129
|
-
an `op_type` of `create` is required.
|
|
1130
1119
|
:param pipeline: The ID of the pipeline to use to preprocess incoming documents.
|
|
1131
1120
|
If the index has a default ingest pipeline specified, setting the value to
|
|
1132
1121
|
`_none` turns off the default ingest pipeline for this request. If a final
|
|
@@ -1178,14 +1167,8 @@ class Elasticsearch(BaseClient):
|
|
|
1178
1167
|
__query["filter_path"] = filter_path
|
|
1179
1168
|
if human is not None:
|
|
1180
1169
|
__query["human"] = human
|
|
1181
|
-
if if_primary_term is not None:
|
|
1182
|
-
__query["if_primary_term"] = if_primary_term
|
|
1183
|
-
if if_seq_no is not None:
|
|
1184
|
-
__query["if_seq_no"] = if_seq_no
|
|
1185
1170
|
if include_source_on_error is not None:
|
|
1186
1171
|
__query["include_source_on_error"] = include_source_on_error
|
|
1187
|
-
if op_type is not None:
|
|
1188
|
-
__query["op_type"] = op_type
|
|
1189
1172
|
if pipeline is not None:
|
|
1190
1173
|
__query["pipeline"] = pipeline
|
|
1191
1174
|
if pretty is not None:
|
|
@@ -1272,7 +1255,7 @@ class Elasticsearch(BaseClient):
|
|
|
1272
1255
|
It then gets redirected into the primary shard within that ID group and replicated (if needed) to shard replicas within that ID group.</p>
|
|
1273
1256
|
|
|
1274
1257
|
|
|
1275
|
-
`<https://www.elastic.co/docs/api/doc/elasticsearch/
|
|
1258
|
+
`<https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-delete>`_
|
|
1276
1259
|
|
|
1277
1260
|
:param index: The name of the target index.
|
|
1278
1261
|
:param id: A unique identifier for the document.
|
|
@@ -1461,7 +1444,7 @@ class Elasticsearch(BaseClient):
|
|
|
1461
1444
|
The get task status API will continue to list the delete by query task until this task checks that it has been cancelled and terminates itself.</p>
|
|
1462
1445
|
|
|
1463
1446
|
|
|
1464
|
-
`<https://www.elastic.co/docs/api/doc/elasticsearch/
|
|
1447
|
+
`<https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-delete-by-query>`_
|
|
1465
1448
|
|
|
1466
1449
|
:param index: A comma-separated list of data streams, indices, and aliases to
|
|
1467
1450
|
search. It supports wildcards (`*`). To search all data streams or indices,
|
|
@@ -1643,7 +1626,7 @@ class Elasticsearch(BaseClient):
|
|
|
1643
1626
|
def delete_by_query_rethrottle(
|
|
1644
1627
|
self,
|
|
1645
1628
|
*,
|
|
1646
|
-
task_id:
|
|
1629
|
+
task_id: str,
|
|
1647
1630
|
error_trace: t.Optional[bool] = None,
|
|
1648
1631
|
filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None,
|
|
1649
1632
|
human: t.Optional[bool] = None,
|
|
@@ -1658,7 +1641,7 @@ class Elasticsearch(BaseClient):
|
|
|
1658
1641
|
Rethrottling that speeds up the query takes effect immediately but rethrotting that slows down the query takes effect after completing the current batch to prevent scroll timeouts.</p>
|
|
1659
1642
|
|
|
1660
1643
|
|
|
1661
|
-
`<https://www.elastic.co/docs/api/doc/elasticsearch/
|
|
1644
|
+
`<https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-delete-by-query-rethrottle>`_
|
|
1662
1645
|
|
|
1663
1646
|
:param task_id: The ID for the task.
|
|
1664
1647
|
:param requests_per_second: The throttle for this request in sub-requests per
|
|
@@ -1708,7 +1691,7 @@ class Elasticsearch(BaseClient):
|
|
|
1708
1691
|
Deletes a stored script or search template.</p>
|
|
1709
1692
|
|
|
1710
1693
|
|
|
1711
|
-
`<https://www.elastic.co/docs/api/doc/elasticsearch/
|
|
1694
|
+
`<https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-delete-script>`_
|
|
1712
1695
|
|
|
1713
1696
|
:param id: The identifier for the stored script or search template.
|
|
1714
1697
|
:param master_timeout: The period to wait for a connection to the master node.
|
|
@@ -1792,7 +1775,7 @@ class Elasticsearch(BaseClient):
|
|
|
1792
1775
|
Elasticsearch cleans up deleted documents in the background as you continue to index more data.</p>
|
|
1793
1776
|
|
|
1794
1777
|
|
|
1795
|
-
`<https://www.elastic.co/docs/api/doc/elasticsearch/
|
|
1778
|
+
`<https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-get>`_
|
|
1796
1779
|
|
|
1797
1780
|
:param index: A comma-separated list of data streams, indices, and aliases. It
|
|
1798
1781
|
supports wildcards (`*`).
|
|
@@ -1915,7 +1898,7 @@ class Elasticsearch(BaseClient):
|
|
|
1915
1898
|
<p>A document's source is not available if it is disabled in the mapping.</p>
|
|
1916
1899
|
|
|
1917
1900
|
|
|
1918
|
-
`<https://www.elastic.co/docs/api/doc/elasticsearch/
|
|
1901
|
+
`<https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-get>`_
|
|
1919
1902
|
|
|
1920
1903
|
:param index: A comma-separated list of data streams, indices, and aliases. It
|
|
1921
1904
|
supports wildcards (`*`).
|
|
@@ -2021,7 +2004,7 @@ class Elasticsearch(BaseClient):
|
|
|
2021
2004
|
It computes a score explanation for a query and a specific document.</p>
|
|
2022
2005
|
|
|
2023
2006
|
|
|
2024
|
-
`<https://www.elastic.co/docs/api/doc/elasticsearch/
|
|
2007
|
+
`<https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-explain>`_
|
|
2025
2008
|
|
|
2026
2009
|
:param index: Index names that are used to limit the request. Only a single index
|
|
2027
2010
|
name can be provided to this parameter.
|
|
@@ -2156,7 +2139,7 @@ class Elasticsearch(BaseClient):
|
|
|
2156
2139
|
For example, a runtime field with a type of keyword is returned the same as any other field that belongs to the <code>keyword</code> family.</p>
|
|
2157
2140
|
|
|
2158
2141
|
|
|
2159
|
-
`<https://www.elastic.co/docs/api/doc/elasticsearch/
|
|
2142
|
+
`<https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-field-caps>`_
|
|
2160
2143
|
|
|
2161
2144
|
:param index: A comma-separated list of data streams, indices, and aliases used
|
|
2162
2145
|
to limit the request. Supports wildcards (*). To target all data streams
|
|
@@ -2317,12 +2300,12 @@ class Elasticsearch(BaseClient):
|
|
|
2317
2300
|
Elasticsearch cleans up deleted documents in the background as you continue to index more data.</p>
|
|
2318
2301
|
|
|
2319
2302
|
|
|
2320
|
-
`<https://www.elastic.co/docs/api/doc/elasticsearch/
|
|
2303
|
+
`<https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-get>`_
|
|
2321
2304
|
|
|
2322
2305
|
:param index: The name of the index that contains the document.
|
|
2323
2306
|
:param id: A unique document identifier.
|
|
2324
2307
|
:param force_synthetic_source: Indicates whether the request forces synthetic
|
|
2325
|
-
`_source`. Use this
|
|
2308
|
+
`_source`. Use this parameter to test if the mapping supports synthetic `_source`
|
|
2326
2309
|
and to get a sense of the worst case performance. Fetches with this parameter
|
|
2327
2310
|
enabled will be slower than enabling synthetic source natively in the index.
|
|
2328
2311
|
:param preference: The node or shard the operation should be performed on. By
|
|
@@ -2353,8 +2336,8 @@ class Elasticsearch(BaseClient):
|
|
|
2353
2336
|
:param stored_fields: A comma-separated list of stored fields to return as part
|
|
2354
2337
|
of a hit. If no fields are specified, no stored fields are included in the
|
|
2355
2338
|
response. If this field is specified, the `_source` parameter defaults to
|
|
2356
|
-
`false`. Only leaf fields can be retrieved with the `
|
|
2357
|
-
Object fields can't be returned
|
|
2339
|
+
`false`. Only leaf fields can be retrieved with the `stored_fields` option.
|
|
2340
|
+
Object fields can't be returned; if specified, the request fails.
|
|
2358
2341
|
:param version: The version number for concurrency control. It must match the
|
|
2359
2342
|
current version of the document for the request to succeed.
|
|
2360
2343
|
:param version_type: The version type.
|
|
@@ -2424,7 +2407,7 @@ class Elasticsearch(BaseClient):
|
|
|
2424
2407
|
Retrieves a stored script or search template.</p>
|
|
2425
2408
|
|
|
2426
2409
|
|
|
2427
|
-
`<https://www.elastic.co/docs/api/doc/elasticsearch/
|
|
2410
|
+
`<https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-get-script>`_
|
|
2428
2411
|
|
|
2429
2412
|
:param id: The identifier for the stored script or search template.
|
|
2430
2413
|
:param master_timeout: The period to wait for the master node. If the master
|
|
@@ -2473,7 +2456,7 @@ class Elasticsearch(BaseClient):
|
|
|
2473
2456
|
<p>Get a list of supported script contexts and their methods.</p>
|
|
2474
2457
|
|
|
2475
2458
|
|
|
2476
|
-
`<https://www.elastic.co/docs/api/doc/elasticsearch/
|
|
2459
|
+
`<https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-get-script-context>`_
|
|
2477
2460
|
"""
|
|
2478
2461
|
__path_parts: t.Dict[str, str] = {}
|
|
2479
2462
|
__path = "/_script_context"
|
|
@@ -2512,7 +2495,7 @@ class Elasticsearch(BaseClient):
|
|
|
2512
2495
|
<p>Get a list of available script types, languages, and contexts.</p>
|
|
2513
2496
|
|
|
2514
2497
|
|
|
2515
|
-
`<https://www.elastic.co/docs/api/doc/elasticsearch/
|
|
2498
|
+
`<https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-get-script-languages>`_
|
|
2516
2499
|
"""
|
|
2517
2500
|
__path_parts: t.Dict[str, str] = {}
|
|
2518
2501
|
__path = "/_script_language"
|
|
@@ -2558,7 +2541,6 @@ class Elasticsearch(BaseClient):
|
|
|
2558
2541
|
source: t.Optional[t.Union[bool, t.Union[str, t.Sequence[str]]]] = None,
|
|
2559
2542
|
source_excludes: t.Optional[t.Union[str, t.Sequence[str]]] = None,
|
|
2560
2543
|
source_includes: t.Optional[t.Union[str, t.Sequence[str]]] = None,
|
|
2561
|
-
stored_fields: t.Optional[t.Union[str, t.Sequence[str]]] = None,
|
|
2562
2544
|
version: t.Optional[int] = None,
|
|
2563
2545
|
version_type: t.Optional[
|
|
2564
2546
|
t.Union[str, t.Literal["external", "external_gte", "force", "internal"]]
|
|
@@ -2577,7 +2559,7 @@ class Elasticsearch(BaseClient):
|
|
|
2577
2559
|
</code></pre>
|
|
2578
2560
|
|
|
2579
2561
|
|
|
2580
|
-
`<https://www.elastic.co/docs/api/doc/elasticsearch/
|
|
2562
|
+
`<https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-get>`_
|
|
2581
2563
|
|
|
2582
2564
|
:param index: The name of the index that contains the document.
|
|
2583
2565
|
:param id: A unique document identifier.
|
|
@@ -2595,8 +2577,6 @@ class Elasticsearch(BaseClient):
|
|
|
2595
2577
|
the response.
|
|
2596
2578
|
:param source_includes: A comma-separated list of source fields to include in
|
|
2597
2579
|
the response.
|
|
2598
|
-
:param stored_fields: A comma-separated list of stored fields to return as part
|
|
2599
|
-
of a hit.
|
|
2600
2580
|
:param version: The version number for concurrency control. It must match the
|
|
2601
2581
|
current version of the document for the request to succeed.
|
|
2602
2582
|
:param version_type: The version type.
|
|
@@ -2630,8 +2610,6 @@ class Elasticsearch(BaseClient):
|
|
|
2630
2610
|
__query["_source_excludes"] = source_excludes
|
|
2631
2611
|
if source_includes is not None:
|
|
2632
2612
|
__query["_source_includes"] = source_includes
|
|
2633
|
-
if stored_fields is not None:
|
|
2634
|
-
__query["stored_fields"] = stored_fields
|
|
2635
2613
|
if version is not None:
|
|
2636
2614
|
__query["version"] = version
|
|
2637
2615
|
if version_type is not None:
|
|
@@ -2677,7 +2655,7 @@ class Elasticsearch(BaseClient):
|
|
|
2677
2655
|
When setting up automated polling of the API for health status, set verbose to false to disable the more expensive analysis logic.</p>
|
|
2678
2656
|
|
|
2679
2657
|
|
|
2680
|
-
`<https://www.elastic.co/docs/api/doc/elasticsearch/
|
|
2658
|
+
`<https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-health-report>`_
|
|
2681
2659
|
|
|
2682
2660
|
:param feature: A feature of the cluster, as returned by the top-level health
|
|
2683
2661
|
report API.
|
|
@@ -2740,6 +2718,7 @@ class Elasticsearch(BaseClient):
|
|
|
2740
2718
|
t.Union[bool, str, t.Literal["false", "true", "wait_for"]]
|
|
2741
2719
|
] = None,
|
|
2742
2720
|
require_alias: t.Optional[bool] = None,
|
|
2721
|
+
require_data_stream: t.Optional[bool] = None,
|
|
2743
2722
|
routing: t.Optional[str] = None,
|
|
2744
2723
|
timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None,
|
|
2745
2724
|
version: t.Optional[int] = None,
|
|
@@ -2842,7 +2821,7 @@ class Elasticsearch(BaseClient):
|
|
|
2842
2821
|
</code></pre>
|
|
2843
2822
|
|
|
2844
2823
|
|
|
2845
|
-
`<https://www.elastic.co/docs/api/doc/elasticsearch/
|
|
2824
|
+
`<https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-create>`_
|
|
2846
2825
|
|
|
2847
2826
|
:param index: The name of the data stream or index to target. If the target doesn't
|
|
2848
2827
|
exist and matches the name or wildcard (`*`) pattern of an index template
|
|
@@ -2875,6 +2854,8 @@ class Elasticsearch(BaseClient):
|
|
|
2875
2854
|
this operation visible to search. If `wait_for`, it waits for a refresh to
|
|
2876
2855
|
make this operation visible to search. If `false`, it does nothing with refreshes.
|
|
2877
2856
|
:param require_alias: If `true`, the destination must be an index alias.
|
|
2857
|
+
:param require_data_stream: If `true`, the request's actions must target a data
|
|
2858
|
+
stream (existing or to be created).
|
|
2878
2859
|
:param routing: A custom value that is used to route operations to a specific
|
|
2879
2860
|
shard.
|
|
2880
2861
|
:param timeout: The period the request waits for the following operations: automatic
|
|
@@ -2936,6 +2917,8 @@ class Elasticsearch(BaseClient):
|
|
|
2936
2917
|
__query["refresh"] = refresh
|
|
2937
2918
|
if require_alias is not None:
|
|
2938
2919
|
__query["require_alias"] = require_alias
|
|
2920
|
+
if require_data_stream is not None:
|
|
2921
|
+
__query["require_data_stream"] = require_data_stream
|
|
2939
2922
|
if routing is not None:
|
|
2940
2923
|
__query["routing"] = routing
|
|
2941
2924
|
if timeout is not None:
|
|
@@ -2971,10 +2954,11 @@ class Elasticsearch(BaseClient):
|
|
|
2971
2954
|
.. raw:: html
|
|
2972
2955
|
|
|
2973
2956
|
<p>Get cluster info.
|
|
2974
|
-
Get basic build, version, and cluster information
|
|
2957
|
+
Get basic build, version, and cluster information.
|
|
2958
|
+
::: In Serverless, this API is retained for backward compatibility only. Some response fields, such as the version number, should be ignored.</p>
|
|
2975
2959
|
|
|
2976
2960
|
|
|
2977
|
-
`<https://www.elastic.co/docs/api/doc/elasticsearch/
|
|
2961
|
+
`<https://www.elastic.co/docs/api/doc/elasticsearch/group/endpoint-info>`_
|
|
2978
2962
|
"""
|
|
2979
2963
|
__path_parts: t.Dict[str, str] = {}
|
|
2980
2964
|
__path = "/"
|
|
@@ -3043,7 +3027,7 @@ class Elasticsearch(BaseClient):
|
|
|
3043
3027
|
You can include the <code>stored_fields</code> query parameter in the request URI to specify the defaults to use when there are no per-document instructions.</p>
|
|
3044
3028
|
|
|
3045
3029
|
|
|
3046
|
-
`<https://www.elastic.co/docs/api/doc/elasticsearch/
|
|
3030
|
+
`<https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-mget>`_
|
|
3047
3031
|
|
|
3048
3032
|
:param index: Name of the index to retrieve documents from when `ids` are specified,
|
|
3049
3033
|
or when a document in the `docs` array does not specify an index.
|
|
@@ -3178,7 +3162,7 @@ class Elasticsearch(BaseClient):
|
|
|
3178
3162
|
When sending requests to this endpoint the <code>Content-Type</code> header should be set to <code>application/x-ndjson</code>.</p>
|
|
3179
3163
|
|
|
3180
3164
|
|
|
3181
|
-
`<https://www.elastic.co/docs/api/doc/elasticsearch/
|
|
3165
|
+
`<https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-msearch>`_
|
|
3182
3166
|
|
|
3183
3167
|
:param searches:
|
|
3184
3168
|
:param index: Comma-separated list of data streams, indices, and index aliases
|
|
@@ -3325,7 +3309,7 @@ class Elasticsearch(BaseClient):
|
|
|
3325
3309
|
</code></pre>
|
|
3326
3310
|
|
|
3327
3311
|
|
|
3328
|
-
`<https://www.elastic.co/docs/api/doc/elasticsearch/
|
|
3312
|
+
`<https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-msearch-template>`_
|
|
3329
3313
|
|
|
3330
3314
|
:param search_templates:
|
|
3331
3315
|
:param index: A comma-separated list of data streams, indices, and aliases to
|
|
@@ -3430,7 +3414,7 @@ class Elasticsearch(BaseClient):
|
|
|
3430
3414
|
The mapping used is determined by the specified <code>_index</code>.</p>
|
|
3431
3415
|
|
|
3432
3416
|
|
|
3433
|
-
`<https://www.elastic.co/docs/api/doc/elasticsearch/
|
|
3417
|
+
`<https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-mtermvectors>`_
|
|
3434
3418
|
|
|
3435
3419
|
:param index: The name of the index that contains the documents.
|
|
3436
3420
|
:param docs: An array of existing or artificial documents.
|
|
@@ -3571,7 +3555,7 @@ class Elasticsearch(BaseClient):
|
|
|
3571
3555
|
You can check how many point-in-times (that is, search contexts) are open with the nodes stats API.</p>
|
|
3572
3556
|
|
|
3573
3557
|
|
|
3574
|
-
`<https://www.elastic.co/docs/api/doc/elasticsearch/
|
|
3558
|
+
`<https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-open-point-in-time>`_
|
|
3575
3559
|
|
|
3576
3560
|
:param index: A comma-separated list of index names to open point in time; use
|
|
3577
3561
|
`_all` or empty string to perform the operation on all indices
|
|
@@ -3584,8 +3568,7 @@ class Elasticsearch(BaseClient):
|
|
|
3584
3568
|
:param expand_wildcards: The type of index that wildcard patterns can match.
|
|
3585
3569
|
If the request can target data streams, this argument determines whether
|
|
3586
3570
|
wildcard expressions match hidden data streams. It supports comma-separated
|
|
3587
|
-
values, such as `open,hidden`.
|
|
3588
|
-
`hidden`, `none`.
|
|
3571
|
+
values, such as `open,hidden`.
|
|
3589
3572
|
:param ignore_unavailable: If `false`, the request returns an error if it targets
|
|
3590
3573
|
a missing or closed index.
|
|
3591
3574
|
:param index_filter: Filter indices if the provided query rewrites to `match_none`
|
|
@@ -3669,7 +3652,7 @@ class Elasticsearch(BaseClient):
|
|
|
3669
3652
|
Creates or updates a stored script or search template.</p>
|
|
3670
3653
|
|
|
3671
3654
|
|
|
3672
|
-
`<https://www.elastic.co/docs/api/doc/elasticsearch/
|
|
3655
|
+
`<https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-put-script>`_
|
|
3673
3656
|
|
|
3674
3657
|
:param id: The identifier for the stored script or search template. It must be
|
|
3675
3658
|
unique within the cluster.
|
|
@@ -3759,7 +3742,7 @@ class Elasticsearch(BaseClient):
|
|
|
3759
3742
|
<p>Evaluate the quality of ranked search results over a set of typical search queries.</p>
|
|
3760
3743
|
|
|
3761
3744
|
|
|
3762
|
-
`<https://www.elastic.co/docs/api/doc/elasticsearch/
|
|
3745
|
+
`<https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-rank-eval>`_
|
|
3763
3746
|
|
|
3764
3747
|
:param requests: A set of typical search requests, together with their provided
|
|
3765
3748
|
ratings.
|
|
@@ -3885,113 +3868,10 @@ class Elasticsearch(BaseClient):
|
|
|
3885
3868
|
In this case, the response includes a count of the version conflicts that were encountered.
|
|
3886
3869
|
Note that the handling of other error types is unaffected by the <code>conflicts</code> property.
|
|
3887
3870
|
Additionally, if you opt to count version conflicts, the operation could attempt to reindex more documents from the source than <code>max_docs</code> until it has successfully indexed <code>max_docs</code> documents into the target or it has gone through every document in the source query.</p>
|
|
3888
|
-
<p>
|
|
3889
|
-
|
|
3890
|
-
|
|
3891
|
-
|
|
3892
|
-
<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 cancel or get the status of the task.
|
|
3893
|
-
Elasticsearch creates a record of this task as a document at <code>_tasks/<task_id></code>.</p>
|
|
3894
|
-
<p><strong>Reindex from multiple sources</strong></p>
|
|
3895
|
-
<p>If you have many sources to reindex it is generally better to reindex them one at a time rather than using a glob pattern to pick up multiple sources.
|
|
3896
|
-
That way you can resume the process if there are any errors by removing the partially completed source and starting over.
|
|
3897
|
-
It also makes parallelizing the process fairly simple: split the list of sources to reindex and run each list in parallel.</p>
|
|
3898
|
-
<p>For example, you can use a bash script like this:</p>
|
|
3899
|
-
<pre><code>for index in i1 i2 i3 i4 i5; do
|
|
3900
|
-
curl -HContent-Type:application/json -XPOST localhost:9200/_reindex?pretty -d'{
|
|
3901
|
-
"source": {
|
|
3902
|
-
"index": "'$index'"
|
|
3903
|
-
},
|
|
3904
|
-
"dest": {
|
|
3905
|
-
"index": "'$index'-reindexed"
|
|
3906
|
-
}
|
|
3907
|
-
}'
|
|
3908
|
-
done
|
|
3909
|
-
</code></pre>
|
|
3910
|
-
<p><strong>Throttling</strong></p>
|
|
3911
|
-
<p>Set <code>requests_per_second</code> to any positive decimal number (<code>1.4</code>, <code>6</code>, <code>1000</code>, for example) to throttle the rate at which reindex issues batches of index operations.
|
|
3912
|
-
Requests are throttled by padding each batch with a wait time.
|
|
3913
|
-
To turn off throttling, set <code>requests_per_second</code> to <code>-1</code>.</p>
|
|
3914
|
-
<p>The throttling is done by waiting between batches so that the scroll that reindex uses internally can be given a timeout that takes into account the padding.
|
|
3915
|
-
The padding time is the difference between the batch size divided by the <code>requests_per_second</code> and the time spent writing.
|
|
3916
|
-
By default the batch size is <code>1000</code>, so if <code>requests_per_second</code> is set to <code>500</code>:</p>
|
|
3917
|
-
<pre><code>target_time = 1000 / 500 per second = 2 seconds
|
|
3918
|
-
wait_time = target_time - write_time = 2 seconds - .5 seconds = 1.5 seconds
|
|
3919
|
-
</code></pre>
|
|
3920
|
-
<p>Since the batch is issued as a single bulk request, large batch sizes cause Elasticsearch to create many requests and then wait for a while before starting the next set.
|
|
3921
|
-
This is "bursty" instead of "smooth".</p>
|
|
3922
|
-
<p><strong>Slicing</strong></p>
|
|
3923
|
-
<p>Reindex supports sliced scroll to parallelize the reindexing process.
|
|
3924
|
-
This parallelization can improve efficiency and provide a convenient way to break the request down into smaller parts.</p>
|
|
3925
|
-
<p>NOTE: Reindexing from remote clusters does not support manual or automatic slicing.</p>
|
|
3926
|
-
<p>You can slice a reindex request manually by providing a slice ID and total number of slices to each request.
|
|
3927
|
-
You can also let reindex automatically parallelize by using sliced scroll to slice on <code>_id</code>.
|
|
3928
|
-
The <code>slices</code> parameter specifies the number of slices to use.</p>
|
|
3929
|
-
<p>Adding <code>slices</code> to the reindex request just automates the manual process, creating sub-requests which means it has some quirks:</p>
|
|
3930
|
-
<ul>
|
|
3931
|
-
<li>You can see these requests in the tasks API. These sub-requests are "child" tasks of the task for the request with slices.</li>
|
|
3932
|
-
<li>Fetching the status of the task for the request with <code>slices</code> only contains the status of completed slices.</li>
|
|
3933
|
-
<li>These sub-requests are individually addressable for things like cancellation and rethrottling.</li>
|
|
3934
|
-
<li>Rethrottling the request with <code>slices</code> will rethrottle the unfinished sub-request proportionally.</li>
|
|
3935
|
-
<li>Canceling the request with <code>slices</code> will cancel each sub-request.</li>
|
|
3936
|
-
<li>Due to the nature of <code>slices</code>, each sub-request won't get a perfectly even portion of the documents. All documents will be addressed, but some slices may be larger than others. Expect larger slices to have a more even distribution.</li>
|
|
3937
|
-
<li>Parameters like <code>requests_per_second</code> and <code>max_docs</code> on a request with <code>slices</code> are distributed proportionally to each sub-request. Combine that with the previous point about distribution being uneven and you should conclude that using <code>max_docs</code> with <code>slices</code> might not result in exactly <code>max_docs</code> documents being reindexed.</li>
|
|
3938
|
-
<li>Each sub-request gets a slightly different snapshot of the source, though these are all taken at approximately the same time.</li>
|
|
3939
|
-
</ul>
|
|
3940
|
-
<p>If slicing automatically, setting <code>slices</code> to <code>auto</code> will choose a reasonable number for most indices.
|
|
3941
|
-
If slicing manually or otherwise tuning automatic slicing, use the following guidelines.</p>
|
|
3942
|
-
<p>Query performance is most efficient when the number of slices is equal to the number of shards in the index.
|
|
3943
|
-
If that number is large (for example, <code>500</code>), choose a lower number as too many slices will hurt performance.
|
|
3944
|
-
Setting slices higher than the number of shards generally does not improve efficiency and adds overhead.</p>
|
|
3945
|
-
<p>Indexing performance scales linearly across available resources with the number of slices.</p>
|
|
3946
|
-
<p>Whether query or indexing performance dominates the runtime depends on the documents being reindexed and cluster resources.</p>
|
|
3947
|
-
<p><strong>Modify documents during reindexing</strong></p>
|
|
3948
|
-
<p>Like <code>_update_by_query</code>, reindex operations support a script that modifies the document.
|
|
3949
|
-
Unlike <code>_update_by_query</code>, the script is allowed to modify the document's metadata.</p>
|
|
3950
|
-
<p>Just as in <code>_update_by_query</code>, you can set <code>ctx.op</code> to change the operation that is run on the destination.
|
|
3951
|
-
For example, set <code>ctx.op</code> to <code>noop</code> if your script decides that the document doesn’t have to be indexed in the destination. This "no operation" will be reported in the <code>noop</code> counter in the response body.
|
|
3952
|
-
Set <code>ctx.op</code> to <code>delete</code> if your script decides that the document must be deleted from the destination.
|
|
3953
|
-
The deletion will be reported in the <code>deleted</code> counter in the response body.
|
|
3954
|
-
Setting <code>ctx.op</code> to anything else will return an error, as will setting any other field in <code>ctx</code>.</p>
|
|
3955
|
-
<p>Think of the possibilities! Just be careful; you are able to change:</p>
|
|
3956
|
-
<ul>
|
|
3957
|
-
<li><code>_id</code></li>
|
|
3958
|
-
<li><code>_index</code></li>
|
|
3959
|
-
<li><code>_version</code></li>
|
|
3960
|
-
<li><code>_routing</code></li>
|
|
3961
|
-
</ul>
|
|
3962
|
-
<p>Setting <code>_version</code> to <code>null</code> or clearing it from the <code>ctx</code> map is just like not sending the version in an indexing request.
|
|
3963
|
-
It will cause the document to be overwritten in the destination regardless of the version on the target or the version type you use in the reindex API.</p>
|
|
3964
|
-
<p><strong>Reindex from remote</strong></p>
|
|
3965
|
-
<p>Reindex supports reindexing from a remote Elasticsearch cluster.
|
|
3966
|
-
The <code>host</code> parameter must contain a scheme, host, port, and optional path.
|
|
3967
|
-
The <code>username</code> and <code>password</code> parameters are optional and when they are present the reindex operation will connect to the remote Elasticsearch node using basic authentication.
|
|
3968
|
-
Be sure to use HTTPS when using basic authentication or the password will be sent in plain text.
|
|
3969
|
-
There are a range of settings available to configure the behavior of the HTTPS connection.</p>
|
|
3970
|
-
<p>When using Elastic Cloud, it is also possible to authenticate against the remote cluster through the use of a valid API key.
|
|
3971
|
-
Remote hosts must be explicitly allowed with the <code>reindex.remote.whitelist</code> setting.
|
|
3972
|
-
It can be set to a comma delimited list of allowed remote host and port combinations.
|
|
3973
|
-
Scheme is ignored; only the host and port are used.
|
|
3974
|
-
For example:</p>
|
|
3975
|
-
<pre><code>reindex.remote.whitelist: [otherhost:9200, another:9200, 127.0.10.*:9200, localhost:*"]
|
|
3976
|
-
</code></pre>
|
|
3977
|
-
<p>The list of allowed hosts must be configured on any nodes that will coordinate the reindex.
|
|
3978
|
-
This feature should work with remote clusters of any version of Elasticsearch.
|
|
3979
|
-
This should enable you to upgrade from any version of Elasticsearch to the current version by reindexing from a cluster of the old version.</p>
|
|
3980
|
-
<p>WARNING: Elasticsearch does not support forward compatibility across major versions.
|
|
3981
|
-
For example, you cannot reindex from a 7.x cluster into a 6.x cluster.</p>
|
|
3982
|
-
<p>To enable queries sent to older versions of Elasticsearch, the <code>query</code> parameter is sent directly to the remote host without validation or modification.</p>
|
|
3983
|
-
<p>NOTE: Reindexing from remote clusters does not support manual or automatic slicing.</p>
|
|
3984
|
-
<p>Reindexing from a remote server uses an on-heap buffer that defaults to a maximum size of 100mb.
|
|
3985
|
-
If the remote index includes very large documents you'll need to use a smaller batch size.
|
|
3986
|
-
It is also possible to set the socket read timeout on the remote connection with the <code>socket_timeout</code> field and the connection timeout with the <code>connect_timeout</code> field.
|
|
3987
|
-
Both default to 30 seconds.</p>
|
|
3988
|
-
<p><strong>Configuring SSL parameters</strong></p>
|
|
3989
|
-
<p>Reindex from remote supports configurable SSL settings.
|
|
3990
|
-
These must be specified in the <code>elasticsearch.yml</code> file, with the exception of the secure settings, which you add in the Elasticsearch keystore.
|
|
3991
|
-
It is not possible to configure SSL in the body of the reindex request.</p>
|
|
3992
|
-
|
|
3993
|
-
|
|
3994
|
-
`<https://www.elastic.co/docs/api/doc/elasticsearch/v9/operation/operation-reindex>`_
|
|
3871
|
+
<p>Refer to the linked documentation for examples of how to reindex documents.</p>
|
|
3872
|
+
|
|
3873
|
+
|
|
3874
|
+
`<https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-reindex>`_
|
|
3995
3875
|
|
|
3996
3876
|
:param dest: The destination you are copying to.
|
|
3997
3877
|
:param source: The source you are copying from.
|
|
@@ -4115,7 +3995,7 @@ class Elasticsearch(BaseClient):
|
|
|
4115
3995
|
This behavior prevents scroll timeouts.</p>
|
|
4116
3996
|
|
|
4117
3997
|
|
|
4118
|
-
`<https://www.elastic.co/docs/api/doc/elasticsearch/
|
|
3998
|
+
`<https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-reindex>`_
|
|
4119
3999
|
|
|
4120
4000
|
:param task_id: The task identifier, which can be found by using the tasks API.
|
|
4121
4001
|
:param requests_per_second: The throttle for this request in sub-requests per
|
|
@@ -4171,7 +4051,7 @@ class Elasticsearch(BaseClient):
|
|
|
4171
4051
|
<p>Render a search template as a search request body.</p>
|
|
4172
4052
|
|
|
4173
4053
|
|
|
4174
|
-
`<https://www.elastic.co/docs/api/doc/elasticsearch/
|
|
4054
|
+
`<https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-render-search-template>`_
|
|
4175
4055
|
|
|
4176
4056
|
:param id: The ID of the search template to render. If no `source` is specified,
|
|
4177
4057
|
this or the `id` request body parameter is required.
|
|
@@ -4338,7 +4218,7 @@ class Elasticsearch(BaseClient):
|
|
|
4338
4218
|
<p>IMPORTANT: Results from a scrolling search reflect the state of the index at the time of the initial search request. Subsequent indexing or document changes only affect later search and scroll requests.</p>
|
|
4339
4219
|
|
|
4340
4220
|
|
|
4341
|
-
`<https://www.elastic.co/docs/api/doc/elasticsearch/
|
|
4221
|
+
`<https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-scroll>`_
|
|
4342
4222
|
|
|
4343
4223
|
:param scroll_id: The scroll ID of the search.
|
|
4344
4224
|
:param rest_total_hits_as_int: If true, the API response’s hit.total property
|
|
@@ -4543,7 +4423,7 @@ class Elasticsearch(BaseClient):
|
|
|
4543
4423
|
This situation can occur because the splitting criterion is based on Lucene document IDs, which are not stable across changes to the index.</p>
|
|
4544
4424
|
|
|
4545
4425
|
|
|
4546
|
-
`<https://www.elastic.co/docs/api/doc/elasticsearch/
|
|
4426
|
+
`<https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-search>`_
|
|
4547
4427
|
|
|
4548
4428
|
:param index: A comma-separated list of data streams, indices, and aliases to
|
|
4549
4429
|
search. It supports wildcards (`*`). To search all data streams and indices,
|
|
@@ -4650,11 +4530,11 @@ class Elasticsearch(BaseClient):
|
|
|
4650
4530
|
of the specified nodes are available, select shards from any available node
|
|
4651
4531
|
using the default method. * `_prefer_nodes:<node-id>,<node-id>` to if possible,
|
|
4652
4532
|
run the search on the specified nodes IDs. If not, select shards using the
|
|
4653
|
-
default method. `_shards:<shard>,<shard>` to run the search only on the
|
|
4654
|
-
shards. You can combine this value with other `preference` values.
|
|
4655
|
-
the `_shards` value must come first. For example: `_shards:2,3|_local`.
|
|
4656
|
-
(any string that does not start with `_`) to route searches
|
|
4657
|
-
`<custom-string>` to the same shards in the same order.
|
|
4533
|
+
default method. * `_shards:<shard>,<shard>` to run the search only on the
|
|
4534
|
+
specified shards. You can combine this value with other `preference` values.
|
|
4535
|
+
However, the `_shards` value must come first. For example: `_shards:2,3|_local`.
|
|
4536
|
+
* `<custom-string>` (any string that does not start with `_`) to route searches
|
|
4537
|
+
with the same `<custom-string>` to the same shards in the same order.
|
|
4658
4538
|
:param profile: Set to `true` to return detailed timing information about the
|
|
4659
4539
|
execution of individual components in a search request. NOTE: This is a debugging
|
|
4660
4540
|
tool and adds significant overhead to search execution.
|
|
@@ -4990,51 +4870,6 @@ class Elasticsearch(BaseClient):
|
|
|
4990
4870
|
<li>Optionally, a <code>geo_bounds</code> aggregation on the <code><field></code>. The search only includes this aggregation if the <code>exact_bounds</code> parameter is <code>true</code>.</li>
|
|
4991
4871
|
<li>If the optional parameter <code>with_labels</code> is <code>true</code>, the internal search will include a dynamic runtime field that calls the <code>getLabelPosition</code> function of the geometry doc value. This enables the generation of new point features containing suggested geometry labels, so that, for example, multi-polygons will have only one label.</li>
|
|
4992
4872
|
</ul>
|
|
4993
|
-
<p>For example, Elasticsearch may translate a vector tile search API request with a <code>grid_agg</code> argument of <code>geotile</code> and an <code>exact_bounds</code> argument of <code>true</code> into the following search</p>
|
|
4994
|
-
<pre><code>GET my-index/_search
|
|
4995
|
-
{
|
|
4996
|
-
"size": 10000,
|
|
4997
|
-
"query": {
|
|
4998
|
-
"geo_bounding_box": {
|
|
4999
|
-
"my-geo-field": {
|
|
5000
|
-
"top_left": {
|
|
5001
|
-
"lat": -40.979898069620134,
|
|
5002
|
-
"lon": -45
|
|
5003
|
-
},
|
|
5004
|
-
"bottom_right": {
|
|
5005
|
-
"lat": -66.51326044311186,
|
|
5006
|
-
"lon": 0
|
|
5007
|
-
}
|
|
5008
|
-
}
|
|
5009
|
-
}
|
|
5010
|
-
},
|
|
5011
|
-
"aggregations": {
|
|
5012
|
-
"grid": {
|
|
5013
|
-
"geotile_grid": {
|
|
5014
|
-
"field": "my-geo-field",
|
|
5015
|
-
"precision": 11,
|
|
5016
|
-
"size": 65536,
|
|
5017
|
-
"bounds": {
|
|
5018
|
-
"top_left": {
|
|
5019
|
-
"lat": -40.979898069620134,
|
|
5020
|
-
"lon": -45
|
|
5021
|
-
},
|
|
5022
|
-
"bottom_right": {
|
|
5023
|
-
"lat": -66.51326044311186,
|
|
5024
|
-
"lon": 0
|
|
5025
|
-
}
|
|
5026
|
-
}
|
|
5027
|
-
}
|
|
5028
|
-
},
|
|
5029
|
-
"bounds": {
|
|
5030
|
-
"geo_bounds": {
|
|
5031
|
-
"field": "my-geo-field",
|
|
5032
|
-
"wrap_longitude": false
|
|
5033
|
-
}
|
|
5034
|
-
}
|
|
5035
|
-
}
|
|
5036
|
-
}
|
|
5037
|
-
</code></pre>
|
|
5038
4873
|
<p>The API returns results as a binary Mapbox vector tile.
|
|
5039
4874
|
Mapbox vector tiles are encoded as Google Protobufs (PBF). By default, the tile contains three layers:</p>
|
|
5040
4875
|
<ul>
|
|
@@ -5289,9 +5124,10 @@ class Elasticsearch(BaseClient):
|
|
|
5289
5124
|
Some cells may intersect more than one vector tile.
|
|
5290
5125
|
To compute the H3 resolution for each precision, Elasticsearch compares the average density of hexagonal bins at each resolution with the average density of tile bins at each zoom level.
|
|
5291
5126
|
Elasticsearch uses the H3 resolution that is closest to the corresponding geotile density.</p>
|
|
5127
|
+
<p>Learn how to use the vector tile search API with practical examples in the <a href="https://www.elastic.co/docs/reference/elasticsearch/rest-apis/vector-tile-search">Vector tile search examples</a> guide.</p>
|
|
5292
5128
|
|
|
5293
5129
|
|
|
5294
|
-
`<https://www.elastic.co/docs/api/doc/elasticsearch/
|
|
5130
|
+
`<https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-search-mvt>`_
|
|
5295
5131
|
|
|
5296
5132
|
:param index: Comma-separated list of data streams, indices, or aliases to search
|
|
5297
5133
|
:param field: Field containing geospatial data to return
|
|
@@ -5465,7 +5301,7 @@ class Elasticsearch(BaseClient):
|
|
|
5465
5301
|
<p>If the Elasticsearch security features are enabled, you must have the <code>view_index_metadata</code> or <code>manage</code> index privilege for the target data stream, index, or alias.</p>
|
|
5466
5302
|
|
|
5467
5303
|
|
|
5468
|
-
`<https://www.elastic.co/docs/api/doc/elasticsearch/
|
|
5304
|
+
`<https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-search-shards>`_
|
|
5469
5305
|
|
|
5470
5306
|
:param index: A comma-separated list of data streams, indices, and aliases to
|
|
5471
5307
|
search. It supports wildcards (`*`). To search all data streams and indices,
|
|
@@ -5478,7 +5314,7 @@ class Elasticsearch(BaseClient):
|
|
|
5478
5314
|
:param expand_wildcards: Type of index that wildcard patterns can match. If the
|
|
5479
5315
|
request can target data streams, this argument determines whether wildcard
|
|
5480
5316
|
expressions match hidden data streams. Supports comma-separated values, such
|
|
5481
|
-
as `open,hidden`.
|
|
5317
|
+
as `open,hidden`.
|
|
5482
5318
|
:param ignore_unavailable: If `false`, the request returns an error if it targets
|
|
5483
5319
|
a missing or closed index.
|
|
5484
5320
|
:param local: If `true`, the request retrieves information from the local node
|
|
@@ -5576,7 +5412,7 @@ class Elasticsearch(BaseClient):
|
|
|
5576
5412
|
<p>Run a search with a search template.</p>
|
|
5577
5413
|
|
|
5578
5414
|
|
|
5579
|
-
`<https://www.elastic.co/docs/api/doc/elasticsearch/
|
|
5415
|
+
`<https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-search-template>`_
|
|
5580
5416
|
|
|
5581
5417
|
:param index: A comma-separated list of data streams, indices, and aliases to
|
|
5582
5418
|
search. It supports wildcards (`*`).
|
|
@@ -5590,8 +5426,7 @@ class Elasticsearch(BaseClient):
|
|
|
5590
5426
|
:param expand_wildcards: The type of index that wildcard patterns can match.
|
|
5591
5427
|
If the request can target data streams, this argument determines whether
|
|
5592
5428
|
wildcard expressions match hidden data streams. Supports comma-separated
|
|
5593
|
-
values, such as `open,hidden`.
|
|
5594
|
-
`hidden`, `none`.
|
|
5429
|
+
values, such as `open,hidden`.
|
|
5595
5430
|
:param explain: If `true`, returns detailed information about score calculation
|
|
5596
5431
|
as part of each hit. If you specify both this and the `explain` query parameter,
|
|
5597
5432
|
the API uses only the query parameter.
|
|
@@ -5719,7 +5554,7 @@ class Elasticsearch(BaseClient):
|
|
|
5719
5554
|
</blockquote>
|
|
5720
5555
|
|
|
5721
5556
|
|
|
5722
|
-
`<https://www.elastic.co/docs/api/doc/elasticsearch/
|
|
5557
|
+
`<https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-terms-enum>`_
|
|
5723
5558
|
|
|
5724
5559
|
:param index: A comma-separated list of data streams, indices, and index aliases
|
|
5725
5560
|
to search. Wildcard (`*`) expressions are supported. To search all data streams
|
|
@@ -5865,10 +5700,11 @@ class Elasticsearch(BaseClient):
|
|
|
5865
5700
|
The information is only retrieved for the shard the requested document resides in.
|
|
5866
5701
|
The term and field statistics are therefore only useful as relative measures whereas the absolute numbers have no meaning in this context.
|
|
5867
5702
|
By default, when requesting term vectors of artificial documents, a shard to get the statistics from is randomly selected.
|
|
5868
|
-
Use <code>routing</code> only to hit a particular shard
|
|
5703
|
+
Use <code>routing</code> only to hit a particular shard.
|
|
5704
|
+
Refer to the linked documentation for detailed examples of how to use this API.</p>
|
|
5869
5705
|
|
|
5870
5706
|
|
|
5871
|
-
`<https://www.elastic.co/docs/api/doc/elasticsearch/
|
|
5707
|
+
`<https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-termvectors>`_
|
|
5872
5708
|
|
|
5873
5709
|
:param index: The name of the index that contains the document.
|
|
5874
5710
|
:param id: A unique identifier for the document.
|
|
@@ -6036,10 +5872,11 @@ class Elasticsearch(BaseClient):
|
|
|
6036
5872
|
</ul>
|
|
6037
5873
|
<p>The document must still be reindexed, but using this API removes some network roundtrips and reduces chances of version conflicts between the GET and the index operation.</p>
|
|
6038
5874
|
<p>The <code>_source</code> field must be enabled to use this API.
|
|
6039
|
-
In addition to <code>_source</code>, you can access the following variables through the <code>ctx</code> map: <code>_index</code>, <code>_type</code>, <code>_id</code>, <code>_version</code>, <code>_routing</code>, and <code>_now</code> (the current timestamp)
|
|
5875
|
+
In addition to <code>_source</code>, you can access the following variables through the <code>ctx</code> map: <code>_index</code>, <code>_type</code>, <code>_id</code>, <code>_version</code>, <code>_routing</code>, and <code>_now</code> (the current timestamp).
|
|
5876
|
+
For usage examples such as partial updates, upserts, and scripted updates, see the External documentation.</p>
|
|
6040
5877
|
|
|
6041
5878
|
|
|
6042
|
-
`<https://www.elastic.co/docs/api/doc/elasticsearch/
|
|
5879
|
+
`<https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-update>`_
|
|
6043
5880
|
|
|
6044
5881
|
:param index: The name of the target index. By default, the index is created
|
|
6045
5882
|
automatically if it doesn't exist.
|
|
@@ -6229,6 +6066,24 @@ class Elasticsearch(BaseClient):
|
|
|
6229
6066
|
A bulk update request is performed for each batch of matching documents.
|
|
6230
6067
|
Any query or update failures cause the update by query request to fail and the failures are shown in the response.
|
|
6231
6068
|
Any update requests that completed successfully still stick, they are not rolled back.</p>
|
|
6069
|
+
<p><strong>Refreshing shards</strong></p>
|
|
6070
|
+
<p>Specifying the <code>refresh</code> parameter refreshes all shards once the request completes.
|
|
6071
|
+
This is different to the update API's <code>refresh</code> parameter, which causes only the shard
|
|
6072
|
+
that received the request to be refreshed. Unlike the update API, it does not support
|
|
6073
|
+
<code>wait_for</code>.</p>
|
|
6074
|
+
<p><strong>Running update by query asynchronously</strong></p>
|
|
6075
|
+
<p>If the request contains <code>wait_for_completion=false</code>, Elasticsearch
|
|
6076
|
+
performs some preflight checks, launches the request, and returns a
|
|
6077
|
+
<a href="https://www.elastic.co/docs/api/doc/elasticsearch/group/endpoint-tasks">task</a> you can use to cancel or get the status of the task.
|
|
6078
|
+
Elasticsearch creates a record of this task as a document at <code>.tasks/task/${taskId}</code>.</p>
|
|
6079
|
+
<p><strong>Waiting for active shards</strong></p>
|
|
6080
|
+
<p><code>wait_for_active_shards</code> controls how many copies of a shard must be active
|
|
6081
|
+
before proceeding with the request. See <a href="https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-create#operation-create-wait_for_active_shards"><code>wait_for_active_shards</code></a>
|
|
6082
|
+
for details. <code>timeout</code> controls how long each write request waits for unavailable
|
|
6083
|
+
shards to become available. Both work exactly the way they work in the
|
|
6084
|
+
<a href="https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-bulk">Bulk API</a>. Update by query uses scrolled searches, so you can also
|
|
6085
|
+
specify the <code>scroll</code> parameter to control how long it keeps the search context
|
|
6086
|
+
alive, for example <code>?scroll=10m</code>. The default is 5 minutes.</p>
|
|
6232
6087
|
<p><strong>Throttling update requests</strong></p>
|
|
6233
6088
|
<p>To control the rate at which update by query issues batches of update operations, you can set <code>requests_per_second</code> to any positive decimal number.
|
|
6234
6089
|
This pads each batch with a wait time to throttle the rate.
|
|
@@ -6263,21 +6118,11 @@ class Elasticsearch(BaseClient):
|
|
|
6263
6118
|
<li>Query performance is most efficient when the number of slices is equal to the number of shards in the index or backing index. If that number is large (for example, 500), choose a lower number as too many slices hurts performance. Setting slices higher than the number of shards generally does not improve efficiency and adds overhead.</li>
|
|
6264
6119
|
<li>Update performance scales linearly across available resources with the number of slices.</li>
|
|
6265
6120
|
</ul>
|
|
6266
|
-
<p>Whether query or update performance dominates the runtime depends on the documents being reindexed and cluster resources
|
|
6267
|
-
|
|
6268
|
-
|
|
6269
|
-
|
|
6270
|
-
|
|
6271
|
-
The update by query operation skips updating the document and increments the <code>noop</code> counter.</p>
|
|
6272
|
-
<p>Set <code>ctx.op = "delete"</code> if your script decides that the document should be deleted.
|
|
6273
|
-
The update by query operation deletes the document and increments the <code>deleted</code> counter.</p>
|
|
6274
|
-
<p>Update by query supports only <code>index</code>, <code>noop</code>, and <code>delete</code>.
|
|
6275
|
-
Setting <code>ctx.op</code> to anything else is an error.
|
|
6276
|
-
Setting any other field in <code>ctx</code> is an error.
|
|
6277
|
-
This API enables you to only modify the source of matching documents; you cannot move them.</p>
|
|
6278
|
-
|
|
6279
|
-
|
|
6280
|
-
`<https://www.elastic.co/docs/api/doc/elasticsearch/v9/operation/operation-update-by-query>`_
|
|
6121
|
+
<p>Whether query or update performance dominates the runtime depends on the documents being reindexed and cluster resources.
|
|
6122
|
+
Refer to the linked documentation for examples of how to update documents using the <code>_update_by_query</code> API:</p>
|
|
6123
|
+
|
|
6124
|
+
|
|
6125
|
+
`<https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-update-by-query>`_
|
|
6281
6126
|
|
|
6282
6127
|
:param index: A comma-separated list of data streams, indices, and aliases to
|
|
6283
6128
|
search. It supports wildcards (`*`). To search all data streams or indices,
|
|
@@ -6302,8 +6147,7 @@ class Elasticsearch(BaseClient):
|
|
|
6302
6147
|
:param expand_wildcards: The type of index that wildcard patterns can match.
|
|
6303
6148
|
If the request can target data streams, this argument determines whether
|
|
6304
6149
|
wildcard expressions match hidden data streams. It supports comma-separated
|
|
6305
|
-
values, such as `open,hidden`.
|
|
6306
|
-
`hidden`, `none`.
|
|
6150
|
+
values, such as `open,hidden`.
|
|
6307
6151
|
:param from_: Skips the specified number of documents.
|
|
6308
6152
|
:param ignore_unavailable: If `false`, the request returns an error if it targets
|
|
6309
6153
|
a missing or closed index.
|
|
@@ -6497,7 +6341,7 @@ class Elasticsearch(BaseClient):
|
|
|
6497
6341
|
Rethrottling that speeds up the query takes effect immediately but rethrotting that slows down the query takes effect after completing the current batch to prevent scroll timeouts.</p>
|
|
6498
6342
|
|
|
6499
6343
|
|
|
6500
|
-
`<https://www.elastic.co/docs/api/doc/elasticsearch/
|
|
6344
|
+
`<https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-update-by-query-rethrottle>`_
|
|
6501
6345
|
|
|
6502
6346
|
:param task_id: The ID for the task.
|
|
6503
6347
|
:param requests_per_second: The throttle for this request in sub-requests per
|