elasticsearch 8.17.0__py3-none-any.whl → 8.17.1__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.
Files changed (68) hide show
  1. elasticsearch/_async/client/__init__.py +153 -51
  2. elasticsearch/_async/client/cat.py +64 -195
  3. elasticsearch/_async/client/cluster.py +19 -19
  4. elasticsearch/_async/client/connector.py +337 -0
  5. elasticsearch/_async/client/dangling_indices.py +3 -3
  6. elasticsearch/_async/client/ilm.py +6 -6
  7. elasticsearch/_async/client/indices.py +360 -81
  8. elasticsearch/_async/client/inference.py +94 -1
  9. elasticsearch/_async/client/ingest.py +175 -2
  10. elasticsearch/_async/client/logstash.py +9 -6
  11. elasticsearch/_async/client/migration.py +16 -7
  12. elasticsearch/_async/client/ml.py +12 -6
  13. elasticsearch/_async/client/monitoring.py +2 -1
  14. elasticsearch/_async/client/nodes.py +3 -3
  15. elasticsearch/_async/client/query_rules.py +33 -12
  16. elasticsearch/_async/client/rollup.py +88 -13
  17. elasticsearch/_async/client/search_application.py +130 -1
  18. elasticsearch/_async/client/searchable_snapshots.py +32 -23
  19. elasticsearch/_async/client/security.py +676 -55
  20. elasticsearch/_async/client/shutdown.py +38 -15
  21. elasticsearch/_async/client/simulate.py +151 -0
  22. elasticsearch/_async/client/slm.py +138 -19
  23. elasticsearch/_async/client/snapshot.py +307 -23
  24. elasticsearch/_async/client/sql.py +66 -46
  25. elasticsearch/_async/client/synonyms.py +39 -19
  26. elasticsearch/_async/client/tasks.py +68 -28
  27. elasticsearch/_async/client/text_structure.py +466 -46
  28. elasticsearch/_async/client/transform.py +9 -2
  29. elasticsearch/_async/client/watcher.py +207 -41
  30. elasticsearch/_async/client/xpack.py +11 -6
  31. elasticsearch/_sync/client/__init__.py +153 -51
  32. elasticsearch/_sync/client/cat.py +64 -195
  33. elasticsearch/_sync/client/cluster.py +19 -19
  34. elasticsearch/_sync/client/connector.py +337 -0
  35. elasticsearch/_sync/client/dangling_indices.py +3 -3
  36. elasticsearch/_sync/client/ilm.py +6 -6
  37. elasticsearch/_sync/client/indices.py +360 -81
  38. elasticsearch/_sync/client/inference.py +94 -1
  39. elasticsearch/_sync/client/ingest.py +175 -2
  40. elasticsearch/_sync/client/logstash.py +9 -6
  41. elasticsearch/_sync/client/migration.py +16 -7
  42. elasticsearch/_sync/client/ml.py +12 -6
  43. elasticsearch/_sync/client/monitoring.py +2 -1
  44. elasticsearch/_sync/client/nodes.py +3 -3
  45. elasticsearch/_sync/client/query_rules.py +33 -12
  46. elasticsearch/_sync/client/rollup.py +88 -13
  47. elasticsearch/_sync/client/search_application.py +130 -1
  48. elasticsearch/_sync/client/searchable_snapshots.py +32 -23
  49. elasticsearch/_sync/client/security.py +676 -55
  50. elasticsearch/_sync/client/shutdown.py +38 -15
  51. elasticsearch/_sync/client/simulate.py +151 -0
  52. elasticsearch/_sync/client/slm.py +138 -19
  53. elasticsearch/_sync/client/snapshot.py +307 -23
  54. elasticsearch/_sync/client/sql.py +66 -46
  55. elasticsearch/_sync/client/synonyms.py +39 -19
  56. elasticsearch/_sync/client/tasks.py +68 -28
  57. elasticsearch/_sync/client/text_structure.py +466 -46
  58. elasticsearch/_sync/client/transform.py +9 -2
  59. elasticsearch/_sync/client/watcher.py +207 -41
  60. elasticsearch/_sync/client/xpack.py +11 -6
  61. elasticsearch/_version.py +1 -1
  62. elasticsearch/client.py +2 -0
  63. {elasticsearch-8.17.0.dist-info → elasticsearch-8.17.1.dist-info}/METADATA +1 -1
  64. elasticsearch-8.17.1.dist-info/RECORD +119 -0
  65. elasticsearch-8.17.0.dist-info/RECORD +0 -117
  66. {elasticsearch-8.17.0.dist-info → elasticsearch-8.17.1.dist-info}/WHEEL +0 -0
  67. {elasticsearch-8.17.0.dist-info → elasticsearch-8.17.1.dist-info}/licenses/LICENSE +0 -0
  68. {elasticsearch-8.17.0.dist-info → elasticsearch-8.17.1.dist-info}/licenses/NOTICE +0 -0
@@ -70,6 +70,7 @@ from .search_application import SearchApplicationClient
70
70
  from .searchable_snapshots import SearchableSnapshotsClient
71
71
  from .security import SecurityClient
72
72
  from .shutdown import ShutdownClient
73
+ from .simulate import SimulateClient
73
74
  from .slm import SlmClient
74
75
  from .snapshot import SnapshotClient
75
76
  from .sql import SqlClient
@@ -465,6 +466,7 @@ class Elasticsearch(BaseClient):
465
466
  self.searchable_snapshots = SearchableSnapshotsClient(self)
466
467
  self.security = SecurityClient(self)
467
468
  self.slm = SlmClient(self)
469
+ self.simulate = SimulateClient(self)
468
470
  self.shutdown = ShutdownClient(self)
469
471
  self.sql = SqlClient(self)
470
472
  self.ssl = SslClient(self)
@@ -642,41 +644,125 @@ class Elasticsearch(BaseClient):
642
644
  ] = None,
643
645
  ) -> ObjectApiResponse[t.Any]:
644
646
  """
645
- Bulk index or delete documents. Performs multiple indexing or delete operations
646
- in a single API call. This reduces overhead and can greatly increase indexing
647
- speed.
647
+ Bulk index or delete documents. Perform multiple `index`, `create`, `delete`,
648
+ and `update` actions in a single request. This reduces overhead and can greatly
649
+ increase indexing speed. If the Elasticsearch security features are enabled,
650
+ you must have the following index privileges for the target data stream, index,
651
+ or index alias: * To use the `create` action, you must have the `create_doc`,
652
+ `create`, `index`, or `write` index privilege. Data streams support only the
653
+ `create` action. * To use the `index` action, you must have the `create`, `index`,
654
+ or `write` index privilege. * To use the `delete` action, you must have the `delete`
655
+ or `write` index privilege. * To use the `update` action, you must have the `index`
656
+ or `write` index privilege. * To automatically create a data stream or index
657
+ with a bulk API request, you must have the `auto_configure`, `create_index`,
658
+ or `manage` index privilege. * To make the result of a bulk operation visible
659
+ to search using the `refresh` parameter, you must have the `maintenance` or `manage`
660
+ index privilege. Automatic data stream creation requires a matching index template
661
+ with data stream enabled. The actions are specified in the request body using
662
+ a newline delimited JSON (NDJSON) structure: ``` action_and_meta_data\\n optional_source\\n
663
+ action_and_meta_data\\n optional_source\\n .... action_and_meta_data\\n optional_source\\n
664
+ ``` The `index` and `create` actions expect a source on the next line and have
665
+ the same semantics as the `op_type` parameter in the standard index API. A `create`
666
+ action fails if a document with the same ID already exists in the target An `index`
667
+ action adds or replaces a document as necessary. NOTE: Data streams support only
668
+ the `create` action. To update or delete a document in a data stream, you must
669
+ target the backing index containing the document. An `update` action expects
670
+ that the partial doc, upsert, and script and its options are specified on the
671
+ next line. A `delete` action does not expect a source on the next line and has
672
+ the same semantics as the standard delete API. NOTE: The final line of data must
673
+ end with a newline character (`\\n`). Each newline character may be preceded
674
+ by a carriage return (`\\r`). When sending NDJSON data to the `_bulk` endpoint,
675
+ use a `Content-Type` header of `application/json` or `application/x-ndjson`.
676
+ Because this format uses literal newline characters (`\\n`) as delimiters, make
677
+ sure that the JSON actions and sources are not pretty printed. If you provide
678
+ a target in the request path, it is used for any actions that don't explicitly
679
+ specify an `_index` argument. A note on the format: the idea here is to make
680
+ processing as fast as possible. As some of the actions are redirected to other
681
+ shards on other nodes, only `action_meta_data` is parsed on the receiving node
682
+ side. Client libraries using this protocol should try and strive to do something
683
+ similar on the client side, and reduce buffering as much as possible. There is
684
+ no "correct" number of actions to perform in a single bulk request. Experiment
685
+ with different settings to find the optimal size for your particular workload.
686
+ Note that Elasticsearch limits the maximum size of a HTTP request to 100mb by
687
+ default so clients must ensure that no request exceeds this size. It is not possible
688
+ to index a single document that exceeds the size limit, so you must pre-process
689
+ any such documents into smaller pieces before sending them to Elasticsearch.
690
+ For instance, split documents into pages or chapters before indexing them, or
691
+ store raw binary data in a system outside Elasticsearch and replace the raw data
692
+ with a link to the external system in the documents that you send to Elasticsearch.
693
+ **Client suppport for bulk requests** Some of the officially supported clients
694
+ provide helpers to assist with bulk requests and reindexing: * Go: Check out
695
+ `esutil.BulkIndexer` * Perl: Check out `Search::Elasticsearch::Client::5_0::Bulk`
696
+ and `Search::Elasticsearch::Client::5_0::Scroll` * Python: Check out `elasticsearch.helpers.*`
697
+ * JavaScript: Check out `client.helpers.*` * .NET: Check out `BulkAllObservable`
698
+ * PHP: Check out bulk indexing. **Submitting bulk requests with cURL** If you're
699
+ providing text file input to `curl`, you must use the `--data-binary` flag instead
700
+ of plain `-d`. The latter doesn't preserve newlines. For example: ``` $ cat requests
701
+ { "index" : { "_index" : "test", "_id" : "1" } } { "field1" : "value1" } $ curl
702
+ -s -H "Content-Type: application/x-ndjson" -XPOST localhost:9200/_bulk --data-binary
703
+ "@requests"; echo {"took":7, "errors": false, "items":[{"index":{"_index":"test","_id":"1","_version":1,"result":"created","forced_refresh":false}}]}
704
+ ``` **Optimistic concurrency control** Each `index` and `delete` action within
705
+ a bulk API call may include the `if_seq_no` and `if_primary_term` parameters
706
+ in their respective action and meta data lines. The `if_seq_no` and `if_primary_term`
707
+ parameters control how operations are run, based on the last modification to
708
+ existing documents. See Optimistic concurrency control for more details. **Versioning**
709
+ Each bulk item can include the version value using the `version` field. It automatically
710
+ follows the behavior of the index or delete operation based on the `_version`
711
+ mapping. It also support the `version_type`. **Routing** Each bulk item can include
712
+ the routing value using the `routing` field. It automatically follows the behavior
713
+ of the index or delete operation based on the `_routing` mapping. NOTE: Data
714
+ streams do not support custom routing unless they were created with the `allow_custom_routing`
715
+ setting enabled in the template. **Wait for active shards** When making bulk
716
+ calls, you can set the `wait_for_active_shards` parameter to require a minimum
717
+ number of shard copies to be active before starting to process the bulk request.
718
+ **Refresh** Control when the changes made by this request are visible to search.
719
+ NOTE: Only the shards that receive the bulk request will be affected by refresh.
720
+ Imagine a `_bulk?refresh=wait_for` request with three documents in it that happen
721
+ to be routed to different shards in an index with five shards. The request will
722
+ only wait for those three shards to refresh. The other two shards that make up
723
+ the index do not participate in the `_bulk` request at all.
648
724
 
649
725
  `<https://www.elastic.co/guide/en/elasticsearch/reference/8.17/docs-bulk.html>`_
650
726
 
651
727
  :param operations:
652
- :param index: Name of the data stream, index, or index alias to perform bulk
728
+ :param index: The name of the data stream, index, or index alias to perform bulk
653
729
  actions on.
654
730
  :param list_executed_pipelines: If `true`, the response will include the ingest
655
- pipelines that were executed for each index or create.
656
- :param pipeline: ID of the pipeline to use to preprocess incoming documents.
657
- If the index has a default ingest pipeline specified, then setting the value
658
- to `_none` disables the default ingest pipeline for this request. If a final
659
- pipeline is configured it will always run, regardless of the value of this
731
+ pipelines that were run for each index or create.
732
+ :param pipeline: The pipeline identifier to use to preprocess incoming documents.
733
+ If the index has a default ingest pipeline specified, setting the value to
734
+ `_none` turns off the default ingest pipeline for this request. If a final
735
+ pipeline is configured, it will always run regardless of the value of this
660
736
  parameter.
661
737
  :param refresh: If `true`, Elasticsearch refreshes the affected shards to make
662
- this operation visible to search, if `wait_for` then wait for a refresh to
663
- make this operation visible to search, if `false` do nothing with refreshes.
738
+ this operation visible to search. If `wait_for`, wait for a refresh to make
739
+ this operation visible to search. If `false`, do nothing with refreshes.
664
740
  Valid values: `true`, `false`, `wait_for`.
665
- :param require_alias: If `true`, the requests actions must target an index alias.
741
+ :param require_alias: If `true`, the request's actions must target an index alias.
666
742
  :param require_data_stream: If `true`, the request's actions must target a data
667
- stream (existing or to-be-created).
668
- :param routing: Custom value used to route operations to a specific shard.
669
- :param source: `true` or `false` to return the `_source` field or not, or a list
670
- of fields to return.
743
+ stream (existing or to be created).
744
+ :param routing: A custom value that is used to route operations to a specific
745
+ shard.
746
+ :param source: Indicates whether to return the `_source` field (`true` or `false`)
747
+ or contains a list of fields to return.
671
748
  :param source_excludes: A comma-separated list of source fields to exclude from
672
- the response.
749
+ the response. You can also use this parameter to exclude fields from the
750
+ subset specified in `_source_includes` query parameter. If the `_source`
751
+ parameter is `false`, this parameter is ignored.
673
752
  :param source_includes: A comma-separated list of source fields to include in
674
- the response.
675
- :param timeout: Period each action waits for the following operations: automatic
676
- index creation, dynamic mapping updates, waiting for active shards.
753
+ the response. If this parameter is specified, only these source fields are
754
+ returned. You can exclude fields from this subset using the `_source_excludes`
755
+ query parameter. If the `_source` parameter is `false`, this parameter is
756
+ ignored.
757
+ :param timeout: The period each action waits for the following operations: automatic
758
+ index creation, dynamic mapping updates, and waiting for active shards. The
759
+ default is `1m` (one minute), which guarantees Elasticsearch waits for at
760
+ least the timeout before failing. The actual wait time could be longer, particularly
761
+ when multiple waits occur.
677
762
  :param wait_for_active_shards: The number of shard copies that must be active
678
- before proceeding with the operation. Set to all or any positive integer
679
- up to the total number of shards in the index (`number_of_replicas+1`).
763
+ before proceeding with the operation. Set to `all` or any positive integer
764
+ up to the total number of shards in the index (`number_of_replicas+1`). The
765
+ default is `1`, which waits for each primary shard to be active.
680
766
  """
681
767
  if operations is None and body is None:
682
768
  raise ValueError(
@@ -756,7 +842,7 @@ class Elasticsearch(BaseClient):
756
842
 
757
843
  `<https://www.elastic.co/guide/en/elasticsearch/reference/8.17/clear-scroll-api.html>`_
758
844
 
759
- :param scroll_id: Scroll IDs to clear. To clear all scroll IDs, use `_all`.
845
+ :param scroll_id: The scroll IDs to clear. To clear all scroll IDs, use `_all`.
760
846
  """
761
847
  __path_parts: t.Dict[str, str] = {}
762
848
  __path = "/_search/scroll"
@@ -880,46 +966,62 @@ class Elasticsearch(BaseClient):
880
966
  body: t.Optional[t.Dict[str, t.Any]] = None,
881
967
  ) -> ObjectApiResponse[t.Any]:
882
968
  """
883
- Count search results. Get the number of documents matching a query.
969
+ Count search results. Get the number of documents matching a query. The query
970
+ can either be provided using a simple query string as a parameter or using the
971
+ Query DSL defined within the request body. The latter must be nested in a `query`
972
+ key, which is the same as the search API. The count API supports multi-target
973
+ syntax. You can run a single count API search across multiple data streams and
974
+ indices. The operation is broadcast across all shards. For each shard ID group,
975
+ a replica is chosen and the search is run against it. This means that replicas
976
+ increase the scalability of the count.
884
977
 
885
978
  `<https://www.elastic.co/guide/en/elasticsearch/reference/8.17/search-count.html>`_
886
979
 
887
- :param index: Comma-separated list of data streams, indices, and aliases to search.
888
- Supports wildcards (`*`). To search all data streams and indices, omit this
889
- parameter or use `*` or `_all`.
980
+ :param index: A comma-separated list of data streams, indices, and aliases to
981
+ search. It supports wildcards (`*`). To search all data streams and indices,
982
+ omit this parameter or use `*` or `_all`.
890
983
  :param allow_no_indices: If `false`, the request returns an error if any wildcard
891
984
  expression, index alias, or `_all` value targets only missing or closed indices.
892
- This behavior applies even if the request targets other open indices.
985
+ This behavior applies even if the request targets other open indices. For
986
+ example, a request targeting `foo*,bar*` returns an error if an index starts
987
+ with `foo` but no index starts with `bar`.
893
988
  :param analyze_wildcard: If `true`, wildcard and prefix queries are analyzed.
894
- This parameter can only be used when the `q` query string parameter is specified.
895
- :param analyzer: Analyzer to use for the query string. This parameter can only
896
- be used when the `q` query string parameter is specified.
989
+ This parameter can be used only when the `q` query string parameter is specified.
990
+ :param analyzer: The analyzer to use for the query string. This parameter can
991
+ be used only when the `q` query string parameter is specified.
897
992
  :param default_operator: The default operator for query string query: `AND` or
898
- `OR`. This parameter can only be used when the `q` query string parameter
993
+ `OR`. This parameter can be used only when the `q` query string parameter
899
994
  is specified.
900
- :param df: Field to use as default where no field prefix is given in the query
901
- string. This parameter can only be used when the `q` query string parameter
995
+ :param df: The field to use as a default when no field prefix is given in the
996
+ query string. This parameter can be used only when the `q` query string parameter
902
997
  is specified.
903
- :param expand_wildcards: Type of index that wildcard patterns can match. If the
904
- request can target data streams, this argument determines whether wildcard
905
- expressions match hidden data streams. Supports comma-separated values, such
906
- as `open,hidden`.
907
- :param ignore_throttled: If `true`, concrete, expanded or aliased indices are
998
+ :param expand_wildcards: The type of index that wildcard patterns can match.
999
+ If the request can target data streams, this argument determines whether
1000
+ wildcard expressions match hidden data streams. It supports comma-separated
1001
+ values, such as `open,hidden`.
1002
+ :param ignore_throttled: If `true`, concrete, expanded, or aliased indices are
908
1003
  ignored when frozen.
909
1004
  :param ignore_unavailable: If `false`, the request returns an error if it targets
910
1005
  a missing or closed index.
911
1006
  :param lenient: If `true`, format-based query failures (such as providing text
912
- to a numeric field) in the query string will be ignored.
913
- :param min_score: Sets the minimum `_score` value that documents must have to
914
- be included in the result.
915
- :param preference: Specifies the node or shard the operation should be performed
916
- on. Random by default.
917
- :param q: Query in the Lucene query string syntax.
918
- :param query: Defines the search definition using the Query DSL.
919
- :param routing: Custom value used to route operations to a specific shard.
920
- :param terminate_after: Maximum number of documents to collect for each shard.
1007
+ to a numeric field) in the query string will be ignored. This parameter can
1008
+ be used only when the `q` query string parameter is specified.
1009
+ :param min_score: The minimum `_score` value that documents must have to be included
1010
+ in the result.
1011
+ :param preference: The node or shard the operation should be performed on. By
1012
+ default, it is random.
1013
+ :param q: The query in Lucene query string syntax.
1014
+ :param query: Defines the search definition using the Query DSL. The query is
1015
+ optional, and when not provided, it will use `match_all` to count all the
1016
+ docs.
1017
+ :param routing: A custom value used to route operations to a specific shard.
1018
+ :param terminate_after: The maximum number of documents to collect for each shard.
921
1019
  If a query reaches this limit, Elasticsearch terminates the query early.
922
- Elasticsearch collects documents before sorting.
1020
+ Elasticsearch collects documents before sorting. IMPORTANT: Use with caution.
1021
+ Elasticsearch applies this parameter to each shard handling the request.
1022
+ When possible, let Elasticsearch perform early termination automatically.
1023
+ Avoid specifying this parameter for requests that target data streams with
1024
+ backing indices across multiple data tiers.
923
1025
  """
924
1026
  __path_parts: t.Dict[str, str]
925
1027
  if index not in SKIP_IN_PATH:
@@ -2487,9 +2589,9 @@ class Elasticsearch(BaseClient):
2487
2589
  pretty: t.Optional[bool] = None,
2488
2590
  ) -> ObjectApiResponse[t.Any]:
2489
2591
  """
2490
- Get cluster info. Returns basic information about the cluster.
2592
+ Get cluster info. Get basic build, version, and cluster information.
2491
2593
 
2492
- `<https://www.elastic.co/guide/en/elasticsearch/reference/8.17/index.html>`_
2594
+ `<https://www.elastic.co/guide/en/elasticsearch/reference/8.17/rest-api-root.html>`_
2493
2595
  """
2494
2596
  __path_parts: t.Dict[str, str] = {}
2495
2597
  __path = "/"