diff --git a/Makefile.toml b/Makefile.toml index 823adabe..8702554c 100644 --- a/Makefile.toml +++ b/Makefile.toml @@ -8,6 +8,8 @@ STACK_VERSION = { value = "7.x-SNAPSHOT", condition = { env_not_set = ["STACK_VE TEST_SUITE = { value = "free", condition = { env_not_set = ["TEST_SUITE"] }} # Set publish flags to dry-run by default, to force user to explicitly define for publishing CARGO_MAKE_CARGO_PUBLISH_FLAGS = "--dry-run" +# RUST_BACKTRACE is set to "full" in cargo make's builtin makefiles/stable.toml +RUST_BACKTRACE = { value = "0", condition = { env_not_set = ["RUST_BACKTRACE"]}} [tasks.set-free-env] category = "Elasticsearch" @@ -39,14 +41,14 @@ category = "Elasticsearch" private = true condition = { env_set = [ "ELASTICSEARCH_URL" ], env_false = ["CARGO_MAKE_CI"] } command = "cargo" -args = ["test", "-p", "yaml_test_runner", "--", "--test-threads=1"] +args = ["test", "-p", "yaml_test_runner", "--", "--test-threads", "1"] dependencies = ["generate-yaml-tests"] [tasks.test-yaml-test-runner-ci] category = "Elasticsearch" private = true condition = { env_set = [ "ELASTICSEARCH_URL" ], env_true = ["CARGO_MAKE_CI"] } -script = ["cargo test -p yaml_test_runner -- --test-threads=1 -Z unstable-options --format json | tee test_results/results.json"] +script = ["cargo test -p yaml_test_runner -- --test-threads 1 -Z unstable-options --format json | tee test_results/results.json"] dependencies = ["generate-yaml-tests"] [tasks.test-elasticsearch] diff --git a/api_generator/rest_specs/async_search.delete.json b/api_generator/rest_specs/async_search.delete.json index 70794f4a..7cfc1448 100644 --- a/api_generator/rest_specs/async_search.delete.json +++ b/api_generator/rest_specs/async_search.delete.json @@ -5,6 +5,10 @@ "description": "Deletes an async search by ID. If the search is still running, the search request will be cancelled. Otherwise, the saved search results are deleted." }, "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "application/json"] + }, "url":{ "paths":[ { diff --git a/api_generator/rest_specs/async_search.get.json b/api_generator/rest_specs/async_search.get.json index 76c4650a..41cf08b6 100644 --- a/api_generator/rest_specs/async_search.get.json +++ b/api_generator/rest_specs/async_search.get.json @@ -5,6 +5,10 @@ "description": "Retrieves the results of a previously submitted async search request given its ID." }, "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "application/json"] + }, "url":{ "paths":[ { diff --git a/api_generator/rest_specs/async_search.status.json b/api_generator/rest_specs/async_search.status.json new file mode 100644 index 00000000..81993cba --- /dev/null +++ b/api_generator/rest_specs/async_search.status.json @@ -0,0 +1,29 @@ +{ + "async_search.status":{ + "documentation":{ + "url":"https://www.elastic.co/guide/en/elasticsearch/reference/current/async-search.html", + "description": "Retrieves the status of a previously submitted async search request given its ID." + }, + "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "application/json"] + }, + "url":{ + "paths":[ + { + "path":"/_async_search/status/{id}", + "methods":[ + "GET" + ], + "parts":{ + "id":{ + "type":"string", + "description":"The async search ID" + } + } + } + ] + } + } +} diff --git a/api_generator/rest_specs/async_search.submit.json b/api_generator/rest_specs/async_search.submit.json index 1f4d0b9a..d8cbb2e6 100644 --- a/api_generator/rest_specs/async_search.submit.json +++ b/api_generator/rest_specs/async_search.submit.json @@ -5,6 +5,11 @@ "description": "Executes a search request asynchronously." }, "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "application/json"], + "content_type": ["application/json"] + }, "url":{ "paths":[ { diff --git a/api_generator/rest_specs/autoscaling.delete_autoscaling_policy.json b/api_generator/rest_specs/autoscaling.delete_autoscaling_policy.json index aeab8482..7ddb1f1c 100644 --- a/api_generator/rest_specs/autoscaling.delete_autoscaling_policy.json +++ b/api_generator/rest_specs/autoscaling.delete_autoscaling_policy.json @@ -2,9 +2,13 @@ "autoscaling.delete_autoscaling_policy":{ "documentation":{ "url":"https://www.elastic.co/guide/en/elasticsearch/reference/current/autoscaling-delete-autoscaling-policy.html", - "description":"Deletes an autoscaling policy." + "description":"Deletes an autoscaling policy. Designed for indirect use by ECE/ESS and ECK. Direct use is not supported." + }, + "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "application/json"] }, - "stability":"experimental", "url":{ "paths":[ { diff --git a/api_generator/rest_specs/autoscaling.get_autoscaling_capacity.json b/api_generator/rest_specs/autoscaling.get_autoscaling_capacity.json new file mode 100644 index 00000000..795507ed --- /dev/null +++ b/api_generator/rest_specs/autoscaling.get_autoscaling_capacity.json @@ -0,0 +1,23 @@ +{ + "autoscaling.get_autoscaling_capacity":{ + "documentation":{ + "url":"https://www.elastic.co/guide/en/elasticsearch/reference/current/autoscaling-get-autoscaling-capacity.html", + "description": "Gets the current autoscaling capacity based on the configured autoscaling policy. Designed for indirect use by ECE/ESS and ECK. Direct use is not supported." + }, + "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "application/json"] + }, + "url":{ + "paths":[ + { + "path":"/_autoscaling/capacity", + "methods":[ + "GET" + ] + } + ] + } + } +} diff --git a/api_generator/rest_specs/autoscaling.get_autoscaling_decision.json b/api_generator/rest_specs/autoscaling.get_autoscaling_decision.json deleted file mode 100644 index 26ce055a..00000000 --- a/api_generator/rest_specs/autoscaling.get_autoscaling_decision.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "autoscaling.get_autoscaling_decision":{ - "documentation":{ - "url":"https://www.elastic.co/guide/en/elasticsearch/reference/current/autoscaling-get-autoscaling-decision.html", - "description": "Gets the current autoscaling decision based on the configured autoscaling policy, indicating whether or not autoscaling is needed." - }, - "stability":"experimental", - "url":{ - "paths":[ - { - "path":"/_autoscaling/decision", - "methods":[ - "GET" - ] - } - ] - } - } -} diff --git a/api_generator/rest_specs/autoscaling.get_autoscaling_policy.json b/api_generator/rest_specs/autoscaling.get_autoscaling_policy.json index 309f9a9a..e76df1ec 100644 --- a/api_generator/rest_specs/autoscaling.get_autoscaling_policy.json +++ b/api_generator/rest_specs/autoscaling.get_autoscaling_policy.json @@ -2,9 +2,13 @@ "autoscaling.get_autoscaling_policy":{ "documentation":{ "url":"https://www.elastic.co/guide/en/elasticsearch/reference/current/autoscaling-get-autoscaling-policy.html", - "description": "Retrieves an autoscaling policy." + "description": "Retrieves an autoscaling policy. Designed for indirect use by ECE/ESS and ECK. Direct use is not supported." + }, + "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "application/json"] }, - "stability":"experimental", "url":{ "paths":[ { diff --git a/api_generator/rest_specs/autoscaling.put_autoscaling_policy.json b/api_generator/rest_specs/autoscaling.put_autoscaling_policy.json index 6d1fe4b6..b51904a1 100644 --- a/api_generator/rest_specs/autoscaling.put_autoscaling_policy.json +++ b/api_generator/rest_specs/autoscaling.put_autoscaling_policy.json @@ -2,9 +2,14 @@ "autoscaling.put_autoscaling_policy":{ "documentation":{ "url":"https://www.elastic.co/guide/en/elasticsearch/reference/current/autoscaling-put-autoscaling-policy.html", - "description": "Creates a new autoscaling policy." + "description": "Creates a new autoscaling policy. Designed for indirect use by ECE/ESS and ECK. Direct use is not supported." + }, + "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "application/json"], + "content_type": ["application/json"] }, - "stability":"experimental", "url":{ "paths":[ { diff --git a/api_generator/rest_specs/bulk.json b/api_generator/rest_specs/bulk.json index f7c0d698..9f2f1e24 100644 --- a/api_generator/rest_specs/bulk.json +++ b/api_generator/rest_specs/bulk.json @@ -5,6 +5,11 @@ "description":"Allows to perform multiple index/update/delete operations in a single request." }, "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "application/json"], + "content_type": ["application/x-ndjson"] + }, "url":{ "paths":[ { diff --git a/api_generator/rest_specs/cat.aliases.json b/api_generator/rest_specs/cat.aliases.json index 1ba12b00..db49daee 100644 --- a/api_generator/rest_specs/cat.aliases.json +++ b/api_generator/rest_specs/cat.aliases.json @@ -5,6 +5,10 @@ "description":"Shows information about currently configured aliases to indices including filter and routing infos." }, "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "text/plain", "application/json"] + }, "url":{ "paths":[ { diff --git a/api_generator/rest_specs/cat.allocation.json b/api_generator/rest_specs/cat.allocation.json index 7b3dc70b..9d19d8bb 100644 --- a/api_generator/rest_specs/cat.allocation.json +++ b/api_generator/rest_specs/cat.allocation.json @@ -5,6 +5,10 @@ "description":"Provides a snapshot of how many shards are allocated to each data node and how much disk space they are using." }, "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "text/plain", "application/json"] + }, "url":{ "paths":[ { diff --git a/api_generator/rest_specs/cat.count.json b/api_generator/rest_specs/cat.count.json index 8cfaddf8..64226f87 100644 --- a/api_generator/rest_specs/cat.count.json +++ b/api_generator/rest_specs/cat.count.json @@ -5,6 +5,10 @@ "description":"Provides quick access to the document count of the entire cluster, or individual indices." }, "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "text/plain", "application/json"] + }, "url":{ "paths":[ { diff --git a/api_generator/rest_specs/cat.fielddata.json b/api_generator/rest_specs/cat.fielddata.json index 9fbde473..497287a3 100644 --- a/api_generator/rest_specs/cat.fielddata.json +++ b/api_generator/rest_specs/cat.fielddata.json @@ -5,6 +5,10 @@ "description":"Shows how much heap memory is currently being used by fielddata on every data node in the cluster." }, "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "text/plain", "application/json"] + }, "url":{ "paths":[ { diff --git a/api_generator/rest_specs/cat.health.json b/api_generator/rest_specs/cat.health.json index bd7454b8..6b49c8e4 100644 --- a/api_generator/rest_specs/cat.health.json +++ b/api_generator/rest_specs/cat.health.json @@ -5,6 +5,10 @@ "description":"Returns a concise representation of the cluster health." }, "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "text/plain", "application/json"] + }, "url":{ "paths":[ { diff --git a/api_generator/rest_specs/cat.help.json b/api_generator/rest_specs/cat.help.json index 54ab6d6e..7c929dca 100644 --- a/api_generator/rest_specs/cat.help.json +++ b/api_generator/rest_specs/cat.help.json @@ -5,6 +5,10 @@ "description":"Returns help for the Cat APIs." }, "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "text/plain" ] + }, "url":{ "paths":[ { diff --git a/api_generator/rest_specs/cat.indices.json b/api_generator/rest_specs/cat.indices.json index a9218913..811359f6 100644 --- a/api_generator/rest_specs/cat.indices.json +++ b/api_generator/rest_specs/cat.indices.json @@ -5,6 +5,10 @@ "description":"Returns information about indices: number of primaries and replicas, document counts, disk size, ..." }, "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "text/plain", "application/json"] + }, "url":{ "paths":[ { @@ -51,7 +55,11 @@ }, "local":{ "type":"boolean", - "description":"Return local information, do not retrieve the state from master node (default: false)" + "description":"Return local information, do not retrieve the state from master node (default: false)", + "deprecated":{ + "version":"7.11.0", + "description":"This parameter does not affect the request. It will be removed in a future release." + } }, "master_timeout":{ "type":"time", diff --git a/api_generator/rest_specs/cat.master.json b/api_generator/rest_specs/cat.master.json index 63fe159e..9041c48b 100644 --- a/api_generator/rest_specs/cat.master.json +++ b/api_generator/rest_specs/cat.master.json @@ -5,6 +5,10 @@ "description":"Returns information about the master node." }, "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "text/plain", "application/json"] + }, "url":{ "paths":[ { diff --git a/api_generator/rest_specs/cat.ml_data_frame_analytics.json b/api_generator/rest_specs/cat.ml_data_frame_analytics.json index ec041788..ded66961 100644 --- a/api_generator/rest_specs/cat.ml_data_frame_analytics.json +++ b/api_generator/rest_specs/cat.ml_data_frame_analytics.json @@ -5,6 +5,10 @@ "description": "Gets configuration and usage information about data frame analytics jobs." }, "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "text/plain", "application/json"] + }, "url":{ "paths":[ { diff --git a/api_generator/rest_specs/cat.ml_datafeeds.json b/api_generator/rest_specs/cat.ml_datafeeds.json index dac54c52..16f34f46 100644 --- a/api_generator/rest_specs/cat.ml_datafeeds.json +++ b/api_generator/rest_specs/cat.ml_datafeeds.json @@ -5,6 +5,10 @@ "description": "Gets configuration and usage information about datafeeds." }, "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "text/plain", "application/json"] + }, "url":{ "paths":[ { diff --git a/api_generator/rest_specs/cat.ml_jobs.json b/api_generator/rest_specs/cat.ml_jobs.json index 2552b1c2..8b8cddb8 100644 --- a/api_generator/rest_specs/cat.ml_jobs.json +++ b/api_generator/rest_specs/cat.ml_jobs.json @@ -5,6 +5,10 @@ "description": "Gets configuration and usage information about anomaly detection jobs." }, "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "text/plain", "application/json"] + }, "url":{ "paths":[ { diff --git a/api_generator/rest_specs/cat.ml_trained_models.json b/api_generator/rest_specs/cat.ml_trained_models.json index e129d320..5176b9d4 100644 --- a/api_generator/rest_specs/cat.ml_trained_models.json +++ b/api_generator/rest_specs/cat.ml_trained_models.json @@ -5,6 +5,10 @@ "description": "Gets configuration and usage information about inference trained models." }, "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "text/plain", "application/json"] + }, "url":{ "paths":[ { diff --git a/api_generator/rest_specs/cat.nodeattrs.json b/api_generator/rest_specs/cat.nodeattrs.json index e688e23c..b92f0233 100644 --- a/api_generator/rest_specs/cat.nodeattrs.json +++ b/api_generator/rest_specs/cat.nodeattrs.json @@ -5,6 +5,10 @@ "description":"Returns information about custom node attributes." }, "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "text/plain", "application/json"] + }, "url":{ "paths":[ { diff --git a/api_generator/rest_specs/cat.nodes.json b/api_generator/rest_specs/cat.nodes.json index ba3faa92..fe3c0c52 100644 --- a/api_generator/rest_specs/cat.nodes.json +++ b/api_generator/rest_specs/cat.nodes.json @@ -5,6 +5,10 @@ "description":"Returns basic statistics about performance of cluster nodes." }, "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "text/plain", "application/json"] + }, "url":{ "paths":[ { diff --git a/api_generator/rest_specs/cat.pending_tasks.json b/api_generator/rest_specs/cat.pending_tasks.json index 36fa33be..40601a11 100644 --- a/api_generator/rest_specs/cat.pending_tasks.json +++ b/api_generator/rest_specs/cat.pending_tasks.json @@ -5,6 +5,10 @@ "description":"Returns a concise representation of the cluster pending tasks." }, "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "text/plain", "application/json"] + }, "url":{ "paths":[ { diff --git a/api_generator/rest_specs/cat.plugins.json b/api_generator/rest_specs/cat.plugins.json index d5346c6d..48635d2f 100644 --- a/api_generator/rest_specs/cat.plugins.json +++ b/api_generator/rest_specs/cat.plugins.json @@ -5,6 +5,10 @@ "description":"Returns information about installed plugins across nodes node." }, "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "text/plain", "application/json"] + }, "url":{ "paths":[ { @@ -37,6 +41,11 @@ "description":"Return help information", "default":false }, + "include_bootstrap":{ + "type":"boolean", + "description":"Include bootstrap plugins in the response", + "default":false + }, "s":{ "type":"list", "description":"Comma-separated list of column names or column aliases to sort by" diff --git a/api_generator/rest_specs/cat.recovery.json b/api_generator/rest_specs/cat.recovery.json index 7baf0b8d..87931462 100644 --- a/api_generator/rest_specs/cat.recovery.json +++ b/api_generator/rest_specs/cat.recovery.json @@ -5,6 +5,10 @@ "description":"Returns information about index shard recoveries, both on-going completed." }, "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "text/plain", "application/json"] + }, "url":{ "paths":[ { diff --git a/api_generator/rest_specs/cat.repositories.json b/api_generator/rest_specs/cat.repositories.json index 84d99659..3dad7a00 100644 --- a/api_generator/rest_specs/cat.repositories.json +++ b/api_generator/rest_specs/cat.repositories.json @@ -5,6 +5,10 @@ "description":"Returns information about snapshot repositories registered in the cluster." }, "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "text/plain", "application/json"] + }, "url":{ "paths":[ { diff --git a/api_generator/rest_specs/cat.segments.json b/api_generator/rest_specs/cat.segments.json index 472ef7fd..7fe66ea3 100644 --- a/api_generator/rest_specs/cat.segments.json +++ b/api_generator/rest_specs/cat.segments.json @@ -5,6 +5,10 @@ "description":"Provides low-level information about the segments in the shards of an index." }, "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "text/plain", "application/json"] + }, "url":{ "paths":[ { diff --git a/api_generator/rest_specs/cat.shards.json b/api_generator/rest_specs/cat.shards.json index a13c0f6b..b7408f68 100644 --- a/api_generator/rest_specs/cat.shards.json +++ b/api_generator/rest_specs/cat.shards.json @@ -5,6 +5,10 @@ "description":"Provides a detailed view of shard allocation on nodes." }, "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "text/plain", "application/json"] + }, "url":{ "paths":[ { @@ -51,7 +55,11 @@ }, "local":{ "type":"boolean", - "description":"Return local information, do not retrieve the state from master node (default: false)" + "description":"Return local information, do not retrieve the state from master node (default: false)", + "deprecated":{ + "version":"7.11.0", + "description":"This parameter does not affect the request. It will be removed in a future release." + } }, "master_timeout":{ "type":"time", diff --git a/api_generator/rest_specs/cat.snapshots.json b/api_generator/rest_specs/cat.snapshots.json index 757c2cfb..3b72e8a1 100644 --- a/api_generator/rest_specs/cat.snapshots.json +++ b/api_generator/rest_specs/cat.snapshots.json @@ -5,6 +5,10 @@ "description":"Returns all snapshots in a specific repository." }, "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "text/plain", "application/json"] + }, "url":{ "paths":[ { diff --git a/api_generator/rest_specs/cat.tasks.json b/api_generator/rest_specs/cat.tasks.json index ae25ab10..5a966554 100644 --- a/api_generator/rest_specs/cat.tasks.json +++ b/api_generator/rest_specs/cat.tasks.json @@ -5,6 +5,10 @@ "description":"Returns information about the tasks currently executing on one or more nodes in the cluster." }, "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "text/plain", "application/json"] + }, "url":{ "paths":[ { @@ -20,7 +24,7 @@ "type":"string", "description":"a short version of the Accept header, e.g. json, yaml" }, - "node_id":{ + "nodes":{ "type":"list", "description":"A comma-separated list of node IDs or names to limit the returned information; use `_local` to return information from the node you're connecting to, leave empty to get information from all nodes" }, @@ -32,9 +36,9 @@ "type":"boolean", "description":"Return detailed task information (default: false)" }, - "parent_task":{ - "type":"number", - "description":"Return tasks with specified parent task id. Set to -1 to return all." + "parent_task_id":{ + "type":"string", + "description":"Return tasks with specified parent task id (node_id:task_number). Set to -1 to return all." }, "h":{ "type":"list", diff --git a/api_generator/rest_specs/cat.templates.json b/api_generator/rest_specs/cat.templates.json index 53fc872b..e7ac67c8 100644 --- a/api_generator/rest_specs/cat.templates.json +++ b/api_generator/rest_specs/cat.templates.json @@ -5,6 +5,10 @@ "description":"Returns information about existing templates." }, "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "text/plain", "application/json"] + }, "url":{ "paths":[ { diff --git a/api_generator/rest_specs/cat.thread_pool.json b/api_generator/rest_specs/cat.thread_pool.json index 710c297d..b418b5ae 100644 --- a/api_generator/rest_specs/cat.thread_pool.json +++ b/api_generator/rest_specs/cat.thread_pool.json @@ -5,6 +5,10 @@ "description":"Returns cluster-wide thread pool statistics per node.\nBy default the active, queue and rejected statistics are returned for all thread pools." }, "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "text/plain", "application/json"] + }, "url":{ "paths":[ { diff --git a/api_generator/rest_specs/cat.transforms.json b/api_generator/rest_specs/cat.transforms.json index ad22e646..c0dd769d 100644 --- a/api_generator/rest_specs/cat.transforms.json +++ b/api_generator/rest_specs/cat.transforms.json @@ -5,6 +5,10 @@ "description": "Gets configuration and usage information about transforms." }, "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "text/plain", "application/json"] + }, "url":{ "paths":[ { diff --git a/api_generator/rest_specs/ccr.delete_auto_follow_pattern.json b/api_generator/rest_specs/ccr.delete_auto_follow_pattern.json index f9e70a1f..52f56ca3 100644 --- a/api_generator/rest_specs/ccr.delete_auto_follow_pattern.json +++ b/api_generator/rest_specs/ccr.delete_auto_follow_pattern.json @@ -5,6 +5,10 @@ "description": "Deletes auto-follow patterns." }, "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "application/json"] + }, "url":{ "paths":[ { diff --git a/api_generator/rest_specs/ccr.follow.json b/api_generator/rest_specs/ccr.follow.json index be3dfc75..6905a53e 100644 --- a/api_generator/rest_specs/ccr.follow.json +++ b/api_generator/rest_specs/ccr.follow.json @@ -5,6 +5,11 @@ "description": "Creates a new follower index configured to follow the referenced leader index." }, "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "application/json"], + "content_type": ["application/json"] + }, "url":{ "paths":[ { diff --git a/api_generator/rest_specs/ccr.follow_info.json b/api_generator/rest_specs/ccr.follow_info.json index 858eab0b..17ecd571 100644 --- a/api_generator/rest_specs/ccr.follow_info.json +++ b/api_generator/rest_specs/ccr.follow_info.json @@ -5,6 +5,10 @@ "description": "Retrieves information about all follower indices, including parameters and status for each follower index" }, "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "application/json"] + }, "url":{ "paths":[ { diff --git a/api_generator/rest_specs/ccr.follow_stats.json b/api_generator/rest_specs/ccr.follow_stats.json index 1abe53bd..54de8c4d 100644 --- a/api_generator/rest_specs/ccr.follow_stats.json +++ b/api_generator/rest_specs/ccr.follow_stats.json @@ -5,6 +5,10 @@ "description": "Retrieves follower stats. return shard-level stats about the following tasks associated with each shard for the specified indices." }, "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "application/json"] + }, "url":{ "paths":[ { diff --git a/api_generator/rest_specs/ccr.forget_follower.json b/api_generator/rest_specs/ccr.forget_follower.json index d0df2f16..8106a74b 100644 --- a/api_generator/rest_specs/ccr.forget_follower.json +++ b/api_generator/rest_specs/ccr.forget_follower.json @@ -5,6 +5,11 @@ "description": "Removes the follower retention leases from the leader." }, "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "application/json"], + "content_type": ["application/json"] + }, "url":{ "paths":[ { diff --git a/api_generator/rest_specs/ccr.get_auto_follow_pattern.json b/api_generator/rest_specs/ccr.get_auto_follow_pattern.json index b89587d2..8073fd72 100644 --- a/api_generator/rest_specs/ccr.get_auto_follow_pattern.json +++ b/api_generator/rest_specs/ccr.get_auto_follow_pattern.json @@ -5,6 +5,10 @@ "description": "Gets configured auto-follow patterns. Returns the specified auto-follow pattern collection." }, "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "application/json"] + }, "url":{ "paths":[ { diff --git a/api_generator/rest_specs/ccr.pause_auto_follow_pattern.json b/api_generator/rest_specs/ccr.pause_auto_follow_pattern.json index 711e3deb..93756734 100644 --- a/api_generator/rest_specs/ccr.pause_auto_follow_pattern.json +++ b/api_generator/rest_specs/ccr.pause_auto_follow_pattern.json @@ -5,6 +5,10 @@ "description": "Pauses an auto-follow pattern" }, "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "application/json"] + }, "url":{ "paths":[ { diff --git a/api_generator/rest_specs/ccr.pause_follow.json b/api_generator/rest_specs/ccr.pause_follow.json index f45947b1..a4923df2 100644 --- a/api_generator/rest_specs/ccr.pause_follow.json +++ b/api_generator/rest_specs/ccr.pause_follow.json @@ -5,6 +5,10 @@ "description": "Pauses a follower index. The follower index will not fetch any additional operations from the leader index." }, "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "application/json"] + }, "url":{ "paths":[ { diff --git a/api_generator/rest_specs/ccr.put_auto_follow_pattern.json b/api_generator/rest_specs/ccr.put_auto_follow_pattern.json index 79a498da..6331b4ff 100644 --- a/api_generator/rest_specs/ccr.put_auto_follow_pattern.json +++ b/api_generator/rest_specs/ccr.put_auto_follow_pattern.json @@ -5,6 +5,11 @@ "description": "Creates a new named collection of auto-follow patterns against a specified remote cluster. Newly created indices on the remote cluster matching any of the specified patterns will be automatically configured as follower indices." }, "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "application/json"], + "content_type": ["application/json"] + }, "url":{ "paths":[ { diff --git a/api_generator/rest_specs/ccr.resume_auto_follow_pattern.json b/api_generator/rest_specs/ccr.resume_auto_follow_pattern.json index e6c3d268..b679155b 100644 --- a/api_generator/rest_specs/ccr.resume_auto_follow_pattern.json +++ b/api_generator/rest_specs/ccr.resume_auto_follow_pattern.json @@ -5,6 +5,10 @@ "description": "Resumes an auto-follow pattern that has been paused" }, "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "application/json"] + }, "url":{ "paths":[ { diff --git a/api_generator/rest_specs/ccr.resume_follow.json b/api_generator/rest_specs/ccr.resume_follow.json index de1945f3..d6addce1 100644 --- a/api_generator/rest_specs/ccr.resume_follow.json +++ b/api_generator/rest_specs/ccr.resume_follow.json @@ -5,6 +5,11 @@ "description": "Resumes a follower index that has been paused" }, "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "application/json"], + "content_type": ["application/json"] + }, "url":{ "paths":[ { diff --git a/api_generator/rest_specs/ccr.stats.json b/api_generator/rest_specs/ccr.stats.json index dc70f1a3..ac47e9c3 100644 --- a/api_generator/rest_specs/ccr.stats.json +++ b/api_generator/rest_specs/ccr.stats.json @@ -5,6 +5,10 @@ "description": "Gets all stats related to cross-cluster replication." }, "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "application/json"] + }, "url":{ "paths":[ { diff --git a/api_generator/rest_specs/ccr.unfollow.json b/api_generator/rest_specs/ccr.unfollow.json index c5db9219..7a49b4a1 100644 --- a/api_generator/rest_specs/ccr.unfollow.json +++ b/api_generator/rest_specs/ccr.unfollow.json @@ -5,6 +5,10 @@ "description": "Stops the following task associated with a follower index and removes index metadata and settings associated with cross-cluster replication." }, "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "application/json"] + }, "url":{ "paths":[ { diff --git a/api_generator/rest_specs/clear_scroll.json b/api_generator/rest_specs/clear_scroll.json index b0e50045..2d76e1e1 100644 --- a/api_generator/rest_specs/clear_scroll.json +++ b/api_generator/rest_specs/clear_scroll.json @@ -5,6 +5,11 @@ "description":"Explicitly clears the search context for a scroll." }, "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "application/json"], + "content_type": ["application/json","text/plain"] + }, "url":{ "paths":[ { diff --git a/api_generator/rest_specs/close_point_in_time.json b/api_generator/rest_specs/close_point_in_time.json new file mode 100644 index 00000000..d3f636a1 --- /dev/null +++ b/api_generator/rest_specs/close_point_in_time.json @@ -0,0 +1,27 @@ +{ + "close_point_in_time":{ + "documentation":{ + "url":"https://www.elastic.co/guide/en/elasticsearch/reference/master/point-in-time-api.html", + "description":"Close a point in time" + }, + "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "application/json"] + }, + "url":{ + "paths":[ + { + "path":"/_pit", + "methods":[ + "DELETE" + ] + } + ] + }, + "params":{}, + "body":{ + "description": "a point-in-time id to close" + } + } +} diff --git a/api_generator/rest_specs/cluster.allocation_explain.json b/api_generator/rest_specs/cluster.allocation_explain.json index e46218a7..36f341d7 100644 --- a/api_generator/rest_specs/cluster.allocation_explain.json +++ b/api_generator/rest_specs/cluster.allocation_explain.json @@ -5,6 +5,11 @@ "description":"Provides explanations for shard allocations in the cluster." }, "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "application/json"], + "content_type": ["application/json"] + }, "url":{ "paths":[ { diff --git a/api_generator/rest_specs/cluster.delete_component_template.json b/api_generator/rest_specs/cluster.delete_component_template.json index 9beea52c..041c1b35 100644 --- a/api_generator/rest_specs/cluster.delete_component_template.json +++ b/api_generator/rest_specs/cluster.delete_component_template.json @@ -4,7 +4,11 @@ "url":"https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-component-template.html", "description":"Deletes a component template" }, - "stability":"experimental", + "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "application/json"] + }, "url":{ "paths":[ { diff --git a/api_generator/rest_specs/cluster.delete_voting_config_exclusions.json b/api_generator/rest_specs/cluster.delete_voting_config_exclusions.json index d3db7ded..ff2abbe8 100644 --- a/api_generator/rest_specs/cluster.delete_voting_config_exclusions.json +++ b/api_generator/rest_specs/cluster.delete_voting_config_exclusions.json @@ -5,6 +5,10 @@ "description":"Clears cluster voting config exclusions." }, "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "application/json"] + }, "url":{ "paths":[ { diff --git a/api_generator/rest_specs/cluster.exists_component_template.json b/api_generator/rest_specs/cluster.exists_component_template.json index cc048ded..818d034c 100644 --- a/api_generator/rest_specs/cluster.exists_component_template.json +++ b/api_generator/rest_specs/cluster.exists_component_template.json @@ -4,7 +4,11 @@ "url":"https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-component-template.html", "description":"Returns information about whether a particular component template exist" }, - "stability":"experimental", + "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "application/json"] + }, "url":{ "paths":[ { diff --git a/api_generator/rest_specs/cluster.get_component_template.json b/api_generator/rest_specs/cluster.get_component_template.json index ecf32f50..67b3c20d 100644 --- a/api_generator/rest_specs/cluster.get_component_template.json +++ b/api_generator/rest_specs/cluster.get_component_template.json @@ -4,7 +4,11 @@ "url":"https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-component-template.html", "description":"Returns one or more component templates" }, - "stability":"experimental", + "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "application/json"] + }, "url":{ "paths":[ { diff --git a/api_generator/rest_specs/cluster.get_settings.json b/api_generator/rest_specs/cluster.get_settings.json index 6f91fbbe..9708a860 100644 --- a/api_generator/rest_specs/cluster.get_settings.json +++ b/api_generator/rest_specs/cluster.get_settings.json @@ -5,6 +5,10 @@ "description":"Returns cluster settings." }, "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "application/json"] + }, "url":{ "paths":[ { diff --git a/api_generator/rest_specs/cluster.health.json b/api_generator/rest_specs/cluster.health.json index 894b141f..91712bbb 100644 --- a/api_generator/rest_specs/cluster.health.json +++ b/api_generator/rest_specs/cluster.health.json @@ -5,6 +5,10 @@ "description":"Returns basic information about the health of the cluster." }, "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "application/json"] + }, "url":{ "paths":[ { diff --git a/api_generator/rest_specs/cluster.pending_tasks.json b/api_generator/rest_specs/cluster.pending_tasks.json index d940adf9..0ce718b3 100644 --- a/api_generator/rest_specs/cluster.pending_tasks.json +++ b/api_generator/rest_specs/cluster.pending_tasks.json @@ -5,6 +5,10 @@ "description":"Returns a list of any cluster-level changes (e.g. create index, update mapping,\nallocate or fail shard) which have not yet been executed." }, "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "application/json"] + }, "url":{ "paths":[ { diff --git a/api_generator/rest_specs/cluster.post_voting_config_exclusions.json b/api_generator/rest_specs/cluster.post_voting_config_exclusions.json index 4dbaf80c..dcdf0f1f 100644 --- a/api_generator/rest_specs/cluster.post_voting_config_exclusions.json +++ b/api_generator/rest_specs/cluster.post_voting_config_exclusions.json @@ -5,6 +5,10 @@ "description":"Updates the cluster voting config exclusions by node ids or node names." }, "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "application/json"] + }, "url":{ "paths":[ { diff --git a/api_generator/rest_specs/cluster.put_component_template.json b/api_generator/rest_specs/cluster.put_component_template.json index abc83fb1..4b7b032b 100644 --- a/api_generator/rest_specs/cluster.put_component_template.json +++ b/api_generator/rest_specs/cluster.put_component_template.json @@ -4,7 +4,12 @@ "url":"https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-component-template.html", "description":"Creates or updates a component template" }, - "stability":"experimental", + "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "application/json"], + "content_type": ["application/json"] + }, "url":{ "paths":[ { diff --git a/api_generator/rest_specs/cluster.put_settings.json b/api_generator/rest_specs/cluster.put_settings.json index f6b9a086..77aac965 100644 --- a/api_generator/rest_specs/cluster.put_settings.json +++ b/api_generator/rest_specs/cluster.put_settings.json @@ -5,6 +5,11 @@ "description":"Updates the cluster settings." }, "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "application/json"], + "content_type": ["application/json"] + }, "url":{ "paths":[ { diff --git a/api_generator/rest_specs/cluster.remote_info.json b/api_generator/rest_specs/cluster.remote_info.json index 4eac0b55..689d1060 100644 --- a/api_generator/rest_specs/cluster.remote_info.json +++ b/api_generator/rest_specs/cluster.remote_info.json @@ -5,6 +5,10 @@ "description":"Returns the information about configured remote clusters." }, "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "application/json"] + }, "url":{ "paths":[ { diff --git a/api_generator/rest_specs/cluster.reroute.json b/api_generator/rest_specs/cluster.reroute.json index b0e8054f..2f543703 100644 --- a/api_generator/rest_specs/cluster.reroute.json +++ b/api_generator/rest_specs/cluster.reroute.json @@ -5,6 +5,11 @@ "description":"Allows to manually change the allocation of individual shards in the cluster." }, "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "application/json"], + "content_type": ["application/json"] + }, "url":{ "paths":[ { diff --git a/api_generator/rest_specs/cluster.state.json b/api_generator/rest_specs/cluster.state.json index 01770508..faf1aafd 100644 --- a/api_generator/rest_specs/cluster.state.json +++ b/api_generator/rest_specs/cluster.state.json @@ -5,6 +5,10 @@ "description":"Returns a comprehensive information about the state of the cluster." }, "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "application/json"] + }, "url":{ "paths":[ { diff --git a/api_generator/rest_specs/cluster.stats.json b/api_generator/rest_specs/cluster.stats.json index f36db097..4a8ca46c 100644 --- a/api_generator/rest_specs/cluster.stats.json +++ b/api_generator/rest_specs/cluster.stats.json @@ -5,6 +5,10 @@ "description":"Returns high-level overview of cluster statistics." }, "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "application/json"] + }, "url":{ "paths":[ { diff --git a/api_generator/rest_specs/count.json b/api_generator/rest_specs/count.json index 9f6461b1..04688df6 100644 --- a/api_generator/rest_specs/count.json +++ b/api_generator/rest_specs/count.json @@ -5,6 +5,11 @@ "description":"Returns number of documents matching a query." }, "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "application/json"], + "content_type": ["application/json"] + }, "url":{ "paths":[ { diff --git a/api_generator/rest_specs/create.json b/api_generator/rest_specs/create.json index 171f3da4..9cdb226f 100644 --- a/api_generator/rest_specs/create.json +++ b/api_generator/rest_specs/create.json @@ -5,6 +5,11 @@ "description":"Creates a new document in the index.\n\nReturns a 409 response when a document with a same ID already exists in the index." }, "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "application/json"], + "content_type": ["application/json"] + }, "url":{ "paths":[ { diff --git a/api_generator/rest_specs/dangling_indices.delete_dangling_index.json b/api_generator/rest_specs/dangling_indices.delete_dangling_index.json index 1e3d7478..8106e80d 100644 --- a/api_generator/rest_specs/dangling_indices.delete_dangling_index.json +++ b/api_generator/rest_specs/dangling_indices.delete_dangling_index.json @@ -5,6 +5,10 @@ "description": "Deletes the specified dangling index" }, "stability": "stable", + "visibility":"public", + "headers":{ + "accept": [ "application/json"] + }, "url": { "paths": [ { diff --git a/api_generator/rest_specs/dangling_indices.import_dangling_index.json b/api_generator/rest_specs/dangling_indices.import_dangling_index.json index e9dce01a..f81afc35 100644 --- a/api_generator/rest_specs/dangling_indices.import_dangling_index.json +++ b/api_generator/rest_specs/dangling_indices.import_dangling_index.json @@ -5,6 +5,10 @@ "description": "Imports the specified dangling index" }, "stability": "stable", + "visibility":"public", + "headers":{ + "accept": [ "application/json"] + }, "url": { "paths": [ { diff --git a/api_generator/rest_specs/dangling_indices.list_dangling_indices.json b/api_generator/rest_specs/dangling_indices.list_dangling_indices.json index dfc21f56..4310faa9 100644 --- a/api_generator/rest_specs/dangling_indices.list_dangling_indices.json +++ b/api_generator/rest_specs/dangling_indices.list_dangling_indices.json @@ -5,6 +5,10 @@ "description": "Returns all dangling indices." }, "stability": "stable", + "visibility":"public", + "headers":{ + "accept": [ "application/json"] + }, "url": { "paths": [ { diff --git a/api_generator/rest_specs/data_frame_transform_deprecated.delete_transform.json b/api_generator/rest_specs/data_frame_transform_deprecated.delete_transform.json index 28c90b60..ac9962fa 100644 --- a/api_generator/rest_specs/data_frame_transform_deprecated.delete_transform.json +++ b/api_generator/rest_specs/data_frame_transform_deprecated.delete_transform.json @@ -5,6 +5,10 @@ "description":"Deletes an existing transform." }, "stability":"beta", + "visibility":"public", + "headers":{ + "accept": [ "application/json"] + }, "url":{ "paths":[ { diff --git a/api_generator/rest_specs/data_frame_transform_deprecated.get_transform.json b/api_generator/rest_specs/data_frame_transform_deprecated.get_transform.json index 17f33386..6737a867 100644 --- a/api_generator/rest_specs/data_frame_transform_deprecated.get_transform.json +++ b/api_generator/rest_specs/data_frame_transform_deprecated.get_transform.json @@ -5,6 +5,10 @@ "description":"Retrieves configuration information for transforms." }, "stability":"beta", + "visibility":"public", + "headers":{ + "accept": [ "application/json"] + }, "url":{ "paths":[ { @@ -50,6 +54,12 @@ "type":"boolean", "required":false, "description":"Whether to ignore if a wildcard expression matches no transforms. (This includes `_all` string or when no transforms have been specified)" + }, + "exclude_generated": { + "required": false, + "type": "boolean", + "default": false, + "description": "Omits generated fields. Allows transform configurations to be easily copied between clusters and within the same cluster" } } } diff --git a/api_generator/rest_specs/data_frame_transform_deprecated.get_transform_stats.json b/api_generator/rest_specs/data_frame_transform_deprecated.get_transform_stats.json index 7822f3ce..0fbbcce2 100644 --- a/api_generator/rest_specs/data_frame_transform_deprecated.get_transform_stats.json +++ b/api_generator/rest_specs/data_frame_transform_deprecated.get_transform_stats.json @@ -5,6 +5,10 @@ "description":"Retrieves usage information for transforms." }, "stability":"beta", + "visibility":"public", + "headers":{ + "accept": [ "application/json"] + }, "url":{ "paths":[ { diff --git a/api_generator/rest_specs/data_frame_transform_deprecated.preview_transform.json b/api_generator/rest_specs/data_frame_transform_deprecated.preview_transform.json index 90b9b917..bcf683f1 100644 --- a/api_generator/rest_specs/data_frame_transform_deprecated.preview_transform.json +++ b/api_generator/rest_specs/data_frame_transform_deprecated.preview_transform.json @@ -5,6 +5,11 @@ "description":"Previews a transform." }, "stability":"beta", + "visibility":"public", + "headers":{ + "accept": [ "application/json"], + "content_type": ["application/json"] + }, "url":{ "paths":[ { diff --git a/api_generator/rest_specs/data_frame_transform_deprecated.put_transform.json b/api_generator/rest_specs/data_frame_transform_deprecated.put_transform.json index ce86e733..02d2dc87 100644 --- a/api_generator/rest_specs/data_frame_transform_deprecated.put_transform.json +++ b/api_generator/rest_specs/data_frame_transform_deprecated.put_transform.json @@ -5,6 +5,11 @@ "description":"Instantiates a transform." }, "stability":"beta", + "visibility":"public", + "headers":{ + "accept": [ "application/json"], + "content_type": ["application/json"] + }, "url":{ "paths":[ { diff --git a/api_generator/rest_specs/data_frame_transform_deprecated.start_transform.json b/api_generator/rest_specs/data_frame_transform_deprecated.start_transform.json index fd9e2561..a7be8c6c 100644 --- a/api_generator/rest_specs/data_frame_transform_deprecated.start_transform.json +++ b/api_generator/rest_specs/data_frame_transform_deprecated.start_transform.json @@ -5,6 +5,10 @@ "description":"Starts one or more transforms." }, "stability":"beta", + "visibility":"public", + "headers":{ + "accept": [ "application/json"] + }, "url":{ "paths":[ { diff --git a/api_generator/rest_specs/data_frame_transform_deprecated.stop_transform.json b/api_generator/rest_specs/data_frame_transform_deprecated.stop_transform.json index 8938ec5b..f479f5a1 100644 --- a/api_generator/rest_specs/data_frame_transform_deprecated.stop_transform.json +++ b/api_generator/rest_specs/data_frame_transform_deprecated.stop_transform.json @@ -5,6 +5,10 @@ "description":"Stops one or more transforms." }, "stability":"beta", + "visibility":"public", + "headers":{ + "accept": [ "application/json"] + }, "url":{ "paths":[ { diff --git a/api_generator/rest_specs/data_frame_transform_deprecated.update_transform.json b/api_generator/rest_specs/data_frame_transform_deprecated.update_transform.json index 97e1821b..630a50a5 100644 --- a/api_generator/rest_specs/data_frame_transform_deprecated.update_transform.json +++ b/api_generator/rest_specs/data_frame_transform_deprecated.update_transform.json @@ -5,6 +5,11 @@ "description":"Updates certain properties of a transform." }, "stability":"beta", + "visibility":"public", + "headers":{ + "accept":[ "application/json"], + "content_type":["application/json"] + }, "url":{ "paths":[ { diff --git a/api_generator/rest_specs/delete.json b/api_generator/rest_specs/delete.json index 0d82bca9..b262bb84 100644 --- a/api_generator/rest_specs/delete.json +++ b/api_generator/rest_specs/delete.json @@ -5,6 +5,10 @@ "description":"Removes a document from the index." }, "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "application/json"] + }, "url":{ "paths":[ { diff --git a/api_generator/rest_specs/delete_by_query.json b/api_generator/rest_specs/delete_by_query.json index 9f651b17..17decab1 100644 --- a/api_generator/rest_specs/delete_by_query.json +++ b/api_generator/rest_specs/delete_by_query.json @@ -5,6 +5,11 @@ "description":"Deletes documents matching the provided query." }, "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "application/json"], + "content_type": ["application/json"] + }, "url":{ "paths":[ { diff --git a/api_generator/rest_specs/delete_by_query_rethrottle.json b/api_generator/rest_specs/delete_by_query_rethrottle.json index 112bfc8a..e8ff1a61 100644 --- a/api_generator/rest_specs/delete_by_query_rethrottle.json +++ b/api_generator/rest_specs/delete_by_query_rethrottle.json @@ -5,6 +5,10 @@ "description":"Changes the number of requests per second for a particular Delete By Query operation." }, "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "application/json"] + }, "url":{ "paths":[ { diff --git a/api_generator/rest_specs/delete_script.json b/api_generator/rest_specs/delete_script.json index b38b97ae..cf657337 100644 --- a/api_generator/rest_specs/delete_script.json +++ b/api_generator/rest_specs/delete_script.json @@ -5,6 +5,10 @@ "description":"Deletes a script." }, "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "application/json"] + }, "url":{ "paths":[ { diff --git a/api_generator/rest_specs/enrich.delete_policy.json b/api_generator/rest_specs/enrich.delete_policy.json index f7a18302..3137f6b5 100644 --- a/api_generator/rest_specs/enrich.delete_policy.json +++ b/api_generator/rest_specs/enrich.delete_policy.json @@ -5,6 +5,10 @@ "description": "Deletes an existing enrich policy and its enrich index." }, "stability" : "stable", + "visibility":"public", + "headers":{ + "accept": [ "application/json"] + }, "url": { "paths": [ { diff --git a/api_generator/rest_specs/enrich.execute_policy.json b/api_generator/rest_specs/enrich.execute_policy.json index a448d910..5e4c8a22 100644 --- a/api_generator/rest_specs/enrich.execute_policy.json +++ b/api_generator/rest_specs/enrich.execute_policy.json @@ -5,6 +5,10 @@ "description": "Creates the enrich index for an existing enrich policy." }, "stability" : "stable", + "visibility":"public", + "headers":{ + "accept": [ "application/json"] + }, "url": { "paths": [ { diff --git a/api_generator/rest_specs/enrich.get_policy.json b/api_generator/rest_specs/enrich.get_policy.json index f1ea3fda..44778aff 100644 --- a/api_generator/rest_specs/enrich.get_policy.json +++ b/api_generator/rest_specs/enrich.get_policy.json @@ -5,6 +5,10 @@ "description": "Gets information about an enrich policy." }, "stability" : "stable", + "visibility":"public", + "headers":{ + "accept": [ "application/json"] + }, "url": { "paths": [ { diff --git a/api_generator/rest_specs/enrich.put_policy.json b/api_generator/rest_specs/enrich.put_policy.json index 10787158..0d1cefd3 100644 --- a/api_generator/rest_specs/enrich.put_policy.json +++ b/api_generator/rest_specs/enrich.put_policy.json @@ -5,6 +5,11 @@ "description": "Creates a new enrich policy." }, "stability" : "stable", + "visibility":"public", + "headers":{ + "accept": [ "application/json"], + "content_type": ["application/json"] + }, "url": { "paths": [ { diff --git a/api_generator/rest_specs/enrich.stats.json b/api_generator/rest_specs/enrich.stats.json index 153ee42b..b4218acf 100644 --- a/api_generator/rest_specs/enrich.stats.json +++ b/api_generator/rest_specs/enrich.stats.json @@ -5,6 +5,10 @@ "description": "Gets enrich coordinator statistics and information about enrich policies that are currently executing." }, "stability" : "stable", + "visibility":"public", + "headers":{ + "accept": [ "application/json"] + }, "url": { "paths": [ { diff --git a/api_generator/rest_specs/eql.delete.json b/api_generator/rest_specs/eql.delete.json index 47b3990a..18f69022 100644 --- a/api_generator/rest_specs/eql.delete.json +++ b/api_generator/rest_specs/eql.delete.json @@ -4,7 +4,11 @@ "url":"https://www.elastic.co/guide/en/elasticsearch/reference/current/eql-search-api.html", "description": "Deletes an async EQL search by ID. If the search is still running, the search request will be cancelled. Otherwise, the saved search results are deleted." }, - "stability":"beta", + "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "application/json"] + }, "url":{ "paths":[ { diff --git a/api_generator/rest_specs/eql.get.json b/api_generator/rest_specs/eql.get.json index 9271f43e..c7a228da 100644 --- a/api_generator/rest_specs/eql.get.json +++ b/api_generator/rest_specs/eql.get.json @@ -4,7 +4,11 @@ "url":"https://www.elastic.co/guide/en/elasticsearch/reference/current/eql-search-api.html", "description": "Returns async results from previously executed Event Query Language (EQL) search" }, - "stability": "beta", + "stability": "stable", + "visibility":"public", + "headers":{ + "accept": [ "application/json"] + }, "url":{ "paths":[ { diff --git a/api_generator/rest_specs/eql.get_status.json b/api_generator/rest_specs/eql.get_status.json new file mode 100644 index 00000000..be8a4398 --- /dev/null +++ b/api_generator/rest_specs/eql.get_status.json @@ -0,0 +1,31 @@ +{ + "eql.get_status": { + "documentation": { + "url": "https://www.elastic.co/guide/en/elasticsearch/reference/current/eql-search-api.html", + "description": "Returns the status of a previously submitted async or stored Event Query Language (EQL) search" + }, + "stability": "stable", + "visibility": "public", + "headers": { + "accept": [ + "application/json" + ] + }, + "url": { + "paths": [ + { + "path": "/_eql/search/status/{id}", + "methods": [ + "GET" + ], + "parts": { + "id": { + "type": "string", + "description": "The async search ID" + } + } + } + ] + } + } +} diff --git a/api_generator/rest_specs/eql.search.json b/api_generator/rest_specs/eql.search.json index c371851d..6748dfd4 100644 --- a/api_generator/rest_specs/eql.search.json +++ b/api_generator/rest_specs/eql.search.json @@ -4,7 +4,13 @@ "url":"https://www.elastic.co/guide/en/elasticsearch/reference/current/eql-search-api.html", "description": "Returns results matching a query expressed in Event Query Language (EQL)" }, - "stability": "beta", + "stability": "stable", + "visibility":"feature_flag", + "feature_flag":"es.eql_feature_flag_registered", + "headers":{ + "accept": [ "application/json"], + "content_type": ["application/json"] + }, "url":{ "paths":[ { diff --git a/api_generator/rest_specs/exists.json b/api_generator/rest_specs/exists.json index 09042376..3baf116c 100644 --- a/api_generator/rest_specs/exists.json +++ b/api_generator/rest_specs/exists.json @@ -5,6 +5,10 @@ "description":"Returns information about whether a document exists in an index." }, "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "application/json"] + }, "url":{ "paths":[ { diff --git a/api_generator/rest_specs/exists_source.json b/api_generator/rest_specs/exists_source.json index 143ee406..9edfeb9f 100644 --- a/api_generator/rest_specs/exists_source.json +++ b/api_generator/rest_specs/exists_source.json @@ -5,6 +5,10 @@ "description":"Returns information about whether a document source exists in an index." }, "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "application/json"] + }, "url":{ "paths":[ { diff --git a/api_generator/rest_specs/explain.json b/api_generator/rest_specs/explain.json index c7c393a6..fb0c851f 100644 --- a/api_generator/rest_specs/explain.json +++ b/api_generator/rest_specs/explain.json @@ -5,6 +5,11 @@ "description":"Returns information about why a specific matches (or doesn't match) a query." }, "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "application/json"], + "content_type": ["application/json"] + }, "url":{ "paths":[ { diff --git a/api_generator/rest_specs/field_caps.json b/api_generator/rest_specs/field_caps.json index 20a87c7d..d2632a12 100644 --- a/api_generator/rest_specs/field_caps.json +++ b/api_generator/rest_specs/field_caps.json @@ -5,6 +5,10 @@ "description":"Returns the information about the capabilities of fields among multiple indices." }, "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "application/json"] + }, "url":{ "paths":[ { diff --git a/api_generator/rest_specs/get.json b/api_generator/rest_specs/get.json index 0c8d62d6..7cb8141c 100644 --- a/api_generator/rest_specs/get.json +++ b/api_generator/rest_specs/get.json @@ -5,6 +5,10 @@ "description":"Returns a document." }, "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "application/json"] + }, "url":{ "paths":[ { diff --git a/api_generator/rest_specs/get_script.json b/api_generator/rest_specs/get_script.json index 14307bea..ae11aa07 100644 --- a/api_generator/rest_specs/get_script.json +++ b/api_generator/rest_specs/get_script.json @@ -5,6 +5,10 @@ "description":"Returns a script." }, "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "application/json"] + }, "url":{ "paths":[ { diff --git a/api_generator/rest_specs/get_script_context.json b/api_generator/rest_specs/get_script_context.json index aa770ee9..5f62e057 100644 --- a/api_generator/rest_specs/get_script_context.json +++ b/api_generator/rest_specs/get_script_context.json @@ -5,6 +5,10 @@ "description":"Returns all script contexts." }, "stability":"experimental", + "visibility":"public", + "headers":{ + "accept": [ "application/json"] + }, "url":{ "paths":[ { diff --git a/api_generator/rest_specs/get_script_languages.json b/api_generator/rest_specs/get_script_languages.json index a5e06cb8..f8df1e76 100644 --- a/api_generator/rest_specs/get_script_languages.json +++ b/api_generator/rest_specs/get_script_languages.json @@ -5,6 +5,10 @@ "description":"Returns available script types, languages and contexts" }, "stability":"experimental", + "visibility":"public", + "headers":{ + "accept": [ "application/json"] + }, "url":{ "paths":[ { diff --git a/api_generator/rest_specs/get_source.json b/api_generator/rest_specs/get_source.json index e5336059..0c24d692 100644 --- a/api_generator/rest_specs/get_source.json +++ b/api_generator/rest_specs/get_source.json @@ -5,6 +5,10 @@ "description":"Returns the source of a document." }, "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "application/json"] + }, "url":{ "paths":[ { diff --git a/api_generator/rest_specs/graph.explore.json b/api_generator/rest_specs/graph.explore.json index 1af87af7..c40a5c5b 100644 --- a/api_generator/rest_specs/graph.explore.json +++ b/api_generator/rest_specs/graph.explore.json @@ -5,6 +5,11 @@ "description": "Explore extracted and summarized information about the documents and terms in an index." }, "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "application/json"], + "content_type": ["application/json"] + }, "url":{ "paths":[ { diff --git a/api_generator/rest_specs/ilm.delete_lifecycle.json b/api_generator/rest_specs/ilm.delete_lifecycle.json index 59c14b3c..2ff1031a 100644 --- a/api_generator/rest_specs/ilm.delete_lifecycle.json +++ b/api_generator/rest_specs/ilm.delete_lifecycle.json @@ -5,6 +5,10 @@ "description": "Deletes the specified lifecycle policy definition. A currently used policy cannot be deleted." }, "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "application/json"] + }, "url":{ "paths":[ { diff --git a/api_generator/rest_specs/ilm.explain_lifecycle.json b/api_generator/rest_specs/ilm.explain_lifecycle.json index 9a8f11ae..c793ed09 100644 --- a/api_generator/rest_specs/ilm.explain_lifecycle.json +++ b/api_generator/rest_specs/ilm.explain_lifecycle.json @@ -5,6 +5,10 @@ "description": "Retrieves information about the index's current lifecycle state, such as the currently executing phase, action, and step." }, "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "application/json"] + }, "url":{ "paths":[ { diff --git a/api_generator/rest_specs/ilm.get_lifecycle.json b/api_generator/rest_specs/ilm.get_lifecycle.json index 6846d92b..17bf8130 100644 --- a/api_generator/rest_specs/ilm.get_lifecycle.json +++ b/api_generator/rest_specs/ilm.get_lifecycle.json @@ -5,6 +5,10 @@ "description": "Returns the specified policy definition. Includes the policy version and last modified date." }, "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "application/json"] + }, "url":{ "paths":[ { diff --git a/api_generator/rest_specs/ilm.get_status.json b/api_generator/rest_specs/ilm.get_status.json index 1808e903..eba1b93c 100644 --- a/api_generator/rest_specs/ilm.get_status.json +++ b/api_generator/rest_specs/ilm.get_status.json @@ -5,6 +5,10 @@ "description":"Retrieves the current index lifecycle management (ILM) status." }, "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "application/json"] + }, "url":{ "paths":[ { diff --git a/api_generator/rest_specs/ilm.move_to_step.json b/api_generator/rest_specs/ilm.move_to_step.json index c3b397ba..3f46b8fa 100644 --- a/api_generator/rest_specs/ilm.move_to_step.json +++ b/api_generator/rest_specs/ilm.move_to_step.json @@ -5,6 +5,11 @@ "description":"Manually moves an index into the specified step and executes that step." }, "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "application/json"], + "content_type": ["application/json"] + }, "url":{ "paths":[ { diff --git a/api_generator/rest_specs/ilm.put_lifecycle.json b/api_generator/rest_specs/ilm.put_lifecycle.json index 26029211..5a12a778 100644 --- a/api_generator/rest_specs/ilm.put_lifecycle.json +++ b/api_generator/rest_specs/ilm.put_lifecycle.json @@ -5,6 +5,11 @@ "description":"Creates a lifecycle policy" }, "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "application/json"], + "content_type": ["application/json"] + }, "url":{ "paths":[ { diff --git a/api_generator/rest_specs/ilm.remove_policy.json b/api_generator/rest_specs/ilm.remove_policy.json index e39c95f6..bc684186 100644 --- a/api_generator/rest_specs/ilm.remove_policy.json +++ b/api_generator/rest_specs/ilm.remove_policy.json @@ -5,6 +5,10 @@ "description":"Removes the assigned lifecycle policy and stops managing the specified index" }, "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "application/json"] + }, "url":{ "paths":[ { diff --git a/api_generator/rest_specs/ilm.retry.json b/api_generator/rest_specs/ilm.retry.json index ab957713..b567d9b7 100644 --- a/api_generator/rest_specs/ilm.retry.json +++ b/api_generator/rest_specs/ilm.retry.json @@ -5,6 +5,10 @@ "description":"Retries executing the policy for an index that is in the ERROR step." }, "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "application/json"] + }, "url":{ "paths":[ { diff --git a/api_generator/rest_specs/ilm.start.json b/api_generator/rest_specs/ilm.start.json index 56ca5a4a..88b02007 100644 --- a/api_generator/rest_specs/ilm.start.json +++ b/api_generator/rest_specs/ilm.start.json @@ -5,6 +5,10 @@ "description":"Start the index lifecycle management (ILM) plugin." }, "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "application/json"] + }, "url":{ "paths":[ { diff --git a/api_generator/rest_specs/ilm.stop.json b/api_generator/rest_specs/ilm.stop.json index 9604499c..8401f93b 100644 --- a/api_generator/rest_specs/ilm.stop.json +++ b/api_generator/rest_specs/ilm.stop.json @@ -5,6 +5,10 @@ "description":"Halts all lifecycle management operations and stops the index lifecycle management (ILM) plugin" }, "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "application/json"] + }, "url":{ "paths":[ { diff --git a/api_generator/rest_specs/index.json b/api_generator/rest_specs/index.json index 37f3cc9f..ac1e1fef 100644 --- a/api_generator/rest_specs/index.json +++ b/api_generator/rest_specs/index.json @@ -5,6 +5,11 @@ "description":"Creates or updates a document in an index." }, "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "application/json"], + "content_type": ["application/json"] + }, "url":{ "paths":[ { diff --git a/api_generator/rest_specs/indices.add_block.json b/api_generator/rest_specs/indices.add_block.json index 7389fb13..24738d1f 100644 --- a/api_generator/rest_specs/indices.add_block.json +++ b/api_generator/rest_specs/indices.add_block.json @@ -5,6 +5,10 @@ "description":"Adds a block to an index." }, "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "application/json"] + }, "url":{ "paths":[ { diff --git a/api_generator/rest_specs/indices.analyze.json b/api_generator/rest_specs/indices.analyze.json index aa8e84c1..a6d8cf6c 100644 --- a/api_generator/rest_specs/indices.analyze.json +++ b/api_generator/rest_specs/indices.analyze.json @@ -5,6 +5,11 @@ "description":"Performs the analysis process on a text and return the tokens breakdown of the text." }, "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "application/json"], + "content_type": ["application/json"] + }, "url":{ "paths":[ { diff --git a/api_generator/rest_specs/indices.clear_cache.json b/api_generator/rest_specs/indices.clear_cache.json index 64c10a52..064a7573 100644 --- a/api_generator/rest_specs/indices.clear_cache.json +++ b/api_generator/rest_specs/indices.clear_cache.json @@ -5,6 +5,10 @@ "description":"Clears all or specific caches for one or more indices." }, "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "application/json"] + }, "url":{ "paths":[ { diff --git a/api_generator/rest_specs/indices.clone.json b/api_generator/rest_specs/indices.clone.json index d3a24958..43a6383a 100644 --- a/api_generator/rest_specs/indices.clone.json +++ b/api_generator/rest_specs/indices.clone.json @@ -5,6 +5,11 @@ "description": "Clones an index" }, "stability": "stable", + "visibility":"public", + "headers":{ + "accept": [ "application/json"], + "content_type": ["application/json"] + }, "url": { "paths": [ { diff --git a/api_generator/rest_specs/indices.close.json b/api_generator/rest_specs/indices.close.json index f26c8e77..00900819 100644 --- a/api_generator/rest_specs/indices.close.json +++ b/api_generator/rest_specs/indices.close.json @@ -5,6 +5,10 @@ "description":"Closes an index." }, "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "application/json"] + }, "url":{ "paths":[ { @@ -52,7 +56,7 @@ }, "wait_for_active_shards":{ "type":"string", - "description":"Sets the number of active shards to wait for before the operation returns." + "description":"Sets the number of active shards to wait for before the operation returns. Set to `index-setting` to wait according to the index setting `index.write.wait_for_active_shards`, or `all` to wait for all shards, or an integer. Defaults to `0`." } } } diff --git a/api_generator/rest_specs/indices.create.json b/api_generator/rest_specs/indices.create.json index 2b9e8617..214e688b 100644 --- a/api_generator/rest_specs/indices.create.json +++ b/api_generator/rest_specs/indices.create.json @@ -5,6 +5,11 @@ "description":"Creates an index with optional settings and mappings." }, "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "application/json"], + "content_type": ["application/json"] + }, "url":{ "paths":[ { diff --git a/api_generator/rest_specs/indices.create_data_stream.json b/api_generator/rest_specs/indices.create_data_stream.json index 693f91a5..f8f3e238 100644 --- a/api_generator/rest_specs/indices.create_data_stream.json +++ b/api_generator/rest_specs/indices.create_data_stream.json @@ -5,6 +5,10 @@ "description":"Creates a data stream" }, "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "application/json"] + }, "url":{ "paths":[ { diff --git a/api_generator/rest_specs/indices.data_streams_stats.json b/api_generator/rest_specs/indices.data_streams_stats.json index 75922e30..90a3574d 100644 --- a/api_generator/rest_specs/indices.data_streams_stats.json +++ b/api_generator/rest_specs/indices.data_streams_stats.json @@ -5,6 +5,10 @@ "description":"Provides statistics on operations happening in a data stream." }, "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "application/json"] + }, "url":{ "paths":[ { diff --git a/api_generator/rest_specs/indices.delete.json b/api_generator/rest_specs/indices.delete.json index 53fdf44b..252ba754 100644 --- a/api_generator/rest_specs/indices.delete.json +++ b/api_generator/rest_specs/indices.delete.json @@ -5,6 +5,10 @@ "description":"Deletes an index." }, "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "application/json"] + }, "url":{ "paths":[ { diff --git a/api_generator/rest_specs/indices.delete_alias.json b/api_generator/rest_specs/indices.delete_alias.json index 13abf70c..7ec072a4 100644 --- a/api_generator/rest_specs/indices.delete_alias.json +++ b/api_generator/rest_specs/indices.delete_alias.json @@ -5,6 +5,10 @@ "description":"Deletes an alias." }, "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "application/json"] + }, "url":{ "paths":[ { diff --git a/api_generator/rest_specs/indices.delete_data_stream.json b/api_generator/rest_specs/indices.delete_data_stream.json index c7b562f3..26f015f6 100644 --- a/api_generator/rest_specs/indices.delete_data_stream.json +++ b/api_generator/rest_specs/indices.delete_data_stream.json @@ -5,6 +5,10 @@ "description":"Deletes a data stream." }, "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "application/json"] + }, "url":{ "paths":[ { @@ -21,6 +25,19 @@ } ] }, - "params":{} + "params":{ + "expand_wildcards":{ + "type":"enum", + "options":[ + "open", + "closed", + "hidden", + "none", + "all" + ], + "default":"open", + "description":"Whether wildcard expressions should get expanded to open or closed indices (default: open)" + } + } } } diff --git a/api_generator/rest_specs/indices.delete_index_template.json b/api_generator/rest_specs/indices.delete_index_template.json index d037b03d..a07d6540 100644 --- a/api_generator/rest_specs/indices.delete_index_template.json +++ b/api_generator/rest_specs/indices.delete_index_template.json @@ -4,7 +4,11 @@ "url":"https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-templates.html", "description":"Deletes an index template." }, - "stability":"experimental", + "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "application/json"] + }, "url":{ "paths":[ { diff --git a/api_generator/rest_specs/indices.delete_template.json b/api_generator/rest_specs/indices.delete_template.json index ca484a73..7d79c2ab 100644 --- a/api_generator/rest_specs/indices.delete_template.json +++ b/api_generator/rest_specs/indices.delete_template.json @@ -5,6 +5,10 @@ "description":"Deletes an index template." }, "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "application/json"] + }, "url":{ "paths":[ { diff --git a/api_generator/rest_specs/indices.exists.json b/api_generator/rest_specs/indices.exists.json index 7539f44a..b8e18348 100644 --- a/api_generator/rest_specs/indices.exists.json +++ b/api_generator/rest_specs/indices.exists.json @@ -5,6 +5,10 @@ "description":"Returns information about whether a particular index exists." }, "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "application/json"] + }, "url":{ "paths":[ { diff --git a/api_generator/rest_specs/indices.exists_alias.json b/api_generator/rest_specs/indices.exists_alias.json index 66e5ce92..b70854fd 100644 --- a/api_generator/rest_specs/indices.exists_alias.json +++ b/api_generator/rest_specs/indices.exists_alias.json @@ -5,6 +5,10 @@ "description":"Returns information about whether a particular alias exists." }, "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "application/json"] + }, "url":{ "paths":[ { diff --git a/api_generator/rest_specs/indices.exists_index_template.json b/api_generator/rest_specs/indices.exists_index_template.json index c5312680..dc0f9ed5 100644 --- a/api_generator/rest_specs/indices.exists_index_template.json +++ b/api_generator/rest_specs/indices.exists_index_template.json @@ -4,7 +4,11 @@ "url":"https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-templates.html", "description":"Returns information about whether a particular index template exists." }, - "stability":"experimental", + "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "application/json"] + }, "url":{ "paths":[ { diff --git a/api_generator/rest_specs/indices.exists_template.json b/api_generator/rest_specs/indices.exists_template.json index 9796bdd9..9d2b6b15 100644 --- a/api_generator/rest_specs/indices.exists_template.json +++ b/api_generator/rest_specs/indices.exists_template.json @@ -5,6 +5,10 @@ "description":"Returns information about whether a particular index template exists." }, "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "application/json"] + }, "url":{ "paths":[ { diff --git a/api_generator/rest_specs/indices.exists_type.json b/api_generator/rest_specs/indices.exists_type.json index c854d0e8..1a3fb54c 100644 --- a/api_generator/rest_specs/indices.exists_type.json +++ b/api_generator/rest_specs/indices.exists_type.json @@ -5,6 +5,10 @@ "description":"Returns information about whether a particular document type exists. (DEPRECATED)" }, "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "application/json"] + }, "url":{ "paths":[ { diff --git a/api_generator/rest_specs/indices.flush.json b/api_generator/rest_specs/indices.flush.json index 35138b92..f48f9ad1 100644 --- a/api_generator/rest_specs/indices.flush.json +++ b/api_generator/rest_specs/indices.flush.json @@ -5,6 +5,10 @@ "description":"Performs the flush operation on one or more indices." }, "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "application/json"] + }, "url":{ "paths":[ { diff --git a/api_generator/rest_specs/indices.flush_synced.json b/api_generator/rest_specs/indices.flush_synced.json index 134ba933..8f9df791 100644 --- a/api_generator/rest_specs/indices.flush_synced.json +++ b/api_generator/rest_specs/indices.flush_synced.json @@ -5,6 +5,10 @@ "description":"Performs a synced flush operation on one or more indices. Synced flush is deprecated and will be removed in 8.0. Use flush instead" }, "stability":"stable", + "visibility" : "public", + "headers":{ + "accept": [ "application/json"] + }, "url":{ "paths":[ { diff --git a/api_generator/rest_specs/indices.forcemerge.json b/api_generator/rest_specs/indices.forcemerge.json index 6036b75b..9afc86cc 100644 --- a/api_generator/rest_specs/indices.forcemerge.json +++ b/api_generator/rest_specs/indices.forcemerge.json @@ -5,6 +5,10 @@ "description":"Performs the force merge operation on one or more indices." }, "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "application/json"] + }, "url":{ "paths":[ { diff --git a/api_generator/rest_specs/indices.freeze.json b/api_generator/rest_specs/indices.freeze.json index 2966db1d..e743a53c 100644 --- a/api_generator/rest_specs/indices.freeze.json +++ b/api_generator/rest_specs/indices.freeze.json @@ -5,6 +5,10 @@ "description":"Freezes an index. A frozen index has almost no overhead on the cluster (except for maintaining its metadata in memory) and is read-only." }, "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "application/json"] + }, "url":{ "paths":[ { diff --git a/api_generator/rest_specs/indices.get.json b/api_generator/rest_specs/indices.get.json index f78b410f..58d07616 100644 --- a/api_generator/rest_specs/indices.get.json +++ b/api_generator/rest_specs/indices.get.json @@ -5,6 +5,10 @@ "description":"Returns information about one or more indices." }, "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "application/json"] + }, "url":{ "paths":[ { diff --git a/api_generator/rest_specs/indices.get_alias.json b/api_generator/rest_specs/indices.get_alias.json index 5bfdd985..0a4e4bb9 100644 --- a/api_generator/rest_specs/indices.get_alias.json +++ b/api_generator/rest_specs/indices.get_alias.json @@ -5,6 +5,10 @@ "description":"Returns an alias." }, "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "application/json"] + }, "url":{ "paths":[ { diff --git a/api_generator/rest_specs/indices.get_data_stream.json b/api_generator/rest_specs/indices.get_data_stream.json index b75ae14a..3b41a9e1 100644 --- a/api_generator/rest_specs/indices.get_data_stream.json +++ b/api_generator/rest_specs/indices.get_data_stream.json @@ -5,6 +5,10 @@ "description":"Returns data streams." }, "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "application/json"] + }, "url":{ "paths":[ { @@ -28,6 +32,18 @@ ] }, "params":{ + "expand_wildcards":{ + "type":"enum", + "options":[ + "open", + "closed", + "hidden", + "none", + "all" + ], + "default":"open", + "description":"Whether wildcard expressions should get expanded to open or closed indices (default: open)" + } } } } diff --git a/api_generator/rest_specs/indices.get_field_mapping.json b/api_generator/rest_specs/indices.get_field_mapping.json index 15cc48a5..d469a755 100644 --- a/api_generator/rest_specs/indices.get_field_mapping.json +++ b/api_generator/rest_specs/indices.get_field_mapping.json @@ -5,6 +5,10 @@ "description":"Returns mapping for one or more fields." }, "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "application/json"] + }, "url":{ "paths":[ { diff --git a/api_generator/rest_specs/indices.get_index_template.json b/api_generator/rest_specs/indices.get_index_template.json index 7ea6dd29..7d47e088 100644 --- a/api_generator/rest_specs/indices.get_index_template.json +++ b/api_generator/rest_specs/indices.get_index_template.json @@ -4,7 +4,11 @@ "url":"https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-templates.html", "description":"Returns an index template." }, - "stability":"experimental", + "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "application/json"] + }, "url":{ "paths":[ { diff --git a/api_generator/rest_specs/indices.get_mapping.json b/api_generator/rest_specs/indices.get_mapping.json index 1d9e795c..5b1431d5 100644 --- a/api_generator/rest_specs/indices.get_mapping.json +++ b/api_generator/rest_specs/indices.get_mapping.json @@ -5,6 +5,10 @@ "description":"Returns mappings for one or more indices." }, "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "application/json"] + }, "url":{ "paths":[ { diff --git a/api_generator/rest_specs/indices.get_settings.json b/api_generator/rest_specs/indices.get_settings.json index 68e32544..027b337f 100644 --- a/api_generator/rest_specs/indices.get_settings.json +++ b/api_generator/rest_specs/indices.get_settings.json @@ -5,6 +5,10 @@ "description":"Returns settings for one or more indices." }, "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "application/json"] + }, "url":{ "paths":[ { diff --git a/api_generator/rest_specs/indices.get_template.json b/api_generator/rest_specs/indices.get_template.json index 9e07ae66..3a4120be 100644 --- a/api_generator/rest_specs/indices.get_template.json +++ b/api_generator/rest_specs/indices.get_template.json @@ -5,6 +5,10 @@ "description":"Returns an index template." }, "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "application/json"] + }, "url":{ "paths":[ { diff --git a/api_generator/rest_specs/indices.get_upgrade.json b/api_generator/rest_specs/indices.get_upgrade.json index 472a9012..47a92b8b 100644 --- a/api_generator/rest_specs/indices.get_upgrade.json +++ b/api_generator/rest_specs/indices.get_upgrade.json @@ -2,16 +2,24 @@ "indices.get_upgrade":{ "documentation":{ "url":"https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-upgrade.html", - "description":"The _upgrade API is no longer useful and will be removed." + "description":"DEPRECATED Returns a progress status of current upgrade." }, "stability":"stable", + "visibility": "public", + "headers":{ + "accept": [ "application/json"] + }, "url":{ "paths":[ { "path":"/_upgrade", "methods":[ "GET" - ] + ], + "deprecated":{ + "version":"8.0.0", + "description":"The _upgrade API is no longer useful and will be removed. Instead, see _reindex API." + } }, { "path":"/{index}/_upgrade", @@ -23,6 +31,10 @@ "type":"list", "description":"A comma-separated list of index names; use `_all` or empty string to perform the operation on all indices" } + }, + "deprecated":{ + "version":"8.0.0", + "description":"The _upgrade API is no longer useful and will be removed. Instead, see _reindex API." } } ] diff --git a/api_generator/rest_specs/indices.migrate_to_data_stream.json b/api_generator/rest_specs/indices.migrate_to_data_stream.json new file mode 100644 index 00000000..4254ae79 --- /dev/null +++ b/api_generator/rest_specs/indices.migrate_to_data_stream.json @@ -0,0 +1,31 @@ +{ + "indices.migrate_to_data_stream":{ + "documentation":{ + "url":"https://www.elastic.co/guide/en/elasticsearch/reference/master/data-streams.html", + "description":"Migrates an alias to a data stream" + }, + "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "application/json"] + }, + "url":{ + "paths":[ + { + "path":"/_data_stream/_migrate/{name}", + "methods":[ + "POST" + ], + "parts":{ + "name":{ + "type":"string", + "description":"The name of the alias to migrate" + } + } + } + ] + }, + "params":{ + } + } +} diff --git a/api_generator/rest_specs/indices.open.json b/api_generator/rest_specs/indices.open.json index 1dab468c..e6c1646d 100644 --- a/api_generator/rest_specs/indices.open.json +++ b/api_generator/rest_specs/indices.open.json @@ -5,6 +5,10 @@ "description":"Opens an index." }, "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "application/json"] + }, "url":{ "paths":[ { diff --git a/api_generator/rest_specs/indices.promote_data_stream.json b/api_generator/rest_specs/indices.promote_data_stream.json new file mode 100644 index 00000000..5b51a900 --- /dev/null +++ b/api_generator/rest_specs/indices.promote_data_stream.json @@ -0,0 +1,31 @@ +{ + "indices.promote_data_stream":{ + "documentation":{ + "url":"https://www.elastic.co/guide/en/elasticsearch/reference/master/data-streams.html", + "description":"Promotes a data stream from a replicated data stream managed by CCR to a regular data stream" + }, + "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "application/json"] + }, + "url":{ + "paths":[ + { + "path":"/_data_stream/_promote/{name}", + "methods":[ + "POST" + ], + "parts":{ + "name":{ + "type":"string", + "description":"The name of the data stream" + } + } + } + ] + }, + "params":{ + } + } +} diff --git a/api_generator/rest_specs/indices.put_alias.json b/api_generator/rest_specs/indices.put_alias.json index 603f24b6..953f119a 100644 --- a/api_generator/rest_specs/indices.put_alias.json +++ b/api_generator/rest_specs/indices.put_alias.json @@ -5,6 +5,11 @@ "description":"Creates or updates an alias." }, "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "application/json"], + "content_type": ["application/json"] + }, "url":{ "paths":[ { diff --git a/api_generator/rest_specs/indices.put_index_template.json b/api_generator/rest_specs/indices.put_index_template.json index 3f758e18..542f316a 100644 --- a/api_generator/rest_specs/indices.put_index_template.json +++ b/api_generator/rest_specs/indices.put_index_template.json @@ -4,7 +4,12 @@ "url":"https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-templates.html", "description":"Creates or updates an index template." }, - "stability":"experimental", + "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "application/json"], + "content_type": ["application/json"] + }, "url":{ "paths":[ { diff --git a/api_generator/rest_specs/indices.put_mapping.json b/api_generator/rest_specs/indices.put_mapping.json index f23380ac..557bbae5 100644 --- a/api_generator/rest_specs/indices.put_mapping.json +++ b/api_generator/rest_specs/indices.put_mapping.json @@ -5,6 +5,11 @@ "description":"Updates the index mappings." }, "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "application/json"], + "content_type": ["application/json"] + }, "url":{ "paths":[ { diff --git a/api_generator/rest_specs/indices.put_settings.json b/api_generator/rest_specs/indices.put_settings.json index 66fe23ba..c1f30799 100644 --- a/api_generator/rest_specs/indices.put_settings.json +++ b/api_generator/rest_specs/indices.put_settings.json @@ -5,6 +5,11 @@ "description":"Updates the index settings." }, "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "application/json"], + "content_type": ["application/json"] + }, "url":{ "paths":[ { diff --git a/api_generator/rest_specs/indices.put_template.json b/api_generator/rest_specs/indices.put_template.json index 701a722d..4222de2a 100644 --- a/api_generator/rest_specs/indices.put_template.json +++ b/api_generator/rest_specs/indices.put_template.json @@ -5,6 +5,11 @@ "description":"Creates or updates an index template." }, "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "application/json"], + "content_type": ["application/json"] + }, "url":{ "paths":[ { diff --git a/api_generator/rest_specs/indices.recovery.json b/api_generator/rest_specs/indices.recovery.json index 8b134bbe..b1174b89 100644 --- a/api_generator/rest_specs/indices.recovery.json +++ b/api_generator/rest_specs/indices.recovery.json @@ -5,6 +5,10 @@ "description":"Returns information about ongoing index shard recoveries." }, "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "application/json"] + }, "url":{ "paths":[ { diff --git a/api_generator/rest_specs/indices.refresh.json b/api_generator/rest_specs/indices.refresh.json index 950e0a62..0932d77e 100644 --- a/api_generator/rest_specs/indices.refresh.json +++ b/api_generator/rest_specs/indices.refresh.json @@ -5,6 +5,10 @@ "description":"Performs the refresh operation in one or more indices." }, "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "application/json"] + }, "url":{ "paths":[ { diff --git a/api_generator/rest_specs/indices.reload_search_analyzers.json b/api_generator/rest_specs/indices.reload_search_analyzers.json index 2c021497..67a1d7ac 100644 --- a/api_generator/rest_specs/indices.reload_search_analyzers.json +++ b/api_generator/rest_specs/indices.reload_search_analyzers.json @@ -5,6 +5,10 @@ "description":"Reloads an index's search analyzers and their resources." }, "stability" : "stable", + "visibility":"public", + "headers":{ + "accept": [ "application/json"] + }, "url":{ "paths":[ { diff --git a/api_generator/rest_specs/indices.resolve_index.json b/api_generator/rest_specs/indices.resolve_index.json index 41d60981..e51c2d52 100644 --- a/api_generator/rest_specs/indices.resolve_index.json +++ b/api_generator/rest_specs/indices.resolve_index.json @@ -5,6 +5,10 @@ "description":"Returns information about any matching indices, aliases, and data streams" }, "stability":"experimental", + "visibility":"public", + "headers":{ + "accept": [ "application/json"] + }, "url":{ "paths":[ { diff --git a/api_generator/rest_specs/indices.rollover.json b/api_generator/rest_specs/indices.rollover.json index 4ed1f9b4..359f3983 100644 --- a/api_generator/rest_specs/indices.rollover.json +++ b/api_generator/rest_specs/indices.rollover.json @@ -5,6 +5,11 @@ "description":"Updates an alias to point to a new index when the existing index\nis considered to be too large or too old." }, "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "application/json"], + "content_type": ["application/json"] + }, "url":{ "paths":[ { diff --git a/api_generator/rest_specs/indices.segments.json b/api_generator/rest_specs/indices.segments.json index 83430a9a..18eecb68 100644 --- a/api_generator/rest_specs/indices.segments.json +++ b/api_generator/rest_specs/indices.segments.json @@ -5,6 +5,10 @@ "description":"Provides low-level information about segments in a Lucene index." }, "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "application/json"] + }, "url":{ "paths":[ { diff --git a/api_generator/rest_specs/indices.shard_stores.json b/api_generator/rest_specs/indices.shard_stores.json index 7e48e999..739107dc 100644 --- a/api_generator/rest_specs/indices.shard_stores.json +++ b/api_generator/rest_specs/indices.shard_stores.json @@ -5,6 +5,10 @@ "description":"Provides store information for shard copies of indices." }, "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "application/json"] + }, "url":{ "paths":[ { diff --git a/api_generator/rest_specs/indices.shrink.json b/api_generator/rest_specs/indices.shrink.json index fd6d705d..a8906fdc 100644 --- a/api_generator/rest_specs/indices.shrink.json +++ b/api_generator/rest_specs/indices.shrink.json @@ -5,6 +5,11 @@ "description":"Allow to shrink an existing index into a new index with fewer primary shards." }, "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "application/json"], + "content_type": ["application/json"] + }, "url":{ "paths":[ { diff --git a/api_generator/rest_specs/indices.simulate_index_template.json b/api_generator/rest_specs/indices.simulate_index_template.json index 2b81572f..a7d2e21d 100644 --- a/api_generator/rest_specs/indices.simulate_index_template.json +++ b/api_generator/rest_specs/indices.simulate_index_template.json @@ -4,7 +4,12 @@ "url":"https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-templates.html", "description": "Simulate matching the given index name against the index templates in the system" }, - "stability":"experimental", + "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "application/json"], + "content_type": ["application/json"] + }, "url":{ "paths":[ { diff --git a/api_generator/rest_specs/indices.simulate_template.json b/api_generator/rest_specs/indices.simulate_template.json index 364547dd..23a41a13 100644 --- a/api_generator/rest_specs/indices.simulate_template.json +++ b/api_generator/rest_specs/indices.simulate_template.json @@ -4,7 +4,12 @@ "url":"https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-templates.html", "description": "Simulate resolving the given template name or body" }, - "stability":"experimental", + "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "application/json"], + "content_type": ["application/json"] + }, "url":{ "paths":[ { diff --git a/api_generator/rest_specs/indices.split.json b/api_generator/rest_specs/indices.split.json index 02df3cde..22c72b66 100644 --- a/api_generator/rest_specs/indices.split.json +++ b/api_generator/rest_specs/indices.split.json @@ -5,6 +5,11 @@ "description":"Allows you to split an existing index into a new index with more primary shards." }, "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "application/json"], + "content_type": ["application/json"] + }, "url":{ "paths":[ { diff --git a/api_generator/rest_specs/indices.stats.json b/api_generator/rest_specs/indices.stats.json index 0a8960f2..4141425d 100644 --- a/api_generator/rest_specs/indices.stats.json +++ b/api_generator/rest_specs/indices.stats.json @@ -5,6 +5,10 @@ "description":"Provides statistics on operations happening in an index." }, "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "application/json"] + }, "url":{ "paths":[ { diff --git a/api_generator/rest_specs/indices.unfreeze.json b/api_generator/rest_specs/indices.unfreeze.json index bc527f6f..c51f70e1 100644 --- a/api_generator/rest_specs/indices.unfreeze.json +++ b/api_generator/rest_specs/indices.unfreeze.json @@ -5,6 +5,10 @@ "description":"Unfreezes an index. When a frozen index is unfrozen, the index goes through the normal recovery process and becomes writeable again." }, "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "application/json"] + }, "url":{ "paths":[ { diff --git a/api_generator/rest_specs/indices.update_aliases.json b/api_generator/rest_specs/indices.update_aliases.json index d4a222f2..76b33ad1 100644 --- a/api_generator/rest_specs/indices.update_aliases.json +++ b/api_generator/rest_specs/indices.update_aliases.json @@ -5,6 +5,11 @@ "description":"Updates index aliases." }, "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "application/json"], + "content_type": ["application/json"] + }, "url":{ "paths":[ { diff --git a/api_generator/rest_specs/indices.upgrade.json b/api_generator/rest_specs/indices.upgrade.json index 670d3e0a..caa11804 100644 --- a/api_generator/rest_specs/indices.upgrade.json +++ b/api_generator/rest_specs/indices.upgrade.json @@ -2,16 +2,24 @@ "indices.upgrade":{ "documentation":{ "url":"https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-upgrade.html", - "description":"The _upgrade API is no longer useful and will be removed." + "description":"DEPRECATED Upgrades to the current version of Lucene." }, "stability":"stable", + "visibility" : "public", + "headers":{ + "accept": [ "application/json"] + }, "url":{ "paths":[ { "path":"/_upgrade", "methods":[ "POST" - ] + ], + "deprecated":{ + "version":"8.0.0", + "description":"The _upgrade API is no longer useful and will be removed. Instead, see _reindex API." + } }, { "path":"/{index}/_upgrade", @@ -23,6 +31,10 @@ "type":"list", "description":"A comma-separated list of index names; use `_all` or empty string to perform the operation on all indices" } + }, + "deprecated":{ + "version":"8.0.0", + "description":"The _upgrade API is no longer useful and will be removed. Instead, see _reindex API." } } ] diff --git a/api_generator/rest_specs/indices.validate_query.json b/api_generator/rest_specs/indices.validate_query.json index 3becec00..9dbe4025 100644 --- a/api_generator/rest_specs/indices.validate_query.json +++ b/api_generator/rest_specs/indices.validate_query.json @@ -5,6 +5,11 @@ "description":"Allows a user to validate a potentially expensive query without executing it." }, "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "application/json"], + "content_type": ["application/json"] + }, "url":{ "paths":[ { diff --git a/api_generator/rest_specs/info.json b/api_generator/rest_specs/info.json index 1c48f05d..286a06f7 100644 --- a/api_generator/rest_specs/info.json +++ b/api_generator/rest_specs/info.json @@ -5,6 +5,10 @@ "description":"Returns basic information about the cluster." }, "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "application/json"] + }, "url":{ "paths":[ { diff --git a/api_generator/rest_specs/ingest.delete_pipeline.json b/api_generator/rest_specs/ingest.delete_pipeline.json index 29b42190..a1f6c0f7 100644 --- a/api_generator/rest_specs/ingest.delete_pipeline.json +++ b/api_generator/rest_specs/ingest.delete_pipeline.json @@ -5,6 +5,10 @@ "description":"Deletes a pipeline." }, "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "application/json"] + }, "url":{ "paths":[ { diff --git a/api_generator/rest_specs/ingest.get_pipeline.json b/api_generator/rest_specs/ingest.get_pipeline.json index 65fc4f91..c438c3bd 100644 --- a/api_generator/rest_specs/ingest.get_pipeline.json +++ b/api_generator/rest_specs/ingest.get_pipeline.json @@ -5,6 +5,10 @@ "description":"Returns a pipeline." }, "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "application/json"] + }, "url":{ "paths":[ { diff --git a/api_generator/rest_specs/ingest.processor_grok.json b/api_generator/rest_specs/ingest.processor_grok.json index ac8ad6e6..e150d953 100644 --- a/api_generator/rest_specs/ingest.processor_grok.json +++ b/api_generator/rest_specs/ingest.processor_grok.json @@ -5,6 +5,10 @@ "description":"Returns a list of the built-in patterns." }, "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "application/json"] + }, "url":{ "paths":[ { diff --git a/api_generator/rest_specs/ingest.put_pipeline.json b/api_generator/rest_specs/ingest.put_pipeline.json index 4d210586..981d4f75 100644 --- a/api_generator/rest_specs/ingest.put_pipeline.json +++ b/api_generator/rest_specs/ingest.put_pipeline.json @@ -5,6 +5,11 @@ "description":"Creates or updates a pipeline." }, "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "application/json"], + "content_type": ["application/json"] + }, "url":{ "paths":[ { diff --git a/api_generator/rest_specs/ingest.simulate.json b/api_generator/rest_specs/ingest.simulate.json index 8122f7a0..04b70464 100644 --- a/api_generator/rest_specs/ingest.simulate.json +++ b/api_generator/rest_specs/ingest.simulate.json @@ -5,6 +5,11 @@ "description":"Allows to simulate a pipeline with example documents." }, "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "application/json"], + "content_type": ["application/json"] + }, "url":{ "paths":[ { diff --git a/api_generator/rest_specs/license.delete.json b/api_generator/rest_specs/license.delete.json index 153f38b2..0ecc702b 100644 --- a/api_generator/rest_specs/license.delete.json +++ b/api_generator/rest_specs/license.delete.json @@ -5,6 +5,10 @@ "description":"Deletes licensing information for the cluster" }, "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "application/json"] + }, "url":{ "paths":[ { diff --git a/api_generator/rest_specs/license.get.json b/api_generator/rest_specs/license.get.json index 4052a2b5..2e01d6ed 100644 --- a/api_generator/rest_specs/license.get.json +++ b/api_generator/rest_specs/license.get.json @@ -5,6 +5,10 @@ "description":"Retrieves licensing information for the cluster" }, "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "application/json"] + }, "url":{ "paths":[ { diff --git a/api_generator/rest_specs/license.get_basic_status.json b/api_generator/rest_specs/license.get_basic_status.json index d29bc9ff..a689daf4 100644 --- a/api_generator/rest_specs/license.get_basic_status.json +++ b/api_generator/rest_specs/license.get_basic_status.json @@ -5,6 +5,10 @@ "description":"Retrieves information about the status of the basic license." }, "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "application/json"] + }, "url":{ "paths":[ { diff --git a/api_generator/rest_specs/license.get_trial_status.json b/api_generator/rest_specs/license.get_trial_status.json index 71c854b4..dffa2932 100644 --- a/api_generator/rest_specs/license.get_trial_status.json +++ b/api_generator/rest_specs/license.get_trial_status.json @@ -5,6 +5,10 @@ "description":"Retrieves information about the status of the trial license." }, "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "application/json"] + }, "url":{ "paths":[ { diff --git a/api_generator/rest_specs/license.post.json b/api_generator/rest_specs/license.post.json index 2b637f85..476aa334 100644 --- a/api_generator/rest_specs/license.post.json +++ b/api_generator/rest_specs/license.post.json @@ -5,6 +5,11 @@ "description":"Updates the license for the cluster." }, "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "application/json"], + "content_type": ["application/json"] + }, "url":{ "paths":[ { diff --git a/api_generator/rest_specs/license.post_start_basic.json b/api_generator/rest_specs/license.post_start_basic.json index 855a90cf..8cf6c7b0 100644 --- a/api_generator/rest_specs/license.post_start_basic.json +++ b/api_generator/rest_specs/license.post_start_basic.json @@ -5,6 +5,10 @@ "description":"Starts an indefinite basic license." }, "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "application/json"] + }, "url":{ "paths":[ { diff --git a/api_generator/rest_specs/license.post_start_trial.json b/api_generator/rest_specs/license.post_start_trial.json index ebf5f718..3da1801d 100644 --- a/api_generator/rest_specs/license.post_start_trial.json +++ b/api_generator/rest_specs/license.post_start_trial.json @@ -5,6 +5,10 @@ "description":"starts a limited time trial license." }, "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "application/json"] + }, "url":{ "paths":[ { diff --git a/api_generator/rest_specs/logstash.delete_pipeline.json b/api_generator/rest_specs/logstash.delete_pipeline.json new file mode 100644 index 00000000..8650f5f7 --- /dev/null +++ b/api_generator/rest_specs/logstash.delete_pipeline.json @@ -0,0 +1,28 @@ +{ + "logstash.delete_pipeline":{ + "documentation":{ + "url":"https://www.elastic.co/guide/en/elasticsearch/reference/current/logstash-api-delete-pipeline.html", + "description":"Deletes Logstash Pipelines used by Central Management" + }, + "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "application/json"] + }, + "url":{ + "paths":[ + { + "path":"/_logstash/pipeline/{id}", + "methods":[ "DELETE" ], + "parts":{ + "id":{ + "type":"string", + "description":"The ID of the Pipeline" + } + } + } + ] + }, + "params":{} + } +} diff --git a/api_generator/rest_specs/logstash.get_pipeline.json b/api_generator/rest_specs/logstash.get_pipeline.json new file mode 100644 index 00000000..061e49e0 --- /dev/null +++ b/api_generator/rest_specs/logstash.get_pipeline.json @@ -0,0 +1,28 @@ +{ + "logstash.get_pipeline":{ + "documentation":{ + "url":"https://www.elastic.co/guide/en/elasticsearch/reference/current/logstash-api-get-pipeline.html", + "description":"Retrieves Logstash Pipelines used by Central Management" + }, + "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "application/json"] + }, + "url":{ + "paths":[ + { + "path":"/_logstash/pipeline/{id}", + "methods":[ "GET" ], + "parts":{ + "id":{ + "type":"string", + "description":"A comma-separated list of Pipeline IDs" + } + } + } + ] + }, + "params":{} + } +} diff --git a/api_generator/rest_specs/logstash.put_pipeline.json b/api_generator/rest_specs/logstash.put_pipeline.json new file mode 100644 index 00000000..e8ec9b0d --- /dev/null +++ b/api_generator/rest_specs/logstash.put_pipeline.json @@ -0,0 +1,34 @@ +{ + "logstash.put_pipeline":{ + "documentation":{ + "url":"https://www.elastic.co/guide/en/elasticsearch/reference/current/logstash-api-put-pipeline.html", + "description":"Adds and updates Logstash Pipelines used for Central Management" + }, + "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "application/json"], + "content_type": ["application/json"] + }, + "url":{ + "paths":[ + { + "path":"/_logstash/pipeline/{id}", + "methods":[ "PUT" ], + "parts":{ + "id":{ + "type":"string", + "description":"The ID of the Pipeline" + } + } + } + ] + }, + "params":{ + }, + "body":{ + "description":"The Pipeline to add or update", + "required":true + } + } +} diff --git a/api_generator/rest_specs/mget.json b/api_generator/rest_specs/mget.json index f1d35aee..0470c969 100644 --- a/api_generator/rest_specs/mget.json +++ b/api_generator/rest_specs/mget.json @@ -5,6 +5,11 @@ "description":"Allows to get multiple documents in one request." }, "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "application/json"], + "content_type": ["application/json"] + }, "url":{ "paths":[ { diff --git a/api_generator/rest_specs/migration.deprecations.json b/api_generator/rest_specs/migration.deprecations.json index ca19147c..6906cacc 100644 --- a/api_generator/rest_specs/migration.deprecations.json +++ b/api_generator/rest_specs/migration.deprecations.json @@ -5,6 +5,10 @@ "description":"Retrieves information about different cluster, node, and index level settings that use deprecated features that will be removed or changed in the next major version." }, "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "application/json"] + }, "url":{ "paths":[ { diff --git a/api_generator/rest_specs/ml.close_job.json b/api_generator/rest_specs/ml.close_job.json index 5d738298..364ae545 100644 --- a/api_generator/rest_specs/ml.close_job.json +++ b/api_generator/rest_specs/ml.close_job.json @@ -5,6 +5,11 @@ "description":"Closes one or more anomaly detection jobs. A job can be opened and closed multiple times throughout its lifecycle." }, "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "application/json"], + "content_type": ["application/json"] + }, "url":{ "paths":[ { diff --git a/api_generator/rest_specs/ml.delete_calendar.json b/api_generator/rest_specs/ml.delete_calendar.json index 7cf3501b..b224c870 100644 --- a/api_generator/rest_specs/ml.delete_calendar.json +++ b/api_generator/rest_specs/ml.delete_calendar.json @@ -5,6 +5,10 @@ "description":"Deletes a calendar." }, "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "application/json"] + }, "url":{ "paths":[ { diff --git a/api_generator/rest_specs/ml.delete_calendar_event.json b/api_generator/rest_specs/ml.delete_calendar_event.json index aa6e2d31..92fe4ea3 100644 --- a/api_generator/rest_specs/ml.delete_calendar_event.json +++ b/api_generator/rest_specs/ml.delete_calendar_event.json @@ -5,6 +5,10 @@ "description":"Deletes scheduled events from a calendar." }, "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "application/json"] + }, "url":{ "paths":[ { diff --git a/api_generator/rest_specs/ml.delete_calendar_job.json b/api_generator/rest_specs/ml.delete_calendar_job.json index 075ddcac..e122c41f 100644 --- a/api_generator/rest_specs/ml.delete_calendar_job.json +++ b/api_generator/rest_specs/ml.delete_calendar_job.json @@ -5,6 +5,10 @@ "description":"Deletes anomaly detection jobs from a calendar." }, "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "application/json"] + }, "url":{ "paths":[ { diff --git a/api_generator/rest_specs/ml.delete_data_frame_analytics.json b/api_generator/rest_specs/ml.delete_data_frame_analytics.json index 7c3308c6..89818ac5 100644 --- a/api_generator/rest_specs/ml.delete_data_frame_analytics.json +++ b/api_generator/rest_specs/ml.delete_data_frame_analytics.json @@ -4,7 +4,11 @@ "url":"https://www.elastic.co/guide/en/elasticsearch/reference/current/delete-dfanalytics.html", "description":"Deletes an existing data frame analytics job." }, - "stability":"experimental", + "stability":"beta", + "visibility":"public", + "headers":{ + "accept": [ "application/json"] + }, "url":{ "paths":[ { diff --git a/api_generator/rest_specs/ml.delete_datafeed.json b/api_generator/rest_specs/ml.delete_datafeed.json index d3abeaa6..8cff1cbf 100644 --- a/api_generator/rest_specs/ml.delete_datafeed.json +++ b/api_generator/rest_specs/ml.delete_datafeed.json @@ -5,6 +5,10 @@ "description":"Deletes an existing datafeed." }, "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "application/json"] + }, "url":{ "paths":[ { diff --git a/api_generator/rest_specs/ml.delete_expired_data.json b/api_generator/rest_specs/ml.delete_expired_data.json index 6b6a1ec0..c45ca323 100644 --- a/api_generator/rest_specs/ml.delete_expired_data.json +++ b/api_generator/rest_specs/ml.delete_expired_data.json @@ -5,6 +5,10 @@ "description":"Deletes expired and unused machine learning data." }, "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "application/json"] + }, "url":{ "paths":[ { diff --git a/api_generator/rest_specs/ml.delete_filter.json b/api_generator/rest_specs/ml.delete_filter.json index 9556a0fe..e275a9dc 100644 --- a/api_generator/rest_specs/ml.delete_filter.json +++ b/api_generator/rest_specs/ml.delete_filter.json @@ -5,6 +5,10 @@ "description":"Deletes a filter." }, "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "application/json"] + }, "url":{ "paths":[ { diff --git a/api_generator/rest_specs/ml.delete_forecast.json b/api_generator/rest_specs/ml.delete_forecast.json index 08f4a79e..45235187 100644 --- a/api_generator/rest_specs/ml.delete_forecast.json +++ b/api_generator/rest_specs/ml.delete_forecast.json @@ -5,6 +5,10 @@ "description":"Deletes forecasts from a machine learning job." }, "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "application/json"] + }, "url":{ "paths":[ { diff --git a/api_generator/rest_specs/ml.delete_job.json b/api_generator/rest_specs/ml.delete_job.json index eb820441..a10e115a 100644 --- a/api_generator/rest_specs/ml.delete_job.json +++ b/api_generator/rest_specs/ml.delete_job.json @@ -5,6 +5,10 @@ "description":"Deletes an existing anomaly detection job." }, "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "application/json"] + }, "url":{ "paths":[ { diff --git a/api_generator/rest_specs/ml.delete_model_snapshot.json b/api_generator/rest_specs/ml.delete_model_snapshot.json index b6caa438..499cb3b1 100644 --- a/api_generator/rest_specs/ml.delete_model_snapshot.json +++ b/api_generator/rest_specs/ml.delete_model_snapshot.json @@ -5,6 +5,10 @@ "description":"Deletes an existing model snapshot." }, "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "application/json"] + }, "url":{ "paths":[ { diff --git a/api_generator/rest_specs/ml.delete_trained_model.json b/api_generator/rest_specs/ml.delete_trained_model.json index 27d24cd7..a7954a6b 100644 --- a/api_generator/rest_specs/ml.delete_trained_model.json +++ b/api_generator/rest_specs/ml.delete_trained_model.json @@ -1,14 +1,18 @@ { "ml.delete_trained_model":{ "documentation":{ - "url":"https://www.elastic.co/guide/en/elasticsearch/reference/current/delete-inference.html", + "url":"https://www.elastic.co/guide/en/elasticsearch/reference/current/delete-trained-models.html", "description":"Deletes an existing trained inference model that is currently not referenced by an ingest pipeline." }, - "stability":"experimental", + "stability":"beta", + "visibility":"public", + "headers":{ + "accept": [ "application/json"] + }, "url":{ "paths":[ { - "path":"/_ml/inference/{model_id}", + "path":"/_ml/trained_models/{model_id}", "methods":[ "DELETE" ], diff --git a/api_generator/rest_specs/ml.estimate_model_memory.json b/api_generator/rest_specs/ml.estimate_model_memory.json index 4a024f93..75bff3b5 100644 --- a/api_generator/rest_specs/ml.estimate_model_memory.json +++ b/api_generator/rest_specs/ml.estimate_model_memory.json @@ -5,6 +5,11 @@ "description":"Estimates the model memory" }, "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "application/json"], + "content_type": ["application/json"] + }, "url":{ "paths":[ { diff --git a/api_generator/rest_specs/ml.evaluate_data_frame.json b/api_generator/rest_specs/ml.evaluate_data_frame.json index 9190f52a..f003155d 100644 --- a/api_generator/rest_specs/ml.evaluate_data_frame.json +++ b/api_generator/rest_specs/ml.evaluate_data_frame.json @@ -4,7 +4,12 @@ "url":"https://www.elastic.co/guide/en/elasticsearch/reference/current/evaluate-dfanalytics.html", "description":"Evaluates the data frame analytics for an annotated index." }, - "stability":"experimental", + "stability":"beta", + "visibility":"public", + "headers":{ + "accept": [ "application/json"], + "content_type": ["application/json"] + }, "url":{ "paths":[ { diff --git a/api_generator/rest_specs/ml.explain_data_frame_analytics.json b/api_generator/rest_specs/ml.explain_data_frame_analytics.json index 9210862d..d1cd6840 100644 --- a/api_generator/rest_specs/ml.explain_data_frame_analytics.json +++ b/api_generator/rest_specs/ml.explain_data_frame_analytics.json @@ -4,7 +4,12 @@ "url":"http://www.elastic.co/guide/en/elasticsearch/reference/current/explain-dfanalytics.html", "description":"Explains a data frame analytics config." }, - "stability":"experimental", + "stability":"beta", + "visibility":"public", + "headers":{ + "accept":[ "application/json"], + "content_type":["application/json"] + }, "url":{ "paths":[ { diff --git a/api_generator/rest_specs/ml.flush_job.json b/api_generator/rest_specs/ml.flush_job.json index 3e2f7f36..71abaf95 100644 --- a/api_generator/rest_specs/ml.flush_job.json +++ b/api_generator/rest_specs/ml.flush_job.json @@ -5,6 +5,11 @@ "description":"Forces any buffered data to be processed by the job." }, "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "application/json"], + "content_type": ["application/json"] + }, "url":{ "paths":[ { diff --git a/api_generator/rest_specs/ml.forecast.json b/api_generator/rest_specs/ml.forecast.json index 28ba5132..8a88e904 100644 --- a/api_generator/rest_specs/ml.forecast.json +++ b/api_generator/rest_specs/ml.forecast.json @@ -5,6 +5,10 @@ "description":"Predicts the future behavior of a time series by using its historical behavior." }, "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "application/json"] + }, "url":{ "paths":[ { diff --git a/api_generator/rest_specs/ml.get_buckets.json b/api_generator/rest_specs/ml.get_buckets.json index 90f7cede..dcf9a2cb 100644 --- a/api_generator/rest_specs/ml.get_buckets.json +++ b/api_generator/rest_specs/ml.get_buckets.json @@ -5,6 +5,11 @@ "description":"Retrieves anomaly detection job results for one or more buckets." }, "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "application/json"], + "content_type": ["application/json"] + }, "url":{ "paths":[ { diff --git a/api_generator/rest_specs/ml.get_calendar_events.json b/api_generator/rest_specs/ml.get_calendar_events.json index 0bb10780..0b3435ff 100644 --- a/api_generator/rest_specs/ml.get_calendar_events.json +++ b/api_generator/rest_specs/ml.get_calendar_events.json @@ -5,6 +5,10 @@ "description":"Retrieves information about the scheduled events in calendars." }, "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "application/json"] + }, "url":{ "paths":[ { diff --git a/api_generator/rest_specs/ml.get_calendars.json b/api_generator/rest_specs/ml.get_calendars.json index ec6268ac..d7666f69 100644 --- a/api_generator/rest_specs/ml.get_calendars.json +++ b/api_generator/rest_specs/ml.get_calendars.json @@ -5,6 +5,11 @@ "description":"Retrieves configuration information for calendars." }, "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "application/json"], + "content_type": ["application/json"] + }, "url":{ "paths":[ { diff --git a/api_generator/rest_specs/ml.get_categories.json b/api_generator/rest_specs/ml.get_categories.json index 654a9635..6dfa2e64 100644 --- a/api_generator/rest_specs/ml.get_categories.json +++ b/api_generator/rest_specs/ml.get_categories.json @@ -5,6 +5,11 @@ "description":"Retrieves anomaly detection job results for one or more categories." }, "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "application/json"], + "content_type": ["application/json"] + }, "url":{ "paths":[ { diff --git a/api_generator/rest_specs/ml.get_data_frame_analytics.json b/api_generator/rest_specs/ml.get_data_frame_analytics.json index 80b46494..8986067b 100644 --- a/api_generator/rest_specs/ml.get_data_frame_analytics.json +++ b/api_generator/rest_specs/ml.get_data_frame_analytics.json @@ -4,7 +4,11 @@ "url":"https://www.elastic.co/guide/en/elasticsearch/reference/current/get-dfanalytics.html", "description":"Retrieves configuration information for data frame analytics jobs." }, - "stability":"experimental", + "stability":"beta", + "visibility":"public", + "headers":{ + "accept": [ "application/json"] + }, "url":{ "paths":[ { @@ -43,6 +47,12 @@ "type":"int", "description":"specifies a max number of analytics to get", "default":100 + }, + "exclude_generated": { + "required": false, + "type": "boolean", + "default": false, + "description": "Omits fields that are illegal to set on data frame analytics PUT" } } } diff --git a/api_generator/rest_specs/ml.get_data_frame_analytics_stats.json b/api_generator/rest_specs/ml.get_data_frame_analytics_stats.json index a00b99d8..baeef37d 100644 --- a/api_generator/rest_specs/ml.get_data_frame_analytics_stats.json +++ b/api_generator/rest_specs/ml.get_data_frame_analytics_stats.json @@ -4,7 +4,11 @@ "url":"https://www.elastic.co/guide/en/elasticsearch/reference/current/get-dfanalytics-stats.html", "description":"Retrieves usage information for data frame analytics jobs." }, - "stability":"experimental", + "stability":"beta", + "visibility":"public", + "headers":{ + "accept": [ "application/json"] + }, "url":{ "paths":[ { diff --git a/api_generator/rest_specs/ml.get_datafeed_stats.json b/api_generator/rest_specs/ml.get_datafeed_stats.json index fda166f2..72d84a27 100644 --- a/api_generator/rest_specs/ml.get_datafeed_stats.json +++ b/api_generator/rest_specs/ml.get_datafeed_stats.json @@ -5,6 +5,10 @@ "description":"Retrieves usage information for datafeeds." }, "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "application/json"] + }, "url":{ "paths":[ { diff --git a/api_generator/rest_specs/ml.get_datafeeds.json b/api_generator/rest_specs/ml.get_datafeeds.json index 56f5ea49..f61a7dae 100644 --- a/api_generator/rest_specs/ml.get_datafeeds.json +++ b/api_generator/rest_specs/ml.get_datafeeds.json @@ -5,6 +5,10 @@ "description":"Retrieves configuration information for datafeeds." }, "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "application/json"] + }, "url":{ "paths":[ { @@ -38,6 +42,12 @@ "required":false, "description":"Whether to ignore if a wildcard expression matches no datafeeds. (This includes `_all` string or when no datafeeds have been specified)", "deprecated":true + }, + "exclude_generated": { + "required": false, + "type": "boolean", + "default": false, + "description": "Omits fields that are illegal to set on datafeed PUT" } } } diff --git a/api_generator/rest_specs/ml.get_filters.json b/api_generator/rest_specs/ml.get_filters.json index b56518c5..1f195a42 100644 --- a/api_generator/rest_specs/ml.get_filters.json +++ b/api_generator/rest_specs/ml.get_filters.json @@ -5,6 +5,10 @@ "description":"Retrieves filters." }, "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "application/json"] + }, "url":{ "paths":[ { diff --git a/api_generator/rest_specs/ml.get_influencers.json b/api_generator/rest_specs/ml.get_influencers.json index 25f68ab0..bf4e43d4 100644 --- a/api_generator/rest_specs/ml.get_influencers.json +++ b/api_generator/rest_specs/ml.get_influencers.json @@ -5,6 +5,11 @@ "description":"Retrieves anomaly detection job results for one or more influencers." }, "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "application/json"], + "content_type": ["application/json"] + }, "url":{ "paths":[ { diff --git a/api_generator/rest_specs/ml.get_job_stats.json b/api_generator/rest_specs/ml.get_job_stats.json index cdabc22a..456cf923 100644 --- a/api_generator/rest_specs/ml.get_job_stats.json +++ b/api_generator/rest_specs/ml.get_job_stats.json @@ -5,6 +5,10 @@ "description":"Retrieves usage information for anomaly detection jobs." }, "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "application/json"] + }, "url":{ "paths":[ { diff --git a/api_generator/rest_specs/ml.get_jobs.json b/api_generator/rest_specs/ml.get_jobs.json index 7a1ebaed..2d716238 100644 --- a/api_generator/rest_specs/ml.get_jobs.json +++ b/api_generator/rest_specs/ml.get_jobs.json @@ -5,6 +5,10 @@ "description":"Retrieves configuration information for anomaly detection jobs." }, "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "application/json"] + }, "url":{ "paths":[ { @@ -38,6 +42,12 @@ "required":false, "description":"Whether to ignore if a wildcard expression matches no jobs. (This includes `_all` string or when no jobs have been specified)", "deprecated":true + }, + "exclude_generated": { + "required": false, + "type": "boolean", + "default": false, + "description": "Omits fields that are illegal to set on job PUT" } } } diff --git a/api_generator/rest_specs/ml.get_model_snapshots.json b/api_generator/rest_specs/ml.get_model_snapshots.json index 5dafaa43..1a9c9147 100644 --- a/api_generator/rest_specs/ml.get_model_snapshots.json +++ b/api_generator/rest_specs/ml.get_model_snapshots.json @@ -5,6 +5,11 @@ "description":"Retrieves information about model snapshots." }, "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "application/json"], + "content_type": ["application/json"] + }, "url":{ "paths":[ { diff --git a/api_generator/rest_specs/ml.get_overall_buckets.json b/api_generator/rest_specs/ml.get_overall_buckets.json index 7bfa7e8e..646275ec 100644 --- a/api_generator/rest_specs/ml.get_overall_buckets.json +++ b/api_generator/rest_specs/ml.get_overall_buckets.json @@ -5,6 +5,11 @@ "description":"Retrieves overall bucket results that summarize the bucket results of multiple anomaly detection jobs." }, "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "application/json"], + "content_type": ["application/json"] + }, "url":{ "paths":[ { diff --git a/api_generator/rest_specs/ml.get_records.json b/api_generator/rest_specs/ml.get_records.json index 9d865897..9af20f70 100644 --- a/api_generator/rest_specs/ml.get_records.json +++ b/api_generator/rest_specs/ml.get_records.json @@ -5,6 +5,11 @@ "description":"Retrieves anomaly records for an anomaly detection job." }, "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "application/json"], + "content_type": ["application/json"] + }, "url":{ "paths":[ { diff --git a/api_generator/rest_specs/ml.get_trained_models.json b/api_generator/rest_specs/ml.get_trained_models.json index 168d233c..8f08856f 100644 --- a/api_generator/rest_specs/ml.get_trained_models.json +++ b/api_generator/rest_specs/ml.get_trained_models.json @@ -1,14 +1,18 @@ { "ml.get_trained_models":{ "documentation":{ - "url":"https://www.elastic.co/guide/en/elasticsearch/reference/current/get-inference.html", + "url":"https://www.elastic.co/guide/en/elasticsearch/reference/current/get-trained-models.html", "description":"Retrieves configuration information for a trained inference model." }, - "stability":"experimental", + "stability":"beta", + "visibility":"public", + "headers":{ + "accept": [ "application/json"] + }, "url":{ "paths":[ { - "path":"/_ml/inference/{model_id}", + "path":"/_ml/trained_models/{model_id}", "methods":[ "GET" ], @@ -20,7 +24,7 @@ } }, { - "path":"/_ml/inference", + "path":"/_ml/trained_models", "methods":[ "GET" ] @@ -34,11 +38,17 @@ "description":"Whether to ignore if a wildcard expression matches no trained models. (This includes `_all` string or when no trained models have been specified)", "default":true }, + "include":{ + "type":"string", + "required":false, + "description":"A comma-separate list of fields to optionally include. Valid options are 'definition' and 'total_feature_importance'. Default is none." + }, "include_model_definition":{ "type":"boolean", "required":false, "description":"Should the full model definition be included in the results. These definitions can be large. So be cautious when including them. Defaults to false.", - "default":false + "default":false, + "deprecated": true }, "decompress_definition":{ "type":"boolean", @@ -63,7 +73,7 @@ "type":"list", "description":"A comma-separated list of tags that the model must have." }, - "for_export": { + "exclude_generated": { "required": false, "type": "boolean", "default": false, diff --git a/api_generator/rest_specs/ml.get_trained_models_stats.json b/api_generator/rest_specs/ml.get_trained_models_stats.json index 93e94452..3b988843 100644 --- a/api_generator/rest_specs/ml.get_trained_models_stats.json +++ b/api_generator/rest_specs/ml.get_trained_models_stats.json @@ -1,14 +1,18 @@ { "ml.get_trained_models_stats":{ "documentation":{ - "url":"https://www.elastic.co/guide/en/elasticsearch/reference/current/get-inference-stats.html", + "url":"https://www.elastic.co/guide/en/elasticsearch/reference/current/get-trained-models-stats.html", "description":"Retrieves usage information for trained inference models." }, - "stability":"experimental", + "stability":"beta", + "visibility":"public", + "headers":{ + "accept": [ "application/json"] + }, "url":{ "paths":[ { - "path":"/_ml/inference/{model_id}/_stats", + "path":"/_ml/trained_models/{model_id}/_stats", "methods":[ "GET" ], @@ -20,7 +24,7 @@ } }, { - "path":"/_ml/inference/_stats", + "path":"/_ml/trained_models/_stats", "methods":[ "GET" ] diff --git a/api_generator/rest_specs/ml.info.json b/api_generator/rest_specs/ml.info.json index 22c15971..25659abf 100644 --- a/api_generator/rest_specs/ml.info.json +++ b/api_generator/rest_specs/ml.info.json @@ -5,6 +5,10 @@ "description":"Returns defaults and limits used by machine learning." }, "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "application/json"] + }, "url":{ "paths":[ { diff --git a/api_generator/rest_specs/ml.open_job.json b/api_generator/rest_specs/ml.open_job.json index 436d4541..07b9e666 100644 --- a/api_generator/rest_specs/ml.open_job.json +++ b/api_generator/rest_specs/ml.open_job.json @@ -5,6 +5,10 @@ "description":"Opens one or more anomaly detection jobs." }, "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "application/json"] + }, "url":{ "paths":[ { diff --git a/api_generator/rest_specs/ml.post_calendar_events.json b/api_generator/rest_specs/ml.post_calendar_events.json index 42dcb38f..a23472b7 100644 --- a/api_generator/rest_specs/ml.post_calendar_events.json +++ b/api_generator/rest_specs/ml.post_calendar_events.json @@ -5,6 +5,11 @@ "description":"Posts scheduled events in a calendar." }, "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "application/json"], + "content_type": ["application/json"] + }, "url":{ "paths":[ { diff --git a/api_generator/rest_specs/ml.post_data.json b/api_generator/rest_specs/ml.post_data.json index 52b8f158..cd2deb10 100644 --- a/api_generator/rest_specs/ml.post_data.json +++ b/api_generator/rest_specs/ml.post_data.json @@ -5,6 +5,11 @@ "description":"Sends data to an anomaly detection job for analysis." }, "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "application/json"], + "content_type": ["application/x-ndjson", "application/json"] + }, "url":{ "paths":[ { diff --git a/api_generator/rest_specs/ml.preview_datafeed.json b/api_generator/rest_specs/ml.preview_datafeed.json index 30926f4a..5cd94bc2 100644 --- a/api_generator/rest_specs/ml.preview_datafeed.json +++ b/api_generator/rest_specs/ml.preview_datafeed.json @@ -5,6 +5,10 @@ "description":"Previews a datafeed." }, "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "application/json"] + }, "url":{ "paths":[ { diff --git a/api_generator/rest_specs/ml.put_calendar.json b/api_generator/rest_specs/ml.put_calendar.json index 88b747a7..597b5d95 100644 --- a/api_generator/rest_specs/ml.put_calendar.json +++ b/api_generator/rest_specs/ml.put_calendar.json @@ -5,6 +5,11 @@ "description":"Instantiates a calendar." }, "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "application/json"], + "content_type": ["application/json"] + }, "url":{ "paths":[ { diff --git a/api_generator/rest_specs/ml.put_calendar_job.json b/api_generator/rest_specs/ml.put_calendar_job.json index 3f478243..e7e0476a 100644 --- a/api_generator/rest_specs/ml.put_calendar_job.json +++ b/api_generator/rest_specs/ml.put_calendar_job.json @@ -5,6 +5,10 @@ "description":"Adds an anomaly detection job to a calendar." }, "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "application/json"] + }, "url":{ "paths":[ { diff --git a/api_generator/rest_specs/ml.put_data_frame_analytics.json b/api_generator/rest_specs/ml.put_data_frame_analytics.json index 6c246074..42f89d2c 100644 --- a/api_generator/rest_specs/ml.put_data_frame_analytics.json +++ b/api_generator/rest_specs/ml.put_data_frame_analytics.json @@ -4,7 +4,12 @@ "url":"https://www.elastic.co/guide/en/elasticsearch/reference/current/put-dfanalytics.html", "description":"Instantiates a data frame analytics job." }, - "stability":"experimental", + "stability":"beta", + "visibility":"public", + "headers":{ + "accept": [ "application/json"], + "content_type": ["application/json"] + }, "url":{ "paths":[ { diff --git a/api_generator/rest_specs/ml.put_datafeed.json b/api_generator/rest_specs/ml.put_datafeed.json index 29d5bbb2..147290cf 100644 --- a/api_generator/rest_specs/ml.put_datafeed.json +++ b/api_generator/rest_specs/ml.put_datafeed.json @@ -5,6 +5,11 @@ "description":"Instantiates a datafeed." }, "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "application/json"], + "content_type": ["application/json"] + }, "url":{ "paths":[ { diff --git a/api_generator/rest_specs/ml.put_filter.json b/api_generator/rest_specs/ml.put_filter.json index 647e9963..0e7de69a 100644 --- a/api_generator/rest_specs/ml.put_filter.json +++ b/api_generator/rest_specs/ml.put_filter.json @@ -5,6 +5,11 @@ "description":"Instantiates a filter." }, "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "application/json"], + "content_type": ["application/json"] + }, "url":{ "paths":[ { diff --git a/api_generator/rest_specs/ml.put_job.json b/api_generator/rest_specs/ml.put_job.json index 4a15a755..24fa08e4 100644 --- a/api_generator/rest_specs/ml.put_job.json +++ b/api_generator/rest_specs/ml.put_job.json @@ -5,6 +5,11 @@ "description":"Instantiates an anomaly detection job." }, "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "application/json"], + "content_type": ["application/json"] + }, "url":{ "paths":[ { diff --git a/api_generator/rest_specs/ml.put_trained_model.json b/api_generator/rest_specs/ml.put_trained_model.json index f69756b5..b76e56c0 100644 --- a/api_generator/rest_specs/ml.put_trained_model.json +++ b/api_generator/rest_specs/ml.put_trained_model.json @@ -1,14 +1,19 @@ { "ml.put_trained_model":{ "documentation":{ - "url":"https://www.elastic.co/guide/en/elasticsearch/reference/current/put-inference.html", + "url":"https://www.elastic.co/guide/en/elasticsearch/reference/current/put-trained-models.html", "description":"Creates an inference trained model." }, - "stability":"experimental", + "stability":"beta", + "visibility":"public", + "headers":{ + "accept": [ "application/json"], + "content_type": ["application/json"] + }, "url":{ "paths":[ { - "path":"/_ml/inference/{model_id}", + "path":"/_ml/trained_models/{model_id}", "methods":[ "PUT" ], diff --git a/api_generator/rest_specs/ml.revert_model_snapshot.json b/api_generator/rest_specs/ml.revert_model_snapshot.json index 3c0ae924..02ae0edd 100644 --- a/api_generator/rest_specs/ml.revert_model_snapshot.json +++ b/api_generator/rest_specs/ml.revert_model_snapshot.json @@ -5,6 +5,11 @@ "description":"Reverts to a specific snapshot." }, "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "application/json"], + "content_type": ["application/json"] + }, "url":{ "paths":[ { diff --git a/api_generator/rest_specs/ml.set_upgrade_mode.json b/api_generator/rest_specs/ml.set_upgrade_mode.json index 3092b48b..0ef2ad9a 100644 --- a/api_generator/rest_specs/ml.set_upgrade_mode.json +++ b/api_generator/rest_specs/ml.set_upgrade_mode.json @@ -5,6 +5,10 @@ "description":"Sets a cluster wide upgrade_mode setting that prepares machine learning indices for an upgrade." }, "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "application/json"] + }, "url":{ "paths":[ { diff --git a/api_generator/rest_specs/ml.start_data_frame_analytics.json b/api_generator/rest_specs/ml.start_data_frame_analytics.json index b075a629..eca008ec 100644 --- a/api_generator/rest_specs/ml.start_data_frame_analytics.json +++ b/api_generator/rest_specs/ml.start_data_frame_analytics.json @@ -4,7 +4,12 @@ "url":"https://www.elastic.co/guide/en/elasticsearch/reference/current/start-dfanalytics.html", "description":"Starts a data frame analytics job." }, - "stability":"experimental", + "stability":"beta", + "visibility":"public", + "headers":{ + "accept": [ "application/json"], + "content_type": ["application/json"] + }, "url":{ "paths":[ { diff --git a/api_generator/rest_specs/ml.start_datafeed.json b/api_generator/rest_specs/ml.start_datafeed.json index 1348478c..9e923180 100644 --- a/api_generator/rest_specs/ml.start_datafeed.json +++ b/api_generator/rest_specs/ml.start_datafeed.json @@ -5,6 +5,11 @@ "description":"Starts one or more datafeeds." }, "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "application/json"], + "content_type": ["application/json"] + }, "url":{ "paths":[ { diff --git a/api_generator/rest_specs/ml.stop_data_frame_analytics.json b/api_generator/rest_specs/ml.stop_data_frame_analytics.json index ec0f95bc..78b6f92f 100644 --- a/api_generator/rest_specs/ml.stop_data_frame_analytics.json +++ b/api_generator/rest_specs/ml.stop_data_frame_analytics.json @@ -4,7 +4,12 @@ "url":"https://www.elastic.co/guide/en/elasticsearch/reference/current/stop-dfanalytics.html", "description":"Stops one or more data frame analytics jobs." }, - "stability":"experimental", + "stability":"beta", + "visibility":"public", + "headers":{ + "accept": [ "application/json"], + "content_type": ["application/json"] + }, "url":{ "paths":[ { diff --git a/api_generator/rest_specs/ml.stop_datafeed.json b/api_generator/rest_specs/ml.stop_datafeed.json index a93af8f1..5dca1e79 100644 --- a/api_generator/rest_specs/ml.stop_datafeed.json +++ b/api_generator/rest_specs/ml.stop_datafeed.json @@ -5,6 +5,10 @@ "description":"Stops one or more datafeeds." }, "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "application/json"] + }, "url":{ "paths":[ { diff --git a/api_generator/rest_specs/ml.update_data_frame_analytics.json b/api_generator/rest_specs/ml.update_data_frame_analytics.json index 9086a655..d6fb79f8 100644 --- a/api_generator/rest_specs/ml.update_data_frame_analytics.json +++ b/api_generator/rest_specs/ml.update_data_frame_analytics.json @@ -4,7 +4,12 @@ "url":"https://www.elastic.co/guide/en/elasticsearch/reference/current/update-dfanalytics.html", "description":"Updates certain properties of a data frame analytics job." }, - "stability":"experimental", + "stability":"beta", + "visibility":"public", + "headers":{ + "accept": [ "application/json"], + "content_type": ["application/json"] + }, "url":{ "paths":[ { diff --git a/api_generator/rest_specs/ml.update_datafeed.json b/api_generator/rest_specs/ml.update_datafeed.json index 29397ced..8c353a55 100644 --- a/api_generator/rest_specs/ml.update_datafeed.json +++ b/api_generator/rest_specs/ml.update_datafeed.json @@ -5,6 +5,11 @@ "description":"Updates certain properties of a datafeed." }, "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "application/json"], + "content_type": ["application/json"] + }, "url":{ "paths":[ { diff --git a/api_generator/rest_specs/ml.update_filter.json b/api_generator/rest_specs/ml.update_filter.json index b945940f..f237c45c 100644 --- a/api_generator/rest_specs/ml.update_filter.json +++ b/api_generator/rest_specs/ml.update_filter.json @@ -5,6 +5,11 @@ "description":"Updates the description of a filter, adds items, or removes items." }, "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "application/json"], + "content_type": ["application/json"] + }, "url":{ "paths":[ { diff --git a/api_generator/rest_specs/ml.update_job.json b/api_generator/rest_specs/ml.update_job.json index ddc39113..69bdcd01 100644 --- a/api_generator/rest_specs/ml.update_job.json +++ b/api_generator/rest_specs/ml.update_job.json @@ -5,6 +5,11 @@ "description":"Updates certain properties of an anomaly detection job." }, "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "application/json"], + "content_type": ["application/json"] + }, "url":{ "paths":[ { diff --git a/api_generator/rest_specs/ml.update_model_snapshot.json b/api_generator/rest_specs/ml.update_model_snapshot.json index 08e17529..77414590 100644 --- a/api_generator/rest_specs/ml.update_model_snapshot.json +++ b/api_generator/rest_specs/ml.update_model_snapshot.json @@ -5,6 +5,11 @@ "description":"Updates certain properties of a snapshot." }, "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "application/json"], + "content_type": ["application/json"] + }, "url":{ "paths":[ { diff --git a/api_generator/rest_specs/ml.upgrade_job_snapshot.json b/api_generator/rest_specs/ml.upgrade_job_snapshot.json new file mode 100644 index 00000000..22de8d49 --- /dev/null +++ b/api_generator/rest_specs/ml.upgrade_job_snapshot.json @@ -0,0 +1,45 @@ +{ + "ml.upgrade_job_snapshot":{ + "documentation":{ + "url":"https://www.elastic.co/guide/en/elasticsearch/reference/current/ml-upgrade-job-model-snapshot.html", + "description":"Upgrades a given job snapshot to the current major version." + }, + "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "application/json"] + }, + "url":{ + "paths":[ + { + "path":"/_ml/anomaly_detectors/{job_id}/model_snapshots/{snapshot_id}/_upgrade", + "methods":[ + "POST" + ], + "parts":{ + "job_id":{ + "type":"string", + "description":"The ID of the job" + }, + "snapshot_id":{ + "type":"string", + "description":"The ID of the snapshot" + } + } + } + ] + }, + "params":{ + "timeout":{ + "type":"time", + "required":false, + "description":"How long should the API wait for the job to be opened and the old snapshot to be loaded." + }, + "wait_for_completion":{ + "type":"boolean", + "required":false, + "description":"Should the request wait until the task is complete before responding to the caller. Default is false." + } + } + } +} diff --git a/api_generator/rest_specs/ml.validate.json b/api_generator/rest_specs/ml.validate.json index 46f6e833..5db5f91d 100644 --- a/api_generator/rest_specs/ml.validate.json +++ b/api_generator/rest_specs/ml.validate.json @@ -5,6 +5,11 @@ "description":"Validates an anomaly detection job." }, "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "application/json"], + "content_type": ["application/json"] + }, "url":{ "paths":[ { diff --git a/api_generator/rest_specs/ml.validate_detector.json b/api_generator/rest_specs/ml.validate_detector.json index 336b81aa..30a24b1c 100644 --- a/api_generator/rest_specs/ml.validate_detector.json +++ b/api_generator/rest_specs/ml.validate_detector.json @@ -5,6 +5,11 @@ "description":"Validates an anomaly detection detector." }, "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "application/json"], + "content_type": ["application/json"] + }, "url":{ "paths":[ { diff --git a/api_generator/rest_specs/monitoring.bulk.json b/api_generator/rest_specs/monitoring.bulk.json index ff48044c..e34bdfe8 100644 --- a/api_generator/rest_specs/monitoring.bulk.json +++ b/api_generator/rest_specs/monitoring.bulk.json @@ -5,6 +5,11 @@ "description":"Used by the monitoring features to send monitoring data." }, "stability":"experimental", + "visibility":"public", + "headers":{ + "accept": [ "application/json"], + "content_type": ["application/json"] + }, "url":{ "paths":[ { diff --git a/api_generator/rest_specs/msearch.json b/api_generator/rest_specs/msearch.json index e3e6ef57..62dce90a 100644 --- a/api_generator/rest_specs/msearch.json +++ b/api_generator/rest_specs/msearch.json @@ -5,6 +5,11 @@ "description":"Allows to execute several search operations in one request." }, "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "application/json"], + "content_type": ["application/x-ndjson"] + }, "url":{ "paths":[ { diff --git a/api_generator/rest_specs/msearch_template.json b/api_generator/rest_specs/msearch_template.json index 8eb300c9..477915a8 100644 --- a/api_generator/rest_specs/msearch_template.json +++ b/api_generator/rest_specs/msearch_template.json @@ -5,6 +5,11 @@ "description":"Allows to execute several search template operations in one request." }, "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "application/json"], + "content_type": ["application/x-ndjson"] + }, "url":{ "paths":[ { diff --git a/api_generator/rest_specs/mtermvectors.json b/api_generator/rest_specs/mtermvectors.json index 93dee177..50012488 100644 --- a/api_generator/rest_specs/mtermvectors.json +++ b/api_generator/rest_specs/mtermvectors.json @@ -5,6 +5,11 @@ "description":"Returns multiple termvectors in one request." }, "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "application/json"], + "content_type": ["application/json"] + }, "url":{ "paths":[ { diff --git a/api_generator/rest_specs/nodes.hot_threads.json b/api_generator/rest_specs/nodes.hot_threads.json index 0830344d..929cc0db 100644 --- a/api_generator/rest_specs/nodes.hot_threads.json +++ b/api_generator/rest_specs/nodes.hot_threads.json @@ -5,6 +5,10 @@ "description":"Returns information about hot threads on each node in the cluster." }, "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "text/plain"] + }, "url":{ "paths":[ { diff --git a/api_generator/rest_specs/nodes.info.json b/api_generator/rest_specs/nodes.info.json index 37279edd..78da8caa 100644 --- a/api_generator/rest_specs/nodes.info.json +++ b/api_generator/rest_specs/nodes.info.json @@ -5,6 +5,10 @@ "description":"Returns information about nodes in the cluster." }, "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "application/json"] + }, "url":{ "paths":[ { diff --git a/api_generator/rest_specs/nodes.reload_secure_settings.json b/api_generator/rest_specs/nodes.reload_secure_settings.json index fd5420d0..777a62a7 100644 --- a/api_generator/rest_specs/nodes.reload_secure_settings.json +++ b/api_generator/rest_specs/nodes.reload_secure_settings.json @@ -5,6 +5,11 @@ "description":"Reloads secure settings." }, "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "application/json"], + "content_type": [ "application/json" ] + }, "url":{ "paths":[ { diff --git a/api_generator/rest_specs/nodes.stats.json b/api_generator/rest_specs/nodes.stats.json index cc1a9e81..dc8c96ff 100644 --- a/api_generator/rest_specs/nodes.stats.json +++ b/api_generator/rest_specs/nodes.stats.json @@ -5,6 +5,10 @@ "description":"Returns statistical information about nodes in the cluster." }, "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "application/json"] + }, "url":{ "paths":[ { diff --git a/api_generator/rest_specs/nodes.usage.json b/api_generator/rest_specs/nodes.usage.json index 5acbf7a5..09aeaba8 100644 --- a/api_generator/rest_specs/nodes.usage.json +++ b/api_generator/rest_specs/nodes.usage.json @@ -5,6 +5,10 @@ "description":"Returns low-level information about REST actions usage on nodes." }, "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "application/json"] + }, "url":{ "paths":[ { diff --git a/api_generator/rest_specs/open_point_in_time.json b/api_generator/rest_specs/open_point_in_time.json new file mode 100644 index 00000000..d33ead15 --- /dev/null +++ b/api_generator/rest_specs/open_point_in_time.json @@ -0,0 +1,65 @@ +{ + "open_point_in_time":{ + "documentation":{ + "url":"https://www.elastic.co/guide/en/elasticsearch/reference/master/point-in-time-api.html", + "description":"Open a point in time that can be used in subsequent searches" + }, + "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "application/json"] + }, + "url":{ + "paths":[ + { + "path":"/_pit", + "methods":[ + "POST" + ] + }, + { + "path":"/{index}/_pit", + "methods":[ + "POST" + ], + "parts":{ + "index":{ + "type":"list", + "description":"A comma-separated list of index names to open point in time; use `_all` or empty string to perform the operation on all indices" + } + } + } + ] + }, + "params":{ + "preference":{ + "type":"string", + "description":"Specify the node or shard the operation should be performed on (default: random)" + }, + "routing":{ + "type":"string", + "description":"Specific routing value" + }, + "ignore_unavailable":{ + "type":"boolean", + "description":"Whether specified concrete indices should be ignored when unavailable (missing or closed)" + }, + "expand_wildcards":{ + "type":"enum", + "options":[ + "open", + "closed", + "hidden", + "none", + "all" + ], + "default":"open", + "description":"Whether to expand wildcard expression to concrete indices that are open, closed or both." + }, + "keep_alive": { + "type": "string", + "description": "Specific the time to live for the point in time" + } + } + } +} diff --git a/api_generator/rest_specs/ping.json b/api_generator/rest_specs/ping.json index 0e787e03..6615f789 100644 --- a/api_generator/rest_specs/ping.json +++ b/api_generator/rest_specs/ping.json @@ -5,6 +5,10 @@ "description":"Returns whether the cluster is running." }, "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "application/json"] + }, "url":{ "paths":[ { diff --git a/api_generator/rest_specs/put_script.json b/api_generator/rest_specs/put_script.json index 750f7fdf..29e95184 100644 --- a/api_generator/rest_specs/put_script.json +++ b/api_generator/rest_specs/put_script.json @@ -5,6 +5,11 @@ "description":"Creates or updates a script." }, "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "application/json"], + "content_type": ["application/json"] + }, "url":{ "paths":[ { diff --git a/api_generator/rest_specs/rank_eval.json b/api_generator/rest_specs/rank_eval.json index eadf2401..ec123f3f 100644 --- a/api_generator/rest_specs/rank_eval.json +++ b/api_generator/rest_specs/rank_eval.json @@ -5,6 +5,11 @@ "description":"Allows to evaluate the quality of ranked search results over a set of typical search queries" }, "stability":"experimental", + "visibility":"public", + "headers":{ + "accept": [ "application/json"], + "content_type": ["application/json"] + }, "url":{ "paths":[ { diff --git a/api_generator/rest_specs/reindex.json b/api_generator/rest_specs/reindex.json index 2fbaf86c..f8038853 100644 --- a/api_generator/rest_specs/reindex.json +++ b/api_generator/rest_specs/reindex.json @@ -5,6 +5,11 @@ "description":"Allows to copy documents from one index to another, optionally filtering the source\ndocuments by a query, changing the destination index settings, or fetching the\ndocuments from a remote cluster." }, "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "application/json"], + "content_type": ["application/json"] + }, "url":{ "paths":[ { diff --git a/api_generator/rest_specs/reindex_rethrottle.json b/api_generator/rest_specs/reindex_rethrottle.json index d91365b3..f53157c3 100644 --- a/api_generator/rest_specs/reindex_rethrottle.json +++ b/api_generator/rest_specs/reindex_rethrottle.json @@ -5,6 +5,10 @@ "description":"Changes the number of requests per second for a particular Reindex operation." }, "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "application/json"] + }, "url":{ "paths":[ { diff --git a/api_generator/rest_specs/render_search_template.json b/api_generator/rest_specs/render_search_template.json index c2c474ed..b962c069 100644 --- a/api_generator/rest_specs/render_search_template.json +++ b/api_generator/rest_specs/render_search_template.json @@ -5,6 +5,11 @@ "description":"Allows to use the Mustache language to pre-render a search definition." }, "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "application/json"], + "content_type": ["application/json"] + }, "url":{ "paths":[ { diff --git a/api_generator/rest_specs/rollup.delete_job.json b/api_generator/rest_specs/rollup.delete_job.json index 574ae3df..0a60a10e 100644 --- a/api_generator/rest_specs/rollup.delete_job.json +++ b/api_generator/rest_specs/rollup.delete_job.json @@ -5,6 +5,10 @@ "description":"Deletes an existing rollup job." }, "stability":"experimental", + "visibility":"public", + "headers":{ + "accept": [ "application/json"] + }, "url":{ "paths":[ { diff --git a/api_generator/rest_specs/rollup.get_jobs.json b/api_generator/rest_specs/rollup.get_jobs.json index f585edfd..46ac1c4d 100644 --- a/api_generator/rest_specs/rollup.get_jobs.json +++ b/api_generator/rest_specs/rollup.get_jobs.json @@ -5,6 +5,10 @@ "description":"Retrieves the configuration, stats, and status of rollup jobs." }, "stability":"experimental", + "visibility":"public", + "headers":{ + "accept": [ "application/json"] + }, "url":{ "paths":[ { diff --git a/api_generator/rest_specs/rollup.get_rollup_caps.json b/api_generator/rest_specs/rollup.get_rollup_caps.json index d139899a..7dcc83ee 100644 --- a/api_generator/rest_specs/rollup.get_rollup_caps.json +++ b/api_generator/rest_specs/rollup.get_rollup_caps.json @@ -5,6 +5,10 @@ "description":"Returns the capabilities of any rollup jobs that have been configured for a specific index or index pattern." }, "stability":"experimental", + "visibility":"public", + "headers":{ + "accept": [ "application/json"] + }, "url":{ "paths":[ { diff --git a/api_generator/rest_specs/rollup.get_rollup_index_caps.json b/api_generator/rest_specs/rollup.get_rollup_index_caps.json index 33bb81f9..c0e81ff7 100644 --- a/api_generator/rest_specs/rollup.get_rollup_index_caps.json +++ b/api_generator/rest_specs/rollup.get_rollup_index_caps.json @@ -5,6 +5,10 @@ "description":"Returns the rollup capabilities of all jobs inside of a rollup index (e.g. the index where rollup data is stored)." }, "stability":"experimental", + "visibility":"public", + "headers":{ + "accept": [ "application/json"] + }, "url":{ "paths":[ { diff --git a/api_generator/rest_specs/rollup.put_job.json b/api_generator/rest_specs/rollup.put_job.json index 8fb10631..2ba845cf 100644 --- a/api_generator/rest_specs/rollup.put_job.json +++ b/api_generator/rest_specs/rollup.put_job.json @@ -5,6 +5,11 @@ "description":"Creates a rollup job." }, "stability":"experimental", + "visibility":"public", + "headers":{ + "accept": [ "application/json"], + "content_type": ["application/json"] + }, "url":{ "paths":[ { diff --git a/api_generator/rest_specs/rollup.rollup.json b/api_generator/rest_specs/rollup.rollup.json new file mode 100644 index 00000000..3774df02 --- /dev/null +++ b/api_generator/rest_specs/rollup.rollup.json @@ -0,0 +1,41 @@ +{ + "rollup.rollup":{ + "documentation":{ + "url":"https://www.elastic.co/guide/en/elasticsearch/reference/master/rollup-api.html", + "description":"Rollup an index" + }, + "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "application/json"], + "content_type": ["application/json"] + }, + "url": { + "paths": [ + { + "path": "/{index}/_rollup/{rollup_index}", + "methods": [ + "POST" + ], + "parts": { + "index": { + "type": "string", + "description": "The index to roll up", + "required": true + }, + "rollup_index": { + "type": "string", + "description": "The name of the rollup index to create", + "required": true + } + } + } + ] + }, + "params":{}, + "body":{ + "description":"The rollup configuration", + "required":true + } + } +} diff --git a/api_generator/rest_specs/rollup.rollup_search.json b/api_generator/rest_specs/rollup.rollup_search.json index 2ca1b53f..6ad72da0 100644 --- a/api_generator/rest_specs/rollup.rollup_search.json +++ b/api_generator/rest_specs/rollup.rollup_search.json @@ -5,6 +5,11 @@ "description":"Enables searching rolled-up data using the standard query DSL." }, "stability":"experimental", + "visibility":"public", + "headers":{ + "accept": [ "application/json"], + "content_type": ["application/json"] + }, "url":{ "paths":[ { diff --git a/api_generator/rest_specs/rollup.start_job.json b/api_generator/rest_specs/rollup.start_job.json index b42924d0..85250cfc 100644 --- a/api_generator/rest_specs/rollup.start_job.json +++ b/api_generator/rest_specs/rollup.start_job.json @@ -5,6 +5,10 @@ "description":"Starts an existing, stopped rollup job." }, "stability":"experimental", + "visibility":"public", + "headers":{ + "accept": [ "application/json"] + }, "url":{ "paths":[ { diff --git a/api_generator/rest_specs/rollup.stop_job.json b/api_generator/rest_specs/rollup.stop_job.json index d2b65fb8..f6405cc9 100644 --- a/api_generator/rest_specs/rollup.stop_job.json +++ b/api_generator/rest_specs/rollup.stop_job.json @@ -5,6 +5,10 @@ "description":"Stops an existing, started rollup job." }, "stability":"experimental", + "visibility":"public", + "headers":{ + "accept": [ "application/json"] + }, "url":{ "paths":[ { diff --git a/api_generator/rest_specs/scripts_painless_execute.json b/api_generator/rest_specs/scripts_painless_execute.json index 9f761fb4..b26d31fb 100644 --- a/api_generator/rest_specs/scripts_painless_execute.json +++ b/api_generator/rest_specs/scripts_painless_execute.json @@ -5,6 +5,11 @@ "description":"Allows an arbitrary script to be executed and a result to be returned" }, "stability":"experimental", + "visibility":"public", + "headers":{ + "accept": [ "application/json"], + "content_type": ["application/json"] + }, "url":{ "paths":[ { diff --git a/api_generator/rest_specs/scroll.json b/api_generator/rest_specs/scroll.json index ea0cbe26..553ee835 100644 --- a/api_generator/rest_specs/scroll.json +++ b/api_generator/rest_specs/scroll.json @@ -5,6 +5,11 @@ "description":"Allows to retrieve a large numbers of results from a single search request." }, "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "application/json"], + "content_type": ["application/json"] + }, "url":{ "paths":[ { diff --git a/api_generator/rest_specs/search.json b/api_generator/rest_specs/search.json index 7770acc5..d127b188 100644 --- a/api_generator/rest_specs/search.json +++ b/api_generator/rest_specs/search.json @@ -5,6 +5,11 @@ "description":"Returns results matching a query." }, "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "application/json"], + "content_type": ["application/json"] + }, "url":{ "paths":[ { @@ -243,6 +248,10 @@ "type":"boolean", "description":"Indicates whether hits.total should be rendered as an integer or an object in the rest search response", "default":false + }, + "min_compatible_shard_node":{ + "type":"string", + "description":"The minimum compatible version that all shards involved in search should have for this request to be successful" } }, "body":{ diff --git a/api_generator/rest_specs/search_shards.json b/api_generator/rest_specs/search_shards.json index 74b7055b..f9afdbfb 100644 --- a/api_generator/rest_specs/search_shards.json +++ b/api_generator/rest_specs/search_shards.json @@ -5,6 +5,10 @@ "description":"Returns information about the indices and shards that a search request would be executed against." }, "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "application/json"] + }, "url":{ "paths":[ { diff --git a/api_generator/rest_specs/search_template.json b/api_generator/rest_specs/search_template.json index 00bd0972..fdf6a513 100644 --- a/api_generator/rest_specs/search_template.json +++ b/api_generator/rest_specs/search_template.json @@ -5,6 +5,11 @@ "description":"Allows to use the Mustache language to pre-render a search definition." }, "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "application/json"], + "content_type": ["application/json"] + }, "url":{ "paths":[ { diff --git a/api_generator/rest_specs/searchable_snapshots.clear_cache.json b/api_generator/rest_specs/searchable_snapshots.clear_cache.json index 9dc9f424..6356045c 100644 --- a/api_generator/rest_specs/searchable_snapshots.clear_cache.json +++ b/api_generator/rest_specs/searchable_snapshots.clear_cache.json @@ -1,10 +1,14 @@ { "searchable_snapshots.clear_cache": { "documentation": { - "url": "https://www.elastic.co/guide/en/elasticsearch/reference/current/searchable-snapshots-api-clear-cache.html", + "url": "https://www.elastic.co/guide/en/elasticsearch/reference/current/searchable-snapshots-apis.html", "description" : "Clear the cache of searchable snapshots." }, "stability": "experimental", + "visibility":"public", + "headers":{ + "accept": [ "application/json"] + }, "url": { "paths": [ { diff --git a/api_generator/rest_specs/searchable_snapshots.mount.json b/api_generator/rest_specs/searchable_snapshots.mount.json index c992384a..61cff6a6 100644 --- a/api_generator/rest_specs/searchable_snapshots.mount.json +++ b/api_generator/rest_specs/searchable_snapshots.mount.json @@ -5,6 +5,11 @@ "description": "Mount a snapshot as a searchable index." }, "stability": "experimental", + "visibility":"public", + "headers":{ + "accept": [ "application/json"], + "content_type": ["application/json"] + }, "url": { "paths": [ { @@ -34,6 +39,11 @@ "type":"boolean", "description":"Should this request wait until the operation has completed before returning", "default":false + }, + "storage":{ + "type":"string", + "description":"Selects the kind of local storage used to accelerate searches. Experimental, and defaults to `full_copy`", + "default":false } }, "body":{ diff --git a/api_generator/rest_specs/searchable_snapshots.repository_stats.json b/api_generator/rest_specs/searchable_snapshots.repository_stats.json index a04bd0db..10276a41 100644 --- a/api_generator/rest_specs/searchable_snapshots.repository_stats.json +++ b/api_generator/rest_specs/searchable_snapshots.repository_stats.json @@ -1,10 +1,14 @@ { "searchable_snapshots.repository_stats": { "documentation": { - "url": "https://www.elastic.co/guide/en/elasticsearch/reference/current/searchable-snapshots-repository-stats.html", - "description": "Retrieve usage statistics about a snapshot repository." + "url": "https://www.elastic.co/guide/en/elasticsearch/reference/current/searchable-snapshots-apis.html", + "description": "DEPRECATED: This API is replaced by the Repositories Metering API." }, "stability": "experimental", + "visibility": "public", + "headers":{ + "accept": [ "application/json"] + }, "url": { "paths": [ { diff --git a/api_generator/rest_specs/searchable_snapshots.stats.json b/api_generator/rest_specs/searchable_snapshots.stats.json index b75903a4..23c6953f 100644 --- a/api_generator/rest_specs/searchable_snapshots.stats.json +++ b/api_generator/rest_specs/searchable_snapshots.stats.json @@ -1,10 +1,14 @@ { "searchable_snapshots.stats": { "documentation": { - "url": "https://www.elastic.co/guide/en/elasticsearch/reference/current/searchable-snapshots-api-stats.html", + "url": "https://www.elastic.co/guide/en/elasticsearch/reference/current/searchable-snapshots-apis.html", "description": "Retrieve various statistics about searchable snapshots." }, "stability": "experimental", + "visibility":"public", + "headers":{ + "accept": [ "application/json"] + }, "url": { "paths": [ { @@ -26,6 +30,18 @@ } } ] + }, + "params": { + "level":{ + "type":"enum", + "description":"Return stats aggregated at cluster, index or shard level", + "options":[ + "cluster", + "indices", + "shards" + ], + "default":"indices" + } } } } diff --git a/api_generator/rest_specs/security.authenticate.json b/api_generator/rest_specs/security.authenticate.json index 35455c78..3b65a7ee 100644 --- a/api_generator/rest_specs/security.authenticate.json +++ b/api_generator/rest_specs/security.authenticate.json @@ -5,6 +5,10 @@ "description":"Enables authentication as a user and retrieve information about the authenticated user." }, "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "application/json"] + }, "url":{ "paths":[ { diff --git a/api_generator/rest_specs/security.change_password.json b/api_generator/rest_specs/security.change_password.json index 1195d82b..c2b1391c 100644 --- a/api_generator/rest_specs/security.change_password.json +++ b/api_generator/rest_specs/security.change_password.json @@ -5,6 +5,11 @@ "description":"Changes the passwords of users in the native realm and built-in users." }, "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "application/json"], + "content_type": ["application/json"] + }, "url":{ "paths":[ { diff --git a/api_generator/rest_specs/security.clear_api_key_cache.json b/api_generator/rest_specs/security.clear_api_key_cache.json new file mode 100644 index 00000000..2f3ce2f2 --- /dev/null +++ b/api_generator/rest_specs/security.clear_api_key_cache.json @@ -0,0 +1,30 @@ +{ + "security.clear_api_key_cache":{ + "documentation":{ + "url":"https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-clear-api-key-cache.html", + "description":"Clear a subset or all entries from the API key cache." + }, + "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "application/json"] + }, + "url":{ + "paths":[ + { + "path":"/_security/api_key/{ids}/_clear_cache", + "methods":[ + "POST" + ], + "parts":{ + "ids":{ + "type":"list", + "description":"A comma-separated list of IDs of API keys to clear from the cache" + } + } + } + ] + }, + "params":{} + } +} diff --git a/api_generator/rest_specs/security.clear_cached_privileges.json b/api_generator/rest_specs/security.clear_cached_privileges.json index e2c66a32..f90fbf9c 100644 --- a/api_generator/rest_specs/security.clear_cached_privileges.json +++ b/api_generator/rest_specs/security.clear_cached_privileges.json @@ -5,6 +5,10 @@ "description":"Evicts application privileges from the native application privileges cache." }, "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "application/json"] + }, "url":{ "paths":[ { diff --git a/api_generator/rest_specs/security.clear_cached_realms.json b/api_generator/rest_specs/security.clear_cached_realms.json index 1e0119af..3b24c6ef 100644 --- a/api_generator/rest_specs/security.clear_cached_realms.json +++ b/api_generator/rest_specs/security.clear_cached_realms.json @@ -5,6 +5,10 @@ "description":"Evicts users from the user cache. Can completely clear the cache or evict specific users." }, "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "application/json"] + }, "url":{ "paths":[ { diff --git a/api_generator/rest_specs/security.clear_cached_roles.json b/api_generator/rest_specs/security.clear_cached_roles.json index 72c8ac21..64a0efe5 100644 --- a/api_generator/rest_specs/security.clear_cached_roles.json +++ b/api_generator/rest_specs/security.clear_cached_roles.json @@ -5,6 +5,10 @@ "description":"Evicts roles from the native role cache." }, "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "application/json"] + }, "url":{ "paths":[ { diff --git a/api_generator/rest_specs/security.create_api_key.json b/api_generator/rest_specs/security.create_api_key.json index e6da6598..31ab3993 100644 --- a/api_generator/rest_specs/security.create_api_key.json +++ b/api_generator/rest_specs/security.create_api_key.json @@ -5,6 +5,11 @@ "description":"Creates an API key for access without requiring basic authentication." }, "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "application/json"], + "content_type": ["application/json"] + }, "url":{ "paths":[ { diff --git a/api_generator/rest_specs/security.delete_privileges.json b/api_generator/rest_specs/security.delete_privileges.json index 8069ed79..53347374 100644 --- a/api_generator/rest_specs/security.delete_privileges.json +++ b/api_generator/rest_specs/security.delete_privileges.json @@ -5,6 +5,10 @@ "description":"Removes application privileges." }, "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "application/json"] + }, "url":{ "paths":[ { diff --git a/api_generator/rest_specs/security.delete_role.json b/api_generator/rest_specs/security.delete_role.json index d718ec77..65b2495f 100644 --- a/api_generator/rest_specs/security.delete_role.json +++ b/api_generator/rest_specs/security.delete_role.json @@ -5,6 +5,10 @@ "description":"Removes roles in the native realm." }, "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "application/json"] + }, "url":{ "paths":[ { diff --git a/api_generator/rest_specs/security.delete_role_mapping.json b/api_generator/rest_specs/security.delete_role_mapping.json index ee0bc3ad..ac73fb4d 100644 --- a/api_generator/rest_specs/security.delete_role_mapping.json +++ b/api_generator/rest_specs/security.delete_role_mapping.json @@ -5,6 +5,10 @@ "description":"Removes role mappings." }, "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "application/json"] + }, "url":{ "paths":[ { diff --git a/api_generator/rest_specs/security.delete_user.json b/api_generator/rest_specs/security.delete_user.json index 7c10cd3f..2c7e1091 100644 --- a/api_generator/rest_specs/security.delete_user.json +++ b/api_generator/rest_specs/security.delete_user.json @@ -5,6 +5,10 @@ "description":"Deletes users from the native realm." }, "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "application/json"] + }, "url":{ "paths":[ { diff --git a/api_generator/rest_specs/security.disable_user.json b/api_generator/rest_specs/security.disable_user.json index 4877870b..0dead4d5 100644 --- a/api_generator/rest_specs/security.disable_user.json +++ b/api_generator/rest_specs/security.disable_user.json @@ -5,6 +5,10 @@ "description":"Disables users in the native realm." }, "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "application/json"] + }, "url":{ "paths":[ { diff --git a/api_generator/rest_specs/security.enable_user.json b/api_generator/rest_specs/security.enable_user.json index 58d7f64f..6218a04c 100644 --- a/api_generator/rest_specs/security.enable_user.json +++ b/api_generator/rest_specs/security.enable_user.json @@ -5,6 +5,10 @@ "description":"Enables users in the native realm." }, "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "application/json"] + }, "url":{ "paths":[ { diff --git a/api_generator/rest_specs/security.get_api_key.json b/api_generator/rest_specs/security.get_api_key.json index 8c508f25..5eebcfb4 100644 --- a/api_generator/rest_specs/security.get_api_key.json +++ b/api_generator/rest_specs/security.get_api_key.json @@ -5,6 +5,10 @@ "description":"Retrieves information for one or more API keys." }, "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "application/json"] + }, "url":{ "paths":[ { diff --git a/api_generator/rest_specs/security.get_builtin_privileges.json b/api_generator/rest_specs/security.get_builtin_privileges.json index cd20a32b..96ab86a6 100644 --- a/api_generator/rest_specs/security.get_builtin_privileges.json +++ b/api_generator/rest_specs/security.get_builtin_privileges.json @@ -5,6 +5,10 @@ "description":"Retrieves the list of cluster privileges and index privileges that are available in this version of Elasticsearch." }, "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "application/json"] + }, "url":{ "paths":[ { diff --git a/api_generator/rest_specs/security.get_privileges.json b/api_generator/rest_specs/security.get_privileges.json index b216ac98..278e8ad2 100644 --- a/api_generator/rest_specs/security.get_privileges.json +++ b/api_generator/rest_specs/security.get_privileges.json @@ -5,6 +5,10 @@ "description":"Retrieves application privileges." }, "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "application/json"] + }, "url":{ "paths":[ { diff --git a/api_generator/rest_specs/security.get_role.json b/api_generator/rest_specs/security.get_role.json index 9c52878a..d5a583f0 100644 --- a/api_generator/rest_specs/security.get_role.json +++ b/api_generator/rest_specs/security.get_role.json @@ -5,6 +5,10 @@ "description":"Retrieves roles in the native realm." }, "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "application/json"] + }, "url":{ "paths":[ { @@ -14,8 +18,8 @@ ], "parts":{ "name":{ - "type":"string", - "description":"Role name" + "type":"list", + "description":"A comma-separated list of role names" } } }, diff --git a/api_generator/rest_specs/security.get_role_mapping.json b/api_generator/rest_specs/security.get_role_mapping.json index 4b98173b..88a2f33d 100644 --- a/api_generator/rest_specs/security.get_role_mapping.json +++ b/api_generator/rest_specs/security.get_role_mapping.json @@ -5,6 +5,10 @@ "description":"Retrieves role mappings." }, "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "application/json"] + }, "url":{ "paths":[ { @@ -14,8 +18,8 @@ ], "parts":{ "name":{ - "type":"string", - "description":"Role-Mapping name" + "type":"list", + "description":"A comma-separated list of role-mapping names" } } }, diff --git a/api_generator/rest_specs/security.get_token.json b/api_generator/rest_specs/security.get_token.json index 84a87a75..356391a6 100644 --- a/api_generator/rest_specs/security.get_token.json +++ b/api_generator/rest_specs/security.get_token.json @@ -5,6 +5,11 @@ "description":"Creates a bearer token for access without requiring basic authentication." }, "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "application/json"], + "content_type": ["application/json"] + }, "url":{ "paths":[ { diff --git a/api_generator/rest_specs/security.get_user.json b/api_generator/rest_specs/security.get_user.json index cb1c64ce..6f0ce577 100644 --- a/api_generator/rest_specs/security.get_user.json +++ b/api_generator/rest_specs/security.get_user.json @@ -5,6 +5,10 @@ "description":"Retrieves information about users in the native realm and built-in users." }, "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "application/json"] + }, "url":{ "paths":[ { diff --git a/api_generator/rest_specs/security.get_user_privileges.json b/api_generator/rest_specs/security.get_user_privileges.json index 7dacebae..f8aab200 100644 --- a/api_generator/rest_specs/security.get_user_privileges.json +++ b/api_generator/rest_specs/security.get_user_privileges.json @@ -5,6 +5,10 @@ "description":"Retrieves application privileges." }, "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "application/json"] + }, "url":{ "paths":[ { diff --git a/api_generator/rest_specs/security.grant_api_key.json b/api_generator/rest_specs/security.grant_api_key.json new file mode 100644 index 00000000..f3cc37bd --- /dev/null +++ b/api_generator/rest_specs/security.grant_api_key.json @@ -0,0 +1,39 @@ +{ + "security.grant_api_key":{ + "documentation":{ + "url":"https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-grant-api-key.html", + "description":"Creates an API key on behalf of another user." + }, + "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "application/json"], + "content_type": ["application/json"] + }, + "url":{ + "paths":[ + { + "path":"/_security/api_key/grant", + "methods":[ + "POST" + ] + } + ] + }, + "params":{ + "refresh":{ + "type":"enum", + "options":[ + "true", + "false", + "wait_for" + ], + "description":"If `true` (the default) then refresh the affected shards to make this operation visible to search, if `wait_for` then wait for a refresh to make this operation visible to search, if `false` then do nothing with refreshes." + } + }, + "body":{ + "description":"The api key request to create an API key", + "required":true + } + } +} diff --git a/api_generator/rest_specs/security.has_privileges.json b/api_generator/rest_specs/security.has_privileges.json index d19f4158..3e6efeb1 100644 --- a/api_generator/rest_specs/security.has_privileges.json +++ b/api_generator/rest_specs/security.has_privileges.json @@ -5,6 +5,11 @@ "description":"Determines whether the specified user has a specified list of privileges." }, "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "application/json"], + "content_type": ["application/json"] + }, "url":{ "paths":[ { diff --git a/api_generator/rest_specs/security.invalidate_api_key.json b/api_generator/rest_specs/security.invalidate_api_key.json index 15a7e543..bdf33859 100644 --- a/api_generator/rest_specs/security.invalidate_api_key.json +++ b/api_generator/rest_specs/security.invalidate_api_key.json @@ -5,6 +5,11 @@ "description":"Invalidates one or more API keys." }, "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "application/json"], + "content_type": ["application/json"] + }, "url":{ "paths":[ { diff --git a/api_generator/rest_specs/security.invalidate_token.json b/api_generator/rest_specs/security.invalidate_token.json index 75a3283c..cf4b56a4 100644 --- a/api_generator/rest_specs/security.invalidate_token.json +++ b/api_generator/rest_specs/security.invalidate_token.json @@ -5,6 +5,11 @@ "description":"Invalidates one or more access tokens or refresh tokens." }, "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "application/json"], + "content_type": ["application/json"] + }, "url":{ "paths":[ { diff --git a/api_generator/rest_specs/security.put_privileges.json b/api_generator/rest_specs/security.put_privileges.json index 36f5bfa2..da63002b 100644 --- a/api_generator/rest_specs/security.put_privileges.json +++ b/api_generator/rest_specs/security.put_privileges.json @@ -5,6 +5,11 @@ "description":"Adds or updates application privileges." }, "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "application/json"], + "content_type": ["application/json"] + }, "url":{ "paths":[ { diff --git a/api_generator/rest_specs/security.put_role.json b/api_generator/rest_specs/security.put_role.json index 61aeca51..687bbe56 100644 --- a/api_generator/rest_specs/security.put_role.json +++ b/api_generator/rest_specs/security.put_role.json @@ -5,6 +5,11 @@ "description":"Adds and updates roles in the native realm." }, "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "application/json"], + "content_type": ["application/json"] + }, "url":{ "paths":[ { diff --git a/api_generator/rest_specs/security.put_role_mapping.json b/api_generator/rest_specs/security.put_role_mapping.json index 167c13c9..12c7e8b1 100644 --- a/api_generator/rest_specs/security.put_role_mapping.json +++ b/api_generator/rest_specs/security.put_role_mapping.json @@ -5,6 +5,11 @@ "description":"Creates and updates role mappings." }, "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "application/json"], + "content_type": ["application/json"] + }, "url":{ "paths":[ { diff --git a/api_generator/rest_specs/security.put_user.json b/api_generator/rest_specs/security.put_user.json index 70dff7ab..a3a170b2 100644 --- a/api_generator/rest_specs/security.put_user.json +++ b/api_generator/rest_specs/security.put_user.json @@ -5,6 +5,11 @@ "description":"Adds and updates users in the native realm. These users are commonly referred to as native users." }, "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "application/json"], + "content_type": ["application/json"] + }, "url":{ "paths":[ { diff --git a/api_generator/rest_specs/slm.delete_lifecycle.json b/api_generator/rest_specs/slm.delete_lifecycle.json index 07b21da6..12202a7a 100644 --- a/api_generator/rest_specs/slm.delete_lifecycle.json +++ b/api_generator/rest_specs/slm.delete_lifecycle.json @@ -5,6 +5,10 @@ "description":"Deletes an existing snapshot lifecycle policy." }, "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "application/json"] + }, "url":{ "paths":[ { diff --git a/api_generator/rest_specs/slm.execute_lifecycle.json b/api_generator/rest_specs/slm.execute_lifecycle.json index 74f57492..1395a3d3 100644 --- a/api_generator/rest_specs/slm.execute_lifecycle.json +++ b/api_generator/rest_specs/slm.execute_lifecycle.json @@ -5,6 +5,10 @@ "description":"Immediately creates a snapshot according to the lifecycle policy, without waiting for the scheduled time." }, "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "application/json"] + }, "url":{ "paths":[ { diff --git a/api_generator/rest_specs/slm.execute_retention.json b/api_generator/rest_specs/slm.execute_retention.json index 6448a1d2..f6ce3e75 100644 --- a/api_generator/rest_specs/slm.execute_retention.json +++ b/api_generator/rest_specs/slm.execute_retention.json @@ -5,6 +5,10 @@ "description":"Deletes any snapshots that are expired according to the policy's retention rules." }, "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "application/json"] + }, "url":{ "paths":[ { diff --git a/api_generator/rest_specs/slm.get_lifecycle.json b/api_generator/rest_specs/slm.get_lifecycle.json index 4a208ebb..94d0772a 100644 --- a/api_generator/rest_specs/slm.get_lifecycle.json +++ b/api_generator/rest_specs/slm.get_lifecycle.json @@ -5,6 +5,10 @@ "description":"Retrieves one or more snapshot lifecycle policy definitions and information about the latest snapshot attempts." }, "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "application/json"] + }, "url":{ "paths":[ { diff --git a/api_generator/rest_specs/slm.get_stats.json b/api_generator/rest_specs/slm.get_stats.json index b4fe2f23..aa693ad3 100644 --- a/api_generator/rest_specs/slm.get_stats.json +++ b/api_generator/rest_specs/slm.get_stats.json @@ -5,6 +5,10 @@ "description":"Returns global and policy-level statistics about actions taken by snapshot lifecycle management." }, "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "application/json"] + }, "url":{ "paths":[ { diff --git a/api_generator/rest_specs/slm.get_status.json b/api_generator/rest_specs/slm.get_status.json index 38240243..92ba1b4c 100644 --- a/api_generator/rest_specs/slm.get_status.json +++ b/api_generator/rest_specs/slm.get_status.json @@ -5,6 +5,10 @@ "description":"Retrieves the status of snapshot lifecycle management (SLM)." }, "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "application/json"] + }, "url":{ "paths":[ { diff --git a/api_generator/rest_specs/slm.put_lifecycle.json b/api_generator/rest_specs/slm.put_lifecycle.json index 9f2b8fe1..7e7babb9 100644 --- a/api_generator/rest_specs/slm.put_lifecycle.json +++ b/api_generator/rest_specs/slm.put_lifecycle.json @@ -5,6 +5,11 @@ "description":"Creates or updates a snapshot lifecycle policy." }, "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "application/json"], + "content_type": ["application/json"] + }, "url":{ "paths":[ { diff --git a/api_generator/rest_specs/slm.start.json b/api_generator/rest_specs/slm.start.json index 8d06c51d..52ee7baa 100644 --- a/api_generator/rest_specs/slm.start.json +++ b/api_generator/rest_specs/slm.start.json @@ -5,6 +5,10 @@ "description":"Turns on snapshot lifecycle management (SLM)." }, "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "application/json"] + }, "url":{ "paths":[ { diff --git a/api_generator/rest_specs/slm.stop.json b/api_generator/rest_specs/slm.stop.json index e35ec0aa..767ce6b6 100644 --- a/api_generator/rest_specs/slm.stop.json +++ b/api_generator/rest_specs/slm.stop.json @@ -5,6 +5,10 @@ "description":"Turns off snapshot lifecycle management (SLM)." }, "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "application/json"] + }, "url":{ "paths":[ { diff --git a/api_generator/rest_specs/snapshot.cleanup_repository.json b/api_generator/rest_specs/snapshot.cleanup_repository.json index 727fe791..3d048bf6 100644 --- a/api_generator/rest_specs/snapshot.cleanup_repository.json +++ b/api_generator/rest_specs/snapshot.cleanup_repository.json @@ -5,6 +5,10 @@ "description": "Removes stale data from repository." }, "stability": "stable", + "visibility":"public", + "headers":{ + "accept": [ "application/json"] + }, "url": { "paths": [ { diff --git a/api_generator/rest_specs/snapshot.clone.json b/api_generator/rest_specs/snapshot.clone.json new file mode 100644 index 00000000..da940911 --- /dev/null +++ b/api_generator/rest_specs/snapshot.clone.json @@ -0,0 +1,48 @@ +{ + "snapshot.clone":{ + "documentation":{ + "url":"https://www.elastic.co/guide/en/elasticsearch/reference/master/modules-snapshots.html", + "description":"Clones indices from one snapshot into another snapshot in the same repository." + }, + "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "application/json"], + "content_type": ["application/json"] + }, + "url":{ + "paths":[ + { + "path":"/_snapshot/{repository}/{snapshot}/_clone/{target_snapshot}", + "methods":[ + "PUT" + ], + "parts":{ + "repository":{ + "type":"string", + "description":"A repository name" + }, + "snapshot":{ + "type":"string", + "description":"The name of the snapshot to clone from" + }, + "target_snapshot":{ + "type":"string", + "description":"The name of the cloned snapshot to create" + } + } + } + ] + }, + "params":{ + "master_timeout":{ + "type":"time", + "description":"Explicit operation timeout for connection to master node" + } + }, + "body":{ + "description":"The snapshot clone definition", + "required":true + } + } +} diff --git a/api_generator/rest_specs/snapshot.create.json b/api_generator/rest_specs/snapshot.create.json index da8cb991..7f70def7 100644 --- a/api_generator/rest_specs/snapshot.create.json +++ b/api_generator/rest_specs/snapshot.create.json @@ -5,6 +5,11 @@ "description":"Creates a snapshot in a repository." }, "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "application/json"], + "content_type": ["application/json"] + }, "url":{ "paths":[ { diff --git a/api_generator/rest_specs/snapshot.create_repository.json b/api_generator/rest_specs/snapshot.create_repository.json index 431ac3c6..504abd3d 100644 --- a/api_generator/rest_specs/snapshot.create_repository.json +++ b/api_generator/rest_specs/snapshot.create_repository.json @@ -5,6 +5,11 @@ "description":"Creates a repository." }, "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "application/json"], + "content_type": ["application/json"] + }, "url":{ "paths":[ { diff --git a/api_generator/rest_specs/snapshot.delete.json b/api_generator/rest_specs/snapshot.delete.json index 30053cd5..3351fdfb 100644 --- a/api_generator/rest_specs/snapshot.delete.json +++ b/api_generator/rest_specs/snapshot.delete.json @@ -5,6 +5,10 @@ "description":"Deletes a snapshot." }, "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "application/json"] + }, "url":{ "paths":[ { diff --git a/api_generator/rest_specs/snapshot.delete_repository.json b/api_generator/rest_specs/snapshot.delete_repository.json index b60aeba8..8b6ce52d 100644 --- a/api_generator/rest_specs/snapshot.delete_repository.json +++ b/api_generator/rest_specs/snapshot.delete_repository.json @@ -5,6 +5,10 @@ "description":"Deletes a repository." }, "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "application/json"] + }, "url":{ "paths":[ { diff --git a/api_generator/rest_specs/snapshot.get.json b/api_generator/rest_specs/snapshot.get.json index 20006f6f..e37a9797 100644 --- a/api_generator/rest_specs/snapshot.get.json +++ b/api_generator/rest_specs/snapshot.get.json @@ -5,6 +5,10 @@ "description":"Returns information about a snapshot." }, "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "application/json"] + }, "url":{ "paths":[ { diff --git a/api_generator/rest_specs/snapshot.get_features.json b/api_generator/rest_specs/snapshot.get_features.json new file mode 100644 index 00000000..76b340d3 --- /dev/null +++ b/api_generator/rest_specs/snapshot.get_features.json @@ -0,0 +1,29 @@ +{ + "snapshot.get_features":{ + "documentation":{ + "url":"https://www.elastic.co/guide/en/elasticsearch/reference/master/modules-snapshots.html", + "description":"Returns a list of features which can be snapshotted in this cluster." + }, + "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "application/json"] + }, + "url":{ + "paths":[ + { + "path":"/_snapshottable_features", + "methods":[ + "GET" + ] + } + ] + }, + "params":{ + "master_timeout":{ + "type":"time", + "description":"Explicit operation timeout for connection to master node" + } + } + } +} diff --git a/api_generator/rest_specs/snapshot.get_repository.json b/api_generator/rest_specs/snapshot.get_repository.json index 8c91caa4..c85d0180 100644 --- a/api_generator/rest_specs/snapshot.get_repository.json +++ b/api_generator/rest_specs/snapshot.get_repository.json @@ -5,6 +5,10 @@ "description":"Returns information about a repository." }, "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "application/json"] + }, "url":{ "paths":[ { diff --git a/api_generator/rest_specs/snapshot.restore.json b/api_generator/rest_specs/snapshot.restore.json index 697ea395..c4ecb557 100644 --- a/api_generator/rest_specs/snapshot.restore.json +++ b/api_generator/rest_specs/snapshot.restore.json @@ -5,6 +5,11 @@ "description":"Restores a snapshot." }, "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "application/json"], + "content_type": ["application/json"] + }, "url":{ "paths":[ { diff --git a/api_generator/rest_specs/snapshot.status.json b/api_generator/rest_specs/snapshot.status.json index 70a7ba23..e5f1af20 100644 --- a/api_generator/rest_specs/snapshot.status.json +++ b/api_generator/rest_specs/snapshot.status.json @@ -5,6 +5,10 @@ "description":"Returns information about the status of a snapshot." }, "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "application/json"] + }, "url":{ "paths":[ { diff --git a/api_generator/rest_specs/snapshot.verify_repository.json b/api_generator/rest_specs/snapshot.verify_repository.json index de638c19..ce5c1d29 100644 --- a/api_generator/rest_specs/snapshot.verify_repository.json +++ b/api_generator/rest_specs/snapshot.verify_repository.json @@ -5,6 +5,10 @@ "description":"Verifies a repository." }, "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "application/json"] + }, "url":{ "paths":[ { diff --git a/api_generator/rest_specs/sql.clear_cursor.json b/api_generator/rest_specs/sql.clear_cursor.json index 7cef02fb..26d4f039 100644 --- a/api_generator/rest_specs/sql.clear_cursor.json +++ b/api_generator/rest_specs/sql.clear_cursor.json @@ -5,6 +5,11 @@ "description":"Clears the SQL cursor" }, "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "application/json"], + "content_type": ["application/json"] + }, "url":{ "paths":[ { diff --git a/api_generator/rest_specs/sql.query.json b/api_generator/rest_specs/sql.query.json index f36ca006..2cd1f9ac 100644 --- a/api_generator/rest_specs/sql.query.json +++ b/api_generator/rest_specs/sql.query.json @@ -5,6 +5,11 @@ "description":"Executes a SQL request" }, "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "application/json"], + "content_type": ["application/json"] + }, "url":{ "paths":[ { diff --git a/api_generator/rest_specs/sql.translate.json b/api_generator/rest_specs/sql.translate.json index 37a66bd2..09623c9b 100644 --- a/api_generator/rest_specs/sql.translate.json +++ b/api_generator/rest_specs/sql.translate.json @@ -5,6 +5,11 @@ "description":"Translates SQL into Elasticsearch queries" }, "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "application/json"], + "content_type": ["application/json"] + }, "url":{ "paths":[ { diff --git a/api_generator/rest_specs/ssl.certificates.json b/api_generator/rest_specs/ssl.certificates.json index 0dd7bce0..233bc088 100644 --- a/api_generator/rest_specs/ssl.certificates.json +++ b/api_generator/rest_specs/ssl.certificates.json @@ -5,6 +5,10 @@ "description":"Retrieves information about the X.509 certificates used to encrypt communications in the cluster." }, "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "application/json"] + }, "url":{ "paths":[ { diff --git a/api_generator/rest_specs/tasks.cancel.json b/api_generator/rest_specs/tasks.cancel.json index 966197f4..525c72aa 100644 --- a/api_generator/rest_specs/tasks.cancel.json +++ b/api_generator/rest_specs/tasks.cancel.json @@ -4,7 +4,11 @@ "url":"https://www.elastic.co/guide/en/elasticsearch/reference/master/tasks.html", "description":"Cancels a task, if it can be cancelled through an API." }, - "stability":"stable", + "stability":"experimental", + "visibility":"public", + "headers":{ + "accept": [ "application/json"] + }, "url":{ "paths":[ { diff --git a/api_generator/rest_specs/tasks.get.json b/api_generator/rest_specs/tasks.get.json index 63bd1b6a..0863e05b 100644 --- a/api_generator/rest_specs/tasks.get.json +++ b/api_generator/rest_specs/tasks.get.json @@ -4,7 +4,11 @@ "url":"https://www.elastic.co/guide/en/elasticsearch/reference/master/tasks.html", "description":"Returns information about a task." }, - "stability":"stable", + "stability":"experimental", + "visibility":"public", + "headers":{ + "accept": [ "application/json"] + }, "url":{ "paths":[ { diff --git a/api_generator/rest_specs/tasks.list.json b/api_generator/rest_specs/tasks.list.json index 0aba6d63..058ff363 100644 --- a/api_generator/rest_specs/tasks.list.json +++ b/api_generator/rest_specs/tasks.list.json @@ -4,7 +4,11 @@ "url":"https://www.elastic.co/guide/en/elasticsearch/reference/master/tasks.html", "description":"Returns a list of tasks." }, - "stability":"stable", + "stability":"experimental", + "visibility":"public", + "headers":{ + "accept": [ "application/json"] + }, "url":{ "paths":[ { diff --git a/api_generator/rest_specs/termvectors.json b/api_generator/rest_specs/termvectors.json index dd7fac97..e9f8d7a4 100644 --- a/api_generator/rest_specs/termvectors.json +++ b/api_generator/rest_specs/termvectors.json @@ -5,6 +5,11 @@ "description":"Returns information and statistics about terms in the fields of a particular document." }, "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "application/json"], + "content_type": ["application/json"] + }, "url":{ "paths":[ { diff --git a/api_generator/rest_specs/ml.find_file_structure.json b/api_generator/rest_specs/text_structure.find_structure.json similarity index 92% rename from api_generator/rest_specs/ml.find_file_structure.json rename to api_generator/rest_specs/text_structure.find_structure.json index 13594031..934bc785 100644 --- a/api_generator/rest_specs/ml.find_file_structure.json +++ b/api_generator/rest_specs/text_structure.find_structure.json @@ -1,14 +1,19 @@ { - "ml.find_file_structure":{ + "text_structure.find_structure":{ "documentation":{ - "url":"https://www.elastic.co/guide/en/elasticsearch/reference/current/ml-find-file-structure.html", + "url":"https://www.elastic.co/guide/en/elasticsearch/reference/current/find-structure.html", "description":"Finds the structure of a text file. The text file must contain data that is suitable to be ingested into Elasticsearch." }, "stability":"experimental", + "visibility":"public", + "headers":{ + "accept": [ "application/json"], + "content_type": ["application/x-ndjson"] + }, "url":{ "paths":[ { - "path":"/_ml/find_file_structure", + "path":"/_text_structure/find_structure", "methods":[ "POST" ] diff --git a/api_generator/rest_specs/transform.delete_transform.json b/api_generator/rest_specs/transform.delete_transform.json index 7378f247..0b0e2377 100644 --- a/api_generator/rest_specs/transform.delete_transform.json +++ b/api_generator/rest_specs/transform.delete_transform.json @@ -5,6 +5,10 @@ "description":"Deletes an existing transform." }, "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "application/json"] + }, "url":{ "paths":[ { diff --git a/api_generator/rest_specs/transform.get_transform.json b/api_generator/rest_specs/transform.get_transform.json index 1ab97aa6..334537d4 100644 --- a/api_generator/rest_specs/transform.get_transform.json +++ b/api_generator/rest_specs/transform.get_transform.json @@ -5,6 +5,10 @@ "description":"Retrieves configuration information for transforms." }, "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "application/json"] + }, "url":{ "paths":[ { @@ -42,6 +46,12 @@ "type":"boolean", "required":false, "description":"Whether to ignore if a wildcard expression matches no transforms. (This includes `_all` string or when no transforms have been specified)" + }, + "exclude_generated": { + "required": false, + "type": "boolean", + "default": false, + "description": "Omits fields that are illegal to set on transform PUT" } } } diff --git a/api_generator/rest_specs/transform.get_transform_stats.json b/api_generator/rest_specs/transform.get_transform_stats.json index 1691d550..f425c41f 100644 --- a/api_generator/rest_specs/transform.get_transform_stats.json +++ b/api_generator/rest_specs/transform.get_transform_stats.json @@ -5,6 +5,10 @@ "description":"Retrieves usage information for transforms." }, "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "application/json"] + }, "url":{ "paths":[ { diff --git a/api_generator/rest_specs/transform.preview_transform.json b/api_generator/rest_specs/transform.preview_transform.json index 83ecc006..89636eb9 100644 --- a/api_generator/rest_specs/transform.preview_transform.json +++ b/api_generator/rest_specs/transform.preview_transform.json @@ -5,6 +5,11 @@ "description":"Previews a transform." }, "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "application/json"], + "content_type": ["application/json"] + }, "url":{ "paths":[ { diff --git a/api_generator/rest_specs/transform.put_transform.json b/api_generator/rest_specs/transform.put_transform.json index 47ade4a0..1e81629b 100644 --- a/api_generator/rest_specs/transform.put_transform.json +++ b/api_generator/rest_specs/transform.put_transform.json @@ -5,6 +5,11 @@ "description":"Instantiates a transform." }, "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "application/json"], + "content_type": ["application/json"] + }, "url":{ "paths":[ { diff --git a/api_generator/rest_specs/transform.start_transform.json b/api_generator/rest_specs/transform.start_transform.json index 9316e500..7c002957 100644 --- a/api_generator/rest_specs/transform.start_transform.json +++ b/api_generator/rest_specs/transform.start_transform.json @@ -5,6 +5,10 @@ "description":"Starts one or more transforms." }, "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "application/json"] + }, "url":{ "paths":[ { diff --git a/api_generator/rest_specs/transform.stop_transform.json b/api_generator/rest_specs/transform.stop_transform.json index 49721981..1beb8066 100644 --- a/api_generator/rest_specs/transform.stop_transform.json +++ b/api_generator/rest_specs/transform.stop_transform.json @@ -5,6 +5,10 @@ "description":"Stops one or more transforms." }, "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "application/json"] + }, "url":{ "paths":[ { diff --git a/api_generator/rest_specs/transform.update_transform.json b/api_generator/rest_specs/transform.update_transform.json index fe74376e..c103570a 100644 --- a/api_generator/rest_specs/transform.update_transform.json +++ b/api_generator/rest_specs/transform.update_transform.json @@ -5,6 +5,11 @@ "description":"Updates certain properties of a transform." }, "stability":"stable", + "visibility":"public", + "headers":{ + "accept":[ "application/json"], + "content_type":["application/json"] + }, "url":{ "paths":[ { diff --git a/api_generator/rest_specs/update.json b/api_generator/rest_specs/update.json index 81bc1016..450f20c0 100644 --- a/api_generator/rest_specs/update.json +++ b/api_generator/rest_specs/update.json @@ -5,6 +5,11 @@ "description":"Updates a document with a script or partial document." }, "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "application/json"], + "content_type": ["application/json"] + }, "url":{ "paths":[ { diff --git a/api_generator/rest_specs/update_by_query.json b/api_generator/rest_specs/update_by_query.json index 930f1a97..cb32ec99 100644 --- a/api_generator/rest_specs/update_by_query.json +++ b/api_generator/rest_specs/update_by_query.json @@ -5,6 +5,11 @@ "description":"Performs an update on every document in the index without changing the source,\nfor example to pick up a mapping change." }, "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "application/json"], + "content_type": ["application/json"] + }, "url":{ "paths":[ { diff --git a/api_generator/rest_specs/update_by_query_rethrottle.json b/api_generator/rest_specs/update_by_query_rethrottle.json index bd70f6e1..18895ad4 100644 --- a/api_generator/rest_specs/update_by_query_rethrottle.json +++ b/api_generator/rest_specs/update_by_query_rethrottle.json @@ -5,6 +5,10 @@ "description":"Changes the number of requests per second for a particular Update By Query operation." }, "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "application/json"] + }, "url":{ "paths":[ { diff --git a/api_generator/rest_specs/watcher.ack_watch.json b/api_generator/rest_specs/watcher.ack_watch.json index 0b9126a8..0c048889 100644 --- a/api_generator/rest_specs/watcher.ack_watch.json +++ b/api_generator/rest_specs/watcher.ack_watch.json @@ -5,6 +5,10 @@ "description":"Acknowledges a watch, manually throttling the execution of the watch's actions." }, "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "application/json"] + }, "url":{ "paths":[ { diff --git a/api_generator/rest_specs/watcher.activate_watch.json b/api_generator/rest_specs/watcher.activate_watch.json index d0a892de..698b08f3 100644 --- a/api_generator/rest_specs/watcher.activate_watch.json +++ b/api_generator/rest_specs/watcher.activate_watch.json @@ -5,6 +5,10 @@ "description":"Activates a currently inactive watch." }, "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "application/json"] + }, "url":{ "paths":[ { diff --git a/api_generator/rest_specs/watcher.deactivate_watch.json b/api_generator/rest_specs/watcher.deactivate_watch.json index 90385dfd..e9b7407e 100644 --- a/api_generator/rest_specs/watcher.deactivate_watch.json +++ b/api_generator/rest_specs/watcher.deactivate_watch.json @@ -5,6 +5,10 @@ "description":"Deactivates a currently active watch." }, "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "application/json"] + }, "url":{ "paths":[ { diff --git a/api_generator/rest_specs/watcher.delete_watch.json b/api_generator/rest_specs/watcher.delete_watch.json index c42ec9cb..9417a8a5 100644 --- a/api_generator/rest_specs/watcher.delete_watch.json +++ b/api_generator/rest_specs/watcher.delete_watch.json @@ -5,6 +5,10 @@ "description":"Removes a watch from Watcher." }, "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "application/json"] + }, "url":{ "paths":[ { diff --git a/api_generator/rest_specs/watcher.execute_watch.json b/api_generator/rest_specs/watcher.execute_watch.json index 3704eb4a..a011669c 100644 --- a/api_generator/rest_specs/watcher.execute_watch.json +++ b/api_generator/rest_specs/watcher.execute_watch.json @@ -5,6 +5,11 @@ "description":"Forces the execution of a stored watch." }, "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "application/json"], + "content_type": ["application/json"] + }, "url":{ "paths":[ { diff --git a/api_generator/rest_specs/watcher.get_watch.json b/api_generator/rest_specs/watcher.get_watch.json index e81dcd7e..26899aef 100644 --- a/api_generator/rest_specs/watcher.get_watch.json +++ b/api_generator/rest_specs/watcher.get_watch.json @@ -5,6 +5,10 @@ "description":"Retrieves a watch by its ID." }, "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "application/json"] + }, "url":{ "paths":[ { diff --git a/api_generator/rest_specs/watcher.put_watch.json b/api_generator/rest_specs/watcher.put_watch.json index 6aa29c5f..46258019 100644 --- a/api_generator/rest_specs/watcher.put_watch.json +++ b/api_generator/rest_specs/watcher.put_watch.json @@ -5,6 +5,11 @@ "description":"Creates a new watch, or updates an existing one." }, "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "application/json"], + "content_type": ["application/json"] + }, "url":{ "paths":[ { diff --git a/api_generator/rest_specs/watcher.query_watches.json b/api_generator/rest_specs/watcher.query_watches.json new file mode 100644 index 00000000..b730f66a --- /dev/null +++ b/api_generator/rest_specs/watcher.query_watches.json @@ -0,0 +1,30 @@ +{ + "watcher.query_watches":{ + "documentation":{ + "url":"https://www.elastic.co/guide/en/elasticsearch/reference/current/watcher-api-query-watches.html", + "description":"Retrieves stored watches." + }, + "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "application/json"], + "content_type": ["application/json"] + }, + "url":{ + "paths":[ + { + "path":"/_watcher/_query/watches", + "methods":[ + "GET", + "POST" + ] + } + ] + }, + "params":{}, + "body":{ + "description":"From, size, query, sort and search_after", + "required":false + } + } +} diff --git a/api_generator/rest_specs/watcher.start.json b/api_generator/rest_specs/watcher.start.json index eb393a25..a7884a41 100644 --- a/api_generator/rest_specs/watcher.start.json +++ b/api_generator/rest_specs/watcher.start.json @@ -5,6 +5,10 @@ "description":"Starts Watcher if it is not already running." }, "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "application/json"] + }, "url":{ "paths":[ { diff --git a/api_generator/rest_specs/watcher.stats.json b/api_generator/rest_specs/watcher.stats.json index 75854017..35e90cbd 100644 --- a/api_generator/rest_specs/watcher.stats.json +++ b/api_generator/rest_specs/watcher.stats.json @@ -5,6 +5,10 @@ "description":"Retrieves the current Watcher metrics." }, "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "application/json"] + }, "url":{ "paths":[ { diff --git a/api_generator/rest_specs/watcher.stop.json b/api_generator/rest_specs/watcher.stop.json index c5014be0..c3e85287 100644 --- a/api_generator/rest_specs/watcher.stop.json +++ b/api_generator/rest_specs/watcher.stop.json @@ -5,6 +5,10 @@ "description":"Stops Watcher if it is running." }, "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "application/json"] + }, "url":{ "paths":[ { diff --git a/api_generator/rest_specs/xpack.info.json b/api_generator/rest_specs/xpack.info.json index b9fcd27a..c5977dac 100644 --- a/api_generator/rest_specs/xpack.info.json +++ b/api_generator/rest_specs/xpack.info.json @@ -5,6 +5,10 @@ "description":"Retrieves information about the installed X-Pack features." }, "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "application/json"] + }, "url":{ "paths":[ { diff --git a/api_generator/rest_specs/xpack.usage.json b/api_generator/rest_specs/xpack.usage.json index 2f99c477..e01f4034 100644 --- a/api_generator/rest_specs/xpack.usage.json +++ b/api_generator/rest_specs/xpack.usage.json @@ -5,6 +5,10 @@ "description":"Retrieves usage information about the installed X-Pack features." }, "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "application/json"] + }, "url":{ "paths":[ { diff --git a/elasticsearch/src/.generated.toml b/elasticsearch/src/.generated.toml index 05fad15f..06ea6570 100644 --- a/elasticsearch/src/.generated.toml +++ b/elasticsearch/src/.generated.toml @@ -1,25 +1,32 @@ written = [ 'async_search.rs', + 'autoscaling.rs', 'cat.rs', 'ccr.rs', 'cluster.rs', 'dangling_indices.rs', 'enrich.rs', + 'eql.rs', 'graph.rs', 'ilm.rs', 'indices.rs', 'ingest.rs', 'license.rs', + 'logstash.rs', 'migration.rs', 'ml.rs', + 'monitoring.rs', 'nodes.rs', + 'rollup.rs', 'root/mod.rs', + 'searchable_snapshots.rs', 'security.rs', 'slm.rs', 'snapshot.rs', 'sql.rs', 'ssl.rs', 'tasks.rs', + 'text_structure.rs', 'transform.rs', 'watcher.rs', 'xpack.rs', diff --git a/elasticsearch/src/async_search.rs b/elasticsearch/src/async_search.rs index 94cbb9ae..8fe38122 100644 --- a/elasticsearch/src/async_search.rs +++ b/elasticsearch/src/async_search.rs @@ -30,7 +30,8 @@ //! let you asynchronously execute a search request, monitor its progress, and retrieve //! partial results as they become available. -# ! [ allow ( unused_imports ) ]use crate::{ +#![allow(unused_imports)] +use crate::{ client::Elasticsearch, error::Error, http::{ @@ -65,8 +66,8 @@ impl<'b> AsyncSearchDeleteParts<'b> { } } } +#[doc = "Builder for the [Async Search Delete API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/async-search.html)\n\nDeletes an async search by ID. If the search is still running, the search request will be cancelled. Otherwise, the saved search results are deleted."] #[derive(Clone, Debug)] -#[doc = "Builder for the [Async Search Delete API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/async-search.html)\n\nDeletes an async search by ID. If the search is still running, the search request will be cancelled. Otherwise, the saved search results are deleted."] pub struct AsyncSearchDelete<'a, 'b> { transport: &'a Transport, parts: AsyncSearchDeleteParts<'b>, @@ -183,8 +184,8 @@ impl<'b> AsyncSearchGetParts<'b> { } } } +#[doc = "Builder for the [Async Search Get API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/async-search.html)\n\nRetrieves the results of a previously submitted async search request given its ID."] #[derive(Clone, Debug)] -#[doc = "Builder for the [Async Search Get API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/async-search.html)\n\nRetrieves the results of a previously submitted async search request given its ID."] pub struct AsyncSearchGet<'a, 'b> { transport: &'a Transport, parts: AsyncSearchGetParts<'b>, @@ -309,6 +310,124 @@ impl<'a, 'b> AsyncSearchGet<'a, 'b> { } } #[derive(Debug, Clone, PartialEq)] +#[doc = "API parts for the Async Search Status API"] +pub enum AsyncSearchStatusParts<'b> { + #[doc = "Id"] + Id(&'b str), +} +impl<'b> AsyncSearchStatusParts<'b> { + #[doc = "Builds a relative URL path to the Async Search Status API"] + pub fn url(self) -> Cow<'static, str> { + match self { + AsyncSearchStatusParts::Id(ref id) => { + let encoded_id: Cow = percent_encode(id.as_bytes(), PARTS_ENCODED).into(); + let mut p = String::with_capacity(22usize + encoded_id.len()); + p.push_str("/_async_search/status/"); + p.push_str(encoded_id.as_ref()); + p.into() + } + } + } +} +#[doc = "Builder for the [Async Search Status API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/async-search.html)\n\nRetrieves the status of a previously submitted async search request given its ID."] +#[derive(Clone, Debug)] +pub struct AsyncSearchStatus<'a, 'b> { + transport: &'a Transport, + parts: AsyncSearchStatusParts<'b>, + error_trace: Option, + filter_path: Option<&'b [&'b str]>, + headers: HeaderMap, + human: Option, + pretty: Option, + request_timeout: Option, + source: Option<&'b str>, +} +impl<'a, 'b> AsyncSearchStatus<'a, 'b> { + #[doc = "Creates a new instance of [AsyncSearchStatus] with the specified API parts"] + pub fn new(transport: &'a Transport, parts: AsyncSearchStatusParts<'b>) -> Self { + let headers = HeaderMap::new(); + AsyncSearchStatus { + transport, + parts, + headers, + error_trace: None, + filter_path: None, + human: None, + pretty: None, + request_timeout: None, + source: None, + } + } + #[doc = "Include the stack trace of returned errors."] + pub fn error_trace(mut self, error_trace: bool) -> Self { + self.error_trace = Some(error_trace); + self + } + #[doc = "A comma-separated list of filters used to reduce the response."] + pub fn filter_path(mut self, filter_path: &'b [&'b str]) -> Self { + self.filter_path = Some(filter_path); + self + } + #[doc = "Adds a HTTP header"] + pub fn header(mut self, key: HeaderName, value: HeaderValue) -> Self { + self.headers.insert(key, value); + self + } + #[doc = "Return human readable values for statistics."] + pub fn human(mut self, human: bool) -> Self { + self.human = Some(human); + self + } + #[doc = "Pretty format the returned JSON response."] + pub fn pretty(mut self, pretty: bool) -> Self { + self.pretty = Some(pretty); + self + } + #[doc = "Sets a request timeout for this API call.\n\nThe timeout is applied from when the request starts connecting until the response body has finished."] + pub fn request_timeout(mut self, timeout: Duration) -> Self { + self.request_timeout = Some(timeout); + self + } + #[doc = "The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests."] + pub fn source(mut self, source: &'b str) -> Self { + self.source = Some(source); + self + } + #[doc = "Creates an asynchronous call to the Async Search Status API that can be awaited"] + pub async fn send(self) -> Result { + let path = self.parts.url(); + let method = Method::Get; + let headers = self.headers; + let timeout = self.request_timeout; + let query_string = { + #[serde_with::skip_serializing_none] + #[derive(Serialize)] + struct QueryParams<'b> { + error_trace: Option, + #[serde(serialize_with = "crate::client::serialize_coll_qs")] + filter_path: Option<&'b [&'b str]>, + human: Option, + pretty: Option, + source: Option<&'b str>, + } + let query_params = QueryParams { + error_trace: self.error_trace, + filter_path: self.filter_path, + human: self.human, + pretty: self.pretty, + source: self.source, + }; + Some(query_params) + }; + let body = Option::<()>::None; + let response = self + .transport + .send(method, &path, headers, query_string.as_ref(), body, timeout) + .await?; + Ok(response) + } +} +#[derive(Debug, Clone, PartialEq)] #[doc = "API parts for the Async Search Submit API"] pub enum AsyncSearchSubmitParts<'b> { #[doc = "No parts"] @@ -334,8 +453,8 @@ impl<'b> AsyncSearchSubmitParts<'b> { } } } +#[doc = "Builder for the [Async Search Submit API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/async-search.html)\n\nExecutes a search request asynchronously."] #[derive(Clone, Debug)] -#[doc = "Builder for the [Async Search Submit API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/async-search.html)\n\nExecutes a search request asynchronously."] pub struct AsyncSearchSubmit<'a, 'b, B> { transport: &'a Transport, parts: AsyncSearchSubmitParts<'b>, @@ -886,15 +1005,19 @@ impl<'a> AsyncSearch<'a> { pub fn transport(&self) -> &Transport { self.transport } - #[doc = "[Async Search Delete API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/async-search.html)\n\nDeletes an async search by ID. If the search is still running, the search request will be cancelled. Otherwise, the saved search results are deleted."] + #[doc = "[Async Search Delete API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/async-search.html)\n\nDeletes an async search by ID. If the search is still running, the search request will be cancelled. Otherwise, the saved search results are deleted."] pub fn delete<'b>(&'a self, parts: AsyncSearchDeleteParts<'b>) -> AsyncSearchDelete<'a, 'b> { AsyncSearchDelete::new(self.transport(), parts) } - #[doc = "[Async Search Get API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/async-search.html)\n\nRetrieves the results of a previously submitted async search request given its ID."] + #[doc = "[Async Search Get API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/async-search.html)\n\nRetrieves the results of a previously submitted async search request given its ID."] pub fn get<'b>(&'a self, parts: AsyncSearchGetParts<'b>) -> AsyncSearchGet<'a, 'b> { AsyncSearchGet::new(self.transport(), parts) } - #[doc = "[Async Search Submit API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/async-search.html)\n\nExecutes a search request asynchronously."] + #[doc = "[Async Search Status API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/async-search.html)\n\nRetrieves the status of a previously submitted async search request given its ID."] + pub fn status<'b>(&'a self, parts: AsyncSearchStatusParts<'b>) -> AsyncSearchStatus<'a, 'b> { + AsyncSearchStatus::new(self.transport(), parts) + } + #[doc = "[Async Search Submit API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/async-search.html)\n\nExecutes a search request asynchronously."] pub fn submit<'b>( &'a self, parts: AsyncSearchSubmitParts<'b>, diff --git a/elasticsearch/src/autoscaling.rs b/elasticsearch/src/autoscaling.rs new file mode 100644 index 00000000..ebf3704b --- /dev/null +++ b/elasticsearch/src/autoscaling.rs @@ -0,0 +1,584 @@ +/* + * Licensed to Elasticsearch B.V. under one or more contributor + * license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright + * ownership. Elasticsearch B.V. licenses this file to you under + * the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +// ----------------------------------------------- +// This file is generated, Please do not edit it manually. +// Run the following in the root of the repo to regenerate: +// +// cargo make generate-api +// ----------------------------------------------- + +//! Autoscaling APIs +//! +//! The [autoscaling feature](https://www.elastic.co/guide/en/elasticsearch/reference/master/xpack-autoscaling.html) +//! enables an operator to configure tiers of nodes that self-monitor whether or not they need to scale based on an +//! operator-defined policy. + +#![allow(unused_imports)] +use crate::{ + client::Elasticsearch, + error::Error, + http::{ + headers::{HeaderMap, HeaderName, HeaderValue, ACCEPT, CONTENT_TYPE}, + request::{Body, JsonBody, NdBody, PARTS_ENCODED}, + response::Response, + transport::Transport, + Method, + }, + params::*, +}; +use percent_encoding::percent_encode; +use serde::Serialize; +use std::{borrow::Cow, time::Duration}; +#[derive(Debug, Clone, PartialEq)] +#[doc = "API parts for the Autoscaling Delete Autoscaling Policy API"] +pub enum AutoscalingDeleteAutoscalingPolicyParts<'b> { + #[doc = "Name"] + Name(&'b str), +} +impl<'b> AutoscalingDeleteAutoscalingPolicyParts<'b> { + #[doc = "Builds a relative URL path to the Autoscaling Delete Autoscaling Policy API"] + pub fn url(self) -> Cow<'static, str> { + match self { + AutoscalingDeleteAutoscalingPolicyParts::Name(ref name) => { + let encoded_name: Cow = percent_encode(name.as_bytes(), PARTS_ENCODED).into(); + let mut p = String::with_capacity(21usize + encoded_name.len()); + p.push_str("/_autoscaling/policy/"); + p.push_str(encoded_name.as_ref()); + p.into() + } + } + } +} +#[doc = "Builder for the [Autoscaling Delete Autoscaling Policy API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/autoscaling-delete-autoscaling-policy.html)\n\nDeletes an autoscaling policy. Designed for indirect use by ECE/ESS and ECK. Direct use is not supported."] +#[derive(Clone, Debug)] +pub struct AutoscalingDeleteAutoscalingPolicy<'a, 'b> { + transport: &'a Transport, + parts: AutoscalingDeleteAutoscalingPolicyParts<'b>, + error_trace: Option, + filter_path: Option<&'b [&'b str]>, + headers: HeaderMap, + human: Option, + pretty: Option, + request_timeout: Option, + source: Option<&'b str>, +} +impl<'a, 'b> AutoscalingDeleteAutoscalingPolicy<'a, 'b> { + #[doc = "Creates a new instance of [AutoscalingDeleteAutoscalingPolicy] with the specified API parts"] + pub fn new( + transport: &'a Transport, + parts: AutoscalingDeleteAutoscalingPolicyParts<'b>, + ) -> Self { + let headers = HeaderMap::new(); + AutoscalingDeleteAutoscalingPolicy { + transport, + parts, + headers, + error_trace: None, + filter_path: None, + human: None, + pretty: None, + request_timeout: None, + source: None, + } + } + #[doc = "Include the stack trace of returned errors."] + pub fn error_trace(mut self, error_trace: bool) -> Self { + self.error_trace = Some(error_trace); + self + } + #[doc = "A comma-separated list of filters used to reduce the response."] + pub fn filter_path(mut self, filter_path: &'b [&'b str]) -> Self { + self.filter_path = Some(filter_path); + self + } + #[doc = "Adds a HTTP header"] + pub fn header(mut self, key: HeaderName, value: HeaderValue) -> Self { + self.headers.insert(key, value); + self + } + #[doc = "Return human readable values for statistics."] + pub fn human(mut self, human: bool) -> Self { + self.human = Some(human); + self + } + #[doc = "Pretty format the returned JSON response."] + pub fn pretty(mut self, pretty: bool) -> Self { + self.pretty = Some(pretty); + self + } + #[doc = "Sets a request timeout for this API call.\n\nThe timeout is applied from when the request starts connecting until the response body has finished."] + pub fn request_timeout(mut self, timeout: Duration) -> Self { + self.request_timeout = Some(timeout); + self + } + #[doc = "The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests."] + pub fn source(mut self, source: &'b str) -> Self { + self.source = Some(source); + self + } + #[doc = "Creates an asynchronous call to the Autoscaling Delete Autoscaling Policy API that can be awaited"] + pub async fn send(self) -> Result { + let path = self.parts.url(); + let method = Method::Delete; + let headers = self.headers; + let timeout = self.request_timeout; + let query_string = { + #[serde_with::skip_serializing_none] + #[derive(Serialize)] + struct QueryParams<'b> { + error_trace: Option, + #[serde(serialize_with = "crate::client::serialize_coll_qs")] + filter_path: Option<&'b [&'b str]>, + human: Option, + pretty: Option, + source: Option<&'b str>, + } + let query_params = QueryParams { + error_trace: self.error_trace, + filter_path: self.filter_path, + human: self.human, + pretty: self.pretty, + source: self.source, + }; + Some(query_params) + }; + let body = Option::<()>::None; + let response = self + .transport + .send(method, &path, headers, query_string.as_ref(), body, timeout) + .await?; + Ok(response) + } +} +#[derive(Debug, Clone, PartialEq)] +#[doc = "API parts for the Autoscaling Get Autoscaling Capacity API"] +pub enum AutoscalingGetAutoscalingCapacityParts { + #[doc = "No parts"] + None, +} +impl AutoscalingGetAutoscalingCapacityParts { + #[doc = "Builds a relative URL path to the Autoscaling Get Autoscaling Capacity API"] + pub fn url(self) -> Cow<'static, str> { + match self { + AutoscalingGetAutoscalingCapacityParts::None => "/_autoscaling/capacity".into(), + } + } +} +#[doc = "Builder for the [Autoscaling Get Autoscaling Capacity API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/autoscaling-get-autoscaling-capacity.html)\n\nGets the current autoscaling capacity based on the configured autoscaling policy. Designed for indirect use by ECE/ESS and ECK. Direct use is not supported."] +#[derive(Clone, Debug)] +pub struct AutoscalingGetAutoscalingCapacity<'a, 'b> { + transport: &'a Transport, + parts: AutoscalingGetAutoscalingCapacityParts, + error_trace: Option, + filter_path: Option<&'b [&'b str]>, + headers: HeaderMap, + human: Option, + pretty: Option, + request_timeout: Option, + source: Option<&'b str>, +} +impl<'a, 'b> AutoscalingGetAutoscalingCapacity<'a, 'b> { + #[doc = "Creates a new instance of [AutoscalingGetAutoscalingCapacity]"] + pub fn new(transport: &'a Transport) -> Self { + let headers = HeaderMap::new(); + AutoscalingGetAutoscalingCapacity { + transport, + parts: AutoscalingGetAutoscalingCapacityParts::None, + headers, + error_trace: None, + filter_path: None, + human: None, + pretty: None, + request_timeout: None, + source: None, + } + } + #[doc = "Include the stack trace of returned errors."] + pub fn error_trace(mut self, error_trace: bool) -> Self { + self.error_trace = Some(error_trace); + self + } + #[doc = "A comma-separated list of filters used to reduce the response."] + pub fn filter_path(mut self, filter_path: &'b [&'b str]) -> Self { + self.filter_path = Some(filter_path); + self + } + #[doc = "Adds a HTTP header"] + pub fn header(mut self, key: HeaderName, value: HeaderValue) -> Self { + self.headers.insert(key, value); + self + } + #[doc = "Return human readable values for statistics."] + pub fn human(mut self, human: bool) -> Self { + self.human = Some(human); + self + } + #[doc = "Pretty format the returned JSON response."] + pub fn pretty(mut self, pretty: bool) -> Self { + self.pretty = Some(pretty); + self + } + #[doc = "Sets a request timeout for this API call.\n\nThe timeout is applied from when the request starts connecting until the response body has finished."] + pub fn request_timeout(mut self, timeout: Duration) -> Self { + self.request_timeout = Some(timeout); + self + } + #[doc = "The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests."] + pub fn source(mut self, source: &'b str) -> Self { + self.source = Some(source); + self + } + #[doc = "Creates an asynchronous call to the Autoscaling Get Autoscaling Capacity API that can be awaited"] + pub async fn send(self) -> Result { + let path = self.parts.url(); + let method = Method::Get; + let headers = self.headers; + let timeout = self.request_timeout; + let query_string = { + #[serde_with::skip_serializing_none] + #[derive(Serialize)] + struct QueryParams<'b> { + error_trace: Option, + #[serde(serialize_with = "crate::client::serialize_coll_qs")] + filter_path: Option<&'b [&'b str]>, + human: Option, + pretty: Option, + source: Option<&'b str>, + } + let query_params = QueryParams { + error_trace: self.error_trace, + filter_path: self.filter_path, + human: self.human, + pretty: self.pretty, + source: self.source, + }; + Some(query_params) + }; + let body = Option::<()>::None; + let response = self + .transport + .send(method, &path, headers, query_string.as_ref(), body, timeout) + .await?; + Ok(response) + } +} +#[derive(Debug, Clone, PartialEq)] +#[doc = "API parts for the Autoscaling Get Autoscaling Policy API"] +pub enum AutoscalingGetAutoscalingPolicyParts<'b> { + #[doc = "Name"] + Name(&'b str), +} +impl<'b> AutoscalingGetAutoscalingPolicyParts<'b> { + #[doc = "Builds a relative URL path to the Autoscaling Get Autoscaling Policy API"] + pub fn url(self) -> Cow<'static, str> { + match self { + AutoscalingGetAutoscalingPolicyParts::Name(ref name) => { + let encoded_name: Cow = percent_encode(name.as_bytes(), PARTS_ENCODED).into(); + let mut p = String::with_capacity(21usize + encoded_name.len()); + p.push_str("/_autoscaling/policy/"); + p.push_str(encoded_name.as_ref()); + p.into() + } + } + } +} +#[doc = "Builder for the [Autoscaling Get Autoscaling Policy API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/autoscaling-get-autoscaling-policy.html)\n\nRetrieves an autoscaling policy. Designed for indirect use by ECE/ESS and ECK. Direct use is not supported."] +#[derive(Clone, Debug)] +pub struct AutoscalingGetAutoscalingPolicy<'a, 'b> { + transport: &'a Transport, + parts: AutoscalingGetAutoscalingPolicyParts<'b>, + error_trace: Option, + filter_path: Option<&'b [&'b str]>, + headers: HeaderMap, + human: Option, + pretty: Option, + request_timeout: Option, + source: Option<&'b str>, +} +impl<'a, 'b> AutoscalingGetAutoscalingPolicy<'a, 'b> { + #[doc = "Creates a new instance of [AutoscalingGetAutoscalingPolicy] with the specified API parts"] + pub fn new(transport: &'a Transport, parts: AutoscalingGetAutoscalingPolicyParts<'b>) -> Self { + let headers = HeaderMap::new(); + AutoscalingGetAutoscalingPolicy { + transport, + parts, + headers, + error_trace: None, + filter_path: None, + human: None, + pretty: None, + request_timeout: None, + source: None, + } + } + #[doc = "Include the stack trace of returned errors."] + pub fn error_trace(mut self, error_trace: bool) -> Self { + self.error_trace = Some(error_trace); + self + } + #[doc = "A comma-separated list of filters used to reduce the response."] + pub fn filter_path(mut self, filter_path: &'b [&'b str]) -> Self { + self.filter_path = Some(filter_path); + self + } + #[doc = "Adds a HTTP header"] + pub fn header(mut self, key: HeaderName, value: HeaderValue) -> Self { + self.headers.insert(key, value); + self + } + #[doc = "Return human readable values for statistics."] + pub fn human(mut self, human: bool) -> Self { + self.human = Some(human); + self + } + #[doc = "Pretty format the returned JSON response."] + pub fn pretty(mut self, pretty: bool) -> Self { + self.pretty = Some(pretty); + self + } + #[doc = "Sets a request timeout for this API call.\n\nThe timeout is applied from when the request starts connecting until the response body has finished."] + pub fn request_timeout(mut self, timeout: Duration) -> Self { + self.request_timeout = Some(timeout); + self + } + #[doc = "The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests."] + pub fn source(mut self, source: &'b str) -> Self { + self.source = Some(source); + self + } + #[doc = "Creates an asynchronous call to the Autoscaling Get Autoscaling Policy API that can be awaited"] + pub async fn send(self) -> Result { + let path = self.parts.url(); + let method = Method::Get; + let headers = self.headers; + let timeout = self.request_timeout; + let query_string = { + #[serde_with::skip_serializing_none] + #[derive(Serialize)] + struct QueryParams<'b> { + error_trace: Option, + #[serde(serialize_with = "crate::client::serialize_coll_qs")] + filter_path: Option<&'b [&'b str]>, + human: Option, + pretty: Option, + source: Option<&'b str>, + } + let query_params = QueryParams { + error_trace: self.error_trace, + filter_path: self.filter_path, + human: self.human, + pretty: self.pretty, + source: self.source, + }; + Some(query_params) + }; + let body = Option::<()>::None; + let response = self + .transport + .send(method, &path, headers, query_string.as_ref(), body, timeout) + .await?; + Ok(response) + } +} +#[derive(Debug, Clone, PartialEq)] +#[doc = "API parts for the Autoscaling Put Autoscaling Policy API"] +pub enum AutoscalingPutAutoscalingPolicyParts<'b> { + #[doc = "Name"] + Name(&'b str), +} +impl<'b> AutoscalingPutAutoscalingPolicyParts<'b> { + #[doc = "Builds a relative URL path to the Autoscaling Put Autoscaling Policy API"] + pub fn url(self) -> Cow<'static, str> { + match self { + AutoscalingPutAutoscalingPolicyParts::Name(ref name) => { + let encoded_name: Cow = percent_encode(name.as_bytes(), PARTS_ENCODED).into(); + let mut p = String::with_capacity(21usize + encoded_name.len()); + p.push_str("/_autoscaling/policy/"); + p.push_str(encoded_name.as_ref()); + p.into() + } + } + } +} +#[doc = "Builder for the [Autoscaling Put Autoscaling Policy API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/autoscaling-put-autoscaling-policy.html)\n\nCreates a new autoscaling policy. Designed for indirect use by ECE/ESS and ECK. Direct use is not supported."] +#[derive(Clone, Debug)] +pub struct AutoscalingPutAutoscalingPolicy<'a, 'b, B> { + transport: &'a Transport, + parts: AutoscalingPutAutoscalingPolicyParts<'b>, + body: Option, + error_trace: Option, + filter_path: Option<&'b [&'b str]>, + headers: HeaderMap, + human: Option, + pretty: Option, + request_timeout: Option, + source: Option<&'b str>, +} +impl<'a, 'b, B> AutoscalingPutAutoscalingPolicy<'a, 'b, B> +where + B: Body, +{ + #[doc = "Creates a new instance of [AutoscalingPutAutoscalingPolicy] with the specified API parts"] + pub fn new(transport: &'a Transport, parts: AutoscalingPutAutoscalingPolicyParts<'b>) -> Self { + let headers = HeaderMap::new(); + AutoscalingPutAutoscalingPolicy { + transport, + parts, + headers, + body: None, + error_trace: None, + filter_path: None, + human: None, + pretty: None, + request_timeout: None, + source: None, + } + } + #[doc = "The body for the API call"] + pub fn body(self, body: T) -> AutoscalingPutAutoscalingPolicy<'a, 'b, JsonBody> + where + T: Serialize, + { + AutoscalingPutAutoscalingPolicy { + transport: self.transport, + parts: self.parts, + body: Some(body.into()), + error_trace: self.error_trace, + filter_path: self.filter_path, + headers: self.headers, + human: self.human, + pretty: self.pretty, + request_timeout: self.request_timeout, + source: self.source, + } + } + #[doc = "Include the stack trace of returned errors."] + pub fn error_trace(mut self, error_trace: bool) -> Self { + self.error_trace = Some(error_trace); + self + } + #[doc = "A comma-separated list of filters used to reduce the response."] + pub fn filter_path(mut self, filter_path: &'b [&'b str]) -> Self { + self.filter_path = Some(filter_path); + self + } + #[doc = "Adds a HTTP header"] + pub fn header(mut self, key: HeaderName, value: HeaderValue) -> Self { + self.headers.insert(key, value); + self + } + #[doc = "Return human readable values for statistics."] + pub fn human(mut self, human: bool) -> Self { + self.human = Some(human); + self + } + #[doc = "Pretty format the returned JSON response."] + pub fn pretty(mut self, pretty: bool) -> Self { + self.pretty = Some(pretty); + self + } + #[doc = "Sets a request timeout for this API call.\n\nThe timeout is applied from when the request starts connecting until the response body has finished."] + pub fn request_timeout(mut self, timeout: Duration) -> Self { + self.request_timeout = Some(timeout); + self + } + #[doc = "The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests."] + pub fn source(mut self, source: &'b str) -> Self { + self.source = Some(source); + self + } + #[doc = "Creates an asynchronous call to the Autoscaling Put Autoscaling Policy API that can be awaited"] + pub async fn send(self) -> Result { + let path = self.parts.url(); + let method = Method::Put; + let headers = self.headers; + let timeout = self.request_timeout; + let query_string = { + #[serde_with::skip_serializing_none] + #[derive(Serialize)] + struct QueryParams<'b> { + error_trace: Option, + #[serde(serialize_with = "crate::client::serialize_coll_qs")] + filter_path: Option<&'b [&'b str]>, + human: Option, + pretty: Option, + source: Option<&'b str>, + } + let query_params = QueryParams { + error_trace: self.error_trace, + filter_path: self.filter_path, + human: self.human, + pretty: self.pretty, + source: self.source, + }; + Some(query_params) + }; + let body = self.body; + let response = self + .transport + .send(method, &path, headers, query_string.as_ref(), body, timeout) + .await?; + Ok(response) + } +} +#[doc = "Namespace client for Autoscaling APIs"] +pub struct Autoscaling<'a> { + transport: &'a Transport, +} +impl<'a> Autoscaling<'a> { + #[doc = "Creates a new instance of [Autoscaling]"] + pub fn new(transport: &'a Transport) -> Self { + Self { transport } + } + pub fn transport(&self) -> &Transport { + self.transport + } + #[doc = "[Autoscaling Delete Autoscaling Policy API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/autoscaling-delete-autoscaling-policy.html)\n\nDeletes an autoscaling policy. Designed for indirect use by ECE/ESS and ECK. Direct use is not supported."] + pub fn delete_autoscaling_policy<'b>( + &'a self, + parts: AutoscalingDeleteAutoscalingPolicyParts<'b>, + ) -> AutoscalingDeleteAutoscalingPolicy<'a, 'b> { + AutoscalingDeleteAutoscalingPolicy::new(self.transport(), parts) + } + #[doc = "[Autoscaling Get Autoscaling Capacity API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/autoscaling-get-autoscaling-capacity.html)\n\nGets the current autoscaling capacity based on the configured autoscaling policy. Designed for indirect use by ECE/ESS and ECK. Direct use is not supported."] + pub fn get_autoscaling_capacity<'b>(&'a self) -> AutoscalingGetAutoscalingCapacity<'a, 'b> { + AutoscalingGetAutoscalingCapacity::new(self.transport()) + } + #[doc = "[Autoscaling Get Autoscaling Policy API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/autoscaling-get-autoscaling-policy.html)\n\nRetrieves an autoscaling policy. Designed for indirect use by ECE/ESS and ECK. Direct use is not supported."] + pub fn get_autoscaling_policy<'b>( + &'a self, + parts: AutoscalingGetAutoscalingPolicyParts<'b>, + ) -> AutoscalingGetAutoscalingPolicy<'a, 'b> { + AutoscalingGetAutoscalingPolicy::new(self.transport(), parts) + } + #[doc = "[Autoscaling Put Autoscaling Policy API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/autoscaling-put-autoscaling-policy.html)\n\nCreates a new autoscaling policy. Designed for indirect use by ECE/ESS and ECK. Direct use is not supported."] + pub fn put_autoscaling_policy<'b>( + &'a self, + parts: AutoscalingPutAutoscalingPolicyParts<'b>, + ) -> AutoscalingPutAutoscalingPolicy<'a, 'b, ()> { + AutoscalingPutAutoscalingPolicy::new(self.transport(), parts) + } +} +impl Elasticsearch { + #[doc = "Creates a namespace client for Autoscaling APIs"] + pub fn autoscaling(&self) -> Autoscaling { + Autoscaling::new(self.transport()) + } +} diff --git a/elasticsearch/src/cat.rs b/elasticsearch/src/cat.rs index 1734b15b..eae6dbe5 100644 --- a/elasticsearch/src/cat.rs +++ b/elasticsearch/src/cat.rs @@ -119,7 +119,8 @@ //! ``` //! -# ! [ allow ( unused_imports ) ]use crate::{ +#![allow(unused_imports)] +use crate::{ client::Elasticsearch, error::Error, http::{ @@ -159,8 +160,8 @@ impl<'b> CatAliasesParts<'b> { } } } +#[doc = "Builder for the [Cat Aliases API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/cat-alias.html)\n\nShows information about currently configured aliases to indices including filter and routing infos."] #[derive(Clone, Debug)] -#[doc = "Builder for the [Cat Aliases API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/cat-alias.html)\n\nShows information about currently configured aliases to indices including filter and routing infos."] pub struct CatAliases<'a, 'b> { transport: &'a Transport, parts: CatAliasesParts<'b>, @@ -350,8 +351,8 @@ impl<'b> CatAllocationParts<'b> { } } } +#[doc = "Builder for the [Cat Allocation API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/cat-allocation.html)\n\nProvides a snapshot of how many shards are allocated to each data node and how much disk space they are using."] #[derive(Clone, Debug)] -#[doc = "Builder for the [Cat Allocation API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/cat-allocation.html)\n\nProvides a snapshot of how many shards are allocated to each data node and how much disk space they are using."] pub struct CatAllocation<'a, 'b> { transport: &'a Transport, parts: CatAllocationParts<'b>, @@ -549,8 +550,8 @@ impl<'b> CatCountParts<'b> { } } } +#[doc = "Builder for the [Cat Count API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/cat-count.html)\n\nProvides quick access to the document count of the entire cluster, or individual indices."] #[derive(Clone, Debug)] -#[doc = "Builder for the [Cat Count API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/cat-count.html)\n\nProvides quick access to the document count of the entire cluster, or individual indices."] pub struct CatCount<'a, 'b> { transport: &'a Transport, parts: CatCountParts<'b>, @@ -721,8 +722,8 @@ impl<'b> CatFielddataParts<'b> { } } } +#[doc = "Builder for the [Cat Fielddata API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/cat-fielddata.html)\n\nShows how much heap memory is currently being used by fielddata on every data node in the cluster."] #[derive(Clone, Debug)] -#[doc = "Builder for the [Cat Fielddata API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/cat-fielddata.html)\n\nShows how much heap memory is currently being used by fielddata on every data node in the cluster."] pub struct CatFielddata<'a, 'b> { transport: &'a Transport, parts: CatFielddataParts<'b>, @@ -901,8 +902,8 @@ impl CatHealthParts { } } } +#[doc = "Builder for the [Cat Health API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/cat-health.html)\n\nReturns a concise representation of the cluster health."] #[derive(Clone, Debug)] -#[doc = "Builder for the [Cat Health API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/cat-health.html)\n\nReturns a concise representation of the cluster health."] pub struct CatHealth<'a, 'b> { transport: &'a Transport, parts: CatHealthParts, @@ -1080,8 +1081,8 @@ impl CatHelpParts { } } } +#[doc = "Builder for the [Cat Help API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/cat.html)\n\nReturns help for the Cat APIs."] #[derive(Clone, Debug)] -#[doc = "Builder for the [Cat Help API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/cat.html)\n\nReturns help for the Cat APIs."] pub struct CatHelp<'a, 'b> { transport: &'a Transport, parts: CatHelpParts, @@ -1224,8 +1225,8 @@ impl<'b> CatIndicesParts<'b> { } } } +#[doc = "Builder for the [Cat Indices API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/cat-indices.html)\n\nReturns information about indices: number of primaries and replicas, document counts, disk size, ..."] #[derive(Clone, Debug)] -#[doc = "Builder for the [Cat Indices API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/cat-indices.html)\n\nReturns information about indices: number of primaries and replicas, document counts, disk size, ..."] pub struct CatIndices<'a, 'b> { transport: &'a Transport, parts: CatIndicesParts<'b>, @@ -1458,8 +1459,8 @@ impl CatMasterParts { } } } +#[doc = "Builder for the [Cat Master API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/cat-master.html)\n\nReturns information about the master node."] #[derive(Clone, Debug)] -#[doc = "Builder for the [Cat Master API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/cat-master.html)\n\nReturns information about the master node."] pub struct CatMaster<'a, 'b> { transport: &'a Transport, parts: CatMasterParts, @@ -1646,8 +1647,8 @@ impl<'b> CatMlDataFrameAnalyticsParts<'b> { } } } +#[doc = "Builder for the [Cat Ml Data Frame Analytics API](http://www.elastic.co/guide/en/elasticsearch/reference/7.11/cat-dfanalytics.html)\n\nGets configuration and usage information about data frame analytics jobs."] #[derive(Clone, Debug)] -#[doc = "Builder for the [Cat Ml Data Frame Analytics API](http://www.elastic.co/guide/en/elasticsearch/reference/7.10/cat-dfanalytics.html)\n\nGets configuration and usage information about data frame analytics jobs."] pub struct CatMlDataFrameAnalytics<'a, 'b> { transport: &'a Transport, parts: CatMlDataFrameAnalyticsParts<'b>, @@ -1844,8 +1845,8 @@ impl<'b> CatMlDatafeedsParts<'b> { } } } +#[doc = "Builder for the [Cat Ml Datafeeds API](http://www.elastic.co/guide/en/elasticsearch/reference/7.11/cat-datafeeds.html)\n\nGets configuration and usage information about datafeeds."] #[derive(Clone, Debug)] -#[doc = "Builder for the [Cat Ml Datafeeds API](http://www.elastic.co/guide/en/elasticsearch/reference/7.10/cat-datafeeds.html)\n\nGets configuration and usage information about datafeeds."] pub struct CatMlDatafeeds<'a, 'b> { transport: &'a Transport, parts: CatMlDatafeedsParts<'b>, @@ -2042,8 +2043,8 @@ impl<'b> CatMlJobsParts<'b> { } } } +#[doc = "Builder for the [Cat Ml Jobs API](http://www.elastic.co/guide/en/elasticsearch/reference/7.11/cat-anomaly-detectors.html)\n\nGets configuration and usage information about anomaly detection jobs."] #[derive(Clone, Debug)] -#[doc = "Builder for the [Cat Ml Jobs API](http://www.elastic.co/guide/en/elasticsearch/reference/7.10/cat-anomaly-detectors.html)\n\nGets configuration and usage information about anomaly detection jobs."] pub struct CatMlJobs<'a, 'b> { transport: &'a Transport, parts: CatMlJobsParts<'b>, @@ -2249,8 +2250,8 @@ impl<'b> CatMlTrainedModelsParts<'b> { } } } +#[doc = "Builder for the [Cat Ml Trained Models API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/cat-trained-model.html)\n\nGets configuration and usage information about inference trained models."] #[derive(Clone, Debug)] -#[doc = "Builder for the [Cat Ml Trained Models API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/cat-trained-model.html)\n\nGets configuration and usage information about inference trained models."] pub struct CatMlTrainedModels<'a, 'b> { transport: &'a Transport, parts: CatMlTrainedModelsParts<'b>, @@ -2455,8 +2456,8 @@ impl CatNodeattrsParts { } } } +#[doc = "Builder for the [Cat Nodeattrs API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/cat-nodeattrs.html)\n\nReturns information about custom node attributes."] #[derive(Clone, Debug)] -#[doc = "Builder for the [Cat Nodeattrs API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/cat-nodeattrs.html)\n\nReturns information about custom node attributes."] pub struct CatNodeattrs<'a, 'b> { transport: &'a Transport, parts: CatNodeattrsParts, @@ -2634,8 +2635,8 @@ impl CatNodesParts { } } } +#[doc = "Builder for the [Cat Nodes API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/cat-nodes.html)\n\nReturns basic statistics about performance of cluster nodes."] #[derive(Clone, Debug)] -#[doc = "Builder for the [Cat Nodes API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/cat-nodes.html)\n\nReturns basic statistics about performance of cluster nodes."] pub struct CatNodes<'a, 'b> { transport: &'a Transport, parts: CatNodesParts, @@ -2840,8 +2841,8 @@ impl CatPendingTasksParts { } } } +#[doc = "Builder for the [Cat Pending Tasks API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/cat-pending-tasks.html)\n\nReturns a concise representation of the cluster pending tasks."] #[derive(Clone, Debug)] -#[doc = "Builder for the [Cat Pending Tasks API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/cat-pending-tasks.html)\n\nReturns a concise representation of the cluster pending tasks."] pub struct CatPendingTasks<'a, 'b> { transport: &'a Transport, parts: CatPendingTasksParts, @@ -3028,8 +3029,8 @@ impl CatPluginsParts { } } } +#[doc = "Builder for the [Cat Plugins API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/cat-plugins.html)\n\nReturns information about installed plugins across nodes node."] #[derive(Clone, Debug)] -#[doc = "Builder for the [Cat Plugins API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/cat-plugins.html)\n\nReturns information about installed plugins across nodes node."] pub struct CatPlugins<'a, 'b> { transport: &'a Transport, parts: CatPluginsParts, @@ -3040,6 +3041,7 @@ pub struct CatPlugins<'a, 'b> { headers: HeaderMap, help: Option, human: Option, + include_bootstrap: Option, local: Option, master_timeout: Option<&'b str>, pretty: Option, @@ -3064,6 +3066,7 @@ impl<'a, 'b> CatPlugins<'a, 'b> { h: None, help: None, human: None, + include_bootstrap: None, local: None, master_timeout: None, pretty: None, @@ -3108,6 +3111,11 @@ impl<'a, 'b> CatPlugins<'a, 'b> { self.human = Some(human); self } + #[doc = "Include bootstrap plugins in the response"] + pub fn include_bootstrap(mut self, include_bootstrap: bool) -> Self { + self.include_bootstrap = Some(include_bootstrap); + self + } #[doc = "Return local information, do not retrieve the state from master node (default: false)"] pub fn local(mut self, local: bool) -> Self { self.local = Some(local); @@ -3161,6 +3169,7 @@ impl<'a, 'b> CatPlugins<'a, 'b> { h: Option<&'b [&'b str]>, help: Option, human: Option, + include_bootstrap: Option, local: Option, master_timeout: Option<&'b str>, pretty: Option, @@ -3176,6 +3185,7 @@ impl<'a, 'b> CatPlugins<'a, 'b> { h: self.h, help: self.help, human: self.human, + include_bootstrap: self.include_bootstrap, local: self.local, master_timeout: self.master_timeout, pretty: self.pretty, @@ -3218,8 +3228,8 @@ impl<'b> CatRecoveryParts<'b> { } } } +#[doc = "Builder for the [Cat Recovery API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/cat-recovery.html)\n\nReturns information about index shard recoveries, both on-going completed."] #[derive(Clone, Debug)] -#[doc = "Builder for the [Cat Recovery API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/cat-recovery.html)\n\nReturns information about index shard recoveries, both on-going completed."] pub struct CatRecovery<'a, 'b> { transport: &'a Transport, parts: CatRecoveryParts<'b>, @@ -3425,8 +3435,8 @@ impl CatRepositoriesParts { } } } +#[doc = "Builder for the [Cat Repositories API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/cat-repositories.html)\n\nReturns information about snapshot repositories registered in the cluster."] #[derive(Clone, Debug)] -#[doc = "Builder for the [Cat Repositories API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/cat-repositories.html)\n\nReturns information about snapshot repositories registered in the cluster."] pub struct CatRepositories<'a, 'b> { transport: &'a Transport, parts: CatRepositoriesParts, @@ -3615,8 +3625,8 @@ impl<'b> CatSegmentsParts<'b> { } } } +#[doc = "Builder for the [Cat Segments API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/cat-segments.html)\n\nProvides low-level information about the segments in the shards of an index."] #[derive(Clone, Debug)] -#[doc = "Builder for the [Cat Segments API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/cat-segments.html)\n\nProvides low-level information about the segments in the shards of an index."] pub struct CatSegments<'a, 'b> { transport: &'a Transport, parts: CatSegmentsParts<'b>, @@ -3796,8 +3806,8 @@ impl<'b> CatShardsParts<'b> { } } } +#[doc = "Builder for the [Cat Shards API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/cat-shards.html)\n\nProvides a detailed view of shard allocation on nodes."] #[derive(Clone, Debug)] -#[doc = "Builder for the [Cat Shards API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/cat-shards.html)\n\nProvides a detailed view of shard allocation on nodes."] pub struct CatShards<'a, 'b> { transport: &'a Transport, parts: CatShardsParts<'b>, @@ -4004,8 +4014,8 @@ impl<'b> CatSnapshotsParts<'b> { } } } +#[doc = "Builder for the [Cat Snapshots API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/cat-snapshots.html)\n\nReturns all snapshots in a specific repository."] #[derive(Clone, Debug)] -#[doc = "Builder for the [Cat Snapshots API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/cat-snapshots.html)\n\nReturns all snapshots in a specific repository."] pub struct CatSnapshots<'a, 'b> { transport: &'a Transport, parts: CatSnapshotsParts<'b>, @@ -4192,8 +4202,8 @@ impl CatTasksParts { } } } +#[doc = "Builder for the [Cat Tasks API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/tasks.html)\n\nReturns information about the tasks currently executing on one or more nodes in the cluster."] #[derive(Clone, Debug)] -#[doc = "Builder for the [Cat Tasks API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/tasks.html)\n\nReturns information about the tasks currently executing on one or more nodes in the cluster."] pub struct CatTasks<'a, 'b> { transport: &'a Transport, parts: CatTasksParts, @@ -4206,8 +4216,8 @@ pub struct CatTasks<'a, 'b> { headers: HeaderMap, help: Option, human: Option, - node_id: Option<&'b [&'b str]>, - parent_task: Option, + nodes: Option<&'b [&'b str]>, + parent_task_id: Option<&'b str>, pretty: Option, request_timeout: Option, s: Option<&'b [&'b str]>, @@ -4233,8 +4243,8 @@ impl<'a, 'b> CatTasks<'a, 'b> { h: None, help: None, human: None, - node_id: None, - parent_task: None, + nodes: None, + parent_task_id: None, pretty: None, request_timeout: None, s: None, @@ -4289,13 +4299,13 @@ impl<'a, 'b> CatTasks<'a, 'b> { self } #[doc = "A comma-separated list of node IDs or names to limit the returned information; use `_local` to return information from the node you're connecting to, leave empty to get information from all nodes"] - pub fn node_id(mut self, node_id: &'b [&'b str]) -> Self { - self.node_id = Some(node_id); + pub fn nodes(mut self, nodes: &'b [&'b str]) -> Self { + self.nodes = Some(nodes); self } - #[doc = "Return tasks with specified parent task id. Set to -1 to return all."] - pub fn parent_task(mut self, parent_task: i64) -> Self { - self.parent_task = Some(parent_task); + #[doc = "Return tasks with specified parent task id (node_id:task_number). Set to -1 to return all."] + pub fn parent_task_id(mut self, parent_task_id: &'b str) -> Self { + self.parent_task_id = Some(parent_task_id); self } #[doc = "Pretty format the returned JSON response."] @@ -4350,8 +4360,8 @@ impl<'a, 'b> CatTasks<'a, 'b> { help: Option, human: Option, #[serde(serialize_with = "crate::client::serialize_coll_qs")] - node_id: Option<&'b [&'b str]>, - parent_task: Option, + nodes: Option<&'b [&'b str]>, + parent_task_id: Option<&'b str>, pretty: Option, #[serde(serialize_with = "crate::client::serialize_coll_qs")] s: Option<&'b [&'b str]>, @@ -4368,8 +4378,8 @@ impl<'a, 'b> CatTasks<'a, 'b> { h: self.h, help: self.help, human: self.human, - node_id: self.node_id, - parent_task: self.parent_task, + nodes: self.nodes, + parent_task_id: self.parent_task_id, pretty: self.pretty, s: self.s, source: self.source, @@ -4409,8 +4419,8 @@ impl<'b> CatTemplatesParts<'b> { } } } +#[doc = "Builder for the [Cat Templates API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/cat-templates.html)\n\nReturns information about existing templates."] #[derive(Clone, Debug)] -#[doc = "Builder for the [Cat Templates API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/cat-templates.html)\n\nReturns information about existing templates."] pub struct CatTemplates<'a, 'b> { transport: &'a Transport, parts: CatTemplatesParts<'b>, @@ -4599,8 +4609,8 @@ impl<'b> CatThreadPoolParts<'b> { } } } +#[doc = "Builder for the [Cat Thread Pool API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/cat-thread-pool.html)\n\nReturns cluster-wide thread pool statistics per node.\nBy default the active, queue and rejected statistics are returned for all thread pools."] #[derive(Clone, Debug)] -#[doc = "Builder for the [Cat Thread Pool API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/cat-thread-pool.html)\n\nReturns cluster-wide thread pool statistics per node.\nBy default the active, queue and rejected statistics are returned for all thread pools."] pub struct CatThreadPool<'a, 'b> { transport: &'a Transport, parts: CatThreadPoolParts<'b>, @@ -4797,8 +4807,8 @@ impl<'b> CatTransformsParts<'b> { } } } +#[doc = "Builder for the [Cat Transforms API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/cat-transforms.html)\n\nGets configuration and usage information about transforms."] #[derive(Clone, Debug)] -#[doc = "Builder for the [Cat Transforms API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/cat-transforms.html)\n\nGets configuration and usage information about transforms."] pub struct CatTransforms<'a, 'b> { transport: &'a Transport, parts: CatTransformsParts<'b>, @@ -4992,109 +5002,109 @@ impl<'a> Cat<'a> { pub fn transport(&self) -> &Transport { self.transport } - #[doc = "[Cat Aliases API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/cat-alias.html)\n\nShows information about currently configured aliases to indices including filter and routing infos."] + #[doc = "[Cat Aliases API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/cat-alias.html)\n\nShows information about currently configured aliases to indices including filter and routing infos."] pub fn aliases<'b>(&'a self, parts: CatAliasesParts<'b>) -> CatAliases<'a, 'b> { CatAliases::new(self.transport(), parts) } - #[doc = "[Cat Allocation API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/cat-allocation.html)\n\nProvides a snapshot of how many shards are allocated to each data node and how much disk space they are using."] + #[doc = "[Cat Allocation API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/cat-allocation.html)\n\nProvides a snapshot of how many shards are allocated to each data node and how much disk space they are using."] pub fn allocation<'b>(&'a self, parts: CatAllocationParts<'b>) -> CatAllocation<'a, 'b> { CatAllocation::new(self.transport(), parts) } - #[doc = "[Cat Count API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/cat-count.html)\n\nProvides quick access to the document count of the entire cluster, or individual indices."] + #[doc = "[Cat Count API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/cat-count.html)\n\nProvides quick access to the document count of the entire cluster, or individual indices."] pub fn count<'b>(&'a self, parts: CatCountParts<'b>) -> CatCount<'a, 'b> { CatCount::new(self.transport(), parts) } - #[doc = "[Cat Fielddata API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/cat-fielddata.html)\n\nShows how much heap memory is currently being used by fielddata on every data node in the cluster."] + #[doc = "[Cat Fielddata API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/cat-fielddata.html)\n\nShows how much heap memory is currently being used by fielddata on every data node in the cluster."] pub fn fielddata<'b>(&'a self, parts: CatFielddataParts<'b>) -> CatFielddata<'a, 'b> { CatFielddata::new(self.transport(), parts) } - #[doc = "[Cat Health API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/cat-health.html)\n\nReturns a concise representation of the cluster health."] + #[doc = "[Cat Health API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/cat-health.html)\n\nReturns a concise representation of the cluster health."] pub fn health<'b>(&'a self) -> CatHealth<'a, 'b> { CatHealth::new(self.transport()) } - #[doc = "[Cat Help API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/cat.html)\n\nReturns help for the Cat APIs."] + #[doc = "[Cat Help API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/cat.html)\n\nReturns help for the Cat APIs."] pub fn help<'b>(&'a self) -> CatHelp<'a, 'b> { CatHelp::new(self.transport()) } - #[doc = "[Cat Indices API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/cat-indices.html)\n\nReturns information about indices: number of primaries and replicas, document counts, disk size, ..."] + #[doc = "[Cat Indices API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/cat-indices.html)\n\nReturns information about indices: number of primaries and replicas, document counts, disk size, ..."] pub fn indices<'b>(&'a self, parts: CatIndicesParts<'b>) -> CatIndices<'a, 'b> { CatIndices::new(self.transport(), parts) } - #[doc = "[Cat Master API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/cat-master.html)\n\nReturns information about the master node."] + #[doc = "[Cat Master API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/cat-master.html)\n\nReturns information about the master node."] pub fn master<'b>(&'a self) -> CatMaster<'a, 'b> { CatMaster::new(self.transport()) } - #[doc = "[Cat Ml Data Frame Analytics API](http://www.elastic.co/guide/en/elasticsearch/reference/7.10/cat-dfanalytics.html)\n\nGets configuration and usage information about data frame analytics jobs."] + #[doc = "[Cat Ml Data Frame Analytics API](http://www.elastic.co/guide/en/elasticsearch/reference/7.11/cat-dfanalytics.html)\n\nGets configuration and usage information about data frame analytics jobs."] pub fn ml_data_frame_analytics<'b>( &'a self, parts: CatMlDataFrameAnalyticsParts<'b>, ) -> CatMlDataFrameAnalytics<'a, 'b> { CatMlDataFrameAnalytics::new(self.transport(), parts) } - #[doc = "[Cat Ml Datafeeds API](http://www.elastic.co/guide/en/elasticsearch/reference/7.10/cat-datafeeds.html)\n\nGets configuration and usage information about datafeeds."] + #[doc = "[Cat Ml Datafeeds API](http://www.elastic.co/guide/en/elasticsearch/reference/7.11/cat-datafeeds.html)\n\nGets configuration and usage information about datafeeds."] pub fn ml_datafeeds<'b>(&'a self, parts: CatMlDatafeedsParts<'b>) -> CatMlDatafeeds<'a, 'b> { CatMlDatafeeds::new(self.transport(), parts) } - #[doc = "[Cat Ml Jobs API](http://www.elastic.co/guide/en/elasticsearch/reference/7.10/cat-anomaly-detectors.html)\n\nGets configuration and usage information about anomaly detection jobs."] + #[doc = "[Cat Ml Jobs API](http://www.elastic.co/guide/en/elasticsearch/reference/7.11/cat-anomaly-detectors.html)\n\nGets configuration and usage information about anomaly detection jobs."] pub fn ml_jobs<'b>(&'a self, parts: CatMlJobsParts<'b>) -> CatMlJobs<'a, 'b> { CatMlJobs::new(self.transport(), parts) } - #[doc = "[Cat Ml Trained Models API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/cat-trained-model.html)\n\nGets configuration and usage information about inference trained models."] + #[doc = "[Cat Ml Trained Models API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/cat-trained-model.html)\n\nGets configuration and usage information about inference trained models."] pub fn ml_trained_models<'b>( &'a self, parts: CatMlTrainedModelsParts<'b>, ) -> CatMlTrainedModels<'a, 'b> { CatMlTrainedModels::new(self.transport(), parts) } - #[doc = "[Cat Nodeattrs API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/cat-nodeattrs.html)\n\nReturns information about custom node attributes."] + #[doc = "[Cat Nodeattrs API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/cat-nodeattrs.html)\n\nReturns information about custom node attributes."] pub fn nodeattrs<'b>(&'a self) -> CatNodeattrs<'a, 'b> { CatNodeattrs::new(self.transport()) } - #[doc = "[Cat Nodes API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/cat-nodes.html)\n\nReturns basic statistics about performance of cluster nodes."] + #[doc = "[Cat Nodes API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/cat-nodes.html)\n\nReturns basic statistics about performance of cluster nodes."] pub fn nodes<'b>(&'a self) -> CatNodes<'a, 'b> { CatNodes::new(self.transport()) } - #[doc = "[Cat Pending Tasks API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/cat-pending-tasks.html)\n\nReturns a concise representation of the cluster pending tasks."] + #[doc = "[Cat Pending Tasks API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/cat-pending-tasks.html)\n\nReturns a concise representation of the cluster pending tasks."] pub fn pending_tasks<'b>(&'a self) -> CatPendingTasks<'a, 'b> { CatPendingTasks::new(self.transport()) } - #[doc = "[Cat Plugins API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/cat-plugins.html)\n\nReturns information about installed plugins across nodes node."] + #[doc = "[Cat Plugins API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/cat-plugins.html)\n\nReturns information about installed plugins across nodes node."] pub fn plugins<'b>(&'a self) -> CatPlugins<'a, 'b> { CatPlugins::new(self.transport()) } - #[doc = "[Cat Recovery API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/cat-recovery.html)\n\nReturns information about index shard recoveries, both on-going completed."] + #[doc = "[Cat Recovery API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/cat-recovery.html)\n\nReturns information about index shard recoveries, both on-going completed."] pub fn recovery<'b>(&'a self, parts: CatRecoveryParts<'b>) -> CatRecovery<'a, 'b> { CatRecovery::new(self.transport(), parts) } - #[doc = "[Cat Repositories API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/cat-repositories.html)\n\nReturns information about snapshot repositories registered in the cluster."] + #[doc = "[Cat Repositories API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/cat-repositories.html)\n\nReturns information about snapshot repositories registered in the cluster."] pub fn repositories<'b>(&'a self) -> CatRepositories<'a, 'b> { CatRepositories::new(self.transport()) } - #[doc = "[Cat Segments API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/cat-segments.html)\n\nProvides low-level information about the segments in the shards of an index."] + #[doc = "[Cat Segments API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/cat-segments.html)\n\nProvides low-level information about the segments in the shards of an index."] pub fn segments<'b>(&'a self, parts: CatSegmentsParts<'b>) -> CatSegments<'a, 'b> { CatSegments::new(self.transport(), parts) } - #[doc = "[Cat Shards API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/cat-shards.html)\n\nProvides a detailed view of shard allocation on nodes."] + #[doc = "[Cat Shards API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/cat-shards.html)\n\nProvides a detailed view of shard allocation on nodes."] pub fn shards<'b>(&'a self, parts: CatShardsParts<'b>) -> CatShards<'a, 'b> { CatShards::new(self.transport(), parts) } - #[doc = "[Cat Snapshots API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/cat-snapshots.html)\n\nReturns all snapshots in a specific repository."] + #[doc = "[Cat Snapshots API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/cat-snapshots.html)\n\nReturns all snapshots in a specific repository."] pub fn snapshots<'b>(&'a self, parts: CatSnapshotsParts<'b>) -> CatSnapshots<'a, 'b> { CatSnapshots::new(self.transport(), parts) } - #[doc = "[Cat Tasks API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/tasks.html)\n\nReturns information about the tasks currently executing on one or more nodes in the cluster."] + #[doc = "[Cat Tasks API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/tasks.html)\n\nReturns information about the tasks currently executing on one or more nodes in the cluster."] pub fn tasks<'b>(&'a self) -> CatTasks<'a, 'b> { CatTasks::new(self.transport()) } - #[doc = "[Cat Templates API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/cat-templates.html)\n\nReturns information about existing templates."] + #[doc = "[Cat Templates API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/cat-templates.html)\n\nReturns information about existing templates."] pub fn templates<'b>(&'a self, parts: CatTemplatesParts<'b>) -> CatTemplates<'a, 'b> { CatTemplates::new(self.transport(), parts) } - #[doc = "[Cat Thread Pool API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/cat-thread-pool.html)\n\nReturns cluster-wide thread pool statistics per node.\nBy default the active, queue and rejected statistics are returned for all thread pools."] + #[doc = "[Cat Thread Pool API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/cat-thread-pool.html)\n\nReturns cluster-wide thread pool statistics per node.\nBy default the active, queue and rejected statistics are returned for all thread pools."] pub fn thread_pool<'b>(&'a self, parts: CatThreadPoolParts<'b>) -> CatThreadPool<'a, 'b> { CatThreadPool::new(self.transport(), parts) } - #[doc = "[Cat Transforms API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/cat-transforms.html)\n\nGets configuration and usage information about transforms."] + #[doc = "[Cat Transforms API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/cat-transforms.html)\n\nGets configuration and usage information about transforms."] pub fn transforms<'b>(&'a self, parts: CatTransformsParts<'b>) -> CatTransforms<'a, 'b> { CatTransforms::new(self.transport(), parts) } diff --git a/elasticsearch/src/ccr.rs b/elasticsearch/src/ccr.rs index 291e3ce3..c1a2c658 100644 --- a/elasticsearch/src/ccr.rs +++ b/elasticsearch/src/ccr.rs @@ -32,7 +32,8 @@ //! - Disaster recovery in case a primary cluster fails. A secondary cluster can serve as a hot backup //! - Geo-proximity so that reads can be served locally -# ! [ allow ( unused_imports ) ]use crate::{ +#![allow(unused_imports)] +use crate::{ client::Elasticsearch, error::Error, http::{ @@ -67,8 +68,8 @@ impl<'b> CcrDeleteAutoFollowPatternParts<'b> { } } } +#[doc = "Builder for the [Ccr Delete Auto Follow Pattern API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/ccr-delete-auto-follow-pattern.html)\n\nDeletes auto-follow patterns."] #[derive(Clone, Debug)] -#[doc = "Builder for the [Ccr Delete Auto Follow Pattern API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/ccr-delete-auto-follow-pattern.html)\n\nDeletes auto-follow patterns."] pub struct CcrDeleteAutoFollowPattern<'a, 'b> { transport: &'a Transport, parts: CcrDeleteAutoFollowPatternParts<'b>, @@ -187,8 +188,8 @@ impl<'b> CcrFollowParts<'b> { } } } +#[doc = "Builder for the [Ccr Follow API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/ccr-put-follow.html)\n\nCreates a new follower index configured to follow the referenced leader index."] #[derive(Clone, Debug)] -#[doc = "Builder for the [Ccr Follow API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/ccr-put-follow.html)\n\nCreates a new follower index configured to follow the referenced leader index."] pub struct CcrFollow<'a, 'b, B> { transport: &'a Transport, parts: CcrFollowParts<'b>, @@ -341,8 +342,8 @@ impl<'b> CcrFollowInfoParts<'b> { } } } +#[doc = "Builder for the [Ccr Follow Info API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/ccr-get-follow-info.html)\n\nRetrieves information about all follower indices, including parameters and status for each follower index"] #[derive(Clone, Debug)] -#[doc = "Builder for the [Ccr Follow Info API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/ccr-get-follow-info.html)\n\nRetrieves information about all follower indices, including parameters and status for each follower index"] pub struct CcrFollowInfo<'a, 'b> { transport: &'a Transport, parts: CcrFollowInfoParts<'b>, @@ -462,8 +463,8 @@ impl<'b> CcrFollowStatsParts<'b> { } } } +#[doc = "Builder for the [Ccr Follow Stats API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/ccr-get-follow-stats.html)\n\nRetrieves follower stats. return shard-level stats about the following tasks associated with each shard for the specified indices."] #[derive(Clone, Debug)] -#[doc = "Builder for the [Ccr Follow Stats API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/ccr-get-follow-stats.html)\n\nRetrieves follower stats. return shard-level stats about the following tasks associated with each shard for the specified indices."] pub struct CcrFollowStats<'a, 'b> { transport: &'a Transport, parts: CcrFollowStatsParts<'b>, @@ -582,8 +583,8 @@ impl<'b> CcrForgetFollowerParts<'b> { } } } +#[doc = "Builder for the [Ccr Forget Follower API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/ccr-post-forget-follower.html)\n\nRemoves the follower retention leases from the leader."] #[derive(Clone, Debug)] -#[doc = "Builder for the [Ccr Forget Follower API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/ccr-post-forget-follower.html)\n\nRemoves the follower retention leases from the leader."] pub struct CcrForgetFollower<'a, 'b, B> { transport: &'a Transport, parts: CcrForgetFollowerParts<'b>, @@ -726,8 +727,8 @@ impl<'b> CcrGetAutoFollowPatternParts<'b> { } } } +#[doc = "Builder for the [Ccr Get Auto Follow Pattern API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/ccr-get-auto-follow-pattern.html)\n\nGets configured auto-follow patterns. Returns the specified auto-follow pattern collection."] #[derive(Clone, Debug)] -#[doc = "Builder for the [Ccr Get Auto Follow Pattern API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/ccr-get-auto-follow-pattern.html)\n\nGets configured auto-follow patterns. Returns the specified auto-follow pattern collection."] pub struct CcrGetAutoFollowPattern<'a, 'b> { transport: &'a Transport, parts: CcrGetAutoFollowPatternParts<'b>, @@ -845,8 +846,8 @@ impl<'b> CcrPauseAutoFollowPatternParts<'b> { } } } +#[doc = "Builder for the [Ccr Pause Auto Follow Pattern API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/ccr-pause-auto-follow-pattern.html)\n\nPauses an auto-follow pattern"] #[derive(Clone, Debug)] -#[doc = "Builder for the [Ccr Pause Auto Follow Pattern API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/ccr-pause-auto-follow-pattern.html)\n\nPauses an auto-follow pattern"] pub struct CcrPauseAutoFollowPattern<'a, 'b, B> { transport: &'a Transport, parts: CcrPauseAutoFollowPatternParts<'b>, @@ -988,8 +989,8 @@ impl<'b> CcrPauseFollowParts<'b> { } } } +#[doc = "Builder for the [Ccr Pause Follow API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/ccr-post-pause-follow.html)\n\nPauses a follower index. The follower index will not fetch any additional operations from the leader index."] #[derive(Clone, Debug)] -#[doc = "Builder for the [Ccr Pause Follow API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/ccr-post-pause-follow.html)\n\nPauses a follower index. The follower index will not fetch any additional operations from the leader index."] pub struct CcrPauseFollow<'a, 'b, B> { transport: &'a Transport, parts: CcrPauseFollowParts<'b>, @@ -1129,8 +1130,8 @@ impl<'b> CcrPutAutoFollowPatternParts<'b> { } } } +#[doc = "Builder for the [Ccr Put Auto Follow Pattern API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/ccr-put-auto-follow-pattern.html)\n\nCreates a new named collection of auto-follow patterns against a specified remote cluster. Newly created indices on the remote cluster matching any of the specified patterns will be automatically configured as follower indices."] #[derive(Clone, Debug)] -#[doc = "Builder for the [Ccr Put Auto Follow Pattern API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/ccr-put-auto-follow-pattern.html)\n\nCreates a new named collection of auto-follow patterns against a specified remote cluster. Newly created indices on the remote cluster matching any of the specified patterns will be automatically configured as follower indices."] pub struct CcrPutAutoFollowPattern<'a, 'b, B> { transport: &'a Transport, parts: CcrPutAutoFollowPatternParts<'b>, @@ -1271,8 +1272,8 @@ impl<'b> CcrResumeAutoFollowPatternParts<'b> { } } } +#[doc = "Builder for the [Ccr Resume Auto Follow Pattern API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/ccr-resume-auto-follow-pattern.html)\n\nResumes an auto-follow pattern that has been paused"] #[derive(Clone, Debug)] -#[doc = "Builder for the [Ccr Resume Auto Follow Pattern API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/ccr-resume-auto-follow-pattern.html)\n\nResumes an auto-follow pattern that has been paused"] pub struct CcrResumeAutoFollowPattern<'a, 'b, B> { transport: &'a Transport, parts: CcrResumeAutoFollowPatternParts<'b>, @@ -1414,8 +1415,8 @@ impl<'b> CcrResumeFollowParts<'b> { } } } +#[doc = "Builder for the [Ccr Resume Follow API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/ccr-post-resume-follow.html)\n\nResumes a follower index that has been paused"] #[derive(Clone, Debug)] -#[doc = "Builder for the [Ccr Resume Follow API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/ccr-post-resume-follow.html)\n\nResumes a follower index that has been paused"] pub struct CcrResumeFollow<'a, 'b, B> { transport: &'a Transport, parts: CcrResumeFollowParts<'b>, @@ -1549,8 +1550,8 @@ impl CcrStatsParts { } } } +#[doc = "Builder for the [Ccr Stats API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/ccr-get-stats.html)\n\nGets all stats related to cross-cluster replication."] #[derive(Clone, Debug)] -#[doc = "Builder for the [Ccr Stats API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/ccr-get-stats.html)\n\nGets all stats related to cross-cluster replication."] pub struct CcrStats<'a, 'b> { transport: &'a Transport, parts: CcrStatsParts, @@ -1669,8 +1670,8 @@ impl<'b> CcrUnfollowParts<'b> { } } } +#[doc = "Builder for the [Ccr Unfollow API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/ccr-post-unfollow.html)\n\nStops the following task associated with a follower index and removes index metadata and settings associated with cross-cluster replication."] #[derive(Clone, Debug)] -#[doc = "Builder for the [Ccr Unfollow API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/ccr-post-unfollow.html)\n\nStops the following task associated with a follower index and removes index metadata and settings associated with cross-cluster replication."] pub struct CcrUnfollow<'a, 'b, B> { transport: &'a Transport, parts: CcrUnfollowParts<'b>, @@ -1802,79 +1803,79 @@ impl<'a> Ccr<'a> { pub fn transport(&self) -> &Transport { self.transport } - #[doc = "[Ccr Delete Auto Follow Pattern API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/ccr-delete-auto-follow-pattern.html)\n\nDeletes auto-follow patterns."] + #[doc = "[Ccr Delete Auto Follow Pattern API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/ccr-delete-auto-follow-pattern.html)\n\nDeletes auto-follow patterns."] pub fn delete_auto_follow_pattern<'b>( &'a self, parts: CcrDeleteAutoFollowPatternParts<'b>, ) -> CcrDeleteAutoFollowPattern<'a, 'b> { CcrDeleteAutoFollowPattern::new(self.transport(), parts) } - #[doc = "[Ccr Follow API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/ccr-put-follow.html)\n\nCreates a new follower index configured to follow the referenced leader index."] + #[doc = "[Ccr Follow API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/ccr-put-follow.html)\n\nCreates a new follower index configured to follow the referenced leader index."] pub fn follow<'b>(&'a self, parts: CcrFollowParts<'b>) -> CcrFollow<'a, 'b, ()> { CcrFollow::new(self.transport(), parts) } - #[doc = "[Ccr Follow Info API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/ccr-get-follow-info.html)\n\nRetrieves information about all follower indices, including parameters and status for each follower index"] + #[doc = "[Ccr Follow Info API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/ccr-get-follow-info.html)\n\nRetrieves information about all follower indices, including parameters and status for each follower index"] pub fn follow_info<'b>(&'a self, parts: CcrFollowInfoParts<'b>) -> CcrFollowInfo<'a, 'b> { CcrFollowInfo::new(self.transport(), parts) } - #[doc = "[Ccr Follow Stats API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/ccr-get-follow-stats.html)\n\nRetrieves follower stats. return shard-level stats about the following tasks associated with each shard for the specified indices."] + #[doc = "[Ccr Follow Stats API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/ccr-get-follow-stats.html)\n\nRetrieves follower stats. return shard-level stats about the following tasks associated with each shard for the specified indices."] pub fn follow_stats<'b>(&'a self, parts: CcrFollowStatsParts<'b>) -> CcrFollowStats<'a, 'b> { CcrFollowStats::new(self.transport(), parts) } - #[doc = "[Ccr Forget Follower API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/ccr-post-forget-follower.html)\n\nRemoves the follower retention leases from the leader."] + #[doc = "[Ccr Forget Follower API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/ccr-post-forget-follower.html)\n\nRemoves the follower retention leases from the leader."] pub fn forget_follower<'b>( &'a self, parts: CcrForgetFollowerParts<'b>, ) -> CcrForgetFollower<'a, 'b, ()> { CcrForgetFollower::new(self.transport(), parts) } - #[doc = "[Ccr Get Auto Follow Pattern API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/ccr-get-auto-follow-pattern.html)\n\nGets configured auto-follow patterns. Returns the specified auto-follow pattern collection."] + #[doc = "[Ccr Get Auto Follow Pattern API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/ccr-get-auto-follow-pattern.html)\n\nGets configured auto-follow patterns. Returns the specified auto-follow pattern collection."] pub fn get_auto_follow_pattern<'b>( &'a self, parts: CcrGetAutoFollowPatternParts<'b>, ) -> CcrGetAutoFollowPattern<'a, 'b> { CcrGetAutoFollowPattern::new(self.transport(), parts) } - #[doc = "[Ccr Pause Auto Follow Pattern API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/ccr-pause-auto-follow-pattern.html)\n\nPauses an auto-follow pattern"] + #[doc = "[Ccr Pause Auto Follow Pattern API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/ccr-pause-auto-follow-pattern.html)\n\nPauses an auto-follow pattern"] pub fn pause_auto_follow_pattern<'b>( &'a self, parts: CcrPauseAutoFollowPatternParts<'b>, ) -> CcrPauseAutoFollowPattern<'a, 'b, ()> { CcrPauseAutoFollowPattern::new(self.transport(), parts) } - #[doc = "[Ccr Pause Follow API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/ccr-post-pause-follow.html)\n\nPauses a follower index. The follower index will not fetch any additional operations from the leader index."] + #[doc = "[Ccr Pause Follow API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/ccr-post-pause-follow.html)\n\nPauses a follower index. The follower index will not fetch any additional operations from the leader index."] pub fn pause_follow<'b>( &'a self, parts: CcrPauseFollowParts<'b>, ) -> CcrPauseFollow<'a, 'b, ()> { CcrPauseFollow::new(self.transport(), parts) } - #[doc = "[Ccr Put Auto Follow Pattern API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/ccr-put-auto-follow-pattern.html)\n\nCreates a new named collection of auto-follow patterns against a specified remote cluster. Newly created indices on the remote cluster matching any of the specified patterns will be automatically configured as follower indices."] + #[doc = "[Ccr Put Auto Follow Pattern API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/ccr-put-auto-follow-pattern.html)\n\nCreates a new named collection of auto-follow patterns against a specified remote cluster. Newly created indices on the remote cluster matching any of the specified patterns will be automatically configured as follower indices."] pub fn put_auto_follow_pattern<'b>( &'a self, parts: CcrPutAutoFollowPatternParts<'b>, ) -> CcrPutAutoFollowPattern<'a, 'b, ()> { CcrPutAutoFollowPattern::new(self.transport(), parts) } - #[doc = "[Ccr Resume Auto Follow Pattern API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/ccr-resume-auto-follow-pattern.html)\n\nResumes an auto-follow pattern that has been paused"] + #[doc = "[Ccr Resume Auto Follow Pattern API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/ccr-resume-auto-follow-pattern.html)\n\nResumes an auto-follow pattern that has been paused"] pub fn resume_auto_follow_pattern<'b>( &'a self, parts: CcrResumeAutoFollowPatternParts<'b>, ) -> CcrResumeAutoFollowPattern<'a, 'b, ()> { CcrResumeAutoFollowPattern::new(self.transport(), parts) } - #[doc = "[Ccr Resume Follow API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/ccr-post-resume-follow.html)\n\nResumes a follower index that has been paused"] + #[doc = "[Ccr Resume Follow API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/ccr-post-resume-follow.html)\n\nResumes a follower index that has been paused"] pub fn resume_follow<'b>( &'a self, parts: CcrResumeFollowParts<'b>, ) -> CcrResumeFollow<'a, 'b, ()> { CcrResumeFollow::new(self.transport(), parts) } - #[doc = "[Ccr Stats API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/ccr-get-stats.html)\n\nGets all stats related to cross-cluster replication."] + #[doc = "[Ccr Stats API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/ccr-get-stats.html)\n\nGets all stats related to cross-cluster replication."] pub fn stats<'b>(&'a self) -> CcrStats<'a, 'b> { CcrStats::new(self.transport()) } - #[doc = "[Ccr Unfollow API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/ccr-post-unfollow.html)\n\nStops the following task associated with a follower index and removes index metadata and settings associated with cross-cluster replication."] + #[doc = "[Ccr Unfollow API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/ccr-post-unfollow.html)\n\nStops the following task associated with a follower index and removes index metadata and settings associated with cross-cluster replication."] pub fn unfollow<'b>(&'a self, parts: CcrUnfollowParts<'b>) -> CcrUnfollow<'a, 'b, ()> { CcrUnfollow::new(self.transport(), parts) } diff --git a/elasticsearch/src/cluster.rs b/elasticsearch/src/cluster.rs index df9c2b4c..04c1b9d5 100644 --- a/elasticsearch/src/cluster.rs +++ b/elasticsearch/src/cluster.rs @@ -29,7 +29,8 @@ //! [Manage settings](https://www.elastic.co/guide/en/elasticsearch/reference/master/cluster.html), //! perform operations, and retrieve information about an Elasticsearch cluster. -# ! [ allow ( unused_imports ) ]use crate::{ +#![allow(unused_imports)] +use crate::{ client::Elasticsearch, error::Error, http::{ @@ -58,8 +59,8 @@ impl ClusterAllocationExplainParts { } } } +#[doc = "Builder for the [Cluster Allocation Explain API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/cluster-allocation-explain.html)\n\nProvides explanations for shard allocations in the cluster."] #[derive(Clone, Debug)] -#[doc = "Builder for the [Cluster Allocation Explain API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/cluster-allocation-explain.html)\n\nProvides explanations for shard allocations in the cluster."] pub struct ClusterAllocationExplain<'a, 'b, B> { transport: &'a Transport, parts: ClusterAllocationExplainParts, @@ -203,6 +204,142 @@ where } } #[derive(Debug, Clone, PartialEq)] +#[doc = "API parts for the Cluster Delete Component Template API"] +pub enum ClusterDeleteComponentTemplateParts<'b> { + #[doc = "Name"] + Name(&'b str), +} +impl<'b> ClusterDeleteComponentTemplateParts<'b> { + #[doc = "Builds a relative URL path to the Cluster Delete Component Template API"] + pub fn url(self) -> Cow<'static, str> { + match self { + ClusterDeleteComponentTemplateParts::Name(ref name) => { + let encoded_name: Cow = percent_encode(name.as_bytes(), PARTS_ENCODED).into(); + let mut p = String::with_capacity(21usize + encoded_name.len()); + p.push_str("/_component_template/"); + p.push_str(encoded_name.as_ref()); + p.into() + } + } + } +} +#[doc = "Builder for the [Cluster Delete Component Template API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/indices-component-template.html)\n\nDeletes a component template"] +#[derive(Clone, Debug)] +pub struct ClusterDeleteComponentTemplate<'a, 'b> { + transport: &'a Transport, + parts: ClusterDeleteComponentTemplateParts<'b>, + error_trace: Option, + filter_path: Option<&'b [&'b str]>, + headers: HeaderMap, + human: Option, + master_timeout: Option<&'b str>, + pretty: Option, + request_timeout: Option, + source: Option<&'b str>, + timeout: Option<&'b str>, +} +impl<'a, 'b> ClusterDeleteComponentTemplate<'a, 'b> { + #[doc = "Creates a new instance of [ClusterDeleteComponentTemplate] with the specified API parts"] + pub fn new(transport: &'a Transport, parts: ClusterDeleteComponentTemplateParts<'b>) -> Self { + let headers = HeaderMap::new(); + ClusterDeleteComponentTemplate { + transport, + parts, + headers, + error_trace: None, + filter_path: None, + human: None, + master_timeout: None, + pretty: None, + request_timeout: None, + source: None, + timeout: None, + } + } + #[doc = "Include the stack trace of returned errors."] + pub fn error_trace(mut self, error_trace: bool) -> Self { + self.error_trace = Some(error_trace); + self + } + #[doc = "A comma-separated list of filters used to reduce the response."] + pub fn filter_path(mut self, filter_path: &'b [&'b str]) -> Self { + self.filter_path = Some(filter_path); + self + } + #[doc = "Adds a HTTP header"] + pub fn header(mut self, key: HeaderName, value: HeaderValue) -> Self { + self.headers.insert(key, value); + self + } + #[doc = "Return human readable values for statistics."] + pub fn human(mut self, human: bool) -> Self { + self.human = Some(human); + self + } + #[doc = "Specify timeout for connection to master"] + pub fn master_timeout(mut self, master_timeout: &'b str) -> Self { + self.master_timeout = Some(master_timeout); + self + } + #[doc = "Pretty format the returned JSON response."] + pub fn pretty(mut self, pretty: bool) -> Self { + self.pretty = Some(pretty); + self + } + #[doc = "Sets a request timeout for this API call.\n\nThe timeout is applied from when the request starts connecting until the response body has finished."] + pub fn request_timeout(mut self, timeout: Duration) -> Self { + self.request_timeout = Some(timeout); + self + } + #[doc = "The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests."] + pub fn source(mut self, source: &'b str) -> Self { + self.source = Some(source); + self + } + #[doc = "Explicit operation timeout"] + pub fn timeout(mut self, timeout: &'b str) -> Self { + self.timeout = Some(timeout); + self + } + #[doc = "Creates an asynchronous call to the Cluster Delete Component Template API that can be awaited"] + pub async fn send(self) -> Result { + let path = self.parts.url(); + let method = Method::Delete; + let headers = self.headers; + let timeout = self.request_timeout; + let query_string = { + #[serde_with::skip_serializing_none] + #[derive(Serialize)] + struct QueryParams<'b> { + error_trace: Option, + #[serde(serialize_with = "crate::client::serialize_coll_qs")] + filter_path: Option<&'b [&'b str]>, + human: Option, + master_timeout: Option<&'b str>, + pretty: Option, + source: Option<&'b str>, + timeout: Option<&'b str>, + } + let query_params = QueryParams { + error_trace: self.error_trace, + filter_path: self.filter_path, + human: self.human, + master_timeout: self.master_timeout, + pretty: self.pretty, + source: self.source, + timeout: self.timeout, + }; + Some(query_params) + }; + let body = Option::<()>::None; + let response = self + .transport + .send(method, &path, headers, query_string.as_ref(), body, timeout) + .await?; + Ok(response) + } +} +#[derive(Debug, Clone, PartialEq)] #[doc = "API parts for the Cluster Delete Voting Config Exclusions API"] pub enum ClusterDeleteVotingConfigExclusionsParts { #[doc = "No parts"] @@ -218,8 +355,8 @@ impl ClusterDeleteVotingConfigExclusionsParts { } } } +#[doc = "Builder for the [Cluster Delete Voting Config Exclusions API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/voting-config-exclusions.html)\n\nClears cluster voting config exclusions."] #[derive(Clone, Debug)] -#[doc = "Builder for the [Cluster Delete Voting Config Exclusions API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/voting-config-exclusions.html)\n\nClears cluster voting config exclusions."] pub struct ClusterDeleteVotingConfigExclusions<'a, 'b> { transport: &'a Transport, parts: ClusterDeleteVotingConfigExclusionsParts, @@ -326,6 +463,283 @@ impl<'a, 'b> ClusterDeleteVotingConfigExclusions<'a, 'b> { } } #[derive(Debug, Clone, PartialEq)] +#[doc = "API parts for the Cluster Exists Component Template API"] +pub enum ClusterExistsComponentTemplateParts<'b> { + #[doc = "Name"] + Name(&'b str), +} +impl<'b> ClusterExistsComponentTemplateParts<'b> { + #[doc = "Builds a relative URL path to the Cluster Exists Component Template API"] + pub fn url(self) -> Cow<'static, str> { + match self { + ClusterExistsComponentTemplateParts::Name(ref name) => { + let encoded_name: Cow = percent_encode(name.as_bytes(), PARTS_ENCODED).into(); + let mut p = String::with_capacity(21usize + encoded_name.len()); + p.push_str("/_component_template/"); + p.push_str(encoded_name.as_ref()); + p.into() + } + } + } +} +#[doc = "Builder for the [Cluster Exists Component Template API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/indices-component-template.html)\n\nReturns information about whether a particular component template exist"] +#[derive(Clone, Debug)] +pub struct ClusterExistsComponentTemplate<'a, 'b> { + transport: &'a Transport, + parts: ClusterExistsComponentTemplateParts<'b>, + error_trace: Option, + filter_path: Option<&'b [&'b str]>, + headers: HeaderMap, + human: Option, + local: Option, + master_timeout: Option<&'b str>, + pretty: Option, + request_timeout: Option, + source: Option<&'b str>, +} +impl<'a, 'b> ClusterExistsComponentTemplate<'a, 'b> { + #[doc = "Creates a new instance of [ClusterExistsComponentTemplate] with the specified API parts"] + pub fn new(transport: &'a Transport, parts: ClusterExistsComponentTemplateParts<'b>) -> Self { + let headers = HeaderMap::new(); + ClusterExistsComponentTemplate { + transport, + parts, + headers, + error_trace: None, + filter_path: None, + human: None, + local: None, + master_timeout: None, + pretty: None, + request_timeout: None, + source: None, + } + } + #[doc = "Include the stack trace of returned errors."] + pub fn error_trace(mut self, error_trace: bool) -> Self { + self.error_trace = Some(error_trace); + self + } + #[doc = "A comma-separated list of filters used to reduce the response."] + pub fn filter_path(mut self, filter_path: &'b [&'b str]) -> Self { + self.filter_path = Some(filter_path); + self + } + #[doc = "Adds a HTTP header"] + pub fn header(mut self, key: HeaderName, value: HeaderValue) -> Self { + self.headers.insert(key, value); + self + } + #[doc = "Return human readable values for statistics."] + pub fn human(mut self, human: bool) -> Self { + self.human = Some(human); + self + } + #[doc = "Return local information, do not retrieve the state from master node (default: false)"] + pub fn local(mut self, local: bool) -> Self { + self.local = Some(local); + self + } + #[doc = "Explicit operation timeout for connection to master node"] + pub fn master_timeout(mut self, master_timeout: &'b str) -> Self { + self.master_timeout = Some(master_timeout); + self + } + #[doc = "Pretty format the returned JSON response."] + pub fn pretty(mut self, pretty: bool) -> Self { + self.pretty = Some(pretty); + self + } + #[doc = "Sets a request timeout for this API call.\n\nThe timeout is applied from when the request starts connecting until the response body has finished."] + pub fn request_timeout(mut self, timeout: Duration) -> Self { + self.request_timeout = Some(timeout); + self + } + #[doc = "The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests."] + pub fn source(mut self, source: &'b str) -> Self { + self.source = Some(source); + self + } + #[doc = "Creates an asynchronous call to the Cluster Exists Component Template API that can be awaited"] + pub async fn send(self) -> Result { + let path = self.parts.url(); + let method = Method::Head; + let headers = self.headers; + let timeout = self.request_timeout; + let query_string = { + #[serde_with::skip_serializing_none] + #[derive(Serialize)] + struct QueryParams<'b> { + error_trace: Option, + #[serde(serialize_with = "crate::client::serialize_coll_qs")] + filter_path: Option<&'b [&'b str]>, + human: Option, + local: Option, + master_timeout: Option<&'b str>, + pretty: Option, + source: Option<&'b str>, + } + let query_params = QueryParams { + error_trace: self.error_trace, + filter_path: self.filter_path, + human: self.human, + local: self.local, + master_timeout: self.master_timeout, + pretty: self.pretty, + source: self.source, + }; + Some(query_params) + }; + let body = Option::<()>::None; + let response = self + .transport + .send(method, &path, headers, query_string.as_ref(), body, timeout) + .await?; + Ok(response) + } +} +#[derive(Debug, Clone, PartialEq)] +#[doc = "API parts for the Cluster Get Component Template API"] +pub enum ClusterGetComponentTemplateParts<'b> { + #[doc = "No parts"] + None, + #[doc = "Name"] + Name(&'b [&'b str]), +} +impl<'b> ClusterGetComponentTemplateParts<'b> { + #[doc = "Builds a relative URL path to the Cluster Get Component Template API"] + pub fn url(self) -> Cow<'static, str> { + match self { + ClusterGetComponentTemplateParts::None => "/_component_template".into(), + ClusterGetComponentTemplateParts::Name(ref name) => { + let name_str = name.join(","); + let encoded_name: Cow = + percent_encode(name_str.as_bytes(), PARTS_ENCODED).into(); + let mut p = String::with_capacity(21usize + encoded_name.len()); + p.push_str("/_component_template/"); + p.push_str(encoded_name.as_ref()); + p.into() + } + } + } +} +#[doc = "Builder for the [Cluster Get Component Template API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/indices-component-template.html)\n\nReturns one or more component templates"] +#[derive(Clone, Debug)] +pub struct ClusterGetComponentTemplate<'a, 'b> { + transport: &'a Transport, + parts: ClusterGetComponentTemplateParts<'b>, + error_trace: Option, + filter_path: Option<&'b [&'b str]>, + headers: HeaderMap, + human: Option, + local: Option, + master_timeout: Option<&'b str>, + pretty: Option, + request_timeout: Option, + source: Option<&'b str>, +} +impl<'a, 'b> ClusterGetComponentTemplate<'a, 'b> { + #[doc = "Creates a new instance of [ClusterGetComponentTemplate] with the specified API parts"] + pub fn new(transport: &'a Transport, parts: ClusterGetComponentTemplateParts<'b>) -> Self { + let headers = HeaderMap::new(); + ClusterGetComponentTemplate { + transport, + parts, + headers, + error_trace: None, + filter_path: None, + human: None, + local: None, + master_timeout: None, + pretty: None, + request_timeout: None, + source: None, + } + } + #[doc = "Include the stack trace of returned errors."] + pub fn error_trace(mut self, error_trace: bool) -> Self { + self.error_trace = Some(error_trace); + self + } + #[doc = "A comma-separated list of filters used to reduce the response."] + pub fn filter_path(mut self, filter_path: &'b [&'b str]) -> Self { + self.filter_path = Some(filter_path); + self + } + #[doc = "Adds a HTTP header"] + pub fn header(mut self, key: HeaderName, value: HeaderValue) -> Self { + self.headers.insert(key, value); + self + } + #[doc = "Return human readable values for statistics."] + pub fn human(mut self, human: bool) -> Self { + self.human = Some(human); + self + } + #[doc = "Return local information, do not retrieve the state from master node (default: false)"] + pub fn local(mut self, local: bool) -> Self { + self.local = Some(local); + self + } + #[doc = "Explicit operation timeout for connection to master node"] + pub fn master_timeout(mut self, master_timeout: &'b str) -> Self { + self.master_timeout = Some(master_timeout); + self + } + #[doc = "Pretty format the returned JSON response."] + pub fn pretty(mut self, pretty: bool) -> Self { + self.pretty = Some(pretty); + self + } + #[doc = "Sets a request timeout for this API call.\n\nThe timeout is applied from when the request starts connecting until the response body has finished."] + pub fn request_timeout(mut self, timeout: Duration) -> Self { + self.request_timeout = Some(timeout); + self + } + #[doc = "The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests."] + pub fn source(mut self, source: &'b str) -> Self { + self.source = Some(source); + self + } + #[doc = "Creates an asynchronous call to the Cluster Get Component Template API that can be awaited"] + pub async fn send(self) -> Result { + let path = self.parts.url(); + let method = Method::Get; + let headers = self.headers; + let timeout = self.request_timeout; + let query_string = { + #[serde_with::skip_serializing_none] + #[derive(Serialize)] + struct QueryParams<'b> { + error_trace: Option, + #[serde(serialize_with = "crate::client::serialize_coll_qs")] + filter_path: Option<&'b [&'b str]>, + human: Option, + local: Option, + master_timeout: Option<&'b str>, + pretty: Option, + source: Option<&'b str>, + } + let query_params = QueryParams { + error_trace: self.error_trace, + filter_path: self.filter_path, + human: self.human, + local: self.local, + master_timeout: self.master_timeout, + pretty: self.pretty, + source: self.source, + }; + Some(query_params) + }; + let body = Option::<()>::None; + let response = self + .transport + .send(method, &path, headers, query_string.as_ref(), body, timeout) + .await?; + Ok(response) + } +} +#[derive(Debug, Clone, PartialEq)] #[doc = "API parts for the Cluster Get Settings API"] pub enum ClusterGetSettingsParts { #[doc = "No parts"] @@ -339,8 +753,8 @@ impl ClusterGetSettingsParts { } } } +#[doc = "Builder for the [Cluster Get Settings API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/cluster-update-settings.html)\n\nReturns cluster settings."] #[derive(Clone, Debug)] -#[doc = "Builder for the [Cluster Get Settings API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/cluster-update-settings.html)\n\nReturns cluster settings."] pub struct ClusterGetSettings<'a, 'b> { transport: &'a Transport, parts: ClusterGetSettingsParts, @@ -498,8 +912,8 @@ impl<'b> ClusterHealthParts<'b> { } } } +#[doc = "Builder for the [Cluster Health API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/cluster-health.html)\n\nReturns basic information about the health of the cluster."] #[derive(Clone, Debug)] -#[doc = "Builder for the [Cluster Health API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/cluster-health.html)\n\nReturns basic information about the health of the cluster."] pub struct ClusterHealth<'a, 'b> { transport: &'a Transport, parts: ClusterHealthParts<'b>, @@ -713,8 +1127,8 @@ impl ClusterPendingTasksParts { } } } +#[doc = "Builder for the [Cluster Pending Tasks API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/cluster-pending.html)\n\nReturns a list of any cluster-level changes (e.g. create index, update mapping,\nallocate or fail shard) which have not yet been executed."] #[derive(Clone, Debug)] -#[doc = "Builder for the [Cluster Pending Tasks API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/cluster-pending.html)\n\nReturns a list of any cluster-level changes (e.g. create index, update mapping,\nallocate or fail shard) which have not yet been executed."] pub struct ClusterPendingTasks<'a, 'b> { transport: &'a Transport, parts: ClusterPendingTasksParts, @@ -845,8 +1259,8 @@ impl ClusterPostVotingConfigExclusionsParts { } } } +#[doc = "Builder for the [Cluster Post Voting Config Exclusions API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/voting-config-exclusions.html)\n\nUpdates the cluster voting config exclusions by node ids or node names."] #[derive(Clone, Debug)] -#[doc = "Builder for the [Cluster Post Voting Config Exclusions API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/voting-config-exclusions.html)\n\nUpdates the cluster voting config exclusions by node ids or node names."] pub struct ClusterPostVotingConfigExclusions<'a, 'b, B> { transport: &'a Transport, parts: ClusterPostVotingConfigExclusionsParts, @@ -997,6 +1411,177 @@ where } } #[derive(Debug, Clone, PartialEq)] +#[doc = "API parts for the Cluster Put Component Template API"] +pub enum ClusterPutComponentTemplateParts<'b> { + #[doc = "Name"] + Name(&'b str), +} +impl<'b> ClusterPutComponentTemplateParts<'b> { + #[doc = "Builds a relative URL path to the Cluster Put Component Template API"] + pub fn url(self) -> Cow<'static, str> { + match self { + ClusterPutComponentTemplateParts::Name(ref name) => { + let encoded_name: Cow = percent_encode(name.as_bytes(), PARTS_ENCODED).into(); + let mut p = String::with_capacity(21usize + encoded_name.len()); + p.push_str("/_component_template/"); + p.push_str(encoded_name.as_ref()); + p.into() + } + } + } +} +#[doc = "Builder for the [Cluster Put Component Template API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/indices-component-template.html)\n\nCreates or updates a component template"] +#[derive(Clone, Debug)] +pub struct ClusterPutComponentTemplate<'a, 'b, B> { + transport: &'a Transport, + parts: ClusterPutComponentTemplateParts<'b>, + body: Option, + create: Option, + error_trace: Option, + filter_path: Option<&'b [&'b str]>, + headers: HeaderMap, + human: Option, + master_timeout: Option<&'b str>, + pretty: Option, + request_timeout: Option, + source: Option<&'b str>, + timeout: Option<&'b str>, +} +impl<'a, 'b, B> ClusterPutComponentTemplate<'a, 'b, B> +where + B: Body, +{ + #[doc = "Creates a new instance of [ClusterPutComponentTemplate] with the specified API parts"] + pub fn new(transport: &'a Transport, parts: ClusterPutComponentTemplateParts<'b>) -> Self { + let headers = HeaderMap::new(); + ClusterPutComponentTemplate { + transport, + parts, + headers, + body: None, + create: None, + error_trace: None, + filter_path: None, + human: None, + master_timeout: None, + pretty: None, + request_timeout: None, + source: None, + timeout: None, + } + } + #[doc = "The body for the API call"] + pub fn body(self, body: T) -> ClusterPutComponentTemplate<'a, 'b, JsonBody> + where + T: Serialize, + { + ClusterPutComponentTemplate { + transport: self.transport, + parts: self.parts, + body: Some(body.into()), + create: self.create, + error_trace: self.error_trace, + filter_path: self.filter_path, + headers: self.headers, + human: self.human, + master_timeout: self.master_timeout, + pretty: self.pretty, + request_timeout: self.request_timeout, + source: self.source, + timeout: self.timeout, + } + } + #[doc = "Whether the index template should only be added if new or can also replace an existing one"] + pub fn create(mut self, create: bool) -> Self { + self.create = Some(create); + self + } + #[doc = "Include the stack trace of returned errors."] + pub fn error_trace(mut self, error_trace: bool) -> Self { + self.error_trace = Some(error_trace); + self + } + #[doc = "A comma-separated list of filters used to reduce the response."] + pub fn filter_path(mut self, filter_path: &'b [&'b str]) -> Self { + self.filter_path = Some(filter_path); + self + } + #[doc = "Adds a HTTP header"] + pub fn header(mut self, key: HeaderName, value: HeaderValue) -> Self { + self.headers.insert(key, value); + self + } + #[doc = "Return human readable values for statistics."] + pub fn human(mut self, human: bool) -> Self { + self.human = Some(human); + self + } + #[doc = "Specify timeout for connection to master"] + pub fn master_timeout(mut self, master_timeout: &'b str) -> Self { + self.master_timeout = Some(master_timeout); + self + } + #[doc = "Pretty format the returned JSON response."] + pub fn pretty(mut self, pretty: bool) -> Self { + self.pretty = Some(pretty); + self + } + #[doc = "Sets a request timeout for this API call.\n\nThe timeout is applied from when the request starts connecting until the response body has finished."] + pub fn request_timeout(mut self, timeout: Duration) -> Self { + self.request_timeout = Some(timeout); + self + } + #[doc = "The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests."] + pub fn source(mut self, source: &'b str) -> Self { + self.source = Some(source); + self + } + #[doc = "Explicit operation timeout"] + pub fn timeout(mut self, timeout: &'b str) -> Self { + self.timeout = Some(timeout); + self + } + #[doc = "Creates an asynchronous call to the Cluster Put Component Template API that can be awaited"] + pub async fn send(self) -> Result { + let path = self.parts.url(); + let method = Method::Put; + let headers = self.headers; + let timeout = self.request_timeout; + let query_string = { + #[serde_with::skip_serializing_none] + #[derive(Serialize)] + struct QueryParams<'b> { + create: Option, + error_trace: Option, + #[serde(serialize_with = "crate::client::serialize_coll_qs")] + filter_path: Option<&'b [&'b str]>, + human: Option, + master_timeout: Option<&'b str>, + pretty: Option, + source: Option<&'b str>, + timeout: Option<&'b str>, + } + let query_params = QueryParams { + create: self.create, + error_trace: self.error_trace, + filter_path: self.filter_path, + human: self.human, + master_timeout: self.master_timeout, + pretty: self.pretty, + source: self.source, + timeout: self.timeout, + }; + Some(query_params) + }; + let body = self.body; + let response = self + .transport + .send(method, &path, headers, query_string.as_ref(), body, timeout) + .await?; + Ok(response) + } +} +#[derive(Debug, Clone, PartialEq)] #[doc = "API parts for the Cluster Put Settings API"] pub enum ClusterPutSettingsParts { #[doc = "No parts"] @@ -1010,8 +1595,8 @@ impl ClusterPutSettingsParts { } } } +#[doc = "Builder for the [Cluster Put Settings API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/cluster-update-settings.html)\n\nUpdates the cluster settings."] #[derive(Clone, Debug)] -#[doc = "Builder for the [Cluster Put Settings API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/cluster-update-settings.html)\n\nUpdates the cluster settings."] pub struct ClusterPutSettings<'a, 'b, B> { transport: &'a Transport, parts: ClusterPutSettingsParts, @@ -1175,8 +1760,8 @@ impl ClusterRemoteInfoParts { } } } +#[doc = "Builder for the [Cluster Remote Info API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/cluster-remote-info.html)\n\nReturns the information about configured remote clusters."] #[derive(Clone, Debug)] -#[doc = "Builder for the [Cluster Remote Info API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/cluster-remote-info.html)\n\nReturns the information about configured remote clusters."] pub struct ClusterRemoteInfo<'a, 'b> { transport: &'a Transport, parts: ClusterRemoteInfoParts, @@ -1287,8 +1872,8 @@ impl ClusterRerouteParts { } } } +#[doc = "Builder for the [Cluster Reroute API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/cluster-reroute.html)\n\nAllows to manually change the allocation of individual shards in the cluster."] #[derive(Clone, Debug)] -#[doc = "Builder for the [Cluster Reroute API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/cluster-reroute.html)\n\nAllows to manually change the allocation of individual shards in the cluster."] pub struct ClusterReroute<'a, 'b, B> { transport: &'a Transport, parts: ClusterRerouteParts, @@ -1511,8 +2096,8 @@ impl<'b> ClusterStateParts<'b> { } } } +#[doc = "Builder for the [Cluster State API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/cluster-state.html)\n\nReturns a comprehensive information about the state of the cluster."] #[derive(Clone, Debug)] -#[doc = "Builder for the [Cluster State API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/cluster-state.html)\n\nReturns a comprehensive information about the state of the cluster."] pub struct ClusterState<'a, 'b> { transport: &'a Transport, parts: ClusterStateParts<'b>, @@ -1707,8 +2292,8 @@ impl<'b> ClusterStatsParts<'b> { } } } +#[doc = "Builder for the [Cluster Stats API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/cluster-stats.html)\n\nReturns high-level overview of cluster statistics."] #[derive(Clone, Debug)] -#[doc = "Builder for the [Cluster Stats API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/cluster-stats.html)\n\nReturns high-level overview of cluster statistics."] pub struct ClusterStats<'a, 'b> { transport: &'a Transport, parts: ClusterStatsParts<'b>, @@ -1835,51 +2420,79 @@ impl<'a> Cluster<'a> { pub fn transport(&self) -> &Transport { self.transport } - #[doc = "[Cluster Allocation Explain API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/cluster-allocation-explain.html)\n\nProvides explanations for shard allocations in the cluster."] + #[doc = "[Cluster Allocation Explain API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/cluster-allocation-explain.html)\n\nProvides explanations for shard allocations in the cluster."] pub fn allocation_explain<'b>(&'a self) -> ClusterAllocationExplain<'a, 'b, ()> { ClusterAllocationExplain::new(self.transport()) } - #[doc = "[Cluster Delete Voting Config Exclusions API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/voting-config-exclusions.html)\n\nClears cluster voting config exclusions."] + #[doc = "[Cluster Delete Component Template API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/indices-component-template.html)\n\nDeletes a component template"] + pub fn delete_component_template<'b>( + &'a self, + parts: ClusterDeleteComponentTemplateParts<'b>, + ) -> ClusterDeleteComponentTemplate<'a, 'b> { + ClusterDeleteComponentTemplate::new(self.transport(), parts) + } + #[doc = "[Cluster Delete Voting Config Exclusions API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/voting-config-exclusions.html)\n\nClears cluster voting config exclusions."] pub fn delete_voting_config_exclusions<'b>( &'a self, ) -> ClusterDeleteVotingConfigExclusions<'a, 'b> { ClusterDeleteVotingConfigExclusions::new(self.transport()) } - #[doc = "[Cluster Get Settings API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/cluster-update-settings.html)\n\nReturns cluster settings."] + #[doc = "[Cluster Exists Component Template API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/indices-component-template.html)\n\nReturns information about whether a particular component template exist"] + pub fn exists_component_template<'b>( + &'a self, + parts: ClusterExistsComponentTemplateParts<'b>, + ) -> ClusterExistsComponentTemplate<'a, 'b> { + ClusterExistsComponentTemplate::new(self.transport(), parts) + } + #[doc = "[Cluster Get Component Template API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/indices-component-template.html)\n\nReturns one or more component templates"] + pub fn get_component_template<'b>( + &'a self, + parts: ClusterGetComponentTemplateParts<'b>, + ) -> ClusterGetComponentTemplate<'a, 'b> { + ClusterGetComponentTemplate::new(self.transport(), parts) + } + #[doc = "[Cluster Get Settings API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/cluster-update-settings.html)\n\nReturns cluster settings."] pub fn get_settings<'b>(&'a self) -> ClusterGetSettings<'a, 'b> { ClusterGetSettings::new(self.transport()) } - #[doc = "[Cluster Health API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/cluster-health.html)\n\nReturns basic information about the health of the cluster."] + #[doc = "[Cluster Health API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/cluster-health.html)\n\nReturns basic information about the health of the cluster."] pub fn health<'b>(&'a self, parts: ClusterHealthParts<'b>) -> ClusterHealth<'a, 'b> { ClusterHealth::new(self.transport(), parts) } - #[doc = "[Cluster Pending Tasks API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/cluster-pending.html)\n\nReturns a list of any cluster-level changes (e.g. create index, update mapping,\nallocate or fail shard) which have not yet been executed."] + #[doc = "[Cluster Pending Tasks API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/cluster-pending.html)\n\nReturns a list of any cluster-level changes (e.g. create index, update mapping,\nallocate or fail shard) which have not yet been executed."] pub fn pending_tasks<'b>(&'a self) -> ClusterPendingTasks<'a, 'b> { ClusterPendingTasks::new(self.transport()) } - #[doc = "[Cluster Post Voting Config Exclusions API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/voting-config-exclusions.html)\n\nUpdates the cluster voting config exclusions by node ids or node names."] + #[doc = "[Cluster Post Voting Config Exclusions API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/voting-config-exclusions.html)\n\nUpdates the cluster voting config exclusions by node ids or node names."] pub fn post_voting_config_exclusions<'b>( &'a self, ) -> ClusterPostVotingConfigExclusions<'a, 'b, ()> { ClusterPostVotingConfigExclusions::new(self.transport()) } - #[doc = "[Cluster Put Settings API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/cluster-update-settings.html)\n\nUpdates the cluster settings."] + #[doc = "[Cluster Put Component Template API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/indices-component-template.html)\n\nCreates or updates a component template"] + pub fn put_component_template<'b>( + &'a self, + parts: ClusterPutComponentTemplateParts<'b>, + ) -> ClusterPutComponentTemplate<'a, 'b, ()> { + ClusterPutComponentTemplate::new(self.transport(), parts) + } + #[doc = "[Cluster Put Settings API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/cluster-update-settings.html)\n\nUpdates the cluster settings."] pub fn put_settings<'b>(&'a self) -> ClusterPutSettings<'a, 'b, ()> { ClusterPutSettings::new(self.transport()) } - #[doc = "[Cluster Remote Info API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/cluster-remote-info.html)\n\nReturns the information about configured remote clusters."] + #[doc = "[Cluster Remote Info API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/cluster-remote-info.html)\n\nReturns the information about configured remote clusters."] pub fn remote_info<'b>(&'a self) -> ClusterRemoteInfo<'a, 'b> { ClusterRemoteInfo::new(self.transport()) } - #[doc = "[Cluster Reroute API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/cluster-reroute.html)\n\nAllows to manually change the allocation of individual shards in the cluster."] + #[doc = "[Cluster Reroute API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/cluster-reroute.html)\n\nAllows to manually change the allocation of individual shards in the cluster."] pub fn reroute<'b>(&'a self) -> ClusterReroute<'a, 'b, ()> { ClusterReroute::new(self.transport()) } - #[doc = "[Cluster State API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/cluster-state.html)\n\nReturns a comprehensive information about the state of the cluster."] + #[doc = "[Cluster State API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/cluster-state.html)\n\nReturns a comprehensive information about the state of the cluster."] pub fn state<'b>(&'a self, parts: ClusterStateParts<'b>) -> ClusterState<'a, 'b> { ClusterState::new(self.transport(), parts) } - #[doc = "[Cluster Stats API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/cluster-stats.html)\n\nReturns high-level overview of cluster statistics."] + #[doc = "[Cluster Stats API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/cluster-stats.html)\n\nReturns high-level overview of cluster statistics."] pub fn stats<'b>(&'a self, parts: ClusterStatsParts<'b>) -> ClusterStats<'a, 'b> { ClusterStats::new(self.transport(), parts) } diff --git a/elasticsearch/src/dangling_indices.rs b/elasticsearch/src/dangling_indices.rs index d376409c..2ccfddbd 100644 --- a/elasticsearch/src/dangling_indices.rs +++ b/elasticsearch/src/dangling_indices.rs @@ -33,7 +33,8 @@ //! //! The dangling indices APIs can list, import and delete dangling indices. -# ! [ allow ( unused_imports ) ]use crate::{ +#![allow(unused_imports)] +use crate::{ client::Elasticsearch, error::Error, http::{ @@ -69,8 +70,8 @@ impl<'b> DanglingIndicesDeleteDanglingIndexParts<'b> { } } } +#[doc = "Builder for the [Dangling Indices Delete Dangling Index API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/modules-gateway-dangling-indices.html)\n\nDeletes the specified dangling index"] #[derive(Clone, Debug)] -#[doc = "Builder for the [Dangling Indices Delete Dangling Index API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/modules-gateway-dangling-indices.html)\n\nDeletes the specified dangling index"] pub struct DanglingIndicesDeleteDanglingIndex<'a, 'b> { transport: &'a Transport, parts: DanglingIndicesDeleteDanglingIndexParts<'b>, @@ -218,8 +219,8 @@ impl<'b> DanglingIndicesImportDanglingIndexParts<'b> { } } } +#[doc = "Builder for the [Dangling Indices Import Dangling Index API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/modules-gateway-dangling-indices.html)\n\nImports the specified dangling index"] #[derive(Clone, Debug)] -#[doc = "Builder for the [Dangling Indices Import Dangling Index API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/modules-gateway-dangling-indices.html)\n\nImports the specified dangling index"] pub struct DanglingIndicesImportDanglingIndex<'a, 'b, B> { transport: &'a Transport, parts: DanglingIndicesImportDanglingIndexParts<'b>, @@ -386,8 +387,8 @@ impl DanglingIndicesListDanglingIndicesParts { } } } +#[doc = "Builder for the [Dangling Indices List Dangling Indices API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/modules-gateway-dangling-indices.html)\n\nReturns all dangling indices."] #[derive(Clone, Debug)] -#[doc = "Builder for the [Dangling Indices List Dangling Indices API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/modules-gateway-dangling-indices.html)\n\nReturns all dangling indices."] pub struct DanglingIndicesListDanglingIndices<'a, 'b> { transport: &'a Transport, parts: DanglingIndicesListDanglingIndicesParts, @@ -496,21 +497,21 @@ impl<'a> DanglingIndices<'a> { pub fn transport(&self) -> &Transport { self.transport } - #[doc = "[Dangling Indices Delete Dangling Index API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/modules-gateway-dangling-indices.html)\n\nDeletes the specified dangling index"] + #[doc = "[Dangling Indices Delete Dangling Index API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/modules-gateway-dangling-indices.html)\n\nDeletes the specified dangling index"] pub fn delete_dangling_index<'b>( &'a self, parts: DanglingIndicesDeleteDanglingIndexParts<'b>, ) -> DanglingIndicesDeleteDanglingIndex<'a, 'b> { DanglingIndicesDeleteDanglingIndex::new(self.transport(), parts) } - #[doc = "[Dangling Indices Import Dangling Index API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/modules-gateway-dangling-indices.html)\n\nImports the specified dangling index"] + #[doc = "[Dangling Indices Import Dangling Index API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/modules-gateway-dangling-indices.html)\n\nImports the specified dangling index"] pub fn import_dangling_index<'b>( &'a self, parts: DanglingIndicesImportDanglingIndexParts<'b>, ) -> DanglingIndicesImportDanglingIndex<'a, 'b, ()> { DanglingIndicesImportDanglingIndex::new(self.transport(), parts) } - #[doc = "[Dangling Indices List Dangling Indices API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/modules-gateway-dangling-indices.html)\n\nReturns all dangling indices."] + #[doc = "[Dangling Indices List Dangling Indices API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/modules-gateway-dangling-indices.html)\n\nReturns all dangling indices."] pub fn list_dangling_indices<'b>(&'a self) -> DanglingIndicesListDanglingIndices<'a, 'b> { DanglingIndicesListDanglingIndices::new(self.transport()) } diff --git a/elasticsearch/src/enrich.rs b/elasticsearch/src/enrich.rs index 7ac399e8..7dcf8428 100644 --- a/elasticsearch/src/enrich.rs +++ b/elasticsearch/src/enrich.rs @@ -31,7 +31,8 @@ //! as part of an [ingest pipeline](../ingest/index.html), to add data from your existing indices //! to incoming documents during ingest. -# ! [ allow ( unused_imports ) ]use crate::{ +#![allow(unused_imports)] +use crate::{ client::Elasticsearch, error::Error, http::{ @@ -66,8 +67,8 @@ impl<'b> EnrichDeletePolicyParts<'b> { } } } +#[doc = "Builder for the [Enrich Delete Policy API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/delete-enrich-policy-api.html)\n\nDeletes an existing enrich policy and its enrich index."] #[derive(Clone, Debug)] -#[doc = "Builder for the [Enrich Delete Policy API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/delete-enrich-policy-api.html)\n\nDeletes an existing enrich policy and its enrich index."] pub struct EnrichDeletePolicy<'a, 'b> { transport: &'a Transport, parts: EnrichDeletePolicyParts<'b>, @@ -185,8 +186,8 @@ impl<'b> EnrichExecutePolicyParts<'b> { } } } +#[doc = "Builder for the [Enrich Execute Policy API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/execute-enrich-policy-api.html)\n\nCreates the enrich index for an existing enrich policy."] #[derive(Clone, Debug)] -#[doc = "Builder for the [Enrich Execute Policy API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/execute-enrich-policy-api.html)\n\nCreates the enrich index for an existing enrich policy."] pub struct EnrichExecutePolicy<'a, 'b, B> { transport: &'a Transport, parts: EnrichExecutePolicyParts<'b>, @@ -341,8 +342,8 @@ impl<'b> EnrichGetPolicyParts<'b> { } } } +#[doc = "Builder for the [Enrich Get Policy API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/get-enrich-policy-api.html)\n\nGets information about an enrich policy."] #[derive(Clone, Debug)] -#[doc = "Builder for the [Enrich Get Policy API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/get-enrich-policy-api.html)\n\nGets information about an enrich policy."] pub struct EnrichGetPolicy<'a, 'b> { transport: &'a Transport, parts: EnrichGetPolicyParts<'b>, @@ -459,8 +460,8 @@ impl<'b> EnrichPutPolicyParts<'b> { } } } +#[doc = "Builder for the [Enrich Put Policy API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/put-enrich-policy-api.html)\n\nCreates a new enrich policy."] #[derive(Clone, Debug)] -#[doc = "Builder for the [Enrich Put Policy API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/put-enrich-policy-api.html)\n\nCreates a new enrich policy."] pub struct EnrichPutPolicy<'a, 'b, B> { transport: &'a Transport, parts: EnrichPutPolicyParts<'b>, @@ -594,8 +595,8 @@ impl EnrichStatsParts { } } } +#[doc = "Builder for the [Enrich Stats API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/enrich-stats-api.html)\n\nGets enrich coordinator statistics and information about enrich policies that are currently executing."] #[derive(Clone, Debug)] -#[doc = "Builder for the [Enrich Stats API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/enrich-stats-api.html)\n\nGets enrich coordinator statistics and information about enrich policies that are currently executing."] pub struct EnrichStats<'a, 'b> { transport: &'a Transport, parts: EnrichStatsParts, @@ -704,32 +705,32 @@ impl<'a> Enrich<'a> { pub fn transport(&self) -> &Transport { self.transport } - #[doc = "[Enrich Delete Policy API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/delete-enrich-policy-api.html)\n\nDeletes an existing enrich policy and its enrich index."] + #[doc = "[Enrich Delete Policy API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/delete-enrich-policy-api.html)\n\nDeletes an existing enrich policy and its enrich index."] pub fn delete_policy<'b>( &'a self, parts: EnrichDeletePolicyParts<'b>, ) -> EnrichDeletePolicy<'a, 'b> { EnrichDeletePolicy::new(self.transport(), parts) } - #[doc = "[Enrich Execute Policy API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/execute-enrich-policy-api.html)\n\nCreates the enrich index for an existing enrich policy."] + #[doc = "[Enrich Execute Policy API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/execute-enrich-policy-api.html)\n\nCreates the enrich index for an existing enrich policy."] pub fn execute_policy<'b>( &'a self, parts: EnrichExecutePolicyParts<'b>, ) -> EnrichExecutePolicy<'a, 'b, ()> { EnrichExecutePolicy::new(self.transport(), parts) } - #[doc = "[Enrich Get Policy API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/get-enrich-policy-api.html)\n\nGets information about an enrich policy."] + #[doc = "[Enrich Get Policy API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/get-enrich-policy-api.html)\n\nGets information about an enrich policy."] pub fn get_policy<'b>(&'a self, parts: EnrichGetPolicyParts<'b>) -> EnrichGetPolicy<'a, 'b> { EnrichGetPolicy::new(self.transport(), parts) } - #[doc = "[Enrich Put Policy API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/put-enrich-policy-api.html)\n\nCreates a new enrich policy."] + #[doc = "[Enrich Put Policy API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/put-enrich-policy-api.html)\n\nCreates a new enrich policy."] pub fn put_policy<'b>( &'a self, parts: EnrichPutPolicyParts<'b>, ) -> EnrichPutPolicy<'a, 'b, ()> { EnrichPutPolicy::new(self.transport(), parts) } - #[doc = "[Enrich Stats API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/enrich-stats-api.html)\n\nGets enrich coordinator statistics and information about enrich policies that are currently executing."] + #[doc = "[Enrich Stats API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/enrich-stats-api.html)\n\nGets enrich coordinator statistics and information about enrich policies that are currently executing."] pub fn stats<'b>(&'a self) -> EnrichStats<'a, 'b> { EnrichStats::new(self.transport()) } diff --git a/elasticsearch/src/eql.rs b/elasticsearch/src/eql.rs new file mode 100644 index 00000000..7c17d4f2 --- /dev/null +++ b/elasticsearch/src/eql.rs @@ -0,0 +1,632 @@ +/* + * Licensed to Elasticsearch B.V. under one or more contributor + * license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright + * ownership. Elasticsearch B.V. licenses this file to you under + * the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +// ----------------------------------------------- +// This file is generated, Please do not edit it manually. +// Run the following in the root of the repo to regenerate: +// +// cargo make generate-api +// ----------------------------------------------- + +//! EQL APIs +//! +//! [Event Query Language (EQL)](https://www.elastic.co/guide/en/elasticsearch/reference/master/eql.html) is a query +//! language for event-based time series data, such as logs, metrics, and traces. +//! +//! + +#![allow(unused_imports)] +use crate::{ + client::Elasticsearch, + error::Error, + http::{ + headers::{HeaderMap, HeaderName, HeaderValue, ACCEPT, CONTENT_TYPE}, + request::{Body, JsonBody, NdBody, PARTS_ENCODED}, + response::Response, + transport::Transport, + Method, + }, + params::*, +}; +use percent_encoding::percent_encode; +use serde::Serialize; +use std::{borrow::Cow, time::Duration}; +#[derive(Debug, Clone, PartialEq)] +#[doc = "API parts for the Eql Delete API"] +pub enum EqlDeleteParts<'b> { + #[doc = "Id"] + Id(&'b str), +} +impl<'b> EqlDeleteParts<'b> { + #[doc = "Builds a relative URL path to the Eql Delete API"] + pub fn url(self) -> Cow<'static, str> { + match self { + EqlDeleteParts::Id(ref id) => { + let encoded_id: Cow = percent_encode(id.as_bytes(), PARTS_ENCODED).into(); + let mut p = String::with_capacity(13usize + encoded_id.len()); + p.push_str("/_eql/search/"); + p.push_str(encoded_id.as_ref()); + p.into() + } + } + } +} +#[doc = "Builder for the [Eql Delete API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/eql-search-api.html)\n\nDeletes an async EQL search by ID. If the search is still running, the search request will be cancelled. Otherwise, the saved search results are deleted."] +#[derive(Clone, Debug)] +pub struct EqlDelete<'a, 'b> { + transport: &'a Transport, + parts: EqlDeleteParts<'b>, + error_trace: Option, + filter_path: Option<&'b [&'b str]>, + headers: HeaderMap, + human: Option, + pretty: Option, + request_timeout: Option, + source: Option<&'b str>, +} +impl<'a, 'b> EqlDelete<'a, 'b> { + #[doc = "Creates a new instance of [EqlDelete] with the specified API parts"] + pub fn new(transport: &'a Transport, parts: EqlDeleteParts<'b>) -> Self { + let headers = HeaderMap::new(); + EqlDelete { + transport, + parts, + headers, + error_trace: None, + filter_path: None, + human: None, + pretty: None, + request_timeout: None, + source: None, + } + } + #[doc = "Include the stack trace of returned errors."] + pub fn error_trace(mut self, error_trace: bool) -> Self { + self.error_trace = Some(error_trace); + self + } + #[doc = "A comma-separated list of filters used to reduce the response."] + pub fn filter_path(mut self, filter_path: &'b [&'b str]) -> Self { + self.filter_path = Some(filter_path); + self + } + #[doc = "Adds a HTTP header"] + pub fn header(mut self, key: HeaderName, value: HeaderValue) -> Self { + self.headers.insert(key, value); + self + } + #[doc = "Return human readable values for statistics."] + pub fn human(mut self, human: bool) -> Self { + self.human = Some(human); + self + } + #[doc = "Pretty format the returned JSON response."] + pub fn pretty(mut self, pretty: bool) -> Self { + self.pretty = Some(pretty); + self + } + #[doc = "Sets a request timeout for this API call.\n\nThe timeout is applied from when the request starts connecting until the response body has finished."] + pub fn request_timeout(mut self, timeout: Duration) -> Self { + self.request_timeout = Some(timeout); + self + } + #[doc = "The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests."] + pub fn source(mut self, source: &'b str) -> Self { + self.source = Some(source); + self + } + #[doc = "Creates an asynchronous call to the Eql Delete API that can be awaited"] + pub async fn send(self) -> Result { + let path = self.parts.url(); + let method = Method::Delete; + let headers = self.headers; + let timeout = self.request_timeout; + let query_string = { + #[serde_with::skip_serializing_none] + #[derive(Serialize)] + struct QueryParams<'b> { + error_trace: Option, + #[serde(serialize_with = "crate::client::serialize_coll_qs")] + filter_path: Option<&'b [&'b str]>, + human: Option, + pretty: Option, + source: Option<&'b str>, + } + let query_params = QueryParams { + error_trace: self.error_trace, + filter_path: self.filter_path, + human: self.human, + pretty: self.pretty, + source: self.source, + }; + Some(query_params) + }; + let body = Option::<()>::None; + let response = self + .transport + .send(method, &path, headers, query_string.as_ref(), body, timeout) + .await?; + Ok(response) + } +} +#[derive(Debug, Clone, PartialEq)] +#[doc = "API parts for the Eql Get API"] +pub enum EqlGetParts<'b> { + #[doc = "Id"] + Id(&'b str), +} +impl<'b> EqlGetParts<'b> { + #[doc = "Builds a relative URL path to the Eql Get API"] + pub fn url(self) -> Cow<'static, str> { + match self { + EqlGetParts::Id(ref id) => { + let encoded_id: Cow = percent_encode(id.as_bytes(), PARTS_ENCODED).into(); + let mut p = String::with_capacity(13usize + encoded_id.len()); + p.push_str("/_eql/search/"); + p.push_str(encoded_id.as_ref()); + p.into() + } + } + } +} +#[doc = "Builder for the [Eql Get API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/eql-search-api.html)\n\nReturns async results from previously executed Event Query Language (EQL) search"] +#[derive(Clone, Debug)] +pub struct EqlGet<'a, 'b> { + transport: &'a Transport, + parts: EqlGetParts<'b>, + error_trace: Option, + filter_path: Option<&'b [&'b str]>, + headers: HeaderMap, + human: Option, + keep_alive: Option<&'b str>, + pretty: Option, + request_timeout: Option, + source: Option<&'b str>, + wait_for_completion_timeout: Option<&'b str>, +} +impl<'a, 'b> EqlGet<'a, 'b> { + #[doc = "Creates a new instance of [EqlGet] with the specified API parts"] + pub fn new(transport: &'a Transport, parts: EqlGetParts<'b>) -> Self { + let headers = HeaderMap::new(); + EqlGet { + transport, + parts, + headers, + error_trace: None, + filter_path: None, + human: None, + keep_alive: None, + pretty: None, + request_timeout: None, + source: None, + wait_for_completion_timeout: None, + } + } + #[doc = "Include the stack trace of returned errors."] + pub fn error_trace(mut self, error_trace: bool) -> Self { + self.error_trace = Some(error_trace); + self + } + #[doc = "A comma-separated list of filters used to reduce the response."] + pub fn filter_path(mut self, filter_path: &'b [&'b str]) -> Self { + self.filter_path = Some(filter_path); + self + } + #[doc = "Adds a HTTP header"] + pub fn header(mut self, key: HeaderName, value: HeaderValue) -> Self { + self.headers.insert(key, value); + self + } + #[doc = "Return human readable values for statistics."] + pub fn human(mut self, human: bool) -> Self { + self.human = Some(human); + self + } + #[doc = "Update the time interval in which the results (partial or final) for this search will be available"] + pub fn keep_alive(mut self, keep_alive: &'b str) -> Self { + self.keep_alive = Some(keep_alive); + self + } + #[doc = "Pretty format the returned JSON response."] + pub fn pretty(mut self, pretty: bool) -> Self { + self.pretty = Some(pretty); + self + } + #[doc = "Sets a request timeout for this API call.\n\nThe timeout is applied from when the request starts connecting until the response body has finished."] + pub fn request_timeout(mut self, timeout: Duration) -> Self { + self.request_timeout = Some(timeout); + self + } + #[doc = "The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests."] + pub fn source(mut self, source: &'b str) -> Self { + self.source = Some(source); + self + } + #[doc = "Specify the time that the request should block waiting for the final response"] + pub fn wait_for_completion_timeout(mut self, wait_for_completion_timeout: &'b str) -> Self { + self.wait_for_completion_timeout = Some(wait_for_completion_timeout); + self + } + #[doc = "Creates an asynchronous call to the Eql Get API that can be awaited"] + pub async fn send(self) -> Result { + let path = self.parts.url(); + let method = Method::Get; + let headers = self.headers; + let timeout = self.request_timeout; + let query_string = { + #[serde_with::skip_serializing_none] + #[derive(Serialize)] + struct QueryParams<'b> { + error_trace: Option, + #[serde(serialize_with = "crate::client::serialize_coll_qs")] + filter_path: Option<&'b [&'b str]>, + human: Option, + keep_alive: Option<&'b str>, + pretty: Option, + source: Option<&'b str>, + wait_for_completion_timeout: Option<&'b str>, + } + let query_params = QueryParams { + error_trace: self.error_trace, + filter_path: self.filter_path, + human: self.human, + keep_alive: self.keep_alive, + pretty: self.pretty, + source: self.source, + wait_for_completion_timeout: self.wait_for_completion_timeout, + }; + Some(query_params) + }; + let body = Option::<()>::None; + let response = self + .transport + .send(method, &path, headers, query_string.as_ref(), body, timeout) + .await?; + Ok(response) + } +} +#[derive(Debug, Clone, PartialEq)] +#[doc = "API parts for the Eql Get Status API"] +pub enum EqlGetStatusParts<'b> { + #[doc = "Id"] + Id(&'b str), +} +impl<'b> EqlGetStatusParts<'b> { + #[doc = "Builds a relative URL path to the Eql Get Status API"] + pub fn url(self) -> Cow<'static, str> { + match self { + EqlGetStatusParts::Id(ref id) => { + let encoded_id: Cow = percent_encode(id.as_bytes(), PARTS_ENCODED).into(); + let mut p = String::with_capacity(20usize + encoded_id.len()); + p.push_str("/_eql/search/status/"); + p.push_str(encoded_id.as_ref()); + p.into() + } + } + } +} +#[doc = "Builder for the [Eql Get Status API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/eql-search-api.html)\n\nReturns the status of a previously submitted async or stored Event Query Language (EQL) search"] +#[derive(Clone, Debug)] +pub struct EqlGetStatus<'a, 'b> { + transport: &'a Transport, + parts: EqlGetStatusParts<'b>, + error_trace: Option, + filter_path: Option<&'b [&'b str]>, + headers: HeaderMap, + human: Option, + pretty: Option, + request_timeout: Option, + source: Option<&'b str>, +} +impl<'a, 'b> EqlGetStatus<'a, 'b> { + #[doc = "Creates a new instance of [EqlGetStatus] with the specified API parts"] + pub fn new(transport: &'a Transport, parts: EqlGetStatusParts<'b>) -> Self { + let headers = HeaderMap::new(); + EqlGetStatus { + transport, + parts, + headers, + error_trace: None, + filter_path: None, + human: None, + pretty: None, + request_timeout: None, + source: None, + } + } + #[doc = "Include the stack trace of returned errors."] + pub fn error_trace(mut self, error_trace: bool) -> Self { + self.error_trace = Some(error_trace); + self + } + #[doc = "A comma-separated list of filters used to reduce the response."] + pub fn filter_path(mut self, filter_path: &'b [&'b str]) -> Self { + self.filter_path = Some(filter_path); + self + } + #[doc = "Adds a HTTP header"] + pub fn header(mut self, key: HeaderName, value: HeaderValue) -> Self { + self.headers.insert(key, value); + self + } + #[doc = "Return human readable values for statistics."] + pub fn human(mut self, human: bool) -> Self { + self.human = Some(human); + self + } + #[doc = "Pretty format the returned JSON response."] + pub fn pretty(mut self, pretty: bool) -> Self { + self.pretty = Some(pretty); + self + } + #[doc = "Sets a request timeout for this API call.\n\nThe timeout is applied from when the request starts connecting until the response body has finished."] + pub fn request_timeout(mut self, timeout: Duration) -> Self { + self.request_timeout = Some(timeout); + self + } + #[doc = "The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests."] + pub fn source(mut self, source: &'b str) -> Self { + self.source = Some(source); + self + } + #[doc = "Creates an asynchronous call to the Eql Get Status API that can be awaited"] + pub async fn send(self) -> Result { + let path = self.parts.url(); + let method = Method::Get; + let headers = self.headers; + let timeout = self.request_timeout; + let query_string = { + #[serde_with::skip_serializing_none] + #[derive(Serialize)] + struct QueryParams<'b> { + error_trace: Option, + #[serde(serialize_with = "crate::client::serialize_coll_qs")] + filter_path: Option<&'b [&'b str]>, + human: Option, + pretty: Option, + source: Option<&'b str>, + } + let query_params = QueryParams { + error_trace: self.error_trace, + filter_path: self.filter_path, + human: self.human, + pretty: self.pretty, + source: self.source, + }; + Some(query_params) + }; + let body = Option::<()>::None; + let response = self + .transport + .send(method, &path, headers, query_string.as_ref(), body, timeout) + .await?; + Ok(response) + } +} +#[derive(Debug, Clone, PartialEq)] +#[doc = "API parts for the Eql Search API"] +pub enum EqlSearchParts<'b> { + #[doc = "Index"] + Index(&'b str), +} +impl<'b> EqlSearchParts<'b> { + #[doc = "Builds a relative URL path to the Eql Search API"] + pub fn url(self) -> Cow<'static, str> { + match self { + EqlSearchParts::Index(ref index) => { + let encoded_index: Cow = + percent_encode(index.as_bytes(), PARTS_ENCODED).into(); + let mut p = String::with_capacity(13usize + encoded_index.len()); + p.push_str("/"); + p.push_str(encoded_index.as_ref()); + p.push_str("/_eql/search"); + p.into() + } + } + } +} +#[doc = "Builder for the [Eql Search API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/eql-search-api.html)\n\nReturns results matching a query expressed in Event Query Language (EQL)"] +#[derive(Clone, Debug)] +pub struct EqlSearch<'a, 'b, B> { + transport: &'a Transport, + parts: EqlSearchParts<'b>, + body: Option, + error_trace: Option, + filter_path: Option<&'b [&'b str]>, + headers: HeaderMap, + human: Option, + keep_alive: Option<&'b str>, + keep_on_completion: Option, + pretty: Option, + request_timeout: Option, + source: Option<&'b str>, + wait_for_completion_timeout: Option<&'b str>, +} +impl<'a, 'b, B> EqlSearch<'a, 'b, B> +where + B: Body, +{ + #[doc = "Creates a new instance of [EqlSearch] with the specified API parts"] + pub fn new(transport: &'a Transport, parts: EqlSearchParts<'b>) -> Self { + let headers = HeaderMap::new(); + EqlSearch { + transport, + parts, + headers, + body: None, + error_trace: None, + filter_path: None, + human: None, + keep_alive: None, + keep_on_completion: None, + pretty: None, + request_timeout: None, + source: None, + wait_for_completion_timeout: None, + } + } + #[doc = "The body for the API call"] + pub fn body(self, body: T) -> EqlSearch<'a, 'b, JsonBody> + where + T: Serialize, + { + EqlSearch { + transport: self.transport, + parts: self.parts, + body: Some(body.into()), + error_trace: self.error_trace, + filter_path: self.filter_path, + headers: self.headers, + human: self.human, + keep_alive: self.keep_alive, + keep_on_completion: self.keep_on_completion, + pretty: self.pretty, + request_timeout: self.request_timeout, + source: self.source, + wait_for_completion_timeout: self.wait_for_completion_timeout, + } + } + #[doc = "Include the stack trace of returned errors."] + pub fn error_trace(mut self, error_trace: bool) -> Self { + self.error_trace = Some(error_trace); + self + } + #[doc = "A comma-separated list of filters used to reduce the response."] + pub fn filter_path(mut self, filter_path: &'b [&'b str]) -> Self { + self.filter_path = Some(filter_path); + self + } + #[doc = "Adds a HTTP header"] + pub fn header(mut self, key: HeaderName, value: HeaderValue) -> Self { + self.headers.insert(key, value); + self + } + #[doc = "Return human readable values for statistics."] + pub fn human(mut self, human: bool) -> Self { + self.human = Some(human); + self + } + #[doc = "Update the time interval in which the results (partial or final) for this search will be available"] + pub fn keep_alive(mut self, keep_alive: &'b str) -> Self { + self.keep_alive = Some(keep_alive); + self + } + #[doc = "Control whether the response should be stored in the cluster if it completed within the provided [wait_for_completion] time (default: false)"] + pub fn keep_on_completion(mut self, keep_on_completion: bool) -> Self { + self.keep_on_completion = Some(keep_on_completion); + self + } + #[doc = "Pretty format the returned JSON response."] + pub fn pretty(mut self, pretty: bool) -> Self { + self.pretty = Some(pretty); + self + } + #[doc = "Sets a request timeout for this API call.\n\nThe timeout is applied from when the request starts connecting until the response body has finished."] + pub fn request_timeout(mut self, timeout: Duration) -> Self { + self.request_timeout = Some(timeout); + self + } + #[doc = "The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests."] + pub fn source(mut self, source: &'b str) -> Self { + self.source = Some(source); + self + } + #[doc = "Specify the time that the request should block waiting for the final response"] + pub fn wait_for_completion_timeout(mut self, wait_for_completion_timeout: &'b str) -> Self { + self.wait_for_completion_timeout = Some(wait_for_completion_timeout); + self + } + #[doc = "Creates an asynchronous call to the Eql Search API that can be awaited"] + pub async fn send(self) -> Result { + let path = self.parts.url(); + let method = match self.body { + Some(_) => Method::Post, + None => Method::Get, + }; + let headers = self.headers; + let timeout = self.request_timeout; + let query_string = { + #[serde_with::skip_serializing_none] + #[derive(Serialize)] + struct QueryParams<'b> { + error_trace: Option, + #[serde(serialize_with = "crate::client::serialize_coll_qs")] + filter_path: Option<&'b [&'b str]>, + human: Option, + keep_alive: Option<&'b str>, + keep_on_completion: Option, + pretty: Option, + source: Option<&'b str>, + wait_for_completion_timeout: Option<&'b str>, + } + let query_params = QueryParams { + error_trace: self.error_trace, + filter_path: self.filter_path, + human: self.human, + keep_alive: self.keep_alive, + keep_on_completion: self.keep_on_completion, + pretty: self.pretty, + source: self.source, + wait_for_completion_timeout: self.wait_for_completion_timeout, + }; + Some(query_params) + }; + let body = self.body; + let response = self + .transport + .send(method, &path, headers, query_string.as_ref(), body, timeout) + .await?; + Ok(response) + } +} +#[doc = "Namespace client for Eql APIs"] +pub struct Eql<'a> { + transport: &'a Transport, +} +impl<'a> Eql<'a> { + #[doc = "Creates a new instance of [Eql]"] + pub fn new(transport: &'a Transport) -> Self { + Self { transport } + } + pub fn transport(&self) -> &Transport { + self.transport + } + #[doc = "[Eql Delete API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/eql-search-api.html)\n\nDeletes an async EQL search by ID. If the search is still running, the search request will be cancelled. Otherwise, the saved search results are deleted."] + pub fn delete<'b>(&'a self, parts: EqlDeleteParts<'b>) -> EqlDelete<'a, 'b> { + EqlDelete::new(self.transport(), parts) + } + #[doc = "[Eql Get API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/eql-search-api.html)\n\nReturns async results from previously executed Event Query Language (EQL) search"] + pub fn get<'b>(&'a self, parts: EqlGetParts<'b>) -> EqlGet<'a, 'b> { + EqlGet::new(self.transport(), parts) + } + #[doc = "[Eql Get Status API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/eql-search-api.html)\n\nReturns the status of a previously submitted async or stored Event Query Language (EQL) search"] + pub fn get_status<'b>(&'a self, parts: EqlGetStatusParts<'b>) -> EqlGetStatus<'a, 'b> { + EqlGetStatus::new(self.transport(), parts) + } + #[doc = "[Eql Search API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/eql-search-api.html)\n\nReturns results matching a query expressed in Event Query Language (EQL)"] + pub fn search<'b>(&'a self, parts: EqlSearchParts<'b>) -> EqlSearch<'a, 'b, ()> { + EqlSearch::new(self.transport(), parts) + } +} +impl Elasticsearch { + #[doc = "Creates a namespace client for Eql APIs"] + pub fn eql(&self) -> Eql { + Eql::new(self.transport()) + } +} diff --git a/elasticsearch/src/graph.rs b/elasticsearch/src/graph.rs index 6b4bdc46..f461372b 100644 --- a/elasticsearch/src/graph.rs +++ b/elasticsearch/src/graph.rs @@ -30,7 +30,8 @@ //! indices, [inferring relationships across documents](https://www.elastic.co/what-is/elasticsearch-graph), //! and allowing the [exploration of such relationships](https://www.elastic.co/guide/en/elasticsearch/reference/master/graph-explore-api.html). -# ! [ allow ( unused_imports ) ]use crate::{ +#![allow(unused_imports)] +use crate::{ client::Elasticsearch, error::Error, http::{ @@ -84,8 +85,8 @@ impl<'b> GraphExploreParts<'b> { } } } +#[doc = "Builder for the [Graph Explore API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/graph-explore-api.html)\n\nExplore extracted and summarized information about the documents and terms in an index."] #[derive(Clone, Debug)] -#[doc = "Builder for the [Graph Explore API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/graph-explore-api.html)\n\nExplore extracted and summarized information about the documents and terms in an index."] pub struct GraphExplore<'a, 'b, B> { transport: &'a Transport, parts: GraphExploreParts<'b>, @@ -240,7 +241,7 @@ impl<'a> Graph<'a> { pub fn transport(&self) -> &Transport { self.transport } - #[doc = "[Graph Explore API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/graph-explore-api.html)\n\nExplore extracted and summarized information about the documents and terms in an index."] + #[doc = "[Graph Explore API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/graph-explore-api.html)\n\nExplore extracted and summarized information about the documents and terms in an index."] pub fn explore<'b>(&'a self, parts: GraphExploreParts<'b>) -> GraphExplore<'a, 'b, ()> { GraphExplore::new(self.transport(), parts) } diff --git a/elasticsearch/src/ilm.rs b/elasticsearch/src/ilm.rs index 60583265..5c490ffc 100644 --- a/elasticsearch/src/ilm.rs +++ b/elasticsearch/src/ilm.rs @@ -34,7 +34,8 @@ //! template used to create them. Update the policy to modify the lifecycle of both new //! and existing indices. -# ! [ allow ( unused_imports ) ]use crate::{ +#![allow(unused_imports)] +use crate::{ client::Elasticsearch, error::Error, http::{ @@ -70,8 +71,8 @@ impl<'b> IlmDeleteLifecycleParts<'b> { } } } +#[doc = "Builder for the [Ilm Delete Lifecycle API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/ilm-delete-lifecycle.html)\n\nDeletes the specified lifecycle policy definition. A currently used policy cannot be deleted."] #[derive(Clone, Debug)] -#[doc = "Builder for the [Ilm Delete Lifecycle API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/ilm-delete-lifecycle.html)\n\nDeletes the specified lifecycle policy definition. A currently used policy cannot be deleted."] pub struct IlmDeleteLifecycle<'a, 'b> { transport: &'a Transport, parts: IlmDeleteLifecycleParts<'b>, @@ -190,8 +191,8 @@ impl<'b> IlmExplainLifecycleParts<'b> { } } } +#[doc = "Builder for the [Ilm Explain Lifecycle API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/ilm-explain-lifecycle.html)\n\nRetrieves information about the index's current lifecycle state, such as the currently executing phase, action, and step."] #[derive(Clone, Debug)] -#[doc = "Builder for the [Ilm Explain Lifecycle API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/ilm-explain-lifecycle.html)\n\nRetrieves information about the index's current lifecycle state, such as the currently executing phase, action, and step."] pub struct IlmExplainLifecycle<'a, 'b> { transport: &'a Transport, parts: IlmExplainLifecycleParts<'b>, @@ -330,8 +331,8 @@ impl<'b> IlmGetLifecycleParts<'b> { } } } +#[doc = "Builder for the [Ilm Get Lifecycle API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/ilm-get-lifecycle.html)\n\nReturns the specified policy definition. Includes the policy version and last modified date."] #[derive(Clone, Debug)] -#[doc = "Builder for the [Ilm Get Lifecycle API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/ilm-get-lifecycle.html)\n\nReturns the specified policy definition. Includes the policy version and last modified date."] pub struct IlmGetLifecycle<'a, 'b> { transport: &'a Transport, parts: IlmGetLifecycleParts<'b>, @@ -442,8 +443,8 @@ impl IlmGetStatusParts { } } } +#[doc = "Builder for the [Ilm Get Status API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/ilm-get-status.html)\n\nRetrieves the current index lifecycle management (ILM) status."] #[derive(Clone, Debug)] -#[doc = "Builder for the [Ilm Get Status API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/ilm-get-status.html)\n\nRetrieves the current index lifecycle management (ILM) status."] pub struct IlmGetStatus<'a, 'b> { transport: &'a Transport, parts: IlmGetStatusParts, @@ -561,8 +562,8 @@ impl<'b> IlmMoveToStepParts<'b> { } } } +#[doc = "Builder for the [Ilm Move To Step API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/ilm-move-to-step.html)\n\nManually moves an index into the specified step and executes that step."] #[derive(Clone, Debug)] -#[doc = "Builder for the [Ilm Move To Step API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/ilm-move-to-step.html)\n\nManually moves an index into the specified step and executes that step."] pub struct IlmMoveToStep<'a, 'b, B> { transport: &'a Transport, parts: IlmMoveToStepParts<'b>, @@ -703,8 +704,8 @@ impl<'b> IlmPutLifecycleParts<'b> { } } } +#[doc = "Builder for the [Ilm Put Lifecycle API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/ilm-put-lifecycle.html)\n\nCreates a lifecycle policy"] #[derive(Clone, Debug)] -#[doc = "Builder for the [Ilm Put Lifecycle API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/ilm-put-lifecycle.html)\n\nCreates a lifecycle policy"] pub struct IlmPutLifecycle<'a, 'b, B> { transport: &'a Transport, parts: IlmPutLifecycleParts<'b>, @@ -846,8 +847,8 @@ impl<'b> IlmRemovePolicyParts<'b> { } } } +#[doc = "Builder for the [Ilm Remove Policy API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/ilm-remove-policy.html)\n\nRemoves the assigned lifecycle policy and stops managing the specified index"] #[derive(Clone, Debug)] -#[doc = "Builder for the [Ilm Remove Policy API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/ilm-remove-policy.html)\n\nRemoves the assigned lifecycle policy and stops managing the specified index"] pub struct IlmRemovePolicy<'a, 'b, B> { transport: &'a Transport, parts: IlmRemovePolicyParts<'b>, @@ -989,8 +990,8 @@ impl<'b> IlmRetryParts<'b> { } } } +#[doc = "Builder for the [Ilm Retry API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/ilm-retry-policy.html)\n\nRetries executing the policy for an index that is in the ERROR step."] #[derive(Clone, Debug)] -#[doc = "Builder for the [Ilm Retry API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/ilm-retry-policy.html)\n\nRetries executing the policy for an index that is in the ERROR step."] pub struct IlmRetry<'a, 'b, B> { transport: &'a Transport, parts: IlmRetryParts<'b>, @@ -1124,8 +1125,8 @@ impl IlmStartParts { } } } +#[doc = "Builder for the [Ilm Start API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/ilm-start.html)\n\nStart the index lifecycle management (ILM) plugin."] #[derive(Clone, Debug)] -#[doc = "Builder for the [Ilm Start API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/ilm-start.html)\n\nStart the index lifecycle management (ILM) plugin."] pub struct IlmStart<'a, 'b, B> { transport: &'a Transport, parts: IlmStartParts, @@ -1259,8 +1260,8 @@ impl IlmStopParts { } } } +#[doc = "Builder for the [Ilm Stop API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/ilm-stop.html)\n\nHalts all lifecycle management operations and stops the index lifecycle management (ILM) plugin"] #[derive(Clone, Debug)] -#[doc = "Builder for the [Ilm Stop API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/ilm-stop.html)\n\nHalts all lifecycle management operations and stops the index lifecycle management (ILM) plugin"] pub struct IlmStop<'a, 'b, B> { transport: &'a Transport, parts: IlmStopParts, @@ -1392,55 +1393,55 @@ impl<'a> Ilm<'a> { pub fn transport(&self) -> &Transport { self.transport } - #[doc = "[Ilm Delete Lifecycle API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/ilm-delete-lifecycle.html)\n\nDeletes the specified lifecycle policy definition. A currently used policy cannot be deleted."] + #[doc = "[Ilm Delete Lifecycle API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/ilm-delete-lifecycle.html)\n\nDeletes the specified lifecycle policy definition. A currently used policy cannot be deleted."] pub fn delete_lifecycle<'b>( &'a self, parts: IlmDeleteLifecycleParts<'b>, ) -> IlmDeleteLifecycle<'a, 'b> { IlmDeleteLifecycle::new(self.transport(), parts) } - #[doc = "[Ilm Explain Lifecycle API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/ilm-explain-lifecycle.html)\n\nRetrieves information about the index's current lifecycle state, such as the currently executing phase, action, and step."] + #[doc = "[Ilm Explain Lifecycle API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/ilm-explain-lifecycle.html)\n\nRetrieves information about the index's current lifecycle state, such as the currently executing phase, action, and step."] pub fn explain_lifecycle<'b>( &'a self, parts: IlmExplainLifecycleParts<'b>, ) -> IlmExplainLifecycle<'a, 'b> { IlmExplainLifecycle::new(self.transport(), parts) } - #[doc = "[Ilm Get Lifecycle API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/ilm-get-lifecycle.html)\n\nReturns the specified policy definition. Includes the policy version and last modified date."] + #[doc = "[Ilm Get Lifecycle API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/ilm-get-lifecycle.html)\n\nReturns the specified policy definition. Includes the policy version and last modified date."] pub fn get_lifecycle<'b>(&'a self, parts: IlmGetLifecycleParts<'b>) -> IlmGetLifecycle<'a, 'b> { IlmGetLifecycle::new(self.transport(), parts) } - #[doc = "[Ilm Get Status API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/ilm-get-status.html)\n\nRetrieves the current index lifecycle management (ILM) status."] + #[doc = "[Ilm Get Status API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/ilm-get-status.html)\n\nRetrieves the current index lifecycle management (ILM) status."] pub fn get_status<'b>(&'a self) -> IlmGetStatus<'a, 'b> { IlmGetStatus::new(self.transport()) } - #[doc = "[Ilm Move To Step API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/ilm-move-to-step.html)\n\nManually moves an index into the specified step and executes that step."] + #[doc = "[Ilm Move To Step API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/ilm-move-to-step.html)\n\nManually moves an index into the specified step and executes that step."] pub fn move_to_step<'b>(&'a self, parts: IlmMoveToStepParts<'b>) -> IlmMoveToStep<'a, 'b, ()> { IlmMoveToStep::new(self.transport(), parts) } - #[doc = "[Ilm Put Lifecycle API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/ilm-put-lifecycle.html)\n\nCreates a lifecycle policy"] + #[doc = "[Ilm Put Lifecycle API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/ilm-put-lifecycle.html)\n\nCreates a lifecycle policy"] pub fn put_lifecycle<'b>( &'a self, parts: IlmPutLifecycleParts<'b>, ) -> IlmPutLifecycle<'a, 'b, ()> { IlmPutLifecycle::new(self.transport(), parts) } - #[doc = "[Ilm Remove Policy API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/ilm-remove-policy.html)\n\nRemoves the assigned lifecycle policy and stops managing the specified index"] + #[doc = "[Ilm Remove Policy API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/ilm-remove-policy.html)\n\nRemoves the assigned lifecycle policy and stops managing the specified index"] pub fn remove_policy<'b>( &'a self, parts: IlmRemovePolicyParts<'b>, ) -> IlmRemovePolicy<'a, 'b, ()> { IlmRemovePolicy::new(self.transport(), parts) } - #[doc = "[Ilm Retry API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/ilm-retry-policy.html)\n\nRetries executing the policy for an index that is in the ERROR step."] + #[doc = "[Ilm Retry API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/ilm-retry-policy.html)\n\nRetries executing the policy for an index that is in the ERROR step."] pub fn retry<'b>(&'a self, parts: IlmRetryParts<'b>) -> IlmRetry<'a, 'b, ()> { IlmRetry::new(self.transport(), parts) } - #[doc = "[Ilm Start API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/ilm-start.html)\n\nStart the index lifecycle management (ILM) plugin."] + #[doc = "[Ilm Start API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/ilm-start.html)\n\nStart the index lifecycle management (ILM) plugin."] pub fn start<'b>(&'a self) -> IlmStart<'a, 'b, ()> { IlmStart::new(self.transport()) } - #[doc = "[Ilm Stop API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/ilm-stop.html)\n\nHalts all lifecycle management operations and stops the index lifecycle management (ILM) plugin"] + #[doc = "[Ilm Stop API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/ilm-stop.html)\n\nHalts all lifecycle management operations and stops the index lifecycle management (ILM) plugin"] pub fn stop<'b>(&'a self) -> IlmStop<'a, 'b, ()> { IlmStop::new(self.transport()) } diff --git a/elasticsearch/src/indices.rs b/elasticsearch/src/indices.rs index 9d36f2c1..ce9c27fb 100644 --- a/elasticsearch/src/indices.rs +++ b/elasticsearch/src/indices.rs @@ -29,7 +29,8 @@ //! [Manage individual indices](https://www.elastic.co/guide/en/elasticsearch/reference/master/indices.html), //! index settings, aliases, mappings, and index templates. -# ! [ allow ( unused_imports ) ]use crate::{ +#![allow(unused_imports)] +use crate::{ client::Elasticsearch, error::Error, http::{ @@ -71,8 +72,8 @@ impl<'b> IndicesAddBlockParts<'b> { } } } +#[doc = "Builder for the [Indices Add Block API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/index-modules-blocks.html)\n\nAdds a block to an index."] #[derive(Clone, Debug)] -#[doc = "Builder for the [Indices Add Block API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/index-modules-blocks.html)\n\nAdds a block to an index."] pub struct IndicesAddBlock<'a, 'b, B> { transport: &'a Transport, parts: IndicesAddBlockParts<'b>, @@ -268,8 +269,8 @@ impl<'b> IndicesAnalyzeParts<'b> { } } } +#[doc = "Builder for the [Indices Analyze API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/indices-analyze.html)\n\nPerforms the analysis process on a text and return the tokens breakdown of the text."] #[derive(Clone, Debug)] -#[doc = "Builder for the [Indices Analyze API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/indices-analyze.html)\n\nPerforms the analysis process on a text and return the tokens breakdown of the text."] pub struct IndicesAnalyze<'a, 'b, B> { transport: &'a Transport, parts: IndicesAnalyzeParts<'b>, @@ -428,8 +429,8 @@ impl<'b> IndicesClearCacheParts<'b> { } } } +#[doc = "Builder for the [Indices Clear Cache API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/indices-clearcache.html)\n\nClears all or specific caches for one or more indices."] #[derive(Clone, Debug)] -#[doc = "Builder for the [Indices Clear Cache API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/indices-clearcache.html)\n\nClears all or specific caches for one or more indices."] pub struct IndicesClearCache<'a, 'b, B> { transport: &'a Transport, parts: IndicesClearCacheParts<'b>, @@ -658,8 +659,8 @@ impl<'b> IndicesCloneParts<'b> { } } } +#[doc = "Builder for the [Indices Clone API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/indices-clone-index.html)\n\nClones an index"] #[derive(Clone, Debug)] -#[doc = "Builder for the [Indices Clone API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/indices-clone-index.html)\n\nClones an index"] pub struct IndicesClone<'a, 'b, B> { transport: &'a Transport, parts: IndicesCloneParts<'b>, @@ -832,8 +833,8 @@ impl<'b> IndicesCloseParts<'b> { } } } +#[doc = "Builder for the [Indices Close API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/indices-open-close.html)\n\nCloses an index."] #[derive(Clone, Debug)] -#[doc = "Builder for the [Indices Close API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/indices-open-close.html)\n\nCloses an index."] pub struct IndicesClose<'a, 'b, B> { transport: &'a Transport, parts: IndicesCloseParts<'b>, @@ -962,7 +963,7 @@ where self.timeout = Some(timeout); self } - #[doc = "Sets the number of active shards to wait for before the operation returns."] + #[doc = "Sets the number of active shards to wait for before the operation returns. Set to `index-setting` to wait according to the index setting `index.write.wait_for_active_shards`, or `all` to wait for all shards, or an integer. Defaults to `0`."] pub fn wait_for_active_shards(mut self, wait_for_active_shards: &'b str) -> Self { self.wait_for_active_shards = Some(wait_for_active_shards); self @@ -1035,8 +1036,8 @@ impl<'b> IndicesCreateParts<'b> { } } } +#[doc = "Builder for the [Indices Create API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/indices-create-index.html)\n\nCreates an index with optional settings and mappings."] #[derive(Clone, Debug)] -#[doc = "Builder for the [Indices Create API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/indices-create-index.html)\n\nCreates an index with optional settings and mappings."] pub struct IndicesCreate<'a, 'b, B> { transport: &'a Transport, parts: IndicesCreateParts<'b>, @@ -1216,8 +1217,8 @@ impl<'b> IndicesCreateDataStreamParts<'b> { } } } +#[doc = "Builder for the [Indices Create Data Stream API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/data-streams.html)\n\nCreates a data stream"] #[derive(Clone, Debug)] -#[doc = "Builder for the [Indices Create Data Stream API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/data-streams.html)\n\nCreates a data stream"] pub struct IndicesCreateDataStream<'a, 'b, B> { transport: &'a Transport, parts: IndicesCreateDataStreamParts<'b>, @@ -1363,8 +1364,8 @@ impl<'b> IndicesDataStreamsStatsParts<'b> { } } } +#[doc = "Builder for the [Indices Data Streams Stats API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/data-streams.html)\n\nProvides statistics on operations happening in a data stream."] #[derive(Clone, Debug)] -#[doc = "Builder for the [Indices Data Streams Stats API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/data-streams.html)\n\nProvides statistics on operations happening in a data stream."] pub struct IndicesDataStreamsStats<'a, 'b> { transport: &'a Transport, parts: IndicesDataStreamsStatsParts<'b>, @@ -1483,8 +1484,8 @@ impl<'b> IndicesDeleteParts<'b> { } } } +#[doc = "Builder for the [Indices Delete API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/indices-delete-index.html)\n\nDeletes an index."] #[derive(Clone, Debug)] -#[doc = "Builder for the [Indices Delete API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/indices-delete-index.html)\n\nDeletes an index."] pub struct IndicesDelete<'a, 'b> { transport: &'a Transport, parts: IndicesDeleteParts<'b>, @@ -1655,8 +1656,8 @@ impl<'b> IndicesDeleteAliasParts<'b> { } } } +#[doc = "Builder for the [Indices Delete Alias API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/indices-aliases.html)\n\nDeletes an alias."] #[derive(Clone, Debug)] -#[doc = "Builder for the [Indices Delete Alias API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/indices-aliases.html)\n\nDeletes an alias."] pub struct IndicesDeleteAlias<'a, 'b> { transport: &'a Transport, parts: IndicesDeleteAliasParts<'b>, @@ -1793,12 +1794,13 @@ impl<'b> IndicesDeleteDataStreamParts<'b> { } } } +#[doc = "Builder for the [Indices Delete Data Stream API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/data-streams.html)\n\nDeletes a data stream."] #[derive(Clone, Debug)] -#[doc = "Builder for the [Indices Delete Data Stream API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/data-streams.html)\n\nDeletes a data stream."] pub struct IndicesDeleteDataStream<'a, 'b> { transport: &'a Transport, parts: IndicesDeleteDataStreamParts<'b>, error_trace: Option, + expand_wildcards: Option<&'b [ExpandWildcards]>, filter_path: Option<&'b [&'b str]>, headers: HeaderMap, human: Option, @@ -1815,6 +1817,7 @@ impl<'a, 'b> IndicesDeleteDataStream<'a, 'b> { parts, headers, error_trace: None, + expand_wildcards: None, filter_path: None, human: None, pretty: None, @@ -1827,6 +1830,11 @@ impl<'a, 'b> IndicesDeleteDataStream<'a, 'b> { self.error_trace = Some(error_trace); self } + #[doc = "Whether wildcard expressions should get expanded to open or closed indices (default: open)"] + pub fn expand_wildcards(mut self, expand_wildcards: &'b [ExpandWildcards]) -> Self { + self.expand_wildcards = Some(expand_wildcards); + self + } #[doc = "A comma-separated list of filters used to reduce the response."] pub fn filter_path(mut self, filter_path: &'b [&'b str]) -> Self { self.filter_path = Some(filter_path); @@ -1858,6 +1866,141 @@ impl<'a, 'b> IndicesDeleteDataStream<'a, 'b> { self } #[doc = "Creates an asynchronous call to the Indices Delete Data Stream API that can be awaited"] + pub async fn send(self) -> Result { + let path = self.parts.url(); + let method = Method::Delete; + let headers = self.headers; + let timeout = self.request_timeout; + let query_string = { + #[serde_with::skip_serializing_none] + #[derive(Serialize)] + struct QueryParams<'b> { + error_trace: Option, + #[serde(serialize_with = "crate::client::serialize_coll_qs")] + expand_wildcards: Option<&'b [ExpandWildcards]>, + #[serde(serialize_with = "crate::client::serialize_coll_qs")] + filter_path: Option<&'b [&'b str]>, + human: Option, + pretty: Option, + source: Option<&'b str>, + } + let query_params = QueryParams { + error_trace: self.error_trace, + expand_wildcards: self.expand_wildcards, + filter_path: self.filter_path, + human: self.human, + pretty: self.pretty, + source: self.source, + }; + Some(query_params) + }; + let body = Option::<()>::None; + let response = self + .transport + .send(method, &path, headers, query_string.as_ref(), body, timeout) + .await?; + Ok(response) + } +} +#[derive(Debug, Clone, PartialEq)] +#[doc = "API parts for the Indices Delete Index Template API"] +pub enum IndicesDeleteIndexTemplateParts<'b> { + #[doc = "Name"] + Name(&'b str), +} +impl<'b> IndicesDeleteIndexTemplateParts<'b> { + #[doc = "Builds a relative URL path to the Indices Delete Index Template API"] + pub fn url(self) -> Cow<'static, str> { + match self { + IndicesDeleteIndexTemplateParts::Name(ref name) => { + let encoded_name: Cow = percent_encode(name.as_bytes(), PARTS_ENCODED).into(); + let mut p = String::with_capacity(17usize + encoded_name.len()); + p.push_str("/_index_template/"); + p.push_str(encoded_name.as_ref()); + p.into() + } + } + } +} +#[doc = "Builder for the [Indices Delete Index Template API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/indices-templates.html)\n\nDeletes an index template."] +#[derive(Clone, Debug)] +pub struct IndicesDeleteIndexTemplate<'a, 'b> { + transport: &'a Transport, + parts: IndicesDeleteIndexTemplateParts<'b>, + error_trace: Option, + filter_path: Option<&'b [&'b str]>, + headers: HeaderMap, + human: Option, + master_timeout: Option<&'b str>, + pretty: Option, + request_timeout: Option, + source: Option<&'b str>, + timeout: Option<&'b str>, +} +impl<'a, 'b> IndicesDeleteIndexTemplate<'a, 'b> { + #[doc = "Creates a new instance of [IndicesDeleteIndexTemplate] with the specified API parts"] + pub fn new(transport: &'a Transport, parts: IndicesDeleteIndexTemplateParts<'b>) -> Self { + let headers = HeaderMap::new(); + IndicesDeleteIndexTemplate { + transport, + parts, + headers, + error_trace: None, + filter_path: None, + human: None, + master_timeout: None, + pretty: None, + request_timeout: None, + source: None, + timeout: None, + } + } + #[doc = "Include the stack trace of returned errors."] + pub fn error_trace(mut self, error_trace: bool) -> Self { + self.error_trace = Some(error_trace); + self + } + #[doc = "A comma-separated list of filters used to reduce the response."] + pub fn filter_path(mut self, filter_path: &'b [&'b str]) -> Self { + self.filter_path = Some(filter_path); + self + } + #[doc = "Adds a HTTP header"] + pub fn header(mut self, key: HeaderName, value: HeaderValue) -> Self { + self.headers.insert(key, value); + self + } + #[doc = "Return human readable values for statistics."] + pub fn human(mut self, human: bool) -> Self { + self.human = Some(human); + self + } + #[doc = "Specify timeout for connection to master"] + pub fn master_timeout(mut self, master_timeout: &'b str) -> Self { + self.master_timeout = Some(master_timeout); + self + } + #[doc = "Pretty format the returned JSON response."] + pub fn pretty(mut self, pretty: bool) -> Self { + self.pretty = Some(pretty); + self + } + #[doc = "Sets a request timeout for this API call.\n\nThe timeout is applied from when the request starts connecting until the response body has finished."] + pub fn request_timeout(mut self, timeout: Duration) -> Self { + self.request_timeout = Some(timeout); + self + } + #[doc = "The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests."] + pub fn source(mut self, source: &'b str) -> Self { + self.source = Some(source); + self + } + #[doc = "Explicit operation timeout"] + pub fn timeout(mut self, timeout: &'b str) -> Self { + self.timeout = Some(timeout); + self + } + #[doc = "Creates an asynchronous call to the Indices Delete Index Template API that can be awaited"] pub async fn send(self) -> Result { let path = self.parts.url(); let method = Method::Delete; @@ -1871,15 +2014,19 @@ impl<'a, 'b> IndicesDeleteDataStream<'a, 'b> { #[serde(serialize_with = "crate::client::serialize_coll_qs")] filter_path: Option<&'b [&'b str]>, human: Option, + master_timeout: Option<&'b str>, pretty: Option, source: Option<&'b str>, + timeout: Option<&'b str>, } let query_params = QueryParams { error_trace: self.error_trace, filter_path: self.filter_path, human: self.human, + master_timeout: self.master_timeout, pretty: self.pretty, source: self.source, + timeout: self.timeout, }; Some(query_params) }; @@ -1911,8 +2058,8 @@ impl<'b> IndicesDeleteTemplateParts<'b> { } } } +#[doc = "Builder for the [Indices Delete Template API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/indices-templates.html)\n\nDeletes an index template."] #[derive(Clone, Debug)] -#[doc = "Builder for the [Indices Delete Template API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/indices-templates.html)\n\nDeletes an index template."] pub struct IndicesDeleteTemplate<'a, 'b> { transport: &'a Transport, parts: IndicesDeleteTemplateParts<'b>, @@ -2049,8 +2196,8 @@ impl<'b> IndicesExistsParts<'b> { } } } +#[doc = "Builder for the [Indices Exists API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/indices-exists.html)\n\nReturns information about whether a particular index exists."] #[derive(Clone, Debug)] -#[doc = "Builder for the [Indices Exists API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/indices-exists.html)\n\nReturns information about whether a particular index exists."] pub struct IndicesExists<'a, 'b> { transport: &'a Transport, parts: IndicesExistsParts<'b>, @@ -2241,8 +2388,8 @@ impl<'b> IndicesExistsAliasParts<'b> { } } } +#[doc = "Builder for the [Indices Exists Alias API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/indices-aliases.html)\n\nReturns information about whether a particular alias exists."] #[derive(Clone, Debug)] -#[doc = "Builder for the [Indices Exists Alias API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/indices-aliases.html)\n\nReturns information about whether a particular alias exists."] pub struct IndicesExistsAlias<'a, 'b> { transport: &'a Transport, parts: IndicesExistsAliasParts<'b>, @@ -2377,32 +2524,30 @@ impl<'a, 'b> IndicesExistsAlias<'a, 'b> { } } #[derive(Debug, Clone, PartialEq)] -#[doc = "API parts for the Indices Exists Template API"] -pub enum IndicesExistsTemplateParts<'b> { +#[doc = "API parts for the Indices Exists Index Template API"] +pub enum IndicesExistsIndexTemplateParts<'b> { #[doc = "Name"] - Name(&'b [&'b str]), + Name(&'b str), } -impl<'b> IndicesExistsTemplateParts<'b> { - #[doc = "Builds a relative URL path to the Indices Exists Template API"] +impl<'b> IndicesExistsIndexTemplateParts<'b> { + #[doc = "Builds a relative URL path to the Indices Exists Index Template API"] pub fn url(self) -> Cow<'static, str> { match self { - IndicesExistsTemplateParts::Name(ref name) => { - let name_str = name.join(","); - let encoded_name: Cow = - percent_encode(name_str.as_bytes(), PARTS_ENCODED).into(); - let mut p = String::with_capacity(11usize + encoded_name.len()); - p.push_str("/_template/"); + IndicesExistsIndexTemplateParts::Name(ref name) => { + let encoded_name: Cow = percent_encode(name.as_bytes(), PARTS_ENCODED).into(); + let mut p = String::with_capacity(17usize + encoded_name.len()); + p.push_str("/_index_template/"); p.push_str(encoded_name.as_ref()); p.into() } } } } +#[doc = "Builder for the [Indices Exists Index Template API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/indices-templates.html)\n\nReturns information about whether a particular index template exists."] #[derive(Clone, Debug)] -#[doc = "Builder for the [Indices Exists Template API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/indices-templates.html)\n\nReturns information about whether a particular index template exists."] -pub struct IndicesExistsTemplate<'a, 'b> { +pub struct IndicesExistsIndexTemplate<'a, 'b> { transport: &'a Transport, - parts: IndicesExistsTemplateParts<'b>, + parts: IndicesExistsIndexTemplateParts<'b>, error_trace: Option, filter_path: Option<&'b [&'b str]>, flat_settings: Option, @@ -2414,11 +2559,11 @@ pub struct IndicesExistsTemplate<'a, 'b> { request_timeout: Option, source: Option<&'b str>, } -impl<'a, 'b> IndicesExistsTemplate<'a, 'b> { - #[doc = "Creates a new instance of [IndicesExistsTemplate] with the specified API parts"] - pub fn new(transport: &'a Transport, parts: IndicesExistsTemplateParts<'b>) -> Self { +impl<'a, 'b> IndicesExistsIndexTemplate<'a, 'b> { + #[doc = "Creates a new instance of [IndicesExistsIndexTemplate] with the specified API parts"] + pub fn new(transport: &'a Transport, parts: IndicesExistsIndexTemplateParts<'b>) -> Self { let headers = HeaderMap::new(); - IndicesExistsTemplate { + IndicesExistsIndexTemplate { transport, parts, headers, @@ -2483,7 +2628,7 @@ impl<'a, 'b> IndicesExistsTemplate<'a, 'b> { self.source = Some(source); self } - #[doc = "Creates an asynchronous call to the Indices Exists Template API that can be awaited"] + #[doc = "Creates an asynchronous call to the Indices Exists Index Template API that can be awaited"] pub async fn send(self) -> Result { let path = self.parts.url(); let method = Method::Head; @@ -2524,88 +2669,77 @@ impl<'a, 'b> IndicesExistsTemplate<'a, 'b> { } } #[derive(Debug, Clone, PartialEq)] -#[doc = "API parts for the Indices Exists Type API"] -pub enum IndicesExistsTypeParts<'b> { - #[doc = "Index and Type"] - IndexType(&'b [&'b str], &'b [&'b str]), +#[doc = "API parts for the Indices Exists Template API"] +pub enum IndicesExistsTemplateParts<'b> { + #[doc = "Name"] + Name(&'b [&'b str]), } -impl<'b> IndicesExistsTypeParts<'b> { - #[doc = "Builds a relative URL path to the Indices Exists Type API"] +impl<'b> IndicesExistsTemplateParts<'b> { + #[doc = "Builds a relative URL path to the Indices Exists Template API"] pub fn url(self) -> Cow<'static, str> { match self { - IndicesExistsTypeParts::IndexType(ref index, ref ty) => { - let index_str = index.join(","); - let ty_str = ty.join(","); - let encoded_index: Cow = - percent_encode(index_str.as_bytes(), PARTS_ENCODED).into(); - let encoded_ty: Cow = percent_encode(ty_str.as_bytes(), PARTS_ENCODED).into(); - let mut p = String::with_capacity(11usize + encoded_index.len() + encoded_ty.len()); - p.push_str("/"); - p.push_str(encoded_index.as_ref()); - p.push_str("/_mapping/"); - p.push_str(encoded_ty.as_ref()); + IndicesExistsTemplateParts::Name(ref name) => { + let name_str = name.join(","); + let encoded_name: Cow = + percent_encode(name_str.as_bytes(), PARTS_ENCODED).into(); + let mut p = String::with_capacity(11usize + encoded_name.len()); + p.push_str("/_template/"); + p.push_str(encoded_name.as_ref()); p.into() } } } } +#[doc = "Builder for the [Indices Exists Template API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/indices-templates.html)\n\nReturns information about whether a particular index template exists."] #[derive(Clone, Debug)] -#[doc = "Builder for the [Indices Exists Type API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/indices-types-exists.html)\n\nReturns information about whether a particular document type exists. (DEPRECATED)"] -pub struct IndicesExistsType<'a, 'b> { +pub struct IndicesExistsTemplate<'a, 'b> { transport: &'a Transport, - parts: IndicesExistsTypeParts<'b>, - allow_no_indices: Option, + parts: IndicesExistsTemplateParts<'b>, error_trace: Option, - expand_wildcards: Option<&'b [ExpandWildcards]>, filter_path: Option<&'b [&'b str]>, + flat_settings: Option, headers: HeaderMap, human: Option, - ignore_unavailable: Option, local: Option, + master_timeout: Option<&'b str>, pretty: Option, request_timeout: Option, source: Option<&'b str>, } -impl<'a, 'b> IndicesExistsType<'a, 'b> { - #[doc = "Creates a new instance of [IndicesExistsType] with the specified API parts"] - pub fn new(transport: &'a Transport, parts: IndicesExistsTypeParts<'b>) -> Self { +impl<'a, 'b> IndicesExistsTemplate<'a, 'b> { + #[doc = "Creates a new instance of [IndicesExistsTemplate] with the specified API parts"] + pub fn new(transport: &'a Transport, parts: IndicesExistsTemplateParts<'b>) -> Self { let headers = HeaderMap::new(); - IndicesExistsType { + IndicesExistsTemplate { transport, parts, headers, - allow_no_indices: None, error_trace: None, - expand_wildcards: None, filter_path: None, + flat_settings: None, human: None, - ignore_unavailable: None, local: None, + master_timeout: None, pretty: None, request_timeout: None, source: None, } } - #[doc = "Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes `_all` string or when no indices have been specified)"] - pub fn allow_no_indices(mut self, allow_no_indices: bool) -> Self { - self.allow_no_indices = Some(allow_no_indices); - self - } #[doc = "Include the stack trace of returned errors."] pub fn error_trace(mut self, error_trace: bool) -> Self { self.error_trace = Some(error_trace); self } - #[doc = "Whether to expand wildcard expression to concrete indices that are open, closed or both."] - pub fn expand_wildcards(mut self, expand_wildcards: &'b [ExpandWildcards]) -> Self { - self.expand_wildcards = Some(expand_wildcards); - self - } #[doc = "A comma-separated list of filters used to reduce the response."] pub fn filter_path(mut self, filter_path: &'b [&'b str]) -> Self { self.filter_path = Some(filter_path); self } + #[doc = "Return settings in flat format (default: false)"] + pub fn flat_settings(mut self, flat_settings: bool) -> Self { + self.flat_settings = Some(flat_settings); + self + } #[doc = "Adds a HTTP header"] pub fn header(mut self, key: HeaderName, value: HeaderValue) -> Self { self.headers.insert(key, value); @@ -2616,16 +2750,16 @@ impl<'a, 'b> IndicesExistsType<'a, 'b> { self.human = Some(human); self } - #[doc = "Whether specified concrete indices should be ignored when unavailable (missing or closed)"] - pub fn ignore_unavailable(mut self, ignore_unavailable: bool) -> Self { - self.ignore_unavailable = Some(ignore_unavailable); - self - } #[doc = "Return local information, do not retrieve the state from master node (default: false)"] pub fn local(mut self, local: bool) -> Self { self.local = Some(local); self } + #[doc = "Explicit operation timeout for connection to master node"] + pub fn master_timeout(mut self, master_timeout: &'b str) -> Self { + self.master_timeout = Some(master_timeout); + self + } #[doc = "Pretty format the returned JSON response."] pub fn pretty(mut self, pretty: bool) -> Self { self.pretty = Some(pretty); @@ -2641,7 +2775,7 @@ impl<'a, 'b> IndicesExistsType<'a, 'b> { self.source = Some(source); self } - #[doc = "Creates an asynchronous call to the Indices Exists Type API that can be awaited"] + #[doc = "Creates an asynchronous call to the Indices Exists Template API that can be awaited"] pub async fn send(self) -> Result { let path = self.parts.url(); let method = Method::Head; @@ -2651,26 +2785,23 @@ impl<'a, 'b> IndicesExistsType<'a, 'b> { #[serde_with::skip_serializing_none] #[derive(Serialize)] struct QueryParams<'b> { - allow_no_indices: Option, error_trace: Option, #[serde(serialize_with = "crate::client::serialize_coll_qs")] - expand_wildcards: Option<&'b [ExpandWildcards]>, - #[serde(serialize_with = "crate::client::serialize_coll_qs")] filter_path: Option<&'b [&'b str]>, + flat_settings: Option, human: Option, - ignore_unavailable: Option, local: Option, + master_timeout: Option<&'b str>, pretty: Option, source: Option<&'b str>, } let query_params = QueryParams { - allow_no_indices: self.allow_no_indices, error_trace: self.error_trace, - expand_wildcards: self.expand_wildcards, filter_path: self.filter_path, + flat_settings: self.flat_settings, human: self.human, - ignore_unavailable: self.ignore_unavailable, local: self.local, + master_timeout: self.master_timeout, pretty: self.pretty, source: self.source, }; @@ -2685,15 +2816,176 @@ impl<'a, 'b> IndicesExistsType<'a, 'b> { } } #[derive(Debug, Clone, PartialEq)] -#[doc = "API parts for the Indices Flush API"] -pub enum IndicesFlushParts<'b> { - #[doc = "No parts"] - None, - #[doc = "Index"] - Index(&'b [&'b str]), +#[doc = "API parts for the Indices Exists Type API"] +pub enum IndicesExistsTypeParts<'b> { + #[doc = "Index and Type"] + IndexType(&'b [&'b str], &'b [&'b str]), } -impl<'b> IndicesFlushParts<'b> { - #[doc = "Builds a relative URL path to the Indices Flush API"] +impl<'b> IndicesExistsTypeParts<'b> { + #[doc = "Builds a relative URL path to the Indices Exists Type API"] + pub fn url(self) -> Cow<'static, str> { + match self { + IndicesExistsTypeParts::IndexType(ref index, ref ty) => { + let index_str = index.join(","); + let ty_str = ty.join(","); + let encoded_index: Cow = + percent_encode(index_str.as_bytes(), PARTS_ENCODED).into(); + let encoded_ty: Cow = percent_encode(ty_str.as_bytes(), PARTS_ENCODED).into(); + let mut p = String::with_capacity(11usize + encoded_index.len() + encoded_ty.len()); + p.push_str("/"); + p.push_str(encoded_index.as_ref()); + p.push_str("/_mapping/"); + p.push_str(encoded_ty.as_ref()); + p.into() + } + } + } +} +#[doc = "Builder for the [Indices Exists Type API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/indices-types-exists.html)\n\nReturns information about whether a particular document type exists. (DEPRECATED)"] +#[derive(Clone, Debug)] +pub struct IndicesExistsType<'a, 'b> { + transport: &'a Transport, + parts: IndicesExistsTypeParts<'b>, + allow_no_indices: Option, + error_trace: Option, + expand_wildcards: Option<&'b [ExpandWildcards]>, + filter_path: Option<&'b [&'b str]>, + headers: HeaderMap, + human: Option, + ignore_unavailable: Option, + local: Option, + pretty: Option, + request_timeout: Option, + source: Option<&'b str>, +} +impl<'a, 'b> IndicesExistsType<'a, 'b> { + #[doc = "Creates a new instance of [IndicesExistsType] with the specified API parts"] + pub fn new(transport: &'a Transport, parts: IndicesExistsTypeParts<'b>) -> Self { + let headers = HeaderMap::new(); + IndicesExistsType { + transport, + parts, + headers, + allow_no_indices: None, + error_trace: None, + expand_wildcards: None, + filter_path: None, + human: None, + ignore_unavailable: None, + local: None, + pretty: None, + request_timeout: None, + source: None, + } + } + #[doc = "Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes `_all` string or when no indices have been specified)"] + pub fn allow_no_indices(mut self, allow_no_indices: bool) -> Self { + self.allow_no_indices = Some(allow_no_indices); + self + } + #[doc = "Include the stack trace of returned errors."] + pub fn error_trace(mut self, error_trace: bool) -> Self { + self.error_trace = Some(error_trace); + self + } + #[doc = "Whether to expand wildcard expression to concrete indices that are open, closed or both."] + pub fn expand_wildcards(mut self, expand_wildcards: &'b [ExpandWildcards]) -> Self { + self.expand_wildcards = Some(expand_wildcards); + self + } + #[doc = "A comma-separated list of filters used to reduce the response."] + pub fn filter_path(mut self, filter_path: &'b [&'b str]) -> Self { + self.filter_path = Some(filter_path); + self + } + #[doc = "Adds a HTTP header"] + pub fn header(mut self, key: HeaderName, value: HeaderValue) -> Self { + self.headers.insert(key, value); + self + } + #[doc = "Return human readable values for statistics."] + pub fn human(mut self, human: bool) -> Self { + self.human = Some(human); + self + } + #[doc = "Whether specified concrete indices should be ignored when unavailable (missing or closed)"] + pub fn ignore_unavailable(mut self, ignore_unavailable: bool) -> Self { + self.ignore_unavailable = Some(ignore_unavailable); + self + } + #[doc = "Return local information, do not retrieve the state from master node (default: false)"] + pub fn local(mut self, local: bool) -> Self { + self.local = Some(local); + self + } + #[doc = "Pretty format the returned JSON response."] + pub fn pretty(mut self, pretty: bool) -> Self { + self.pretty = Some(pretty); + self + } + #[doc = "Sets a request timeout for this API call.\n\nThe timeout is applied from when the request starts connecting until the response body has finished."] + pub fn request_timeout(mut self, timeout: Duration) -> Self { + self.request_timeout = Some(timeout); + self + } + #[doc = "The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests."] + pub fn source(mut self, source: &'b str) -> Self { + self.source = Some(source); + self + } + #[doc = "Creates an asynchronous call to the Indices Exists Type API that can be awaited"] + pub async fn send(self) -> Result { + let path = self.parts.url(); + let method = Method::Head; + let headers = self.headers; + let timeout = self.request_timeout; + let query_string = { + #[serde_with::skip_serializing_none] + #[derive(Serialize)] + struct QueryParams<'b> { + allow_no_indices: Option, + error_trace: Option, + #[serde(serialize_with = "crate::client::serialize_coll_qs")] + expand_wildcards: Option<&'b [ExpandWildcards]>, + #[serde(serialize_with = "crate::client::serialize_coll_qs")] + filter_path: Option<&'b [&'b str]>, + human: Option, + ignore_unavailable: Option, + local: Option, + pretty: Option, + source: Option<&'b str>, + } + let query_params = QueryParams { + allow_no_indices: self.allow_no_indices, + error_trace: self.error_trace, + expand_wildcards: self.expand_wildcards, + filter_path: self.filter_path, + human: self.human, + ignore_unavailable: self.ignore_unavailable, + local: self.local, + pretty: self.pretty, + source: self.source, + }; + Some(query_params) + }; + let body = Option::<()>::None; + let response = self + .transport + .send(method, &path, headers, query_string.as_ref(), body, timeout) + .await?; + Ok(response) + } +} +#[derive(Debug, Clone, PartialEq)] +#[doc = "API parts for the Indices Flush API"] +pub enum IndicesFlushParts<'b> { + #[doc = "No parts"] + None, + #[doc = "Index"] + Index(&'b [&'b str]), +} +impl<'b> IndicesFlushParts<'b> { + #[doc = "Builds a relative URL path to the Indices Flush API"] pub fn url(self) -> Cow<'static, str> { match self { IndicesFlushParts::None => "/_flush".into(), @@ -2710,8 +3002,8 @@ impl<'b> IndicesFlushParts<'b> { } } } +#[doc = "Builder for the [Indices Flush API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/indices-flush.html)\n\nPerforms the flush operation on one or more indices."] #[derive(Clone, Debug)] -#[doc = "Builder for the [Indices Flush API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/indices-flush.html)\n\nPerforms the flush operation on one or more indices."] pub struct IndicesFlush<'a, 'b, B> { transport: &'a Transport, parts: IndicesFlushParts<'b>, @@ -2911,8 +3203,8 @@ impl<'b> IndicesFlushSyncedParts<'b> { } } } +#[doc = "Builder for the [Indices Flush Synced API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/indices-synced-flush-api.html)\n\nPerforms a synced flush operation on one or more indices. Synced flush is deprecated and will be removed in 8.0. Use flush instead"] #[derive(Clone, Debug)] -#[doc = "Builder for the [Indices Flush Synced API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/indices-synced-flush-api.html)\n\nPerforms a synced flush operation on one or more indices. Synced flush is deprecated and will be removed in 8.0. Use flush instead"] pub struct IndicesFlushSynced<'a, 'b, B> { transport: &'a Transport, parts: IndicesFlushSyncedParts<'b>, @@ -3092,8 +3384,8 @@ impl<'b> IndicesForcemergeParts<'b> { } } } +#[doc = "Builder for the [Indices Forcemerge API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/indices-forcemerge.html)\n\nPerforms the force merge operation on one or more indices."] #[derive(Clone, Debug)] -#[doc = "Builder for the [Indices Forcemerge API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/indices-forcemerge.html)\n\nPerforms the force merge operation on one or more indices."] pub struct IndicesForcemerge<'a, 'b, B> { transport: &'a Transport, parts: IndicesForcemergeParts<'b>, @@ -3296,8 +3588,8 @@ impl<'b> IndicesFreezeParts<'b> { } } } +#[doc = "Builder for the [Indices Freeze API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/freeze-index-api.html)\n\nFreezes an index. A frozen index has almost no overhead on the cluster (except for maintaining its metadata in memory) and is read-only."] #[derive(Clone, Debug)] -#[doc = "Builder for the [Indices Freeze API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/freeze-index-api.html)\n\nFreezes an index. A frozen index has almost no overhead on the cluster (except for maintaining its metadata in memory) and is read-only."] pub struct IndicesFreeze<'a, 'b, B> { transport: &'a Transport, parts: IndicesFreezeParts<'b>, @@ -3500,8 +3792,8 @@ impl<'b> IndicesGetParts<'b> { } } } +#[doc = "Builder for the [Indices Get API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/indices-get-index.html)\n\nReturns information about one or more indices."] #[derive(Clone, Debug)] -#[doc = "Builder for the [Indices Get API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/indices-get-index.html)\n\nReturns information about one or more indices."] pub struct IndicesGet<'a, 'b> { transport: &'a Transport, parts: IndicesGetParts<'b>, @@ -3725,8 +4017,8 @@ impl<'b> IndicesGetAliasParts<'b> { } } } +#[doc = "Builder for the [Indices Get Alias API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/indices-aliases.html)\n\nReturns an alias."] #[derive(Clone, Debug)] -#[doc = "Builder for the [Indices Get Alias API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/indices-aliases.html)\n\nReturns an alias."] pub struct IndicesGetAlias<'a, 'b> { transport: &'a Transport, parts: IndicesGetAliasParts<'b>, @@ -3885,12 +4177,13 @@ impl<'b> IndicesGetDataStreamParts<'b> { } } } +#[doc = "Builder for the [Indices Get Data Stream API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/data-streams.html)\n\nReturns data streams."] #[derive(Clone, Debug)] -#[doc = "Builder for the [Indices Get Data Stream API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/data-streams.html)\n\nReturns data streams."] pub struct IndicesGetDataStream<'a, 'b> { transport: &'a Transport, parts: IndicesGetDataStreamParts<'b>, error_trace: Option, + expand_wildcards: Option<&'b [ExpandWildcards]>, filter_path: Option<&'b [&'b str]>, headers: HeaderMap, human: Option, @@ -3907,6 +4200,7 @@ impl<'a, 'b> IndicesGetDataStream<'a, 'b> { parts, headers, error_trace: None, + expand_wildcards: None, filter_path: None, human: None, pretty: None, @@ -3919,6 +4213,11 @@ impl<'a, 'b> IndicesGetDataStream<'a, 'b> { self.error_trace = Some(error_trace); self } + #[doc = "Whether wildcard expressions should get expanded to open or closed indices (default: open)"] + pub fn expand_wildcards(mut self, expand_wildcards: &'b [ExpandWildcards]) -> Self { + self.expand_wildcards = Some(expand_wildcards); + self + } #[doc = "A comma-separated list of filters used to reduce the response."] pub fn filter_path(mut self, filter_path: &'b [&'b str]) -> Self { self.filter_path = Some(filter_path); @@ -3961,6 +4260,8 @@ impl<'a, 'b> IndicesGetDataStream<'a, 'b> { struct QueryParams<'b> { error_trace: Option, #[serde(serialize_with = "crate::client::serialize_coll_qs")] + expand_wildcards: Option<&'b [ExpandWildcards]>, + #[serde(serialize_with = "crate::client::serialize_coll_qs")] filter_path: Option<&'b [&'b str]>, human: Option, pretty: Option, @@ -3968,6 +4269,7 @@ impl<'a, 'b> IndicesGetDataStream<'a, 'b> { } let query_params = QueryParams { error_trace: self.error_trace, + expand_wildcards: self.expand_wildcards, filter_path: self.filter_path, human: self.human, pretty: self.pretty, @@ -4060,8 +4362,8 @@ impl<'b> IndicesGetFieldMappingParts<'b> { } } } +#[doc = "Builder for the [Indices Get Field Mapping API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/indices-get-field-mapping.html)\n\nReturns mapping for one or more fields."] #[derive(Clone, Debug)] -#[doc = "Builder for the [Indices Get Field Mapping API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/indices-get-field-mapping.html)\n\nReturns mapping for one or more fields."] pub struct IndicesGetFieldMapping<'a, 'b> { transport: &'a Transport, parts: IndicesGetFieldMappingParts<'b>, @@ -4214,90 +4516,58 @@ impl<'a, 'b> IndicesGetFieldMapping<'a, 'b> { } } #[derive(Debug, Clone, PartialEq)] -#[doc = "API parts for the Indices Get Mapping API"] -pub enum IndicesGetMappingParts<'b> { +#[doc = "API parts for the Indices Get Index Template API"] +pub enum IndicesGetIndexTemplateParts<'b> { #[doc = "No parts"] None, - #[doc = "Index"] - Index(&'b [&'b str]), - #[doc = "Type"] - Type(&'b [&'b str]), - #[doc = "Index and Type"] - IndexType(&'b [&'b str], &'b [&'b str]), + #[doc = "Name"] + Name(&'b [&'b str]), } -impl<'b> IndicesGetMappingParts<'b> { - #[doc = "Builds a relative URL path to the Indices Get Mapping API"] +impl<'b> IndicesGetIndexTemplateParts<'b> { + #[doc = "Builds a relative URL path to the Indices Get Index Template API"] pub fn url(self) -> Cow<'static, str> { match self { - IndicesGetMappingParts::None => "/_mapping".into(), - IndicesGetMappingParts::Index(ref index) => { - let index_str = index.join(","); - let encoded_index: Cow = - percent_encode(index_str.as_bytes(), PARTS_ENCODED).into(); - let mut p = String::with_capacity(10usize + encoded_index.len()); - p.push_str("/"); - p.push_str(encoded_index.as_ref()); - p.push_str("/_mapping"); - p.into() - } - IndicesGetMappingParts::Type(ref ty) => { - let ty_str = ty.join(","); - let encoded_ty: Cow = percent_encode(ty_str.as_bytes(), PARTS_ENCODED).into(); - let mut p = String::with_capacity(10usize + encoded_ty.len()); - p.push_str("/_mapping/"); - p.push_str(encoded_ty.as_ref()); - p.into() - } - IndicesGetMappingParts::IndexType(ref index, ref ty) => { - let index_str = index.join(","); - let ty_str = ty.join(","); - let encoded_index: Cow = - percent_encode(index_str.as_bytes(), PARTS_ENCODED).into(); - let encoded_ty: Cow = percent_encode(ty_str.as_bytes(), PARTS_ENCODED).into(); - let mut p = String::with_capacity(11usize + encoded_index.len() + encoded_ty.len()); - p.push_str("/"); - p.push_str(encoded_index.as_ref()); - p.push_str("/_mapping/"); - p.push_str(encoded_ty.as_ref()); + IndicesGetIndexTemplateParts::None => "/_index_template".into(), + IndicesGetIndexTemplateParts::Name(ref name) => { + let name_str = name.join(","); + let encoded_name: Cow = + percent_encode(name_str.as_bytes(), PARTS_ENCODED).into(); + let mut p = String::with_capacity(17usize + encoded_name.len()); + p.push_str("/_index_template/"); + p.push_str(encoded_name.as_ref()); p.into() } } } } +#[doc = "Builder for the [Indices Get Index Template API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/indices-templates.html)\n\nReturns an index template."] #[derive(Clone, Debug)] -#[doc = "Builder for the [Indices Get Mapping API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/indices-get-mapping.html)\n\nReturns mappings for one or more indices."] -pub struct IndicesGetMapping<'a, 'b> { +pub struct IndicesGetIndexTemplate<'a, 'b> { transport: &'a Transport, - parts: IndicesGetMappingParts<'b>, - allow_no_indices: Option, + parts: IndicesGetIndexTemplateParts<'b>, error_trace: Option, - expand_wildcards: Option<&'b [ExpandWildcards]>, filter_path: Option<&'b [&'b str]>, + flat_settings: Option, headers: HeaderMap, human: Option, - ignore_unavailable: Option, - include_type_name: Option, local: Option, master_timeout: Option<&'b str>, pretty: Option, request_timeout: Option, source: Option<&'b str>, } -impl<'a, 'b> IndicesGetMapping<'a, 'b> { - #[doc = "Creates a new instance of [IndicesGetMapping] with the specified API parts"] - pub fn new(transport: &'a Transport, parts: IndicesGetMappingParts<'b>) -> Self { +impl<'a, 'b> IndicesGetIndexTemplate<'a, 'b> { + #[doc = "Creates a new instance of [IndicesGetIndexTemplate] with the specified API parts"] + pub fn new(transport: &'a Transport, parts: IndicesGetIndexTemplateParts<'b>) -> Self { let headers = HeaderMap::new(); - IndicesGetMapping { + IndicesGetIndexTemplate { transport, parts, headers, - allow_no_indices: None, error_trace: None, - expand_wildcards: None, filter_path: None, + flat_settings: None, human: None, - ignore_unavailable: None, - include_type_name: None, local: None, master_timeout: None, pretty: None, @@ -4305,26 +4575,21 @@ impl<'a, 'b> IndicesGetMapping<'a, 'b> { source: None, } } - #[doc = "Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes `_all` string or when no indices have been specified)"] - pub fn allow_no_indices(mut self, allow_no_indices: bool) -> Self { - self.allow_no_indices = Some(allow_no_indices); - self - } #[doc = "Include the stack trace of returned errors."] pub fn error_trace(mut self, error_trace: bool) -> Self { self.error_trace = Some(error_trace); self } - #[doc = "Whether to expand wildcard expression to concrete indices that are open, closed or both."] - pub fn expand_wildcards(mut self, expand_wildcards: &'b [ExpandWildcards]) -> Self { - self.expand_wildcards = Some(expand_wildcards); - self - } #[doc = "A comma-separated list of filters used to reduce the response."] pub fn filter_path(mut self, filter_path: &'b [&'b str]) -> Self { self.filter_path = Some(filter_path); self } + #[doc = "Return settings in flat format (default: false)"] + pub fn flat_settings(mut self, flat_settings: bool) -> Self { + self.flat_settings = Some(flat_settings); + self + } #[doc = "Adds a HTTP header"] pub fn header(mut self, key: HeaderName, value: HeaderValue) -> Self { self.headers.insert(key, value); @@ -4335,12 +4600,199 @@ impl<'a, 'b> IndicesGetMapping<'a, 'b> { self.human = Some(human); self } - #[doc = "Whether specified concrete indices should be ignored when unavailable (missing or closed)"] - pub fn ignore_unavailable(mut self, ignore_unavailable: bool) -> Self { - self.ignore_unavailable = Some(ignore_unavailable); + #[doc = "Return local information, do not retrieve the state from master node (default: false)"] + pub fn local(mut self, local: bool) -> Self { + self.local = Some(local); self } - #[doc = "Whether to add the type name to the response (default: false)"] + #[doc = "Explicit operation timeout for connection to master node"] + pub fn master_timeout(mut self, master_timeout: &'b str) -> Self { + self.master_timeout = Some(master_timeout); + self + } + #[doc = "Pretty format the returned JSON response."] + pub fn pretty(mut self, pretty: bool) -> Self { + self.pretty = Some(pretty); + self + } + #[doc = "Sets a request timeout for this API call.\n\nThe timeout is applied from when the request starts connecting until the response body has finished."] + pub fn request_timeout(mut self, timeout: Duration) -> Self { + self.request_timeout = Some(timeout); + self + } + #[doc = "The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests."] + pub fn source(mut self, source: &'b str) -> Self { + self.source = Some(source); + self + } + #[doc = "Creates an asynchronous call to the Indices Get Index Template API that can be awaited"] + pub async fn send(self) -> Result { + let path = self.parts.url(); + let method = Method::Get; + let headers = self.headers; + let timeout = self.request_timeout; + let query_string = { + #[serde_with::skip_serializing_none] + #[derive(Serialize)] + struct QueryParams<'b> { + error_trace: Option, + #[serde(serialize_with = "crate::client::serialize_coll_qs")] + filter_path: Option<&'b [&'b str]>, + flat_settings: Option, + human: Option, + local: Option, + master_timeout: Option<&'b str>, + pretty: Option, + source: Option<&'b str>, + } + let query_params = QueryParams { + error_trace: self.error_trace, + filter_path: self.filter_path, + flat_settings: self.flat_settings, + human: self.human, + local: self.local, + master_timeout: self.master_timeout, + pretty: self.pretty, + source: self.source, + }; + Some(query_params) + }; + let body = Option::<()>::None; + let response = self + .transport + .send(method, &path, headers, query_string.as_ref(), body, timeout) + .await?; + Ok(response) + } +} +#[derive(Debug, Clone, PartialEq)] +#[doc = "API parts for the Indices Get Mapping API"] +pub enum IndicesGetMappingParts<'b> { + #[doc = "No parts"] + None, + #[doc = "Index"] + Index(&'b [&'b str]), + #[doc = "Type"] + Type(&'b [&'b str]), + #[doc = "Index and Type"] + IndexType(&'b [&'b str], &'b [&'b str]), +} +impl<'b> IndicesGetMappingParts<'b> { + #[doc = "Builds a relative URL path to the Indices Get Mapping API"] + pub fn url(self) -> Cow<'static, str> { + match self { + IndicesGetMappingParts::None => "/_mapping".into(), + IndicesGetMappingParts::Index(ref index) => { + let index_str = index.join(","); + let encoded_index: Cow = + percent_encode(index_str.as_bytes(), PARTS_ENCODED).into(); + let mut p = String::with_capacity(10usize + encoded_index.len()); + p.push_str("/"); + p.push_str(encoded_index.as_ref()); + p.push_str("/_mapping"); + p.into() + } + IndicesGetMappingParts::Type(ref ty) => { + let ty_str = ty.join(","); + let encoded_ty: Cow = percent_encode(ty_str.as_bytes(), PARTS_ENCODED).into(); + let mut p = String::with_capacity(10usize + encoded_ty.len()); + p.push_str("/_mapping/"); + p.push_str(encoded_ty.as_ref()); + p.into() + } + IndicesGetMappingParts::IndexType(ref index, ref ty) => { + let index_str = index.join(","); + let ty_str = ty.join(","); + let encoded_index: Cow = + percent_encode(index_str.as_bytes(), PARTS_ENCODED).into(); + let encoded_ty: Cow = percent_encode(ty_str.as_bytes(), PARTS_ENCODED).into(); + let mut p = String::with_capacity(11usize + encoded_index.len() + encoded_ty.len()); + p.push_str("/"); + p.push_str(encoded_index.as_ref()); + p.push_str("/_mapping/"); + p.push_str(encoded_ty.as_ref()); + p.into() + } + } + } +} +#[doc = "Builder for the [Indices Get Mapping API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/indices-get-mapping.html)\n\nReturns mappings for one or more indices."] +#[derive(Clone, Debug)] +pub struct IndicesGetMapping<'a, 'b> { + transport: &'a Transport, + parts: IndicesGetMappingParts<'b>, + allow_no_indices: Option, + error_trace: Option, + expand_wildcards: Option<&'b [ExpandWildcards]>, + filter_path: Option<&'b [&'b str]>, + headers: HeaderMap, + human: Option, + ignore_unavailable: Option, + include_type_name: Option, + local: Option, + master_timeout: Option<&'b str>, + pretty: Option, + request_timeout: Option, + source: Option<&'b str>, +} +impl<'a, 'b> IndicesGetMapping<'a, 'b> { + #[doc = "Creates a new instance of [IndicesGetMapping] with the specified API parts"] + pub fn new(transport: &'a Transport, parts: IndicesGetMappingParts<'b>) -> Self { + let headers = HeaderMap::new(); + IndicesGetMapping { + transport, + parts, + headers, + allow_no_indices: None, + error_trace: None, + expand_wildcards: None, + filter_path: None, + human: None, + ignore_unavailable: None, + include_type_name: None, + local: None, + master_timeout: None, + pretty: None, + request_timeout: None, + source: None, + } + } + #[doc = "Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes `_all` string or when no indices have been specified)"] + pub fn allow_no_indices(mut self, allow_no_indices: bool) -> Self { + self.allow_no_indices = Some(allow_no_indices); + self + } + #[doc = "Include the stack trace of returned errors."] + pub fn error_trace(mut self, error_trace: bool) -> Self { + self.error_trace = Some(error_trace); + self + } + #[doc = "Whether to expand wildcard expression to concrete indices that are open, closed or both."] + pub fn expand_wildcards(mut self, expand_wildcards: &'b [ExpandWildcards]) -> Self { + self.expand_wildcards = Some(expand_wildcards); + self + } + #[doc = "A comma-separated list of filters used to reduce the response."] + pub fn filter_path(mut self, filter_path: &'b [&'b str]) -> Self { + self.filter_path = Some(filter_path); + self + } + #[doc = "Adds a HTTP header"] + pub fn header(mut self, key: HeaderName, value: HeaderValue) -> Self { + self.headers.insert(key, value); + self + } + #[doc = "Return human readable values for statistics."] + pub fn human(mut self, human: bool) -> Self { + self.human = Some(human); + self + } + #[doc = "Whether specified concrete indices should be ignored when unavailable (missing or closed)"] + pub fn ignore_unavailable(mut self, ignore_unavailable: bool) -> Self { + self.ignore_unavailable = Some(ignore_unavailable); + self + } + #[doc = "Whether to add the type name to the response (default: false)"] pub fn include_type_name(mut self, include_type_name: bool) -> Self { self.include_type_name = Some(include_type_name); self @@ -4471,8 +4923,8 @@ impl<'b> IndicesGetSettingsParts<'b> { } } } +#[doc = "Builder for the [Indices Get Settings API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/indices-get-settings.html)\n\nReturns settings for one or more indices."] #[derive(Clone, Debug)] -#[doc = "Builder for the [Indices Get Settings API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/indices-get-settings.html)\n\nReturns settings for one or more indices."] pub struct IndicesGetSettings<'a, 'b> { transport: &'a Transport, parts: IndicesGetSettingsParts<'b>, @@ -4658,8 +5110,8 @@ impl<'b> IndicesGetTemplateParts<'b> { } } } +#[doc = "Builder for the [Indices Get Template API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/indices-templates.html)\n\nReturns an index template."] #[derive(Clone, Debug)] -#[doc = "Builder for the [Indices Get Template API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/indices-templates.html)\n\nReturns an index template."] pub struct IndicesGetTemplate<'a, 'b> { transport: &'a Transport, parts: IndicesGetTemplateParts<'b>, @@ -4818,8 +5270,8 @@ impl<'b> IndicesGetUpgradeParts<'b> { } } } +#[doc = "Builder for the [Indices Get Upgrade API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/indices-upgrade.html)\n\nDEPRECATED Returns a progress status of current upgrade."] #[derive(Clone, Debug)] -#[doc = "Builder for the [Indices Get Upgrade API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/indices-upgrade.html)\n\nThe _upgrade API is no longer useful and will be removed."] pub struct IndicesGetUpgrade<'a, 'b> { transport: &'a Transport, parts: IndicesGetUpgradeParts<'b>, @@ -4945,101 +5397,75 @@ impl<'a, 'b> IndicesGetUpgrade<'a, 'b> { } } #[derive(Debug, Clone, PartialEq)] -#[doc = "API parts for the Indices Open API"] -pub enum IndicesOpenParts<'b> { - #[doc = "Index"] - Index(&'b [&'b str]), +#[doc = "API parts for the Indices Migrate To Data Stream API"] +pub enum IndicesMigrateToDataStreamParts<'b> { + #[doc = "Name"] + Name(&'b str), } -impl<'b> IndicesOpenParts<'b> { - #[doc = "Builds a relative URL path to the Indices Open API"] +impl<'b> IndicesMigrateToDataStreamParts<'b> { + #[doc = "Builds a relative URL path to the Indices Migrate To Data Stream API"] pub fn url(self) -> Cow<'static, str> { match self { - IndicesOpenParts::Index(ref index) => { - let index_str = index.join(","); - let encoded_index: Cow = - percent_encode(index_str.as_bytes(), PARTS_ENCODED).into(); - let mut p = String::with_capacity(7usize + encoded_index.len()); - p.push_str("/"); - p.push_str(encoded_index.as_ref()); - p.push_str("/_open"); + IndicesMigrateToDataStreamParts::Name(ref name) => { + let encoded_name: Cow = percent_encode(name.as_bytes(), PARTS_ENCODED).into(); + let mut p = String::with_capacity(23usize + encoded_name.len()); + p.push_str("/_data_stream/_migrate/"); + p.push_str(encoded_name.as_ref()); p.into() } } } } +#[doc = "Builder for the [Indices Migrate To Data Stream API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/data-streams.html)\n\nMigrates an alias to a data stream"] #[derive(Clone, Debug)] -#[doc = "Builder for the [Indices Open API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/indices-open-close.html)\n\nOpens an index."] -pub struct IndicesOpen<'a, 'b, B> { +pub struct IndicesMigrateToDataStream<'a, 'b, B> { transport: &'a Transport, - parts: IndicesOpenParts<'b>, - allow_no_indices: Option, + parts: IndicesMigrateToDataStreamParts<'b>, body: Option, error_trace: Option, - expand_wildcards: Option<&'b [ExpandWildcards]>, filter_path: Option<&'b [&'b str]>, headers: HeaderMap, human: Option, - ignore_unavailable: Option, - master_timeout: Option<&'b str>, pretty: Option, request_timeout: Option, source: Option<&'b str>, - timeout: Option<&'b str>, - wait_for_active_shards: Option<&'b str>, } -impl<'a, 'b, B> IndicesOpen<'a, 'b, B> +impl<'a, 'b, B> IndicesMigrateToDataStream<'a, 'b, B> where B: Body, { - #[doc = "Creates a new instance of [IndicesOpen] with the specified API parts"] - pub fn new(transport: &'a Transport, parts: IndicesOpenParts<'b>) -> Self { + #[doc = "Creates a new instance of [IndicesMigrateToDataStream] with the specified API parts"] + pub fn new(transport: &'a Transport, parts: IndicesMigrateToDataStreamParts<'b>) -> Self { let headers = HeaderMap::new(); - IndicesOpen { + IndicesMigrateToDataStream { transport, parts, headers, - allow_no_indices: None, body: None, error_trace: None, - expand_wildcards: None, filter_path: None, human: None, - ignore_unavailable: None, - master_timeout: None, pretty: None, request_timeout: None, source: None, - timeout: None, - wait_for_active_shards: None, } } - #[doc = "Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes `_all` string or when no indices have been specified)"] - pub fn allow_no_indices(mut self, allow_no_indices: bool) -> Self { - self.allow_no_indices = Some(allow_no_indices); - self - } #[doc = "The body for the API call"] - pub fn body(self, body: T) -> IndicesOpen<'a, 'b, JsonBody> + pub fn body(self, body: T) -> IndicesMigrateToDataStream<'a, 'b, JsonBody> where T: Serialize, { - IndicesOpen { + IndicesMigrateToDataStream { transport: self.transport, parts: self.parts, body: Some(body.into()), - allow_no_indices: self.allow_no_indices, error_trace: self.error_trace, - expand_wildcards: self.expand_wildcards, filter_path: self.filter_path, headers: self.headers, human: self.human, - ignore_unavailable: self.ignore_unavailable, - master_timeout: self.master_timeout, pretty: self.pretty, request_timeout: self.request_timeout, source: self.source, - timeout: self.timeout, - wait_for_active_shards: self.wait_for_active_shards, } } #[doc = "Include the stack trace of returned errors."] @@ -5047,11 +5473,6 @@ where self.error_trace = Some(error_trace); self } - #[doc = "Whether to expand wildcard expression to concrete indices that are open, closed or both."] - pub fn expand_wildcards(mut self, expand_wildcards: &'b [ExpandWildcards]) -> Self { - self.expand_wildcards = Some(expand_wildcards); - self - } #[doc = "A comma-separated list of filters used to reduce the response."] pub fn filter_path(mut self, filter_path: &'b [&'b str]) -> Self { self.filter_path = Some(filter_path); @@ -5067,16 +5488,6 @@ where self.human = Some(human); self } - #[doc = "Whether specified concrete indices should be ignored when unavailable (missing or closed)"] - pub fn ignore_unavailable(mut self, ignore_unavailable: bool) -> Self { - self.ignore_unavailable = Some(ignore_unavailable); - self - } - #[doc = "Specify timeout for connection to master"] - pub fn master_timeout(mut self, master_timeout: &'b str) -> Self { - self.master_timeout = Some(master_timeout); - self - } #[doc = "Pretty format the returned JSON response."] pub fn pretty(mut self, pretty: bool) -> Self { self.pretty = Some(pretty); @@ -5092,17 +5503,7 @@ where self.source = Some(source); self } - #[doc = "Explicit operation timeout"] - pub fn timeout(mut self, timeout: &'b str) -> Self { - self.timeout = Some(timeout); - self - } - #[doc = "Sets the number of active shards to wait for before the operation returns."] - pub fn wait_for_active_shards(mut self, wait_for_active_shards: &'b str) -> Self { - self.wait_for_active_shards = Some(wait_for_active_shards); - self - } - #[doc = "Creates an asynchronous call to the Indices Open API that can be awaited"] + #[doc = "Creates an asynchronous call to the Indices Migrate To Data Stream API that can be awaited"] pub async fn send(self) -> Result { let path = self.parts.url(); let method = Method::Post; @@ -5112,32 +5513,19 @@ where #[serde_with::skip_serializing_none] #[derive(Serialize)] struct QueryParams<'b> { - allow_no_indices: Option, error_trace: Option, #[serde(serialize_with = "crate::client::serialize_coll_qs")] - expand_wildcards: Option<&'b [ExpandWildcards]>, - #[serde(serialize_with = "crate::client::serialize_coll_qs")] filter_path: Option<&'b [&'b str]>, human: Option, - ignore_unavailable: Option, - master_timeout: Option<&'b str>, pretty: Option, source: Option<&'b str>, - timeout: Option<&'b str>, - wait_for_active_shards: Option<&'b str>, } let query_params = QueryParams { - allow_no_indices: self.allow_no_indices, error_trace: self.error_trace, - expand_wildcards: self.expand_wildcards, filter_path: self.filter_path, human: self.human, - ignore_unavailable: self.ignore_unavailable, - master_timeout: self.master_timeout, pretty: self.pretty, source: self.source, - timeout: self.timeout, - wait_for_active_shards: self.wait_for_active_shards, }; Some(query_params) }; @@ -5150,87 +5538,101 @@ where } } #[derive(Debug, Clone, PartialEq)] -#[doc = "API parts for the Indices Put Alias API"] -pub enum IndicesPutAliasParts<'b> { - #[doc = "Index and Name"] - IndexName(&'b [&'b str], &'b str), +#[doc = "API parts for the Indices Open API"] +pub enum IndicesOpenParts<'b> { + #[doc = "Index"] + Index(&'b [&'b str]), } -impl<'b> IndicesPutAliasParts<'b> { - #[doc = "Builds a relative URL path to the Indices Put Alias API"] +impl<'b> IndicesOpenParts<'b> { + #[doc = "Builds a relative URL path to the Indices Open API"] pub fn url(self) -> Cow<'static, str> { match self { - IndicesPutAliasParts::IndexName(ref index, ref name) => { + IndicesOpenParts::Index(ref index) => { let index_str = index.join(","); let encoded_index: Cow = percent_encode(index_str.as_bytes(), PARTS_ENCODED).into(); - let encoded_name: Cow = percent_encode(name.as_bytes(), PARTS_ENCODED).into(); - let mut p = - String::with_capacity(9usize + encoded_index.len() + encoded_name.len()); + let mut p = String::with_capacity(7usize + encoded_index.len()); p.push_str("/"); p.push_str(encoded_index.as_ref()); - p.push_str("/_alias/"); - p.push_str(encoded_name.as_ref()); + p.push_str("/_open"); p.into() } } } } +#[doc = "Builder for the [Indices Open API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/indices-open-close.html)\n\nOpens an index."] #[derive(Clone, Debug)] -#[doc = "Builder for the [Indices Put Alias API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/indices-aliases.html)\n\nCreates or updates an alias."] -pub struct IndicesPutAlias<'a, 'b, B> { +pub struct IndicesOpen<'a, 'b, B> { transport: &'a Transport, - parts: IndicesPutAliasParts<'b>, + parts: IndicesOpenParts<'b>, + allow_no_indices: Option, body: Option, error_trace: Option, + expand_wildcards: Option<&'b [ExpandWildcards]>, filter_path: Option<&'b [&'b str]>, headers: HeaderMap, human: Option, + ignore_unavailable: Option, master_timeout: Option<&'b str>, pretty: Option, request_timeout: Option, source: Option<&'b str>, timeout: Option<&'b str>, + wait_for_active_shards: Option<&'b str>, } -impl<'a, 'b, B> IndicesPutAlias<'a, 'b, B> +impl<'a, 'b, B> IndicesOpen<'a, 'b, B> where B: Body, { - #[doc = "Creates a new instance of [IndicesPutAlias] with the specified API parts"] - pub fn new(transport: &'a Transport, parts: IndicesPutAliasParts<'b>) -> Self { + #[doc = "Creates a new instance of [IndicesOpen] with the specified API parts"] + pub fn new(transport: &'a Transport, parts: IndicesOpenParts<'b>) -> Self { let headers = HeaderMap::new(); - IndicesPutAlias { + IndicesOpen { transport, parts, headers, + allow_no_indices: None, body: None, error_trace: None, + expand_wildcards: None, filter_path: None, human: None, + ignore_unavailable: None, master_timeout: None, pretty: None, request_timeout: None, source: None, timeout: None, + wait_for_active_shards: None, } } + #[doc = "Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes `_all` string or when no indices have been specified)"] + pub fn allow_no_indices(mut self, allow_no_indices: bool) -> Self { + self.allow_no_indices = Some(allow_no_indices); + self + } #[doc = "The body for the API call"] - pub fn body(self, body: T) -> IndicesPutAlias<'a, 'b, JsonBody> + pub fn body(self, body: T) -> IndicesOpen<'a, 'b, JsonBody> where T: Serialize, { - IndicesPutAlias { + IndicesOpen { transport: self.transport, parts: self.parts, body: Some(body.into()), + allow_no_indices: self.allow_no_indices, error_trace: self.error_trace, + expand_wildcards: self.expand_wildcards, filter_path: self.filter_path, headers: self.headers, human: self.human, + ignore_unavailable: self.ignore_unavailable, master_timeout: self.master_timeout, pretty: self.pretty, request_timeout: self.request_timeout, source: self.source, timeout: self.timeout, + wait_for_active_shards: self.wait_for_active_shards, } } #[doc = "Include the stack trace of returned errors."] @@ -5238,6 +5640,11 @@ where self.error_trace = Some(error_trace); self } + #[doc = "Whether to expand wildcard expression to concrete indices that are open, closed or both."] + pub fn expand_wildcards(mut self, expand_wildcards: &'b [ExpandWildcards]) -> Self { + self.expand_wildcards = Some(expand_wildcards); + self + } #[doc = "A comma-separated list of filters used to reduce the response."] pub fn filter_path(mut self, filter_path: &'b [&'b str]) -> Self { self.filter_path = Some(filter_path); @@ -5253,6 +5660,11 @@ where self.human = Some(human); self } + #[doc = "Whether specified concrete indices should be ignored when unavailable (missing or closed)"] + pub fn ignore_unavailable(mut self, ignore_unavailable: bool) -> Self { + self.ignore_unavailable = Some(ignore_unavailable); + self + } #[doc = "Specify timeout for connection to master"] pub fn master_timeout(mut self, master_timeout: &'b str) -> Self { self.master_timeout = Some(master_timeout); @@ -5273,38 +5685,52 @@ where self.source = Some(source); self } - #[doc = "Explicit timestamp for the document"] + #[doc = "Explicit operation timeout"] pub fn timeout(mut self, timeout: &'b str) -> Self { self.timeout = Some(timeout); self } - #[doc = "Creates an asynchronous call to the Indices Put Alias API that can be awaited"] + #[doc = "Sets the number of active shards to wait for before the operation returns."] + pub fn wait_for_active_shards(mut self, wait_for_active_shards: &'b str) -> Self { + self.wait_for_active_shards = Some(wait_for_active_shards); + self + } + #[doc = "Creates an asynchronous call to the Indices Open API that can be awaited"] pub async fn send(self) -> Result { let path = self.parts.url(); - let method = Method::Put; + let method = Method::Post; let headers = self.headers; let timeout = self.request_timeout; let query_string = { #[serde_with::skip_serializing_none] #[derive(Serialize)] struct QueryParams<'b> { + allow_no_indices: Option, error_trace: Option, #[serde(serialize_with = "crate::client::serialize_coll_qs")] + expand_wildcards: Option<&'b [ExpandWildcards]>, + #[serde(serialize_with = "crate::client::serialize_coll_qs")] filter_path: Option<&'b [&'b str]>, human: Option, + ignore_unavailable: Option, master_timeout: Option<&'b str>, pretty: Option, source: Option<&'b str>, timeout: Option<&'b str>, + wait_for_active_shards: Option<&'b str>, } let query_params = QueryParams { + allow_no_indices: self.allow_no_indices, error_trace: self.error_trace, + expand_wildcards: self.expand_wildcards, filter_path: self.filter_path, human: self.human, + ignore_unavailable: self.ignore_unavailable, master_timeout: self.master_timeout, pretty: self.pretty, source: self.source, timeout: self.timeout, + wait_for_active_shards: self.wait_for_active_shards, }; Some(query_params) }; @@ -5317,128 +5743,75 @@ where } } #[derive(Debug, Clone, PartialEq)] -#[doc = "API parts for the Indices Put Mapping API"] -pub enum IndicesPutMappingParts<'b> { - #[doc = "Index"] - Index(&'b [&'b str]), - #[doc = "Index and Type"] - IndexType(&'b [&'b str], &'b str), - #[doc = "Type"] - Type(&'b str), +#[doc = "API parts for the Indices Promote Data Stream API"] +pub enum IndicesPromoteDataStreamParts<'b> { + #[doc = "Name"] + Name(&'b str), } -impl<'b> IndicesPutMappingParts<'b> { - #[doc = "Builds a relative URL path to the Indices Put Mapping API"] +impl<'b> IndicesPromoteDataStreamParts<'b> { + #[doc = "Builds a relative URL path to the Indices Promote Data Stream API"] pub fn url(self) -> Cow<'static, str> { match self { - IndicesPutMappingParts::Index(ref index) => { - let index_str = index.join(","); - let encoded_index: Cow = - percent_encode(index_str.as_bytes(), PARTS_ENCODED).into(); - let mut p = String::with_capacity(10usize + encoded_index.len()); - p.push_str("/"); - p.push_str(encoded_index.as_ref()); - p.push_str("/_mapping"); - p.into() - } - IndicesPutMappingParts::IndexType(ref index, ref ty) => { - let index_str = index.join(","); - let encoded_index: Cow = - percent_encode(index_str.as_bytes(), PARTS_ENCODED).into(); - let encoded_ty: Cow = percent_encode(ty.as_bytes(), PARTS_ENCODED).into(); - let mut p = String::with_capacity(11usize + encoded_index.len() + encoded_ty.len()); - p.push_str("/"); - p.push_str(encoded_index.as_ref()); - p.push_str("/"); - p.push_str(encoded_ty.as_ref()); - p.push_str("/_mapping"); - p.into() - } - IndicesPutMappingParts::Type(ref ty) => { - let encoded_ty: Cow = percent_encode(ty.as_bytes(), PARTS_ENCODED).into(); - let mut p = String::with_capacity(11usize + encoded_ty.len()); - p.push_str("/_mappings/"); - p.push_str(encoded_ty.as_ref()); + IndicesPromoteDataStreamParts::Name(ref name) => { + let encoded_name: Cow = percent_encode(name.as_bytes(), PARTS_ENCODED).into(); + let mut p = String::with_capacity(23usize + encoded_name.len()); + p.push_str("/_data_stream/_promote/"); + p.push_str(encoded_name.as_ref()); p.into() } } } } +#[doc = "Builder for the [Indices Promote Data Stream API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/data-streams.html)\n\nPromotes a data stream from a replicated data stream managed by CCR to a regular data stream"] #[derive(Clone, Debug)] -#[doc = "Builder for the [Indices Put Mapping API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/indices-put-mapping.html)\n\nUpdates the index mappings."] -pub struct IndicesPutMapping<'a, 'b, B> { +pub struct IndicesPromoteDataStream<'a, 'b, B> { transport: &'a Transport, - parts: IndicesPutMappingParts<'b>, - allow_no_indices: Option, + parts: IndicesPromoteDataStreamParts<'b>, body: Option, error_trace: Option, - expand_wildcards: Option<&'b [ExpandWildcards]>, filter_path: Option<&'b [&'b str]>, headers: HeaderMap, human: Option, - ignore_unavailable: Option, - include_type_name: Option, - master_timeout: Option<&'b str>, pretty: Option, request_timeout: Option, source: Option<&'b str>, - timeout: Option<&'b str>, - write_index_only: Option, } -impl<'a, 'b, B> IndicesPutMapping<'a, 'b, B> +impl<'a, 'b, B> IndicesPromoteDataStream<'a, 'b, B> where B: Body, { - #[doc = "Creates a new instance of [IndicesPutMapping] with the specified API parts"] - pub fn new(transport: &'a Transport, parts: IndicesPutMappingParts<'b>) -> Self { + #[doc = "Creates a new instance of [IndicesPromoteDataStream] with the specified API parts"] + pub fn new(transport: &'a Transport, parts: IndicesPromoteDataStreamParts<'b>) -> Self { let headers = HeaderMap::new(); - IndicesPutMapping { + IndicesPromoteDataStream { transport, parts, headers, - allow_no_indices: None, body: None, error_trace: None, - expand_wildcards: None, filter_path: None, human: None, - ignore_unavailable: None, - include_type_name: None, - master_timeout: None, pretty: None, request_timeout: None, source: None, - timeout: None, - write_index_only: None, } } - #[doc = "Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes `_all` string or when no indices have been specified)"] - pub fn allow_no_indices(mut self, allow_no_indices: bool) -> Self { - self.allow_no_indices = Some(allow_no_indices); - self - } #[doc = "The body for the API call"] - pub fn body(self, body: T) -> IndicesPutMapping<'a, 'b, JsonBody> + pub fn body(self, body: T) -> IndicesPromoteDataStream<'a, 'b, JsonBody> where T: Serialize, { - IndicesPutMapping { + IndicesPromoteDataStream { transport: self.transport, parts: self.parts, body: Some(body.into()), - allow_no_indices: self.allow_no_indices, error_trace: self.error_trace, - expand_wildcards: self.expand_wildcards, filter_path: self.filter_path, headers: self.headers, human: self.human, - ignore_unavailable: self.ignore_unavailable, - include_type_name: self.include_type_name, - master_timeout: self.master_timeout, pretty: self.pretty, request_timeout: self.request_timeout, source: self.source, - timeout: self.timeout, - write_index_only: self.write_index_only, } } #[doc = "Include the stack trace of returned errors."] @@ -5446,11 +5819,6 @@ where self.error_trace = Some(error_trace); self } - #[doc = "Whether to expand wildcard expression to concrete indices that are open, closed or both."] - pub fn expand_wildcards(mut self, expand_wildcards: &'b [ExpandWildcards]) -> Self { - self.expand_wildcards = Some(expand_wildcards); - self - } #[doc = "A comma-separated list of filters used to reduce the response."] pub fn filter_path(mut self, filter_path: &'b [&'b str]) -> Self { self.filter_path = Some(filter_path); @@ -5466,21 +5834,6 @@ where self.human = Some(human); self } - #[doc = "Whether specified concrete indices should be ignored when unavailable (missing or closed)"] - pub fn ignore_unavailable(mut self, ignore_unavailable: bool) -> Self { - self.ignore_unavailable = Some(ignore_unavailable); - self - } - #[doc = "Whether a type should be expected in the body of the mappings."] - pub fn include_type_name(mut self, include_type_name: bool) -> Self { - self.include_type_name = Some(include_type_name); - self - } - #[doc = "Specify timeout for connection to master"] - pub fn master_timeout(mut self, master_timeout: &'b str) -> Self { - self.master_timeout = Some(master_timeout); - self - } #[doc = "Pretty format the returned JSON response."] pub fn pretty(mut self, pretty: bool) -> Self { self.pretty = Some(pretty); @@ -5496,54 +5849,29 @@ where self.source = Some(source); self } - #[doc = "Explicit operation timeout"] - pub fn timeout(mut self, timeout: &'b str) -> Self { - self.timeout = Some(timeout); - self - } - #[doc = "When true, applies mappings only to the write index of an alias or data stream"] - pub fn write_index_only(mut self, write_index_only: bool) -> Self { - self.write_index_only = Some(write_index_only); - self - } - #[doc = "Creates an asynchronous call to the Indices Put Mapping API that can be awaited"] + #[doc = "Creates an asynchronous call to the Indices Promote Data Stream API that can be awaited"] pub async fn send(self) -> Result { let path = self.parts.url(); - let method = Method::Put; + let method = Method::Post; let headers = self.headers; let timeout = self.request_timeout; let query_string = { #[serde_with::skip_serializing_none] #[derive(Serialize)] struct QueryParams<'b> { - allow_no_indices: Option, error_trace: Option, #[serde(serialize_with = "crate::client::serialize_coll_qs")] - expand_wildcards: Option<&'b [ExpandWildcards]>, - #[serde(serialize_with = "crate::client::serialize_coll_qs")] filter_path: Option<&'b [&'b str]>, human: Option, - ignore_unavailable: Option, - include_type_name: Option, - master_timeout: Option<&'b str>, pretty: Option, source: Option<&'b str>, - timeout: Option<&'b str>, - write_index_only: Option, } let query_params = QueryParams { - allow_no_indices: self.allow_no_indices, error_trace: self.error_trace, - expand_wildcards: self.expand_wildcards, filter_path: self.filter_path, human: self.human, - ignore_unavailable: self.ignore_unavailable, - include_type_name: self.include_type_name, - master_timeout: self.master_timeout, pretty: self.pretty, source: self.source, - timeout: self.timeout, - write_index_only: self.write_index_only, }; Some(query_params) }; @@ -5556,103 +5884,83 @@ where } } #[derive(Debug, Clone, PartialEq)] -#[doc = "API parts for the Indices Put Settings API"] -pub enum IndicesPutSettingsParts<'b> { - #[doc = "No parts"] - None, - #[doc = "Index"] - Index(&'b [&'b str]), +#[doc = "API parts for the Indices Put Alias API"] +pub enum IndicesPutAliasParts<'b> { + #[doc = "Index and Name"] + IndexName(&'b [&'b str], &'b str), } -impl<'b> IndicesPutSettingsParts<'b> { - #[doc = "Builds a relative URL path to the Indices Put Settings API"] +impl<'b> IndicesPutAliasParts<'b> { + #[doc = "Builds a relative URL path to the Indices Put Alias API"] pub fn url(self) -> Cow<'static, str> { match self { - IndicesPutSettingsParts::None => "/_settings".into(), - IndicesPutSettingsParts::Index(ref index) => { + IndicesPutAliasParts::IndexName(ref index, ref name) => { let index_str = index.join(","); let encoded_index: Cow = percent_encode(index_str.as_bytes(), PARTS_ENCODED).into(); - let mut p = String::with_capacity(11usize + encoded_index.len()); + let encoded_name: Cow = percent_encode(name.as_bytes(), PARTS_ENCODED).into(); + let mut p = + String::with_capacity(9usize + encoded_index.len() + encoded_name.len()); p.push_str("/"); p.push_str(encoded_index.as_ref()); - p.push_str("/_settings"); + p.push_str("/_alias/"); + p.push_str(encoded_name.as_ref()); p.into() } } } } +#[doc = "Builder for the [Indices Put Alias API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/indices-aliases.html)\n\nCreates or updates an alias."] #[derive(Clone, Debug)] -#[doc = "Builder for the [Indices Put Settings API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/indices-update-settings.html)\n\nUpdates the index settings."] -pub struct IndicesPutSettings<'a, 'b, B> { +pub struct IndicesPutAlias<'a, 'b, B> { transport: &'a Transport, - parts: IndicesPutSettingsParts<'b>, - allow_no_indices: Option, + parts: IndicesPutAliasParts<'b>, body: Option, error_trace: Option, - expand_wildcards: Option<&'b [ExpandWildcards]>, filter_path: Option<&'b [&'b str]>, - flat_settings: Option, headers: HeaderMap, human: Option, - ignore_unavailable: Option, master_timeout: Option<&'b str>, - preserve_existing: Option, pretty: Option, request_timeout: Option, source: Option<&'b str>, timeout: Option<&'b str>, } -impl<'a, 'b, B> IndicesPutSettings<'a, 'b, B> +impl<'a, 'b, B> IndicesPutAlias<'a, 'b, B> where B: Body, { - #[doc = "Creates a new instance of [IndicesPutSettings] with the specified API parts"] - pub fn new(transport: &'a Transport, parts: IndicesPutSettingsParts<'b>) -> Self { + #[doc = "Creates a new instance of [IndicesPutAlias] with the specified API parts"] + pub fn new(transport: &'a Transport, parts: IndicesPutAliasParts<'b>) -> Self { let headers = HeaderMap::new(); - IndicesPutSettings { + IndicesPutAlias { transport, parts, headers, - allow_no_indices: None, body: None, error_trace: None, - expand_wildcards: None, filter_path: None, - flat_settings: None, human: None, - ignore_unavailable: None, master_timeout: None, - preserve_existing: None, pretty: None, request_timeout: None, source: None, timeout: None, } } - #[doc = "Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes `_all` string or when no indices have been specified)"] - pub fn allow_no_indices(mut self, allow_no_indices: bool) -> Self { - self.allow_no_indices = Some(allow_no_indices); - self - } #[doc = "The body for the API call"] - pub fn body(self, body: T) -> IndicesPutSettings<'a, 'b, JsonBody> + pub fn body(self, body: T) -> IndicesPutAlias<'a, 'b, JsonBody> where T: Serialize, { - IndicesPutSettings { + IndicesPutAlias { transport: self.transport, parts: self.parts, body: Some(body.into()), - allow_no_indices: self.allow_no_indices, error_trace: self.error_trace, - expand_wildcards: self.expand_wildcards, filter_path: self.filter_path, - flat_settings: self.flat_settings, headers: self.headers, human: self.human, - ignore_unavailable: self.ignore_unavailable, master_timeout: self.master_timeout, - preserve_existing: self.preserve_existing, pretty: self.pretty, request_timeout: self.request_timeout, source: self.source, @@ -5664,21 +5972,11 @@ where self.error_trace = Some(error_trace); self } - #[doc = "Whether to expand wildcard expression to concrete indices that are open, closed or both."] - pub fn expand_wildcards(mut self, expand_wildcards: &'b [ExpandWildcards]) -> Self { - self.expand_wildcards = Some(expand_wildcards); - self - } #[doc = "A comma-separated list of filters used to reduce the response."] pub fn filter_path(mut self, filter_path: &'b [&'b str]) -> Self { self.filter_path = Some(filter_path); self } - #[doc = "Return settings in flat format (default: false)"] - pub fn flat_settings(mut self, flat_settings: bool) -> Self { - self.flat_settings = Some(flat_settings); - self - } #[doc = "Adds a HTTP header"] pub fn header(mut self, key: HeaderName, value: HeaderValue) -> Self { self.headers.insert(key, value); @@ -5689,21 +5987,11 @@ where self.human = Some(human); self } - #[doc = "Whether specified concrete indices should be ignored when unavailable (missing or closed)"] - pub fn ignore_unavailable(mut self, ignore_unavailable: bool) -> Self { - self.ignore_unavailable = Some(ignore_unavailable); - self - } #[doc = "Specify timeout for connection to master"] pub fn master_timeout(mut self, master_timeout: &'b str) -> Self { self.master_timeout = Some(master_timeout); self } - #[doc = "Whether to update existing settings. If set to `true` existing settings on an index remain unchanged, the default is `false`"] - pub fn preserve_existing(mut self, preserve_existing: bool) -> Self { - self.preserve_existing = Some(preserve_existing); - self - } #[doc = "Pretty format the returned JSON response."] pub fn pretty(mut self, pretty: bool) -> Self { self.pretty = Some(pretty); @@ -5719,12 +6007,12 @@ where self.source = Some(source); self } - #[doc = "Explicit operation timeout"] + #[doc = "Explicit timestamp for the document"] pub fn timeout(mut self, timeout: &'b str) -> Self { self.timeout = Some(timeout); self } - #[doc = "Creates an asynchronous call to the Indices Put Settings API that can be awaited"] + #[doc = "Creates an asynchronous call to the Indices Put Alias API that can be awaited"] pub async fn send(self) -> Result { let path = self.parts.url(); let method = Method::Put; @@ -5734,31 +6022,20 @@ where #[serde_with::skip_serializing_none] #[derive(Serialize)] struct QueryParams<'b> { - allow_no_indices: Option, error_trace: Option, #[serde(serialize_with = "crate::client::serialize_coll_qs")] - expand_wildcards: Option<&'b [ExpandWildcards]>, - #[serde(serialize_with = "crate::client::serialize_coll_qs")] filter_path: Option<&'b [&'b str]>, - flat_settings: Option, human: Option, - ignore_unavailable: Option, master_timeout: Option<&'b str>, - preserve_existing: Option, pretty: Option, source: Option<&'b str>, timeout: Option<&'b str>, } let query_params = QueryParams { - allow_no_indices: self.allow_no_indices, error_trace: self.error_trace, - expand_wildcards: self.expand_wildcards, filter_path: self.filter_path, - flat_settings: self.flat_settings, human: self.human, - ignore_unavailable: self.ignore_unavailable, master_timeout: self.master_timeout, - preserve_existing: self.preserve_existing, pretty: self.pretty, source: self.source, timeout: self.timeout, @@ -5774,89 +6051,91 @@ where } } #[derive(Debug, Clone, PartialEq)] -#[doc = "API parts for the Indices Put Template API"] -pub enum IndicesPutTemplateParts<'b> { +#[doc = "API parts for the Indices Put Index Template API"] +pub enum IndicesPutIndexTemplateParts<'b> { #[doc = "Name"] Name(&'b str), } -impl<'b> IndicesPutTemplateParts<'b> { - #[doc = "Builds a relative URL path to the Indices Put Template API"] +impl<'b> IndicesPutIndexTemplateParts<'b> { + #[doc = "Builds a relative URL path to the Indices Put Index Template API"] pub fn url(self) -> Cow<'static, str> { match self { - IndicesPutTemplateParts::Name(ref name) => { + IndicesPutIndexTemplateParts::Name(ref name) => { let encoded_name: Cow = percent_encode(name.as_bytes(), PARTS_ENCODED).into(); - let mut p = String::with_capacity(11usize + encoded_name.len()); - p.push_str("/_template/"); + let mut p = String::with_capacity(17usize + encoded_name.len()); + p.push_str("/_index_template/"); p.push_str(encoded_name.as_ref()); p.into() } } } } +#[doc = "Builder for the [Indices Put Index Template API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/indices-templates.html)\n\nCreates or updates an index template."] #[derive(Clone, Debug)] -#[doc = "Builder for the [Indices Put Template API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/indices-templates.html)\n\nCreates or updates an index template."] -pub struct IndicesPutTemplate<'a, 'b, B> { +pub struct IndicesPutIndexTemplate<'a, 'b, B> { transport: &'a Transport, - parts: IndicesPutTemplateParts<'b>, + parts: IndicesPutIndexTemplateParts<'b>, body: Option, + cause: Option<&'b str>, create: Option, error_trace: Option, filter_path: Option<&'b [&'b str]>, headers: HeaderMap, human: Option, - include_type_name: Option, master_timeout: Option<&'b str>, - order: Option, pretty: Option, request_timeout: Option, source: Option<&'b str>, } -impl<'a, 'b, B> IndicesPutTemplate<'a, 'b, B> +impl<'a, 'b, B> IndicesPutIndexTemplate<'a, 'b, B> where B: Body, { - #[doc = "Creates a new instance of [IndicesPutTemplate] with the specified API parts"] - pub fn new(transport: &'a Transport, parts: IndicesPutTemplateParts<'b>) -> Self { + #[doc = "Creates a new instance of [IndicesPutIndexTemplate] with the specified API parts"] + pub fn new(transport: &'a Transport, parts: IndicesPutIndexTemplateParts<'b>) -> Self { let headers = HeaderMap::new(); - IndicesPutTemplate { + IndicesPutIndexTemplate { transport, parts, headers, body: None, + cause: None, create: None, error_trace: None, filter_path: None, human: None, - include_type_name: None, master_timeout: None, - order: None, pretty: None, request_timeout: None, source: None, } } #[doc = "The body for the API call"] - pub fn body(self, body: T) -> IndicesPutTemplate<'a, 'b, JsonBody> + pub fn body(self, body: T) -> IndicesPutIndexTemplate<'a, 'b, JsonBody> where T: Serialize, { - IndicesPutTemplate { + IndicesPutIndexTemplate { transport: self.transport, parts: self.parts, body: Some(body.into()), + cause: self.cause, create: self.create, error_trace: self.error_trace, filter_path: self.filter_path, headers: self.headers, human: self.human, - include_type_name: self.include_type_name, master_timeout: self.master_timeout, - order: self.order, pretty: self.pretty, request_timeout: self.request_timeout, source: self.source, } } + #[doc = "User defined reason for creating/updating the index template"] + pub fn cause(mut self, cause: &'b str) -> Self { + self.cause = Some(cause); + self + } #[doc = "Whether the index template should only be added if new or can also replace an existing one"] pub fn create(mut self, create: bool) -> Self { self.create = Some(create); @@ -5882,21 +6161,11 @@ where self.human = Some(human); self } - #[doc = "Whether a type should be returned in the body of the mappings."] - pub fn include_type_name(mut self, include_type_name: bool) -> Self { - self.include_type_name = Some(include_type_name); - self - } #[doc = "Specify timeout for connection to master"] pub fn master_timeout(mut self, master_timeout: &'b str) -> Self { self.master_timeout = Some(master_timeout); self } - #[doc = "The order for this template when merging multiple matching ones (higher numbers are merged later, overriding the lower numbers)"] - pub fn order(mut self, order: i64) -> Self { - self.order = Some(order); - self - } #[doc = "Pretty format the returned JSON response."] pub fn pretty(mut self, pretty: bool) -> Self { self.pretty = Some(pretty); @@ -5912,7 +6181,7 @@ where self.source = Some(source); self } - #[doc = "Creates an asynchronous call to the Indices Put Template API that can be awaited"] + #[doc = "Creates an asynchronous call to the Indices Put Index Template API that can be awaited"] pub async fn send(self) -> Result { let path = self.parts.url(); let method = Method::Put; @@ -5922,25 +6191,23 @@ where #[serde_with::skip_serializing_none] #[derive(Serialize)] struct QueryParams<'b> { + cause: Option<&'b str>, create: Option, error_trace: Option, #[serde(serialize_with = "crate::client::serialize_coll_qs")] filter_path: Option<&'b [&'b str]>, human: Option, - include_type_name: Option, master_timeout: Option<&'b str>, - order: Option, pretty: Option, source: Option<&'b str>, } let query_params = QueryParams { + cause: self.cause, create: self.create, error_trace: self.error_trace, filter_path: self.filter_path, human: self.human, - include_type_name: self.include_type_name, master_timeout: self.master_timeout, - order: self.order, pretty: self.pretty, source: self.source, }; @@ -5955,79 +6222,140 @@ where } } #[derive(Debug, Clone, PartialEq)] -#[doc = "API parts for the Indices Recovery API"] -pub enum IndicesRecoveryParts<'b> { - #[doc = "No parts"] - None, +#[doc = "API parts for the Indices Put Mapping API"] +pub enum IndicesPutMappingParts<'b> { #[doc = "Index"] Index(&'b [&'b str]), + #[doc = "Index and Type"] + IndexType(&'b [&'b str], &'b str), + #[doc = "Type"] + Type(&'b str), } -impl<'b> IndicesRecoveryParts<'b> { - #[doc = "Builds a relative URL path to the Indices Recovery API"] +impl<'b> IndicesPutMappingParts<'b> { + #[doc = "Builds a relative URL path to the Indices Put Mapping API"] pub fn url(self) -> Cow<'static, str> { match self { - IndicesRecoveryParts::None => "/_recovery".into(), - IndicesRecoveryParts::Index(ref index) => { + IndicesPutMappingParts::Index(ref index) => { let index_str = index.join(","); let encoded_index: Cow = percent_encode(index_str.as_bytes(), PARTS_ENCODED).into(); - let mut p = String::with_capacity(11usize + encoded_index.len()); + let mut p = String::with_capacity(10usize + encoded_index.len()); p.push_str("/"); p.push_str(encoded_index.as_ref()); - p.push_str("/_recovery"); + p.push_str("/_mapping"); + p.into() + } + IndicesPutMappingParts::IndexType(ref index, ref ty) => { + let index_str = index.join(","); + let encoded_index: Cow = + percent_encode(index_str.as_bytes(), PARTS_ENCODED).into(); + let encoded_ty: Cow = percent_encode(ty.as_bytes(), PARTS_ENCODED).into(); + let mut p = String::with_capacity(11usize + encoded_index.len() + encoded_ty.len()); + p.push_str("/"); + p.push_str(encoded_index.as_ref()); + p.push_str("/"); + p.push_str(encoded_ty.as_ref()); + p.push_str("/_mapping"); + p.into() + } + IndicesPutMappingParts::Type(ref ty) => { + let encoded_ty: Cow = percent_encode(ty.as_bytes(), PARTS_ENCODED).into(); + let mut p = String::with_capacity(11usize + encoded_ty.len()); + p.push_str("/_mappings/"); + p.push_str(encoded_ty.as_ref()); p.into() } } } } +#[doc = "Builder for the [Indices Put Mapping API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/indices-put-mapping.html)\n\nUpdates the index mappings."] #[derive(Clone, Debug)] -#[doc = "Builder for the [Indices Recovery API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/indices-recovery.html)\n\nReturns information about ongoing index shard recoveries."] -pub struct IndicesRecovery<'a, 'b> { +pub struct IndicesPutMapping<'a, 'b, B> { transport: &'a Transport, - parts: IndicesRecoveryParts<'b>, - active_only: Option, - detailed: Option, + parts: IndicesPutMappingParts<'b>, + allow_no_indices: Option, + body: Option, error_trace: Option, + expand_wildcards: Option<&'b [ExpandWildcards]>, filter_path: Option<&'b [&'b str]>, headers: HeaderMap, human: Option, + ignore_unavailable: Option, + include_type_name: Option, + master_timeout: Option<&'b str>, pretty: Option, request_timeout: Option, source: Option<&'b str>, + timeout: Option<&'b str>, + write_index_only: Option, } -impl<'a, 'b> IndicesRecovery<'a, 'b> { - #[doc = "Creates a new instance of [IndicesRecovery] with the specified API parts"] - pub fn new(transport: &'a Transport, parts: IndicesRecoveryParts<'b>) -> Self { +impl<'a, 'b, B> IndicesPutMapping<'a, 'b, B> +where + B: Body, +{ + #[doc = "Creates a new instance of [IndicesPutMapping] with the specified API parts"] + pub fn new(transport: &'a Transport, parts: IndicesPutMappingParts<'b>) -> Self { let headers = HeaderMap::new(); - IndicesRecovery { + IndicesPutMapping { transport, parts, headers, - active_only: None, - detailed: None, + allow_no_indices: None, + body: None, error_trace: None, + expand_wildcards: None, filter_path: None, human: None, + ignore_unavailable: None, + include_type_name: None, + master_timeout: None, pretty: None, request_timeout: None, source: None, + timeout: None, + write_index_only: None, } } - #[doc = "Display only those recoveries that are currently on-going"] - pub fn active_only(mut self, active_only: bool) -> Self { - self.active_only = Some(active_only); + #[doc = "Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes `_all` string or when no indices have been specified)"] + pub fn allow_no_indices(mut self, allow_no_indices: bool) -> Self { + self.allow_no_indices = Some(allow_no_indices); self } - #[doc = "Whether to display detailed information about shard recovery"] - pub fn detailed(mut self, detailed: bool) -> Self { - self.detailed = Some(detailed); - self + #[doc = "The body for the API call"] + pub fn body(self, body: T) -> IndicesPutMapping<'a, 'b, JsonBody> + where + T: Serialize, + { + IndicesPutMapping { + transport: self.transport, + parts: self.parts, + body: Some(body.into()), + allow_no_indices: self.allow_no_indices, + error_trace: self.error_trace, + expand_wildcards: self.expand_wildcards, + filter_path: self.filter_path, + headers: self.headers, + human: self.human, + ignore_unavailable: self.ignore_unavailable, + include_type_name: self.include_type_name, + master_timeout: self.master_timeout, + pretty: self.pretty, + request_timeout: self.request_timeout, + source: self.source, + timeout: self.timeout, + write_index_only: self.write_index_only, + } } #[doc = "Include the stack trace of returned errors."] pub fn error_trace(mut self, error_trace: bool) -> Self { self.error_trace = Some(error_trace); self } + #[doc = "Whether to expand wildcard expression to concrete indices that are open, closed or both."] + pub fn expand_wildcards(mut self, expand_wildcards: &'b [ExpandWildcards]) -> Self { + self.expand_wildcards = Some(expand_wildcards); + self + } #[doc = "A comma-separated list of filters used to reduce the response."] pub fn filter_path(mut self, filter_path: &'b [&'b str]) -> Self { self.filter_path = Some(filter_path); @@ -6043,6 +6371,21 @@ impl<'a, 'b> IndicesRecovery<'a, 'b> { self.human = Some(human); self } + #[doc = "Whether specified concrete indices should be ignored when unavailable (missing or closed)"] + pub fn ignore_unavailable(mut self, ignore_unavailable: bool) -> Self { + self.ignore_unavailable = Some(ignore_unavailable); + self + } + #[doc = "Whether a type should be expected in the body of the mappings."] + pub fn include_type_name(mut self, include_type_name: bool) -> Self { + self.include_type_name = Some(include_type_name); + self + } + #[doc = "Specify timeout for connection to master"] + pub fn master_timeout(mut self, master_timeout: &'b str) -> Self { + self.master_timeout = Some(master_timeout); + self + } #[doc = "Pretty format the returned JSON response."] pub fn pretty(mut self, pretty: bool) -> Self { self.pretty = Some(pretty); @@ -6058,37 +6401,58 @@ impl<'a, 'b> IndicesRecovery<'a, 'b> { self.source = Some(source); self } - #[doc = "Creates an asynchronous call to the Indices Recovery API that can be awaited"] + #[doc = "Explicit operation timeout"] + pub fn timeout(mut self, timeout: &'b str) -> Self { + self.timeout = Some(timeout); + self + } + #[doc = "When true, applies mappings only to the write index of an alias or data stream"] + pub fn write_index_only(mut self, write_index_only: bool) -> Self { + self.write_index_only = Some(write_index_only); + self + } + #[doc = "Creates an asynchronous call to the Indices Put Mapping API that can be awaited"] pub async fn send(self) -> Result { let path = self.parts.url(); - let method = Method::Get; + let method = Method::Put; let headers = self.headers; let timeout = self.request_timeout; let query_string = { #[serde_with::skip_serializing_none] #[derive(Serialize)] struct QueryParams<'b> { - active_only: Option, - detailed: Option, + allow_no_indices: Option, error_trace: Option, #[serde(serialize_with = "crate::client::serialize_coll_qs")] + expand_wildcards: Option<&'b [ExpandWildcards]>, + #[serde(serialize_with = "crate::client::serialize_coll_qs")] filter_path: Option<&'b [&'b str]>, human: Option, + ignore_unavailable: Option, + include_type_name: Option, + master_timeout: Option<&'b str>, pretty: Option, source: Option<&'b str>, - } + timeout: Option<&'b str>, + write_index_only: Option, + } let query_params = QueryParams { - active_only: self.active_only, - detailed: self.detailed, + allow_no_indices: self.allow_no_indices, error_trace: self.error_trace, + expand_wildcards: self.expand_wildcards, filter_path: self.filter_path, human: self.human, + ignore_unavailable: self.ignore_unavailable, + include_type_name: self.include_type_name, + master_timeout: self.master_timeout, pretty: self.pretty, source: self.source, + timeout: self.timeout, + write_index_only: self.write_index_only, }; Some(query_params) }; - let body = Option::<()>::None; + let body = self.body; let response = self .transport .send(method, &path, headers, query_string.as_ref(), body, timeout) @@ -6097,56 +6461,60 @@ impl<'a, 'b> IndicesRecovery<'a, 'b> { } } #[derive(Debug, Clone, PartialEq)] -#[doc = "API parts for the Indices Refresh API"] -pub enum IndicesRefreshParts<'b> { +#[doc = "API parts for the Indices Put Settings API"] +pub enum IndicesPutSettingsParts<'b> { #[doc = "No parts"] None, #[doc = "Index"] Index(&'b [&'b str]), } -impl<'b> IndicesRefreshParts<'b> { - #[doc = "Builds a relative URL path to the Indices Refresh API"] +impl<'b> IndicesPutSettingsParts<'b> { + #[doc = "Builds a relative URL path to the Indices Put Settings API"] pub fn url(self) -> Cow<'static, str> { match self { - IndicesRefreshParts::None => "/_refresh".into(), - IndicesRefreshParts::Index(ref index) => { + IndicesPutSettingsParts::None => "/_settings".into(), + IndicesPutSettingsParts::Index(ref index) => { let index_str = index.join(","); let encoded_index: Cow = percent_encode(index_str.as_bytes(), PARTS_ENCODED).into(); - let mut p = String::with_capacity(10usize + encoded_index.len()); + let mut p = String::with_capacity(11usize + encoded_index.len()); p.push_str("/"); p.push_str(encoded_index.as_ref()); - p.push_str("/_refresh"); + p.push_str("/_settings"); p.into() } } } } +#[doc = "Builder for the [Indices Put Settings API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/indices-update-settings.html)\n\nUpdates the index settings."] #[derive(Clone, Debug)] -#[doc = "Builder for the [Indices Refresh API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/indices-refresh.html)\n\nPerforms the refresh operation in one or more indices."] -pub struct IndicesRefresh<'a, 'b, B> { +pub struct IndicesPutSettings<'a, 'b, B> { transport: &'a Transport, - parts: IndicesRefreshParts<'b>, + parts: IndicesPutSettingsParts<'b>, allow_no_indices: Option, body: Option, error_trace: Option, expand_wildcards: Option<&'b [ExpandWildcards]>, filter_path: Option<&'b [&'b str]>, + flat_settings: Option, headers: HeaderMap, human: Option, ignore_unavailable: Option, + master_timeout: Option<&'b str>, + preserve_existing: Option, pretty: Option, request_timeout: Option, source: Option<&'b str>, + timeout: Option<&'b str>, } -impl<'a, 'b, B> IndicesRefresh<'a, 'b, B> +impl<'a, 'b, B> IndicesPutSettings<'a, 'b, B> where B: Body, { - #[doc = "Creates a new instance of [IndicesRefresh] with the specified API parts"] - pub fn new(transport: &'a Transport, parts: IndicesRefreshParts<'b>) -> Self { + #[doc = "Creates a new instance of [IndicesPutSettings] with the specified API parts"] + pub fn new(transport: &'a Transport, parts: IndicesPutSettingsParts<'b>) -> Self { let headers = HeaderMap::new(); - IndicesRefresh { + IndicesPutSettings { transport, parts, headers, @@ -6155,11 +6523,15 @@ where error_trace: None, expand_wildcards: None, filter_path: None, + flat_settings: None, human: None, ignore_unavailable: None, + master_timeout: None, + preserve_existing: None, pretty: None, request_timeout: None, source: None, + timeout: None, } } #[doc = "Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes `_all` string or when no indices have been specified)"] @@ -6168,11 +6540,11 @@ where self } #[doc = "The body for the API call"] - pub fn body(self, body: T) -> IndicesRefresh<'a, 'b, JsonBody> + pub fn body(self, body: T) -> IndicesPutSettings<'a, 'b, JsonBody> where T: Serialize, { - IndicesRefresh { + IndicesPutSettings { transport: self.transport, parts: self.parts, body: Some(body.into()), @@ -6180,12 +6552,16 @@ where error_trace: self.error_trace, expand_wildcards: self.expand_wildcards, filter_path: self.filter_path, + flat_settings: self.flat_settings, headers: self.headers, human: self.human, ignore_unavailable: self.ignore_unavailable, + master_timeout: self.master_timeout, + preserve_existing: self.preserve_existing, pretty: self.pretty, request_timeout: self.request_timeout, source: self.source, + timeout: self.timeout, } } #[doc = "Include the stack trace of returned errors."] @@ -6203,6 +6579,11 @@ where self.filter_path = Some(filter_path); self } + #[doc = "Return settings in flat format (default: false)"] + pub fn flat_settings(mut self, flat_settings: bool) -> Self { + self.flat_settings = Some(flat_settings); + self + } #[doc = "Adds a HTTP header"] pub fn header(mut self, key: HeaderName, value: HeaderValue) -> Self { self.headers.insert(key, value); @@ -6218,6 +6599,16 @@ where self.ignore_unavailable = Some(ignore_unavailable); self } + #[doc = "Specify timeout for connection to master"] + pub fn master_timeout(mut self, master_timeout: &'b str) -> Self { + self.master_timeout = Some(master_timeout); + self + } + #[doc = "Whether to update existing settings. If set to `true` existing settings on an index remain unchanged, the default is `false`"] + pub fn preserve_existing(mut self, preserve_existing: bool) -> Self { + self.preserve_existing = Some(preserve_existing); + self + } #[doc = "Pretty format the returned JSON response."] pub fn pretty(mut self, pretty: bool) -> Self { self.pretty = Some(pretty); @@ -6233,13 +6624,15 @@ where self.source = Some(source); self } - #[doc = "Creates an asynchronous call to the Indices Refresh API that can be awaited"] + #[doc = "Explicit operation timeout"] + pub fn timeout(mut self, timeout: &'b str) -> Self { + self.timeout = Some(timeout); + self + } + #[doc = "Creates an asynchronous call to the Indices Put Settings API that can be awaited"] pub async fn send(self) -> Result { let path = self.parts.url(); - let method = match self.body { - Some(_) => Method::Post, - None => Method::Get, - }; + let method = Method::Put; let headers = self.headers; let timeout = self.request_timeout; let query_string = { @@ -6252,20 +6645,28 @@ where expand_wildcards: Option<&'b [ExpandWildcards]>, #[serde(serialize_with = "crate::client::serialize_coll_qs")] filter_path: Option<&'b [&'b str]>, + flat_settings: Option, human: Option, ignore_unavailable: Option, + master_timeout: Option<&'b str>, + preserve_existing: Option, pretty: Option, source: Option<&'b str>, + timeout: Option<&'b str>, } let query_params = QueryParams { allow_no_indices: self.allow_no_indices, error_trace: self.error_trace, expand_wildcards: self.expand_wildcards, filter_path: self.filter_path, + flat_settings: self.flat_settings, human: self.human, ignore_unavailable: self.ignore_unavailable, + master_timeout: self.master_timeout, + preserve_existing: self.preserve_existing, pretty: self.pretty, source: self.source, + timeout: self.timeout, }; Some(query_params) }; @@ -6278,104 +6679,99 @@ where } } #[derive(Debug, Clone, PartialEq)] -#[doc = "API parts for the Indices Reload Search Analyzers API"] -pub enum IndicesReloadSearchAnalyzersParts<'b> { - #[doc = "Index"] - Index(&'b [&'b str]), +#[doc = "API parts for the Indices Put Template API"] +pub enum IndicesPutTemplateParts<'b> { + #[doc = "Name"] + Name(&'b str), } -impl<'b> IndicesReloadSearchAnalyzersParts<'b> { - #[doc = "Builds a relative URL path to the Indices Reload Search Analyzers API"] +impl<'b> IndicesPutTemplateParts<'b> { + #[doc = "Builds a relative URL path to the Indices Put Template API"] pub fn url(self) -> Cow<'static, str> { match self { - IndicesReloadSearchAnalyzersParts::Index(ref index) => { - let index_str = index.join(","); - let encoded_index: Cow = - percent_encode(index_str.as_bytes(), PARTS_ENCODED).into(); - let mut p = String::with_capacity(26usize + encoded_index.len()); - p.push_str("/"); - p.push_str(encoded_index.as_ref()); - p.push_str("/_reload_search_analyzers"); + IndicesPutTemplateParts::Name(ref name) => { + let encoded_name: Cow = percent_encode(name.as_bytes(), PARTS_ENCODED).into(); + let mut p = String::with_capacity(11usize + encoded_name.len()); + p.push_str("/_template/"); + p.push_str(encoded_name.as_ref()); p.into() } } } } +#[doc = "Builder for the [Indices Put Template API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/indices-templates.html)\n\nCreates or updates an index template."] #[derive(Clone, Debug)] -#[doc = "Builder for the [Indices Reload Search Analyzers API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/indices-reload-analyzers.html)\n\nReloads an index's search analyzers and their resources."] -pub struct IndicesReloadSearchAnalyzers<'a, 'b, B> { +pub struct IndicesPutTemplate<'a, 'b, B> { transport: &'a Transport, - parts: IndicesReloadSearchAnalyzersParts<'b>, - allow_no_indices: Option, + parts: IndicesPutTemplateParts<'b>, body: Option, + create: Option, error_trace: Option, - expand_wildcards: Option<&'b [ExpandWildcards]>, filter_path: Option<&'b [&'b str]>, headers: HeaderMap, human: Option, - ignore_unavailable: Option, + include_type_name: Option, + master_timeout: Option<&'b str>, + order: Option, pretty: Option, request_timeout: Option, source: Option<&'b str>, } -impl<'a, 'b, B> IndicesReloadSearchAnalyzers<'a, 'b, B> +impl<'a, 'b, B> IndicesPutTemplate<'a, 'b, B> where B: Body, { - #[doc = "Creates a new instance of [IndicesReloadSearchAnalyzers] with the specified API parts"] - pub fn new(transport: &'a Transport, parts: IndicesReloadSearchAnalyzersParts<'b>) -> Self { + #[doc = "Creates a new instance of [IndicesPutTemplate] with the specified API parts"] + pub fn new(transport: &'a Transport, parts: IndicesPutTemplateParts<'b>) -> Self { let headers = HeaderMap::new(); - IndicesReloadSearchAnalyzers { + IndicesPutTemplate { transport, parts, headers, - allow_no_indices: None, body: None, + create: None, error_trace: None, - expand_wildcards: None, filter_path: None, human: None, - ignore_unavailable: None, + include_type_name: None, + master_timeout: None, + order: None, pretty: None, request_timeout: None, source: None, } } - #[doc = "Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes `_all` string or when no indices have been specified)"] - pub fn allow_no_indices(mut self, allow_no_indices: bool) -> Self { - self.allow_no_indices = Some(allow_no_indices); - self - } #[doc = "The body for the API call"] - pub fn body(self, body: T) -> IndicesReloadSearchAnalyzers<'a, 'b, JsonBody> + pub fn body(self, body: T) -> IndicesPutTemplate<'a, 'b, JsonBody> where T: Serialize, { - IndicesReloadSearchAnalyzers { + IndicesPutTemplate { transport: self.transport, parts: self.parts, body: Some(body.into()), - allow_no_indices: self.allow_no_indices, + create: self.create, error_trace: self.error_trace, - expand_wildcards: self.expand_wildcards, filter_path: self.filter_path, headers: self.headers, human: self.human, - ignore_unavailable: self.ignore_unavailable, + include_type_name: self.include_type_name, + master_timeout: self.master_timeout, + order: self.order, pretty: self.pretty, request_timeout: self.request_timeout, source: self.source, } } + #[doc = "Whether the index template should only be added if new or can also replace an existing one"] + pub fn create(mut self, create: bool) -> Self { + self.create = Some(create); + self + } #[doc = "Include the stack trace of returned errors."] pub fn error_trace(mut self, error_trace: bool) -> Self { self.error_trace = Some(error_trace); self } - #[doc = "Whether to expand wildcard expression to concrete indices that are open, closed or both."] - pub fn expand_wildcards(mut self, expand_wildcards: &'b [ExpandWildcards]) -> Self { - self.expand_wildcards = Some(expand_wildcards); - self - } #[doc = "A comma-separated list of filters used to reduce the response."] pub fn filter_path(mut self, filter_path: &'b [&'b str]) -> Self { self.filter_path = Some(filter_path); @@ -6391,9 +6787,19 @@ where self.human = Some(human); self } - #[doc = "Whether specified concrete indices should be ignored when unavailable (missing or closed)"] - pub fn ignore_unavailable(mut self, ignore_unavailable: bool) -> Self { - self.ignore_unavailable = Some(ignore_unavailable); + #[doc = "Whether a type should be returned in the body of the mappings."] + pub fn include_type_name(mut self, include_type_name: bool) -> Self { + self.include_type_name = Some(include_type_name); + self + } + #[doc = "Specify timeout for connection to master"] + pub fn master_timeout(mut self, master_timeout: &'b str) -> Self { + self.master_timeout = Some(master_timeout); + self + } + #[doc = "The order for this template when merging multiple matching ones (higher numbers are merged later, overriding the lower numbers)"] + pub fn order(mut self, order: i64) -> Self { + self.order = Some(order); self } #[doc = "Pretty format the returned JSON response."] @@ -6411,37 +6817,35 @@ where self.source = Some(source); self } - #[doc = "Creates an asynchronous call to the Indices Reload Search Analyzers API that can be awaited"] + #[doc = "Creates an asynchronous call to the Indices Put Template API that can be awaited"] pub async fn send(self) -> Result { let path = self.parts.url(); - let method = match self.body { - Some(_) => Method::Post, - None => Method::Get, - }; + let method = Method::Put; let headers = self.headers; let timeout = self.request_timeout; let query_string = { #[serde_with::skip_serializing_none] #[derive(Serialize)] struct QueryParams<'b> { - allow_no_indices: Option, + create: Option, error_trace: Option, #[serde(serialize_with = "crate::client::serialize_coll_qs")] - expand_wildcards: Option<&'b [ExpandWildcards]>, - #[serde(serialize_with = "crate::client::serialize_coll_qs")] filter_path: Option<&'b [&'b str]>, human: Option, - ignore_unavailable: Option, + include_type_name: Option, + master_timeout: Option<&'b str>, + order: Option, pretty: Option, source: Option<&'b str>, } let query_params = QueryParams { - allow_no_indices: self.allow_no_indices, + create: self.create, error_trace: self.error_trace, - expand_wildcards: self.expand_wildcards, filter_path: self.filter_path, human: self.human, - ignore_unavailable: self.ignore_unavailable, + include_type_name: self.include_type_name, + master_timeout: self.master_timeout, + order: self.order, pretty: self.pretty, source: self.source, }; @@ -6456,112 +6860,72 @@ where } } #[derive(Debug, Clone, PartialEq)] -#[doc = "API parts for the Indices Rollover API"] -pub enum IndicesRolloverParts<'b> { - #[doc = "Alias"] - Alias(&'b str), - #[doc = "Alias and NewIndex"] - AliasNewIndex(&'b str, &'b str), +#[doc = "API parts for the Indices Recovery API"] +pub enum IndicesRecoveryParts<'b> { + #[doc = "No parts"] + None, + #[doc = "Index"] + Index(&'b [&'b str]), } -impl<'b> IndicesRolloverParts<'b> { - #[doc = "Builds a relative URL path to the Indices Rollover API"] +impl<'b> IndicesRecoveryParts<'b> { + #[doc = "Builds a relative URL path to the Indices Recovery API"] pub fn url(self) -> Cow<'static, str> { match self { - IndicesRolloverParts::Alias(ref alias) => { - let encoded_alias: Cow = - percent_encode(alias.as_bytes(), PARTS_ENCODED).into(); - let mut p = String::with_capacity(11usize + encoded_alias.len()); - p.push_str("/"); - p.push_str(encoded_alias.as_ref()); - p.push_str("/_rollover"); - p.into() - } - IndicesRolloverParts::AliasNewIndex(ref alias, ref new_index) => { - let encoded_alias: Cow = - percent_encode(alias.as_bytes(), PARTS_ENCODED).into(); - let encoded_new_index: Cow = - percent_encode(new_index.as_bytes(), PARTS_ENCODED).into(); - let mut p = - String::with_capacity(12usize + encoded_alias.len() + encoded_new_index.len()); + IndicesRecoveryParts::None => "/_recovery".into(), + IndicesRecoveryParts::Index(ref index) => { + let index_str = index.join(","); + let encoded_index: Cow = + percent_encode(index_str.as_bytes(), PARTS_ENCODED).into(); + let mut p = String::with_capacity(11usize + encoded_index.len()); p.push_str("/"); - p.push_str(encoded_alias.as_ref()); - p.push_str("/_rollover/"); - p.push_str(encoded_new_index.as_ref()); + p.push_str(encoded_index.as_ref()); + p.push_str("/_recovery"); p.into() } } } } +#[doc = "Builder for the [Indices Recovery API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/indices-recovery.html)\n\nReturns information about ongoing index shard recoveries."] #[derive(Clone, Debug)] -#[doc = "Builder for the [Indices Rollover API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/indices-rollover-index.html)\n\nUpdates an alias to point to a new index when the existing index\nis considered to be too large or too old."] -pub struct IndicesRollover<'a, 'b, B> { +pub struct IndicesRecovery<'a, 'b> { transport: &'a Transport, - parts: IndicesRolloverParts<'b>, - body: Option, - dry_run: Option, + parts: IndicesRecoveryParts<'b>, + active_only: Option, + detailed: Option, error_trace: Option, filter_path: Option<&'b [&'b str]>, headers: HeaderMap, human: Option, - include_type_name: Option, - master_timeout: Option<&'b str>, pretty: Option, request_timeout: Option, source: Option<&'b str>, - timeout: Option<&'b str>, - wait_for_active_shards: Option<&'b str>, } -impl<'a, 'b, B> IndicesRollover<'a, 'b, B> -where - B: Body, -{ - #[doc = "Creates a new instance of [IndicesRollover] with the specified API parts"] - pub fn new(transport: &'a Transport, parts: IndicesRolloverParts<'b>) -> Self { +impl<'a, 'b> IndicesRecovery<'a, 'b> { + #[doc = "Creates a new instance of [IndicesRecovery] with the specified API parts"] + pub fn new(transport: &'a Transport, parts: IndicesRecoveryParts<'b>) -> Self { let headers = HeaderMap::new(); - IndicesRollover { + IndicesRecovery { transport, parts, headers, - body: None, - dry_run: None, + active_only: None, + detailed: None, error_trace: None, filter_path: None, human: None, - include_type_name: None, - master_timeout: None, pretty: None, request_timeout: None, source: None, - timeout: None, - wait_for_active_shards: None, } } - #[doc = "The body for the API call"] - pub fn body(self, body: T) -> IndicesRollover<'a, 'b, JsonBody> - where - T: Serialize, - { - IndicesRollover { - transport: self.transport, - parts: self.parts, - body: Some(body.into()), - dry_run: self.dry_run, - error_trace: self.error_trace, - filter_path: self.filter_path, - headers: self.headers, - human: self.human, - include_type_name: self.include_type_name, - master_timeout: self.master_timeout, - pretty: self.pretty, - request_timeout: self.request_timeout, - source: self.source, - timeout: self.timeout, - wait_for_active_shards: self.wait_for_active_shards, - } + #[doc = "Display only those recoveries that are currently on-going"] + pub fn active_only(mut self, active_only: bool) -> Self { + self.active_only = Some(active_only); + self } - #[doc = "If set to true the rollover action will only be validated but not actually performed even if a condition matches. The default is false"] - pub fn dry_run(mut self, dry_run: bool) -> Self { - self.dry_run = Some(dry_run); + #[doc = "Whether to display detailed information about shard recovery"] + pub fn detailed(mut self, detailed: bool) -> Self { + self.detailed = Some(detailed); self } #[doc = "Include the stack trace of returned errors."] @@ -6584,16 +6948,6 @@ where self.human = Some(human); self } - #[doc = "Whether a type should be included in the body of the mappings."] - pub fn include_type_name(mut self, include_type_name: bool) -> Self { - self.include_type_name = Some(include_type_name); - self - } - #[doc = "Specify timeout for connection to master"] - pub fn master_timeout(mut self, master_timeout: &'b str) -> Self { - self.master_timeout = Some(master_timeout); - self - } #[doc = "Pretty format the returned JSON response."] pub fn pretty(mut self, pretty: bool) -> Self { self.pretty = Some(pretty); @@ -6609,53 +6963,37 @@ where self.source = Some(source); self } - #[doc = "Explicit operation timeout"] - pub fn timeout(mut self, timeout: &'b str) -> Self { - self.timeout = Some(timeout); - self - } - #[doc = "Set the number of active shards to wait for on the newly created rollover index before the operation returns."] - pub fn wait_for_active_shards(mut self, wait_for_active_shards: &'b str) -> Self { - self.wait_for_active_shards = Some(wait_for_active_shards); - self - } - #[doc = "Creates an asynchronous call to the Indices Rollover API that can be awaited"] + #[doc = "Creates an asynchronous call to the Indices Recovery API that can be awaited"] pub async fn send(self) -> Result { let path = self.parts.url(); - let method = Method::Post; + let method = Method::Get; let headers = self.headers; let timeout = self.request_timeout; let query_string = { #[serde_with::skip_serializing_none] #[derive(Serialize)] struct QueryParams<'b> { - dry_run: Option, + active_only: Option, + detailed: Option, error_trace: Option, #[serde(serialize_with = "crate::client::serialize_coll_qs")] filter_path: Option<&'b [&'b str]>, human: Option, - include_type_name: Option, - master_timeout: Option<&'b str>, pretty: Option, source: Option<&'b str>, - timeout: Option<&'b str>, - wait_for_active_shards: Option<&'b str>, } let query_params = QueryParams { - dry_run: self.dry_run, + active_only: self.active_only, + detailed: self.detailed, error_trace: self.error_trace, filter_path: self.filter_path, human: self.human, - include_type_name: self.include_type_name, - master_timeout: self.master_timeout, pretty: self.pretty, source: self.source, - timeout: self.timeout, - wait_for_active_shards: self.wait_for_active_shards, }; Some(query_params) }; - let body = self.body; + let body = Option::<()>::None; let response = self .transport .send(method, &path, headers, query_string.as_ref(), body, timeout) @@ -6664,37 +7002,38 @@ where } } #[derive(Debug, Clone, PartialEq)] -#[doc = "API parts for the Indices Segments API"] -pub enum IndicesSegmentsParts<'b> { +#[doc = "API parts for the Indices Refresh API"] +pub enum IndicesRefreshParts<'b> { #[doc = "No parts"] None, #[doc = "Index"] Index(&'b [&'b str]), } -impl<'b> IndicesSegmentsParts<'b> { - #[doc = "Builds a relative URL path to the Indices Segments API"] +impl<'b> IndicesRefreshParts<'b> { + #[doc = "Builds a relative URL path to the Indices Refresh API"] pub fn url(self) -> Cow<'static, str> { match self { - IndicesSegmentsParts::None => "/_segments".into(), - IndicesSegmentsParts::Index(ref index) => { + IndicesRefreshParts::None => "/_refresh".into(), + IndicesRefreshParts::Index(ref index) => { let index_str = index.join(","); let encoded_index: Cow = percent_encode(index_str.as_bytes(), PARTS_ENCODED).into(); - let mut p = String::with_capacity(11usize + encoded_index.len()); + let mut p = String::with_capacity(10usize + encoded_index.len()); p.push_str("/"); p.push_str(encoded_index.as_ref()); - p.push_str("/_segments"); + p.push_str("/_refresh"); p.into() } } } } +#[doc = "Builder for the [Indices Refresh API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/indices-refresh.html)\n\nPerforms the refresh operation in one or more indices."] #[derive(Clone, Debug)] -#[doc = "Builder for the [Indices Segments API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/indices-segments.html)\n\nProvides low-level information about segments in a Lucene index."] -pub struct IndicesSegments<'a, 'b> { +pub struct IndicesRefresh<'a, 'b, B> { transport: &'a Transport, - parts: IndicesSegmentsParts<'b>, + parts: IndicesRefreshParts<'b>, allow_no_indices: Option, + body: Option, error_trace: Option, expand_wildcards: Option<&'b [ExpandWildcards]>, filter_path: Option<&'b [&'b str]>, @@ -6704,17 +7043,20 @@ pub struct IndicesSegments<'a, 'b> { pretty: Option, request_timeout: Option, source: Option<&'b str>, - verbose: Option, } -impl<'a, 'b> IndicesSegments<'a, 'b> { - #[doc = "Creates a new instance of [IndicesSegments] with the specified API parts"] - pub fn new(transport: &'a Transport, parts: IndicesSegmentsParts<'b>) -> Self { +impl<'a, 'b, B> IndicesRefresh<'a, 'b, B> +where + B: Body, +{ + #[doc = "Creates a new instance of [IndicesRefresh] with the specified API parts"] + pub fn new(transport: &'a Transport, parts: IndicesRefreshParts<'b>) -> Self { let headers = HeaderMap::new(); - IndicesSegments { + IndicesRefresh { transport, parts, headers, allow_no_indices: None, + body: None, error_trace: None, expand_wildcards: None, filter_path: None, @@ -6723,12 +7065,1060 @@ impl<'a, 'b> IndicesSegments<'a, 'b> { pretty: None, request_timeout: None, source: None, - verbose: None, } } - #[doc = "Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes `_all` string or when no indices have been specified)"] - pub fn allow_no_indices(mut self, allow_no_indices: bool) -> Self { - self.allow_no_indices = Some(allow_no_indices); + #[doc = "Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes `_all` string or when no indices have been specified)"] + pub fn allow_no_indices(mut self, allow_no_indices: bool) -> Self { + self.allow_no_indices = Some(allow_no_indices); + self + } + #[doc = "The body for the API call"] + pub fn body(self, body: T) -> IndicesRefresh<'a, 'b, JsonBody> + where + T: Serialize, + { + IndicesRefresh { + transport: self.transport, + parts: self.parts, + body: Some(body.into()), + allow_no_indices: self.allow_no_indices, + error_trace: self.error_trace, + expand_wildcards: self.expand_wildcards, + filter_path: self.filter_path, + headers: self.headers, + human: self.human, + ignore_unavailable: self.ignore_unavailable, + pretty: self.pretty, + request_timeout: self.request_timeout, + source: self.source, + } + } + #[doc = "Include the stack trace of returned errors."] + pub fn error_trace(mut self, error_trace: bool) -> Self { + self.error_trace = Some(error_trace); + self + } + #[doc = "Whether to expand wildcard expression to concrete indices that are open, closed or both."] + pub fn expand_wildcards(mut self, expand_wildcards: &'b [ExpandWildcards]) -> Self { + self.expand_wildcards = Some(expand_wildcards); + self + } + #[doc = "A comma-separated list of filters used to reduce the response."] + pub fn filter_path(mut self, filter_path: &'b [&'b str]) -> Self { + self.filter_path = Some(filter_path); + self + } + #[doc = "Adds a HTTP header"] + pub fn header(mut self, key: HeaderName, value: HeaderValue) -> Self { + self.headers.insert(key, value); + self + } + #[doc = "Return human readable values for statistics."] + pub fn human(mut self, human: bool) -> Self { + self.human = Some(human); + self + } + #[doc = "Whether specified concrete indices should be ignored when unavailable (missing or closed)"] + pub fn ignore_unavailable(mut self, ignore_unavailable: bool) -> Self { + self.ignore_unavailable = Some(ignore_unavailable); + self + } + #[doc = "Pretty format the returned JSON response."] + pub fn pretty(mut self, pretty: bool) -> Self { + self.pretty = Some(pretty); + self + } + #[doc = "Sets a request timeout for this API call.\n\nThe timeout is applied from when the request starts connecting until the response body has finished."] + pub fn request_timeout(mut self, timeout: Duration) -> Self { + self.request_timeout = Some(timeout); + self + } + #[doc = "The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests."] + pub fn source(mut self, source: &'b str) -> Self { + self.source = Some(source); + self + } + #[doc = "Creates an asynchronous call to the Indices Refresh API that can be awaited"] + pub async fn send(self) -> Result { + let path = self.parts.url(); + let method = match self.body { + Some(_) => Method::Post, + None => Method::Get, + }; + let headers = self.headers; + let timeout = self.request_timeout; + let query_string = { + #[serde_with::skip_serializing_none] + #[derive(Serialize)] + struct QueryParams<'b> { + allow_no_indices: Option, + error_trace: Option, + #[serde(serialize_with = "crate::client::serialize_coll_qs")] + expand_wildcards: Option<&'b [ExpandWildcards]>, + #[serde(serialize_with = "crate::client::serialize_coll_qs")] + filter_path: Option<&'b [&'b str]>, + human: Option, + ignore_unavailable: Option, + pretty: Option, + source: Option<&'b str>, + } + let query_params = QueryParams { + allow_no_indices: self.allow_no_indices, + error_trace: self.error_trace, + expand_wildcards: self.expand_wildcards, + filter_path: self.filter_path, + human: self.human, + ignore_unavailable: self.ignore_unavailable, + pretty: self.pretty, + source: self.source, + }; + Some(query_params) + }; + let body = self.body; + let response = self + .transport + .send(method, &path, headers, query_string.as_ref(), body, timeout) + .await?; + Ok(response) + } +} +#[derive(Debug, Clone, PartialEq)] +#[doc = "API parts for the Indices Reload Search Analyzers API"] +pub enum IndicesReloadSearchAnalyzersParts<'b> { + #[doc = "Index"] + Index(&'b [&'b str]), +} +impl<'b> IndicesReloadSearchAnalyzersParts<'b> { + #[doc = "Builds a relative URL path to the Indices Reload Search Analyzers API"] + pub fn url(self) -> Cow<'static, str> { + match self { + IndicesReloadSearchAnalyzersParts::Index(ref index) => { + let index_str = index.join(","); + let encoded_index: Cow = + percent_encode(index_str.as_bytes(), PARTS_ENCODED).into(); + let mut p = String::with_capacity(26usize + encoded_index.len()); + p.push_str("/"); + p.push_str(encoded_index.as_ref()); + p.push_str("/_reload_search_analyzers"); + p.into() + } + } + } +} +#[doc = "Builder for the [Indices Reload Search Analyzers API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/indices-reload-analyzers.html)\n\nReloads an index's search analyzers and their resources."] +#[derive(Clone, Debug)] +pub struct IndicesReloadSearchAnalyzers<'a, 'b, B> { + transport: &'a Transport, + parts: IndicesReloadSearchAnalyzersParts<'b>, + allow_no_indices: Option, + body: Option, + error_trace: Option, + expand_wildcards: Option<&'b [ExpandWildcards]>, + filter_path: Option<&'b [&'b str]>, + headers: HeaderMap, + human: Option, + ignore_unavailable: Option, + pretty: Option, + request_timeout: Option, + source: Option<&'b str>, +} +impl<'a, 'b, B> IndicesReloadSearchAnalyzers<'a, 'b, B> +where + B: Body, +{ + #[doc = "Creates a new instance of [IndicesReloadSearchAnalyzers] with the specified API parts"] + pub fn new(transport: &'a Transport, parts: IndicesReloadSearchAnalyzersParts<'b>) -> Self { + let headers = HeaderMap::new(); + IndicesReloadSearchAnalyzers { + transport, + parts, + headers, + allow_no_indices: None, + body: None, + error_trace: None, + expand_wildcards: None, + filter_path: None, + human: None, + ignore_unavailable: None, + pretty: None, + request_timeout: None, + source: None, + } + } + #[doc = "Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes `_all` string or when no indices have been specified)"] + pub fn allow_no_indices(mut self, allow_no_indices: bool) -> Self { + self.allow_no_indices = Some(allow_no_indices); + self + } + #[doc = "The body for the API call"] + pub fn body(self, body: T) -> IndicesReloadSearchAnalyzers<'a, 'b, JsonBody> + where + T: Serialize, + { + IndicesReloadSearchAnalyzers { + transport: self.transport, + parts: self.parts, + body: Some(body.into()), + allow_no_indices: self.allow_no_indices, + error_trace: self.error_trace, + expand_wildcards: self.expand_wildcards, + filter_path: self.filter_path, + headers: self.headers, + human: self.human, + ignore_unavailable: self.ignore_unavailable, + pretty: self.pretty, + request_timeout: self.request_timeout, + source: self.source, + } + } + #[doc = "Include the stack trace of returned errors."] + pub fn error_trace(mut self, error_trace: bool) -> Self { + self.error_trace = Some(error_trace); + self + } + #[doc = "Whether to expand wildcard expression to concrete indices that are open, closed or both."] + pub fn expand_wildcards(mut self, expand_wildcards: &'b [ExpandWildcards]) -> Self { + self.expand_wildcards = Some(expand_wildcards); + self + } + #[doc = "A comma-separated list of filters used to reduce the response."] + pub fn filter_path(mut self, filter_path: &'b [&'b str]) -> Self { + self.filter_path = Some(filter_path); + self + } + #[doc = "Adds a HTTP header"] + pub fn header(mut self, key: HeaderName, value: HeaderValue) -> Self { + self.headers.insert(key, value); + self + } + #[doc = "Return human readable values for statistics."] + pub fn human(mut self, human: bool) -> Self { + self.human = Some(human); + self + } + #[doc = "Whether specified concrete indices should be ignored when unavailable (missing or closed)"] + pub fn ignore_unavailable(mut self, ignore_unavailable: bool) -> Self { + self.ignore_unavailable = Some(ignore_unavailable); + self + } + #[doc = "Pretty format the returned JSON response."] + pub fn pretty(mut self, pretty: bool) -> Self { + self.pretty = Some(pretty); + self + } + #[doc = "Sets a request timeout for this API call.\n\nThe timeout is applied from when the request starts connecting until the response body has finished."] + pub fn request_timeout(mut self, timeout: Duration) -> Self { + self.request_timeout = Some(timeout); + self + } + #[doc = "The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests."] + pub fn source(mut self, source: &'b str) -> Self { + self.source = Some(source); + self + } + #[doc = "Creates an asynchronous call to the Indices Reload Search Analyzers API that can be awaited"] + pub async fn send(self) -> Result { + let path = self.parts.url(); + let method = match self.body { + Some(_) => Method::Post, + None => Method::Get, + }; + let headers = self.headers; + let timeout = self.request_timeout; + let query_string = { + #[serde_with::skip_serializing_none] + #[derive(Serialize)] + struct QueryParams<'b> { + allow_no_indices: Option, + error_trace: Option, + #[serde(serialize_with = "crate::client::serialize_coll_qs")] + expand_wildcards: Option<&'b [ExpandWildcards]>, + #[serde(serialize_with = "crate::client::serialize_coll_qs")] + filter_path: Option<&'b [&'b str]>, + human: Option, + ignore_unavailable: Option, + pretty: Option, + source: Option<&'b str>, + } + let query_params = QueryParams { + allow_no_indices: self.allow_no_indices, + error_trace: self.error_trace, + expand_wildcards: self.expand_wildcards, + filter_path: self.filter_path, + human: self.human, + ignore_unavailable: self.ignore_unavailable, + pretty: self.pretty, + source: self.source, + }; + Some(query_params) + }; + let body = self.body; + let response = self + .transport + .send(method, &path, headers, query_string.as_ref(), body, timeout) + .await?; + Ok(response) + } +} +#[cfg(feature = "experimental-apis")] +#[derive(Debug, Clone, PartialEq)] +#[doc = "API parts for the Indices Resolve Index API"] +pub enum IndicesResolveIndexParts<'b> { + #[doc = "Name"] + Name(&'b [&'b str]), +} +#[cfg(feature = "experimental-apis")] +impl<'b> IndicesResolveIndexParts<'b> { + #[doc = "Builds a relative URL path to the Indices Resolve Index API"] + pub fn url(self) -> Cow<'static, str> { + match self { + IndicesResolveIndexParts::Name(ref name) => { + let name_str = name.join(","); + let encoded_name: Cow = + percent_encode(name_str.as_bytes(), PARTS_ENCODED).into(); + let mut p = String::with_capacity(16usize + encoded_name.len()); + p.push_str("/_resolve/index/"); + p.push_str(encoded_name.as_ref()); + p.into() + } + } + } +} +#[doc = "Builder for the [Indices Resolve Index API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/indices-resolve-index-api.html)\n\nReturns information about any matching indices, aliases, and data streams"] +#[doc = " \n# Optional, experimental\nThis requires the `experimental-apis` feature. Can have breaking changes in future\nversions or might even be removed entirely.\n "] +#[cfg(feature = "experimental-apis")] +#[derive(Clone, Debug)] +pub struct IndicesResolveIndex<'a, 'b> { + transport: &'a Transport, + parts: IndicesResolveIndexParts<'b>, + error_trace: Option, + expand_wildcards: Option<&'b [ExpandWildcards]>, + filter_path: Option<&'b [&'b str]>, + headers: HeaderMap, + human: Option, + pretty: Option, + request_timeout: Option, + source: Option<&'b str>, +} +#[cfg(feature = "experimental-apis")] +impl<'a, 'b> IndicesResolveIndex<'a, 'b> { + #[doc = "Creates a new instance of [IndicesResolveIndex] with the specified API parts"] + pub fn new(transport: &'a Transport, parts: IndicesResolveIndexParts<'b>) -> Self { + let headers = HeaderMap::new(); + IndicesResolveIndex { + transport, + parts, + headers, + error_trace: None, + expand_wildcards: None, + filter_path: None, + human: None, + pretty: None, + request_timeout: None, + source: None, + } + } + #[doc = "Include the stack trace of returned errors."] + pub fn error_trace(mut self, error_trace: bool) -> Self { + self.error_trace = Some(error_trace); + self + } + #[doc = "Whether wildcard expressions should get expanded to open or closed indices (default: open)"] + pub fn expand_wildcards(mut self, expand_wildcards: &'b [ExpandWildcards]) -> Self { + self.expand_wildcards = Some(expand_wildcards); + self + } + #[doc = "A comma-separated list of filters used to reduce the response."] + pub fn filter_path(mut self, filter_path: &'b [&'b str]) -> Self { + self.filter_path = Some(filter_path); + self + } + #[doc = "Adds a HTTP header"] + pub fn header(mut self, key: HeaderName, value: HeaderValue) -> Self { + self.headers.insert(key, value); + self + } + #[doc = "Return human readable values for statistics."] + pub fn human(mut self, human: bool) -> Self { + self.human = Some(human); + self + } + #[doc = "Pretty format the returned JSON response."] + pub fn pretty(mut self, pretty: bool) -> Self { + self.pretty = Some(pretty); + self + } + #[doc = "Sets a request timeout for this API call.\n\nThe timeout is applied from when the request starts connecting until the response body has finished."] + pub fn request_timeout(mut self, timeout: Duration) -> Self { + self.request_timeout = Some(timeout); + self + } + #[doc = "The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests."] + pub fn source(mut self, source: &'b str) -> Self { + self.source = Some(source); + self + } + #[doc = "Creates an asynchronous call to the Indices Resolve Index API that can be awaited"] + pub async fn send(self) -> Result { + let path = self.parts.url(); + let method = Method::Get; + let headers = self.headers; + let timeout = self.request_timeout; + let query_string = { + #[serde_with::skip_serializing_none] + #[derive(Serialize)] + struct QueryParams<'b> { + error_trace: Option, + #[serde(serialize_with = "crate::client::serialize_coll_qs")] + expand_wildcards: Option<&'b [ExpandWildcards]>, + #[serde(serialize_with = "crate::client::serialize_coll_qs")] + filter_path: Option<&'b [&'b str]>, + human: Option, + pretty: Option, + source: Option<&'b str>, + } + let query_params = QueryParams { + error_trace: self.error_trace, + expand_wildcards: self.expand_wildcards, + filter_path: self.filter_path, + human: self.human, + pretty: self.pretty, + source: self.source, + }; + Some(query_params) + }; + let body = Option::<()>::None; + let response = self + .transport + .send(method, &path, headers, query_string.as_ref(), body, timeout) + .await?; + Ok(response) + } +} +#[derive(Debug, Clone, PartialEq)] +#[doc = "API parts for the Indices Rollover API"] +pub enum IndicesRolloverParts<'b> { + #[doc = "Alias"] + Alias(&'b str), + #[doc = "Alias and NewIndex"] + AliasNewIndex(&'b str, &'b str), +} +impl<'b> IndicesRolloverParts<'b> { + #[doc = "Builds a relative URL path to the Indices Rollover API"] + pub fn url(self) -> Cow<'static, str> { + match self { + IndicesRolloverParts::Alias(ref alias) => { + let encoded_alias: Cow = + percent_encode(alias.as_bytes(), PARTS_ENCODED).into(); + let mut p = String::with_capacity(11usize + encoded_alias.len()); + p.push_str("/"); + p.push_str(encoded_alias.as_ref()); + p.push_str("/_rollover"); + p.into() + } + IndicesRolloverParts::AliasNewIndex(ref alias, ref new_index) => { + let encoded_alias: Cow = + percent_encode(alias.as_bytes(), PARTS_ENCODED).into(); + let encoded_new_index: Cow = + percent_encode(new_index.as_bytes(), PARTS_ENCODED).into(); + let mut p = + String::with_capacity(12usize + encoded_alias.len() + encoded_new_index.len()); + p.push_str("/"); + p.push_str(encoded_alias.as_ref()); + p.push_str("/_rollover/"); + p.push_str(encoded_new_index.as_ref()); + p.into() + } + } + } +} +#[doc = "Builder for the [Indices Rollover API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/indices-rollover-index.html)\n\nUpdates an alias to point to a new index when the existing index\nis considered to be too large or too old."] +#[derive(Clone, Debug)] +pub struct IndicesRollover<'a, 'b, B> { + transport: &'a Transport, + parts: IndicesRolloverParts<'b>, + body: Option, + dry_run: Option, + error_trace: Option, + filter_path: Option<&'b [&'b str]>, + headers: HeaderMap, + human: Option, + include_type_name: Option, + master_timeout: Option<&'b str>, + pretty: Option, + request_timeout: Option, + source: Option<&'b str>, + timeout: Option<&'b str>, + wait_for_active_shards: Option<&'b str>, +} +impl<'a, 'b, B> IndicesRollover<'a, 'b, B> +where + B: Body, +{ + #[doc = "Creates a new instance of [IndicesRollover] with the specified API parts"] + pub fn new(transport: &'a Transport, parts: IndicesRolloverParts<'b>) -> Self { + let headers = HeaderMap::new(); + IndicesRollover { + transport, + parts, + headers, + body: None, + dry_run: None, + error_trace: None, + filter_path: None, + human: None, + include_type_name: None, + master_timeout: None, + pretty: None, + request_timeout: None, + source: None, + timeout: None, + wait_for_active_shards: None, + } + } + #[doc = "The body for the API call"] + pub fn body(self, body: T) -> IndicesRollover<'a, 'b, JsonBody> + where + T: Serialize, + { + IndicesRollover { + transport: self.transport, + parts: self.parts, + body: Some(body.into()), + dry_run: self.dry_run, + error_trace: self.error_trace, + filter_path: self.filter_path, + headers: self.headers, + human: self.human, + include_type_name: self.include_type_name, + master_timeout: self.master_timeout, + pretty: self.pretty, + request_timeout: self.request_timeout, + source: self.source, + timeout: self.timeout, + wait_for_active_shards: self.wait_for_active_shards, + } + } + #[doc = "If set to true the rollover action will only be validated but not actually performed even if a condition matches. The default is false"] + pub fn dry_run(mut self, dry_run: bool) -> Self { + self.dry_run = Some(dry_run); + self + } + #[doc = "Include the stack trace of returned errors."] + pub fn error_trace(mut self, error_trace: bool) -> Self { + self.error_trace = Some(error_trace); + self + } + #[doc = "A comma-separated list of filters used to reduce the response."] + pub fn filter_path(mut self, filter_path: &'b [&'b str]) -> Self { + self.filter_path = Some(filter_path); + self + } + #[doc = "Adds a HTTP header"] + pub fn header(mut self, key: HeaderName, value: HeaderValue) -> Self { + self.headers.insert(key, value); + self + } + #[doc = "Return human readable values for statistics."] + pub fn human(mut self, human: bool) -> Self { + self.human = Some(human); + self + } + #[doc = "Whether a type should be included in the body of the mappings."] + pub fn include_type_name(mut self, include_type_name: bool) -> Self { + self.include_type_name = Some(include_type_name); + self + } + #[doc = "Specify timeout for connection to master"] + pub fn master_timeout(mut self, master_timeout: &'b str) -> Self { + self.master_timeout = Some(master_timeout); + self + } + #[doc = "Pretty format the returned JSON response."] + pub fn pretty(mut self, pretty: bool) -> Self { + self.pretty = Some(pretty); + self + } + #[doc = "Sets a request timeout for this API call.\n\nThe timeout is applied from when the request starts connecting until the response body has finished."] + pub fn request_timeout(mut self, timeout: Duration) -> Self { + self.request_timeout = Some(timeout); + self + } + #[doc = "The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests."] + pub fn source(mut self, source: &'b str) -> Self { + self.source = Some(source); + self + } + #[doc = "Explicit operation timeout"] + pub fn timeout(mut self, timeout: &'b str) -> Self { + self.timeout = Some(timeout); + self + } + #[doc = "Set the number of active shards to wait for on the newly created rollover index before the operation returns."] + pub fn wait_for_active_shards(mut self, wait_for_active_shards: &'b str) -> Self { + self.wait_for_active_shards = Some(wait_for_active_shards); + self + } + #[doc = "Creates an asynchronous call to the Indices Rollover API that can be awaited"] + pub async fn send(self) -> Result { + let path = self.parts.url(); + let method = Method::Post; + let headers = self.headers; + let timeout = self.request_timeout; + let query_string = { + #[serde_with::skip_serializing_none] + #[derive(Serialize)] + struct QueryParams<'b> { + dry_run: Option, + error_trace: Option, + #[serde(serialize_with = "crate::client::serialize_coll_qs")] + filter_path: Option<&'b [&'b str]>, + human: Option, + include_type_name: Option, + master_timeout: Option<&'b str>, + pretty: Option, + source: Option<&'b str>, + timeout: Option<&'b str>, + wait_for_active_shards: Option<&'b str>, + } + let query_params = QueryParams { + dry_run: self.dry_run, + error_trace: self.error_trace, + filter_path: self.filter_path, + human: self.human, + include_type_name: self.include_type_name, + master_timeout: self.master_timeout, + pretty: self.pretty, + source: self.source, + timeout: self.timeout, + wait_for_active_shards: self.wait_for_active_shards, + }; + Some(query_params) + }; + let body = self.body; + let response = self + .transport + .send(method, &path, headers, query_string.as_ref(), body, timeout) + .await?; + Ok(response) + } +} +#[derive(Debug, Clone, PartialEq)] +#[doc = "API parts for the Indices Segments API"] +pub enum IndicesSegmentsParts<'b> { + #[doc = "No parts"] + None, + #[doc = "Index"] + Index(&'b [&'b str]), +} +impl<'b> IndicesSegmentsParts<'b> { + #[doc = "Builds a relative URL path to the Indices Segments API"] + pub fn url(self) -> Cow<'static, str> { + match self { + IndicesSegmentsParts::None => "/_segments".into(), + IndicesSegmentsParts::Index(ref index) => { + let index_str = index.join(","); + let encoded_index: Cow = + percent_encode(index_str.as_bytes(), PARTS_ENCODED).into(); + let mut p = String::with_capacity(11usize + encoded_index.len()); + p.push_str("/"); + p.push_str(encoded_index.as_ref()); + p.push_str("/_segments"); + p.into() + } + } + } +} +#[doc = "Builder for the [Indices Segments API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/indices-segments.html)\n\nProvides low-level information about segments in a Lucene index."] +#[derive(Clone, Debug)] +pub struct IndicesSegments<'a, 'b> { + transport: &'a Transport, + parts: IndicesSegmentsParts<'b>, + allow_no_indices: Option, + error_trace: Option, + expand_wildcards: Option<&'b [ExpandWildcards]>, + filter_path: Option<&'b [&'b str]>, + headers: HeaderMap, + human: Option, + ignore_unavailable: Option, + pretty: Option, + request_timeout: Option, + source: Option<&'b str>, + verbose: Option, +} +impl<'a, 'b> IndicesSegments<'a, 'b> { + #[doc = "Creates a new instance of [IndicesSegments] with the specified API parts"] + pub fn new(transport: &'a Transport, parts: IndicesSegmentsParts<'b>) -> Self { + let headers = HeaderMap::new(); + IndicesSegments { + transport, + parts, + headers, + allow_no_indices: None, + error_trace: None, + expand_wildcards: None, + filter_path: None, + human: None, + ignore_unavailable: None, + pretty: None, + request_timeout: None, + source: None, + verbose: None, + } + } + #[doc = "Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes `_all` string or when no indices have been specified)"] + pub fn allow_no_indices(mut self, allow_no_indices: bool) -> Self { + self.allow_no_indices = Some(allow_no_indices); + self + } + #[doc = "Include the stack trace of returned errors."] + pub fn error_trace(mut self, error_trace: bool) -> Self { + self.error_trace = Some(error_trace); + self + } + #[doc = "Whether to expand wildcard expression to concrete indices that are open, closed or both."] + pub fn expand_wildcards(mut self, expand_wildcards: &'b [ExpandWildcards]) -> Self { + self.expand_wildcards = Some(expand_wildcards); + self + } + #[doc = "A comma-separated list of filters used to reduce the response."] + pub fn filter_path(mut self, filter_path: &'b [&'b str]) -> Self { + self.filter_path = Some(filter_path); + self + } + #[doc = "Adds a HTTP header"] + pub fn header(mut self, key: HeaderName, value: HeaderValue) -> Self { + self.headers.insert(key, value); + self + } + #[doc = "Return human readable values for statistics."] + pub fn human(mut self, human: bool) -> Self { + self.human = Some(human); + self + } + #[doc = "Whether specified concrete indices should be ignored when unavailable (missing or closed)"] + pub fn ignore_unavailable(mut self, ignore_unavailable: bool) -> Self { + self.ignore_unavailable = Some(ignore_unavailable); + self + } + #[doc = "Pretty format the returned JSON response."] + pub fn pretty(mut self, pretty: bool) -> Self { + self.pretty = Some(pretty); + self + } + #[doc = "Sets a request timeout for this API call.\n\nThe timeout is applied from when the request starts connecting until the response body has finished."] + pub fn request_timeout(mut self, timeout: Duration) -> Self { + self.request_timeout = Some(timeout); + self + } + #[doc = "The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests."] + pub fn source(mut self, source: &'b str) -> Self { + self.source = Some(source); + self + } + #[doc = "Includes detailed memory usage by Lucene."] + pub fn verbose(mut self, verbose: bool) -> Self { + self.verbose = Some(verbose); + self + } + #[doc = "Creates an asynchronous call to the Indices Segments API that can be awaited"] + pub async fn send(self) -> Result { + let path = self.parts.url(); + let method = Method::Get; + let headers = self.headers; + let timeout = self.request_timeout; + let query_string = { + #[serde_with::skip_serializing_none] + #[derive(Serialize)] + struct QueryParams<'b> { + allow_no_indices: Option, + error_trace: Option, + #[serde(serialize_with = "crate::client::serialize_coll_qs")] + expand_wildcards: Option<&'b [ExpandWildcards]>, + #[serde(serialize_with = "crate::client::serialize_coll_qs")] + filter_path: Option<&'b [&'b str]>, + human: Option, + ignore_unavailable: Option, + pretty: Option, + source: Option<&'b str>, + verbose: Option, + } + let query_params = QueryParams { + allow_no_indices: self.allow_no_indices, + error_trace: self.error_trace, + expand_wildcards: self.expand_wildcards, + filter_path: self.filter_path, + human: self.human, + ignore_unavailable: self.ignore_unavailable, + pretty: self.pretty, + source: self.source, + verbose: self.verbose, + }; + Some(query_params) + }; + let body = Option::<()>::None; + let response = self + .transport + .send(method, &path, headers, query_string.as_ref(), body, timeout) + .await?; + Ok(response) + } +} +#[derive(Debug, Clone, PartialEq)] +#[doc = "API parts for the Indices Shard Stores API"] +pub enum IndicesShardStoresParts<'b> { + #[doc = "No parts"] + None, + #[doc = "Index"] + Index(&'b [&'b str]), +} +impl<'b> IndicesShardStoresParts<'b> { + #[doc = "Builds a relative URL path to the Indices Shard Stores API"] + pub fn url(self) -> Cow<'static, str> { + match self { + IndicesShardStoresParts::None => "/_shard_stores".into(), + IndicesShardStoresParts::Index(ref index) => { + let index_str = index.join(","); + let encoded_index: Cow = + percent_encode(index_str.as_bytes(), PARTS_ENCODED).into(); + let mut p = String::with_capacity(15usize + encoded_index.len()); + p.push_str("/"); + p.push_str(encoded_index.as_ref()); + p.push_str("/_shard_stores"); + p.into() + } + } + } +} +#[doc = "Builder for the [Indices Shard Stores API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/indices-shards-stores.html)\n\nProvides store information for shard copies of indices."] +#[derive(Clone, Debug)] +pub struct IndicesShardStores<'a, 'b> { + transport: &'a Transport, + parts: IndicesShardStoresParts<'b>, + allow_no_indices: Option, + error_trace: Option, + expand_wildcards: Option<&'b [ExpandWildcards]>, + filter_path: Option<&'b [&'b str]>, + headers: HeaderMap, + human: Option, + ignore_unavailable: Option, + pretty: Option, + request_timeout: Option, + source: Option<&'b str>, + status: Option<&'b [&'b str]>, +} +impl<'a, 'b> IndicesShardStores<'a, 'b> { + #[doc = "Creates a new instance of [IndicesShardStores] with the specified API parts"] + pub fn new(transport: &'a Transport, parts: IndicesShardStoresParts<'b>) -> Self { + let headers = HeaderMap::new(); + IndicesShardStores { + transport, + parts, + headers, + allow_no_indices: None, + error_trace: None, + expand_wildcards: None, + filter_path: None, + human: None, + ignore_unavailable: None, + pretty: None, + request_timeout: None, + source: None, + status: None, + } + } + #[doc = "Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes `_all` string or when no indices have been specified)"] + pub fn allow_no_indices(mut self, allow_no_indices: bool) -> Self { + self.allow_no_indices = Some(allow_no_indices); + self + } + #[doc = "Include the stack trace of returned errors."] + pub fn error_trace(mut self, error_trace: bool) -> Self { + self.error_trace = Some(error_trace); + self + } + #[doc = "Whether to expand wildcard expression to concrete indices that are open, closed or both."] + pub fn expand_wildcards(mut self, expand_wildcards: &'b [ExpandWildcards]) -> Self { + self.expand_wildcards = Some(expand_wildcards); + self + } + #[doc = "A comma-separated list of filters used to reduce the response."] + pub fn filter_path(mut self, filter_path: &'b [&'b str]) -> Self { + self.filter_path = Some(filter_path); + self + } + #[doc = "Adds a HTTP header"] + pub fn header(mut self, key: HeaderName, value: HeaderValue) -> Self { + self.headers.insert(key, value); + self + } + #[doc = "Return human readable values for statistics."] + pub fn human(mut self, human: bool) -> Self { + self.human = Some(human); + self + } + #[doc = "Whether specified concrete indices should be ignored when unavailable (missing or closed)"] + pub fn ignore_unavailable(mut self, ignore_unavailable: bool) -> Self { + self.ignore_unavailable = Some(ignore_unavailable); + self + } + #[doc = "Pretty format the returned JSON response."] + pub fn pretty(mut self, pretty: bool) -> Self { + self.pretty = Some(pretty); + self + } + #[doc = "Sets a request timeout for this API call.\n\nThe timeout is applied from when the request starts connecting until the response body has finished."] + pub fn request_timeout(mut self, timeout: Duration) -> Self { + self.request_timeout = Some(timeout); + self + } + #[doc = "The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests."] + pub fn source(mut self, source: &'b str) -> Self { + self.source = Some(source); + self + } + #[doc = "A comma-separated list of statuses used to filter on shards to get store information for"] + pub fn status(mut self, status: &'b [&'b str]) -> Self { + self.status = Some(status); + self + } + #[doc = "Creates an asynchronous call to the Indices Shard Stores API that can be awaited"] + pub async fn send(self) -> Result { + let path = self.parts.url(); + let method = Method::Get; + let headers = self.headers; + let timeout = self.request_timeout; + let query_string = { + #[serde_with::skip_serializing_none] + #[derive(Serialize)] + struct QueryParams<'b> { + allow_no_indices: Option, + error_trace: Option, + #[serde(serialize_with = "crate::client::serialize_coll_qs")] + expand_wildcards: Option<&'b [ExpandWildcards]>, + #[serde(serialize_with = "crate::client::serialize_coll_qs")] + filter_path: Option<&'b [&'b str]>, + human: Option, + ignore_unavailable: Option, + pretty: Option, + source: Option<&'b str>, + #[serde(serialize_with = "crate::client::serialize_coll_qs")] + status: Option<&'b [&'b str]>, + } + let query_params = QueryParams { + allow_no_indices: self.allow_no_indices, + error_trace: self.error_trace, + expand_wildcards: self.expand_wildcards, + filter_path: self.filter_path, + human: self.human, + ignore_unavailable: self.ignore_unavailable, + pretty: self.pretty, + source: self.source, + status: self.status, + }; + Some(query_params) + }; + let body = Option::<()>::None; + let response = self + .transport + .send(method, &path, headers, query_string.as_ref(), body, timeout) + .await?; + Ok(response) + } +} +#[derive(Debug, Clone, PartialEq)] +#[doc = "API parts for the Indices Shrink API"] +pub enum IndicesShrinkParts<'b> { + #[doc = "Index and Target"] + IndexTarget(&'b str, &'b str), +} +impl<'b> IndicesShrinkParts<'b> { + #[doc = "Builds a relative URL path to the Indices Shrink API"] + pub fn url(self) -> Cow<'static, str> { + match self { + IndicesShrinkParts::IndexTarget(ref index, ref target) => { + let encoded_index: Cow = + percent_encode(index.as_bytes(), PARTS_ENCODED).into(); + let encoded_target: Cow = + percent_encode(target.as_bytes(), PARTS_ENCODED).into(); + let mut p = + String::with_capacity(10usize + encoded_index.len() + encoded_target.len()); + p.push_str("/"); + p.push_str(encoded_index.as_ref()); + p.push_str("/_shrink/"); + p.push_str(encoded_target.as_ref()); + p.into() + } + } + } +} +#[doc = "Builder for the [Indices Shrink API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/indices-shrink-index.html)\n\nAllow to shrink an existing index into a new index with fewer primary shards."] +#[derive(Clone, Debug)] +pub struct IndicesShrink<'a, 'b, B> { + transport: &'a Transport, + parts: IndicesShrinkParts<'b>, + body: Option, + copy_settings: Option, + error_trace: Option, + filter_path: Option<&'b [&'b str]>, + headers: HeaderMap, + human: Option, + master_timeout: Option<&'b str>, + pretty: Option, + request_timeout: Option, + source: Option<&'b str>, + timeout: Option<&'b str>, + wait_for_active_shards: Option<&'b str>, +} +impl<'a, 'b, B> IndicesShrink<'a, 'b, B> +where + B: Body, +{ + #[doc = "Creates a new instance of [IndicesShrink] with the specified API parts"] + pub fn new(transport: &'a Transport, parts: IndicesShrinkParts<'b>) -> Self { + let headers = HeaderMap::new(); + IndicesShrink { + transport, + parts, + headers, + body: None, + copy_settings: None, + error_trace: None, + filter_path: None, + human: None, + master_timeout: None, + pretty: None, + request_timeout: None, + source: None, + timeout: None, + wait_for_active_shards: None, + } + } + #[doc = "The body for the API call"] + pub fn body(self, body: T) -> IndicesShrink<'a, 'b, JsonBody> + where + T: Serialize, + { + IndicesShrink { + transport: self.transport, + parts: self.parts, + body: Some(body.into()), + copy_settings: self.copy_settings, + error_trace: self.error_trace, + filter_path: self.filter_path, + headers: self.headers, + human: self.human, + master_timeout: self.master_timeout, + pretty: self.pretty, + request_timeout: self.request_timeout, + source: self.source, + timeout: self.timeout, + wait_for_active_shards: self.wait_for_active_shards, + } + } + #[doc = "whether or not to copy settings from the source index (defaults to false)"] + pub fn copy_settings(mut self, copy_settings: bool) -> Self { + self.copy_settings = Some(copy_settings); self } #[doc = "Include the stack trace of returned errors."] @@ -6736,11 +8126,6 @@ impl<'a, 'b> IndicesSegments<'a, 'b> { self.error_trace = Some(error_trace); self } - #[doc = "Whether to expand wildcard expression to concrete indices that are open, closed or both."] - pub fn expand_wildcards(mut self, expand_wildcards: &'b [ExpandWildcards]) -> Self { - self.expand_wildcards = Some(expand_wildcards); - self - } #[doc = "A comma-separated list of filters used to reduce the response."] pub fn filter_path(mut self, filter_path: &'b [&'b str]) -> Self { self.filter_path = Some(filter_path); @@ -6756,9 +8141,9 @@ impl<'a, 'b> IndicesSegments<'a, 'b> { self.human = Some(human); self } - #[doc = "Whether specified concrete indices should be ignored when unavailable (missing or closed)"] - pub fn ignore_unavailable(mut self, ignore_unavailable: bool) -> Self { - self.ignore_unavailable = Some(ignore_unavailable); + #[doc = "Specify timeout for connection to master"] + pub fn master_timeout(mut self, master_timeout: &'b str) -> Self { + self.master_timeout = Some(master_timeout); self } #[doc = "Pretty format the returned JSON response."] @@ -6776,47 +8161,51 @@ impl<'a, 'b> IndicesSegments<'a, 'b> { self.source = Some(source); self } - #[doc = "Includes detailed memory usage by Lucene."] - pub fn verbose(mut self, verbose: bool) -> Self { - self.verbose = Some(verbose); + #[doc = "Explicit operation timeout"] + pub fn timeout(mut self, timeout: &'b str) -> Self { + self.timeout = Some(timeout); self } - #[doc = "Creates an asynchronous call to the Indices Segments API that can be awaited"] + #[doc = "Set the number of active shards to wait for on the shrunken index before the operation returns."] + pub fn wait_for_active_shards(mut self, wait_for_active_shards: &'b str) -> Self { + self.wait_for_active_shards = Some(wait_for_active_shards); + self + } + #[doc = "Creates an asynchronous call to the Indices Shrink API that can be awaited"] pub async fn send(self) -> Result { let path = self.parts.url(); - let method = Method::Get; + let method = Method::Post; let headers = self.headers; let timeout = self.request_timeout; let query_string = { #[serde_with::skip_serializing_none] #[derive(Serialize)] struct QueryParams<'b> { - allow_no_indices: Option, + copy_settings: Option, error_trace: Option, #[serde(serialize_with = "crate::client::serialize_coll_qs")] - expand_wildcards: Option<&'b [ExpandWildcards]>, - #[serde(serialize_with = "crate::client::serialize_coll_qs")] filter_path: Option<&'b [&'b str]>, human: Option, - ignore_unavailable: Option, + master_timeout: Option<&'b str>, pretty: Option, source: Option<&'b str>, - verbose: Option, + timeout: Option<&'b str>, + wait_for_active_shards: Option<&'b str>, } let query_params = QueryParams { - allow_no_indices: self.allow_no_indices, + copy_settings: self.copy_settings, error_trace: self.error_trace, - expand_wildcards: self.expand_wildcards, filter_path: self.filter_path, human: self.human, - ignore_unavailable: self.ignore_unavailable, + master_timeout: self.master_timeout, pretty: self.pretty, source: self.source, - verbose: self.verbose, + timeout: self.timeout, + wait_for_active_shards: self.wait_for_active_shards, }; Some(query_params) }; - let body = Option::<()>::None; + let body = self.body; let response = self .transport .send(method, &path, headers, query_string.as_ref(), body, timeout) @@ -6825,71 +8214,94 @@ impl<'a, 'b> IndicesSegments<'a, 'b> { } } #[derive(Debug, Clone, PartialEq)] -#[doc = "API parts for the Indices Shard Stores API"] -pub enum IndicesShardStoresParts<'b> { - #[doc = "No parts"] - None, - #[doc = "Index"] - Index(&'b [&'b str]), +#[doc = "API parts for the Indices Simulate Index Template API"] +pub enum IndicesSimulateIndexTemplateParts<'b> { + #[doc = "Name"] + Name(&'b str), } -impl<'b> IndicesShardStoresParts<'b> { - #[doc = "Builds a relative URL path to the Indices Shard Stores API"] +impl<'b> IndicesSimulateIndexTemplateParts<'b> { + #[doc = "Builds a relative URL path to the Indices Simulate Index Template API"] pub fn url(self) -> Cow<'static, str> { match self { - IndicesShardStoresParts::None => "/_shard_stores".into(), - IndicesShardStoresParts::Index(ref index) => { - let index_str = index.join(","); - let encoded_index: Cow = - percent_encode(index_str.as_bytes(), PARTS_ENCODED).into(); - let mut p = String::with_capacity(15usize + encoded_index.len()); - p.push_str("/"); - p.push_str(encoded_index.as_ref()); - p.push_str("/_shard_stores"); + IndicesSimulateIndexTemplateParts::Name(ref name) => { + let encoded_name: Cow = percent_encode(name.as_bytes(), PARTS_ENCODED).into(); + let mut p = String::with_capacity(33usize + encoded_name.len()); + p.push_str("/_index_template/_simulate_index/"); + p.push_str(encoded_name.as_ref()); p.into() } } } } +#[doc = "Builder for the [Indices Simulate Index Template API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/indices-templates.html)\n\nSimulate matching the given index name against the index templates in the system"] #[derive(Clone, Debug)] -#[doc = "Builder for the [Indices Shard Stores API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/indices-shards-stores.html)\n\nProvides store information for shard copies of indices."] -pub struct IndicesShardStores<'a, 'b> { +pub struct IndicesSimulateIndexTemplate<'a, 'b, B> { transport: &'a Transport, - parts: IndicesShardStoresParts<'b>, - allow_no_indices: Option, + parts: IndicesSimulateIndexTemplateParts<'b>, + body: Option, + cause: Option<&'b str>, + create: Option, error_trace: Option, - expand_wildcards: Option<&'b [ExpandWildcards]>, filter_path: Option<&'b [&'b str]>, headers: HeaderMap, human: Option, - ignore_unavailable: Option, + master_timeout: Option<&'b str>, pretty: Option, request_timeout: Option, source: Option<&'b str>, - status: Option<&'b [&'b str]>, } -impl<'a, 'b> IndicesShardStores<'a, 'b> { - #[doc = "Creates a new instance of [IndicesShardStores] with the specified API parts"] - pub fn new(transport: &'a Transport, parts: IndicesShardStoresParts<'b>) -> Self { +impl<'a, 'b, B> IndicesSimulateIndexTemplate<'a, 'b, B> +where + B: Body, +{ + #[doc = "Creates a new instance of [IndicesSimulateIndexTemplate] with the specified API parts"] + pub fn new(transport: &'a Transport, parts: IndicesSimulateIndexTemplateParts<'b>) -> Self { let headers = HeaderMap::new(); - IndicesShardStores { + IndicesSimulateIndexTemplate { transport, parts, headers, - allow_no_indices: None, + body: None, + cause: None, + create: None, error_trace: None, - expand_wildcards: None, filter_path: None, human: None, - ignore_unavailable: None, + master_timeout: None, pretty: None, request_timeout: None, source: None, - status: None, } } - #[doc = "Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes `_all` string or when no indices have been specified)"] - pub fn allow_no_indices(mut self, allow_no_indices: bool) -> Self { - self.allow_no_indices = Some(allow_no_indices); + #[doc = "The body for the API call"] + pub fn body(self, body: T) -> IndicesSimulateIndexTemplate<'a, 'b, JsonBody> + where + T: Serialize, + { + IndicesSimulateIndexTemplate { + transport: self.transport, + parts: self.parts, + body: Some(body.into()), + cause: self.cause, + create: self.create, + error_trace: self.error_trace, + filter_path: self.filter_path, + headers: self.headers, + human: self.human, + master_timeout: self.master_timeout, + pretty: self.pretty, + request_timeout: self.request_timeout, + source: self.source, + } + } + #[doc = "User defined reason for dry-run creating the new template for simulation purposes"] + pub fn cause(mut self, cause: &'b str) -> Self { + self.cause = Some(cause); + self + } + #[doc = "Whether the index template we optionally defined in the body should only be dry-run added if new or can also replace an existing one"] + pub fn create(mut self, create: bool) -> Self { + self.create = Some(create); self } #[doc = "Include the stack trace of returned errors."] @@ -6897,11 +8309,6 @@ impl<'a, 'b> IndicesShardStores<'a, 'b> { self.error_trace = Some(error_trace); self } - #[doc = "Whether to expand wildcard expression to concrete indices that are open, closed or both."] - pub fn expand_wildcards(mut self, expand_wildcards: &'b [ExpandWildcards]) -> Self { - self.expand_wildcards = Some(expand_wildcards); - self - } #[doc = "A comma-separated list of filters used to reduce the response."] pub fn filter_path(mut self, filter_path: &'b [&'b str]) -> Self { self.filter_path = Some(filter_path); @@ -6917,9 +8324,9 @@ impl<'a, 'b> IndicesShardStores<'a, 'b> { self.human = Some(human); self } - #[doc = "Whether specified concrete indices should be ignored when unavailable (missing or closed)"] - pub fn ignore_unavailable(mut self, ignore_unavailable: bool) -> Self { - self.ignore_unavailable = Some(ignore_unavailable); + #[doc = "Specify timeout for connection to master"] + pub fn master_timeout(mut self, master_timeout: &'b str) -> Self { + self.master_timeout = Some(master_timeout); self } #[doc = "Pretty format the returned JSON response."] @@ -6937,48 +8344,39 @@ impl<'a, 'b> IndicesShardStores<'a, 'b> { self.source = Some(source); self } - #[doc = "A comma-separated list of statuses used to filter on shards to get store information for"] - pub fn status(mut self, status: &'b [&'b str]) -> Self { - self.status = Some(status); - self - } - #[doc = "Creates an asynchronous call to the Indices Shard Stores API that can be awaited"] + #[doc = "Creates an asynchronous call to the Indices Simulate Index Template API that can be awaited"] pub async fn send(self) -> Result { let path = self.parts.url(); - let method = Method::Get; + let method = Method::Post; let headers = self.headers; let timeout = self.request_timeout; let query_string = { #[serde_with::skip_serializing_none] #[derive(Serialize)] struct QueryParams<'b> { - allow_no_indices: Option, + cause: Option<&'b str>, + create: Option, error_trace: Option, #[serde(serialize_with = "crate::client::serialize_coll_qs")] - expand_wildcards: Option<&'b [ExpandWildcards]>, - #[serde(serialize_with = "crate::client::serialize_coll_qs")] filter_path: Option<&'b [&'b str]>, human: Option, - ignore_unavailable: Option, + master_timeout: Option<&'b str>, pretty: Option, source: Option<&'b str>, - #[serde(serialize_with = "crate::client::serialize_coll_qs")] - status: Option<&'b [&'b str]>, } let query_params = QueryParams { - allow_no_indices: self.allow_no_indices, + cause: self.cause, + create: self.create, error_trace: self.error_trace, - expand_wildcards: self.expand_wildcards, filter_path: self.filter_path, human: self.human, - ignore_unavailable: self.ignore_unavailable, + master_timeout: self.master_timeout, pretty: self.pretty, source: self.source, - status: self.status, }; Some(query_params) }; - let body = Option::<()>::None; + let body = self.body; let response = self .transport .send(method, &path, headers, query_string.as_ref(), body, timeout) @@ -6987,38 +8385,36 @@ impl<'a, 'b> IndicesShardStores<'a, 'b> { } } #[derive(Debug, Clone, PartialEq)] -#[doc = "API parts for the Indices Shrink API"] -pub enum IndicesShrinkParts<'b> { - #[doc = "Index and Target"] - IndexTarget(&'b str, &'b str), +#[doc = "API parts for the Indices Simulate Template API"] +pub enum IndicesSimulateTemplateParts<'b> { + #[doc = "No parts"] + None, + #[doc = "Name"] + Name(&'b str), } -impl<'b> IndicesShrinkParts<'b> { - #[doc = "Builds a relative URL path to the Indices Shrink API"] +impl<'b> IndicesSimulateTemplateParts<'b> { + #[doc = "Builds a relative URL path to the Indices Simulate Template API"] pub fn url(self) -> Cow<'static, str> { match self { - IndicesShrinkParts::IndexTarget(ref index, ref target) => { - let encoded_index: Cow = - percent_encode(index.as_bytes(), PARTS_ENCODED).into(); - let encoded_target: Cow = - percent_encode(target.as_bytes(), PARTS_ENCODED).into(); - let mut p = - String::with_capacity(10usize + encoded_index.len() + encoded_target.len()); - p.push_str("/"); - p.push_str(encoded_index.as_ref()); - p.push_str("/_shrink/"); - p.push_str(encoded_target.as_ref()); + IndicesSimulateTemplateParts::None => "/_index_template/_simulate".into(), + IndicesSimulateTemplateParts::Name(ref name) => { + let encoded_name: Cow = percent_encode(name.as_bytes(), PARTS_ENCODED).into(); + let mut p = String::with_capacity(27usize + encoded_name.len()); + p.push_str("/_index_template/_simulate/"); + p.push_str(encoded_name.as_ref()); p.into() } } } } +#[doc = "Builder for the [Indices Simulate Template API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/indices-templates.html)\n\nSimulate resolving the given template name or body"] #[derive(Clone, Debug)] -#[doc = "Builder for the [Indices Shrink API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/indices-shrink-index.html)\n\nAllow to shrink an existing index into a new index with fewer primary shards."] -pub struct IndicesShrink<'a, 'b, B> { +pub struct IndicesSimulateTemplate<'a, 'b, B> { transport: &'a Transport, - parts: IndicesShrinkParts<'b>, + parts: IndicesSimulateTemplateParts<'b>, body: Option, - copy_settings: Option, + cause: Option<&'b str>, + create: Option, error_trace: Option, filter_path: Option<&'b [&'b str]>, headers: HeaderMap, @@ -7027,22 +8423,21 @@ pub struct IndicesShrink<'a, 'b, B> { pretty: Option, request_timeout: Option, source: Option<&'b str>, - timeout: Option<&'b str>, - wait_for_active_shards: Option<&'b str>, } -impl<'a, 'b, B> IndicesShrink<'a, 'b, B> +impl<'a, 'b, B> IndicesSimulateTemplate<'a, 'b, B> where B: Body, { - #[doc = "Creates a new instance of [IndicesShrink] with the specified API parts"] - pub fn new(transport: &'a Transport, parts: IndicesShrinkParts<'b>) -> Self { + #[doc = "Creates a new instance of [IndicesSimulateTemplate] with the specified API parts"] + pub fn new(transport: &'a Transport, parts: IndicesSimulateTemplateParts<'b>) -> Self { let headers = HeaderMap::new(); - IndicesShrink { + IndicesSimulateTemplate { transport, parts, headers, body: None, - copy_settings: None, + cause: None, + create: None, error_trace: None, filter_path: None, human: None, @@ -7050,20 +8445,19 @@ where pretty: None, request_timeout: None, source: None, - timeout: None, - wait_for_active_shards: None, } } #[doc = "The body for the API call"] - pub fn body(self, body: T) -> IndicesShrink<'a, 'b, JsonBody> + pub fn body(self, body: T) -> IndicesSimulateTemplate<'a, 'b, JsonBody> where T: Serialize, { - IndicesShrink { + IndicesSimulateTemplate { transport: self.transport, parts: self.parts, body: Some(body.into()), - copy_settings: self.copy_settings, + cause: self.cause, + create: self.create, error_trace: self.error_trace, filter_path: self.filter_path, headers: self.headers, @@ -7072,13 +8466,16 @@ where pretty: self.pretty, request_timeout: self.request_timeout, source: self.source, - timeout: self.timeout, - wait_for_active_shards: self.wait_for_active_shards, } } - #[doc = "whether or not to copy settings from the source index (defaults to false)"] - pub fn copy_settings(mut self, copy_settings: bool) -> Self { - self.copy_settings = Some(copy_settings); + #[doc = "User defined reason for dry-run creating the new template for simulation purposes"] + pub fn cause(mut self, cause: &'b str) -> Self { + self.cause = Some(cause); + self + } + #[doc = "Whether the index template we optionally defined in the body should only be dry-run added if new or can also replace an existing one"] + pub fn create(mut self, create: bool) -> Self { + self.create = Some(create); self } #[doc = "Include the stack trace of returned errors."] @@ -7121,17 +8518,7 @@ where self.source = Some(source); self } - #[doc = "Explicit operation timeout"] - pub fn timeout(mut self, timeout: &'b str) -> Self { - self.timeout = Some(timeout); - self - } - #[doc = "Set the number of active shards to wait for on the shrunken index before the operation returns."] - pub fn wait_for_active_shards(mut self, wait_for_active_shards: &'b str) -> Self { - self.wait_for_active_shards = Some(wait_for_active_shards); - self - } - #[doc = "Creates an asynchronous call to the Indices Shrink API that can be awaited"] + #[doc = "Creates an asynchronous call to the Indices Simulate Template API that can be awaited"] pub async fn send(self) -> Result { let path = self.parts.url(); let method = Method::Post; @@ -7141,7 +8528,8 @@ where #[serde_with::skip_serializing_none] #[derive(Serialize)] struct QueryParams<'b> { - copy_settings: Option, + cause: Option<&'b str>, + create: Option, error_trace: Option, #[serde(serialize_with = "crate::client::serialize_coll_qs")] filter_path: Option<&'b [&'b str]>, @@ -7149,19 +8537,16 @@ where master_timeout: Option<&'b str>, pretty: Option, source: Option<&'b str>, - timeout: Option<&'b str>, - wait_for_active_shards: Option<&'b str>, } let query_params = QueryParams { - copy_settings: self.copy_settings, + cause: self.cause, + create: self.create, error_trace: self.error_trace, filter_path: self.filter_path, human: self.human, master_timeout: self.master_timeout, pretty: self.pretty, source: self.source, - timeout: self.timeout, - wait_for_active_shards: self.wait_for_active_shards, }; Some(query_params) }; @@ -7199,8 +8584,8 @@ impl<'b> IndicesSplitParts<'b> { } } } +#[doc = "Builder for the [Indices Split API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/indices-split-index.html)\n\nAllows you to split an existing index into a new index with more primary shards."] #[derive(Clone, Debug)] -#[doc = "Builder for the [Indices Split API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/indices-split-index.html)\n\nAllows you to split an existing index into a new index with more primary shards."] pub struct IndicesSplit<'a, 'b, B> { transport: &'a Transport, parts: IndicesSplitParts<'b>, @@ -7414,8 +8799,8 @@ impl<'b> IndicesStatsParts<'b> { } } } +#[doc = "Builder for the [Indices Stats API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/indices-stats.html)\n\nProvides statistics on operations happening in an index."] #[derive(Clone, Debug)] -#[doc = "Builder for the [Indices Stats API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/indices-stats.html)\n\nProvides statistics on operations happening in an index."] pub struct IndicesStats<'a, 'b> { transport: &'a Transport, parts: IndicesStatsParts<'b>, @@ -7630,8 +9015,8 @@ impl<'b> IndicesUnfreezeParts<'b> { } } } +#[doc = "Builder for the [Indices Unfreeze API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/unfreeze-index-api.html)\n\nUnfreezes an index. When a frozen index is unfrozen, the index goes through the normal recovery process and becomes writeable again."] #[derive(Clone, Debug)] -#[doc = "Builder for the [Indices Unfreeze API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/unfreeze-index-api.html)\n\nUnfreezes an index. When a frozen index is unfrozen, the index goes through the normal recovery process and becomes writeable again."] pub struct IndicesUnfreeze<'a, 'b, B> { transport: &'a Transport, parts: IndicesUnfreezeParts<'b>, @@ -7826,8 +9211,8 @@ impl IndicesUpdateAliasesParts { } } } +#[doc = "Builder for the [Indices Update Aliases API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/indices-aliases.html)\n\nUpdates index aliases."] #[derive(Clone, Debug)] -#[doc = "Builder for the [Indices Update Aliases API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/indices-aliases.html)\n\nUpdates index aliases."] pub struct IndicesUpdateAliases<'a, 'b, B> { transport: &'a Transport, parts: IndicesUpdateAliasesParts, @@ -7993,8 +9378,8 @@ impl<'b> IndicesUpgradeParts<'b> { } } } +#[doc = "Builder for the [Indices Upgrade API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/indices-upgrade.html)\n\nDEPRECATED Upgrades to the current version of Lucene."] #[derive(Clone, Debug)] -#[doc = "Builder for the [Indices Upgrade API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/indices-upgrade.html)\n\nThe _upgrade API is no longer useful and will be removed."] pub struct IndicesUpgrade<'a, 'b, B> { transport: &'a Transport, parts: IndicesUpgradeParts<'b>, @@ -8207,8 +9592,8 @@ impl<'b> IndicesValidateQueryParts<'b> { } } } +#[doc = "Builder for the [Indices Validate Query API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/search-validate.html)\n\nAllows a user to validate a potentially expensive query without executing it."] #[derive(Clone, Debug)] -#[doc = "Builder for the [Indices Validate Query API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/search-validate.html)\n\nAllows a user to validate a potentially expensive query without executing it."] pub struct IndicesValidateQuery<'a, 'b, B> { transport: &'a Transport, parts: IndicesValidateQueryParts<'b>, @@ -8464,253 +9849,318 @@ impl<'a> Indices<'a> { pub fn transport(&self) -> &Transport { self.transport } - #[doc = "[Indices Add Block API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/index-modules-blocks.html)\n\nAdds a block to an index."] + #[doc = "[Indices Add Block API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/index-modules-blocks.html)\n\nAdds a block to an index."] pub fn add_block<'b>(&'a self, parts: IndicesAddBlockParts<'b>) -> IndicesAddBlock<'a, 'b, ()> { IndicesAddBlock::new(self.transport(), parts) } - #[doc = "[Indices Analyze API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/indices-analyze.html)\n\nPerforms the analysis process on a text and return the tokens breakdown of the text."] + #[doc = "[Indices Analyze API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/indices-analyze.html)\n\nPerforms the analysis process on a text and return the tokens breakdown of the text."] pub fn analyze<'b>(&'a self, parts: IndicesAnalyzeParts<'b>) -> IndicesAnalyze<'a, 'b, ()> { IndicesAnalyze::new(self.transport(), parts) } - #[doc = "[Indices Clear Cache API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/indices-clearcache.html)\n\nClears all or specific caches for one or more indices."] + #[doc = "[Indices Clear Cache API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/indices-clearcache.html)\n\nClears all or specific caches for one or more indices."] pub fn clear_cache<'b>( &'a self, parts: IndicesClearCacheParts<'b>, ) -> IndicesClearCache<'a, 'b, ()> { IndicesClearCache::new(self.transport(), parts) } - #[doc = "[Indices Clone API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/indices-clone-index.html)\n\nClones an index"] + #[doc = "[Indices Clone API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/indices-clone-index.html)\n\nClones an index"] pub fn clone<'b>(&'a self, parts: IndicesCloneParts<'b>) -> IndicesClone<'a, 'b, ()> { IndicesClone::new(self.transport(), parts) } - #[doc = "[Indices Close API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/indices-open-close.html)\n\nCloses an index."] + #[doc = "[Indices Close API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/indices-open-close.html)\n\nCloses an index."] pub fn close<'b>(&'a self, parts: IndicesCloseParts<'b>) -> IndicesClose<'a, 'b, ()> { IndicesClose::new(self.transport(), parts) } - #[doc = "[Indices Create API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/indices-create-index.html)\n\nCreates an index with optional settings and mappings.\n\n# Examples\n\nCreate an index with a mapping\n\n```rust,no_run\n# use elasticsearch::{Elasticsearch, Error, indices::IndicesCreateParts};\n# use serde_json::{json, Value};\n# async fn doc() -> Result<(), Box> {\nlet client = Elasticsearch::default();\nlet response = client\n .indices()\n .create(IndicesCreateParts::Index(\"test_index\"))\n .body(json!({\n \"mappings\" : {\n \"properties\" : {\n \"field1\" : { \"type\" : \"text\" }\n }\n }\n }))\n .send()\n .await?;\n \n# Ok(())\n# }\n```"] + #[doc = "[Indices Create API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/indices-create-index.html)\n\nCreates an index with optional settings and mappings.\n\n# Examples\n\nCreate an index with a mapping\n\n```rust,no_run\n# use elasticsearch::{Elasticsearch, Error, indices::IndicesCreateParts};\n# use serde_json::{json, Value};\n# async fn doc() -> Result<(), Box> {\nlet client = Elasticsearch::default();\nlet response = client\n .indices()\n .create(IndicesCreateParts::Index(\"test_index\"))\n .body(json!({\n \"mappings\" : {\n \"properties\" : {\n \"field1\" : { \"type\" : \"text\" }\n }\n }\n }))\n .send()\n .await?;\n \n# Ok(())\n# }\n```"] pub fn create<'b>(&'a self, parts: IndicesCreateParts<'b>) -> IndicesCreate<'a, 'b, ()> { IndicesCreate::new(self.transport(), parts) } - #[doc = "[Indices Create Data Stream API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/data-streams.html)\n\nCreates a data stream"] + #[doc = "[Indices Create Data Stream API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/data-streams.html)\n\nCreates a data stream"] pub fn create_data_stream<'b>( &'a self, parts: IndicesCreateDataStreamParts<'b>, ) -> IndicesCreateDataStream<'a, 'b, ()> { IndicesCreateDataStream::new(self.transport(), parts) } - #[doc = "[Indices Data Streams Stats API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/data-streams.html)\n\nProvides statistics on operations happening in a data stream."] + #[doc = "[Indices Data Streams Stats API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/data-streams.html)\n\nProvides statistics on operations happening in a data stream."] pub fn data_streams_stats<'b>( &'a self, parts: IndicesDataStreamsStatsParts<'b>, ) -> IndicesDataStreamsStats<'a, 'b> { IndicesDataStreamsStats::new(self.transport(), parts) } - #[doc = "[Indices Delete API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/indices-delete-index.html)\n\nDeletes an index."] + #[doc = "[Indices Delete API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/indices-delete-index.html)\n\nDeletes an index."] pub fn delete<'b>(&'a self, parts: IndicesDeleteParts<'b>) -> IndicesDelete<'a, 'b> { IndicesDelete::new(self.transport(), parts) } - #[doc = "[Indices Delete Alias API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/indices-aliases.html)\n\nDeletes an alias."] + #[doc = "[Indices Delete Alias API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/indices-aliases.html)\n\nDeletes an alias."] pub fn delete_alias<'b>( &'a self, parts: IndicesDeleteAliasParts<'b>, ) -> IndicesDeleteAlias<'a, 'b> { IndicesDeleteAlias::new(self.transport(), parts) } - #[doc = "[Indices Delete Data Stream API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/data-streams.html)\n\nDeletes a data stream."] + #[doc = "[Indices Delete Data Stream API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/data-streams.html)\n\nDeletes a data stream."] pub fn delete_data_stream<'b>( &'a self, parts: IndicesDeleteDataStreamParts<'b>, ) -> IndicesDeleteDataStream<'a, 'b> { IndicesDeleteDataStream::new(self.transport(), parts) } - #[doc = "[Indices Delete Template API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/indices-templates.html)\n\nDeletes an index template."] + #[doc = "[Indices Delete Index Template API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/indices-templates.html)\n\nDeletes an index template."] + pub fn delete_index_template<'b>( + &'a self, + parts: IndicesDeleteIndexTemplateParts<'b>, + ) -> IndicesDeleteIndexTemplate<'a, 'b> { + IndicesDeleteIndexTemplate::new(self.transport(), parts) + } + #[doc = "[Indices Delete Template API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/indices-templates.html)\n\nDeletes an index template."] pub fn delete_template<'b>( &'a self, parts: IndicesDeleteTemplateParts<'b>, ) -> IndicesDeleteTemplate<'a, 'b> { IndicesDeleteTemplate::new(self.transport(), parts) } - #[doc = "[Indices Exists API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/indices-exists.html)\n\nReturns information about whether a particular index exists."] + #[doc = "[Indices Exists API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/indices-exists.html)\n\nReturns information about whether a particular index exists."] pub fn exists<'b>(&'a self, parts: IndicesExistsParts<'b>) -> IndicesExists<'a, 'b> { IndicesExists::new(self.transport(), parts) } - #[doc = "[Indices Exists Alias API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/indices-aliases.html)\n\nReturns information about whether a particular alias exists."] + #[doc = "[Indices Exists Alias API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/indices-aliases.html)\n\nReturns information about whether a particular alias exists."] pub fn exists_alias<'b>( &'a self, parts: IndicesExistsAliasParts<'b>, ) -> IndicesExistsAlias<'a, 'b> { IndicesExistsAlias::new(self.transport(), parts) } - #[doc = "[Indices Exists Template API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/indices-templates.html)\n\nReturns information about whether a particular index template exists."] + #[doc = "[Indices Exists Index Template API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/indices-templates.html)\n\nReturns information about whether a particular index template exists."] + pub fn exists_index_template<'b>( + &'a self, + parts: IndicesExistsIndexTemplateParts<'b>, + ) -> IndicesExistsIndexTemplate<'a, 'b> { + IndicesExistsIndexTemplate::new(self.transport(), parts) + } + #[doc = "[Indices Exists Template API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/indices-templates.html)\n\nReturns information about whether a particular index template exists."] pub fn exists_template<'b>( &'a self, parts: IndicesExistsTemplateParts<'b>, ) -> IndicesExistsTemplate<'a, 'b> { IndicesExistsTemplate::new(self.transport(), parts) } - #[doc = "[Indices Exists Type API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/indices-types-exists.html)\n\nReturns information about whether a particular document type exists. (DEPRECATED)"] + #[doc = "[Indices Exists Type API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/indices-types-exists.html)\n\nReturns information about whether a particular document type exists. (DEPRECATED)"] pub fn exists_type<'b>( &'a self, parts: IndicesExistsTypeParts<'b>, ) -> IndicesExistsType<'a, 'b> { IndicesExistsType::new(self.transport(), parts) } - #[doc = "[Indices Flush API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/indices-flush.html)\n\nPerforms the flush operation on one or more indices."] + #[doc = "[Indices Flush API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/indices-flush.html)\n\nPerforms the flush operation on one or more indices."] pub fn flush<'b>(&'a self, parts: IndicesFlushParts<'b>) -> IndicesFlush<'a, 'b, ()> { IndicesFlush::new(self.transport(), parts) } - #[doc = "[Indices Flush Synced API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/indices-synced-flush-api.html)\n\nPerforms a synced flush operation on one or more indices. Synced flush is deprecated and will be removed in 8.0. Use flush instead"] + #[doc = "[Indices Flush Synced API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/indices-synced-flush-api.html)\n\nPerforms a synced flush operation on one or more indices. Synced flush is deprecated and will be removed in 8.0. Use flush instead"] pub fn flush_synced<'b>( &'a self, parts: IndicesFlushSyncedParts<'b>, ) -> IndicesFlushSynced<'a, 'b, ()> { IndicesFlushSynced::new(self.transport(), parts) } - #[doc = "[Indices Forcemerge API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/indices-forcemerge.html)\n\nPerforms the force merge operation on one or more indices."] + #[doc = "[Indices Forcemerge API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/indices-forcemerge.html)\n\nPerforms the force merge operation on one or more indices."] pub fn forcemerge<'b>( &'a self, parts: IndicesForcemergeParts<'b>, ) -> IndicesForcemerge<'a, 'b, ()> { IndicesForcemerge::new(self.transport(), parts) } - #[doc = "[Indices Freeze API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/freeze-index-api.html)\n\nFreezes an index. A frozen index has almost no overhead on the cluster (except for maintaining its metadata in memory) and is read-only."] + #[doc = "[Indices Freeze API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/freeze-index-api.html)\n\nFreezes an index. A frozen index has almost no overhead on the cluster (except for maintaining its metadata in memory) and is read-only."] pub fn freeze<'b>(&'a self, parts: IndicesFreezeParts<'b>) -> IndicesFreeze<'a, 'b, ()> { IndicesFreeze::new(self.transport(), parts) } - #[doc = "[Indices Get API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/indices-get-index.html)\n\nReturns information about one or more indices."] + #[doc = "[Indices Get API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/indices-get-index.html)\n\nReturns information about one or more indices."] pub fn get<'b>(&'a self, parts: IndicesGetParts<'b>) -> IndicesGet<'a, 'b> { IndicesGet::new(self.transport(), parts) } - #[doc = "[Indices Get Alias API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/indices-aliases.html)\n\nReturns an alias."] + #[doc = "[Indices Get Alias API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/indices-aliases.html)\n\nReturns an alias."] pub fn get_alias<'b>(&'a self, parts: IndicesGetAliasParts<'b>) -> IndicesGetAlias<'a, 'b> { IndicesGetAlias::new(self.transport(), parts) } - #[doc = "[Indices Get Data Stream API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/data-streams.html)\n\nReturns data streams."] + #[doc = "[Indices Get Data Stream API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/data-streams.html)\n\nReturns data streams."] pub fn get_data_stream<'b>( &'a self, parts: IndicesGetDataStreamParts<'b>, ) -> IndicesGetDataStream<'a, 'b> { IndicesGetDataStream::new(self.transport(), parts) } - #[doc = "[Indices Get Field Mapping API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/indices-get-field-mapping.html)\n\nReturns mapping for one or more fields."] + #[doc = "[Indices Get Field Mapping API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/indices-get-field-mapping.html)\n\nReturns mapping for one or more fields."] pub fn get_field_mapping<'b>( &'a self, parts: IndicesGetFieldMappingParts<'b>, ) -> IndicesGetFieldMapping<'a, 'b> { IndicesGetFieldMapping::new(self.transport(), parts) } - #[doc = "[Indices Get Mapping API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/indices-get-mapping.html)\n\nReturns mappings for one or more indices."] + #[doc = "[Indices Get Index Template API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/indices-templates.html)\n\nReturns an index template."] + pub fn get_index_template<'b>( + &'a self, + parts: IndicesGetIndexTemplateParts<'b>, + ) -> IndicesGetIndexTemplate<'a, 'b> { + IndicesGetIndexTemplate::new(self.transport(), parts) + } + #[doc = "[Indices Get Mapping API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/indices-get-mapping.html)\n\nReturns mappings for one or more indices."] pub fn get_mapping<'b>( &'a self, parts: IndicesGetMappingParts<'b>, ) -> IndicesGetMapping<'a, 'b> { IndicesGetMapping::new(self.transport(), parts) } - #[doc = "[Indices Get Settings API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/indices-get-settings.html)\n\nReturns settings for one or more indices."] + #[doc = "[Indices Get Settings API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/indices-get-settings.html)\n\nReturns settings for one or more indices."] pub fn get_settings<'b>( &'a self, parts: IndicesGetSettingsParts<'b>, ) -> IndicesGetSettings<'a, 'b> { IndicesGetSettings::new(self.transport(), parts) } - #[doc = "[Indices Get Template API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/indices-templates.html)\n\nReturns an index template."] + #[doc = "[Indices Get Template API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/indices-templates.html)\n\nReturns an index template."] pub fn get_template<'b>( &'a self, parts: IndicesGetTemplateParts<'b>, ) -> IndicesGetTemplate<'a, 'b> { IndicesGetTemplate::new(self.transport(), parts) } - #[doc = "[Indices Get Upgrade API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/indices-upgrade.html)\n\nThe _upgrade API is no longer useful and will be removed."] + #[doc = "[Indices Get Upgrade API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/indices-upgrade.html)\n\nDEPRECATED Returns a progress status of current upgrade."] pub fn get_upgrade<'b>( &'a self, parts: IndicesGetUpgradeParts<'b>, ) -> IndicesGetUpgrade<'a, 'b> { IndicesGetUpgrade::new(self.transport(), parts) } - #[doc = "[Indices Open API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/indices-open-close.html)\n\nOpens an index."] + #[doc = "[Indices Migrate To Data Stream API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/data-streams.html)\n\nMigrates an alias to a data stream"] + pub fn migrate_to_data_stream<'b>( + &'a self, + parts: IndicesMigrateToDataStreamParts<'b>, + ) -> IndicesMigrateToDataStream<'a, 'b, ()> { + IndicesMigrateToDataStream::new(self.transport(), parts) + } + #[doc = "[Indices Open API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/indices-open-close.html)\n\nOpens an index."] pub fn open<'b>(&'a self, parts: IndicesOpenParts<'b>) -> IndicesOpen<'a, 'b, ()> { IndicesOpen::new(self.transport(), parts) } - #[doc = "[Indices Put Alias API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/indices-aliases.html)\n\nCreates or updates an alias."] + #[doc = "[Indices Promote Data Stream API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/data-streams.html)\n\nPromotes a data stream from a replicated data stream managed by CCR to a regular data stream"] + pub fn promote_data_stream<'b>( + &'a self, + parts: IndicesPromoteDataStreamParts<'b>, + ) -> IndicesPromoteDataStream<'a, 'b, ()> { + IndicesPromoteDataStream::new(self.transport(), parts) + } + #[doc = "[Indices Put Alias API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/indices-aliases.html)\n\nCreates or updates an alias."] pub fn put_alias<'b>(&'a self, parts: IndicesPutAliasParts<'b>) -> IndicesPutAlias<'a, 'b, ()> { IndicesPutAlias::new(self.transport(), parts) } - #[doc = "[Indices Put Mapping API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/indices-put-mapping.html)\n\nUpdates the index mappings.\n\n# Examples\n\nPut a mapping into an existing index, assuming the index does not have a mapping, \nor that any properties specified do not conflict with existing properties\n\n```rust,no_run\n# use elasticsearch::{Elasticsearch, Error, indices::IndicesPutMappingParts};\n# use serde_json::{json, Value};\n# async fn doc() -> Result<(), Box> {\nlet client = Elasticsearch::default();\nlet response = client\n .indices()\n .put_mapping(IndicesPutMappingParts::Index(&[\"test_index\"]))\n .body(json!({\n \"properties\" : {\n \"field1\" : { \"type\" : \"text\" }\n }\n }))\n .send()\n .await?;\n \n# Ok(())\n# }\n```"] + #[doc = "[Indices Put Index Template API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/indices-templates.html)\n\nCreates or updates an index template."] + pub fn put_index_template<'b>( + &'a self, + parts: IndicesPutIndexTemplateParts<'b>, + ) -> IndicesPutIndexTemplate<'a, 'b, ()> { + IndicesPutIndexTemplate::new(self.transport(), parts) + } + #[doc = "[Indices Put Mapping API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/indices-put-mapping.html)\n\nUpdates the index mappings.\n\n# Examples\n\nPut a mapping into an existing index, assuming the index does not have a mapping, \nor that any properties specified do not conflict with existing properties\n\n```rust,no_run\n# use elasticsearch::{Elasticsearch, Error, indices::IndicesPutMappingParts};\n# use serde_json::{json, Value};\n# async fn doc() -> Result<(), Box> {\nlet client = Elasticsearch::default();\nlet response = client\n .indices()\n .put_mapping(IndicesPutMappingParts::Index(&[\"test_index\"]))\n .body(json!({\n \"properties\" : {\n \"field1\" : { \"type\" : \"text\" }\n }\n }))\n .send()\n .await?;\n \n# Ok(())\n# }\n```"] pub fn put_mapping<'b>( &'a self, parts: IndicesPutMappingParts<'b>, ) -> IndicesPutMapping<'a, 'b, ()> { IndicesPutMapping::new(self.transport(), parts) } - #[doc = "[Indices Put Settings API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/indices-update-settings.html)\n\nUpdates the index settings."] + #[doc = "[Indices Put Settings API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/indices-update-settings.html)\n\nUpdates the index settings."] pub fn put_settings<'b>( &'a self, parts: IndicesPutSettingsParts<'b>, ) -> IndicesPutSettings<'a, 'b, ()> { IndicesPutSettings::new(self.transport(), parts) } - #[doc = "[Indices Put Template API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/indices-templates.html)\n\nCreates or updates an index template."] + #[doc = "[Indices Put Template API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/indices-templates.html)\n\nCreates or updates an index template."] pub fn put_template<'b>( &'a self, parts: IndicesPutTemplateParts<'b>, ) -> IndicesPutTemplate<'a, 'b, ()> { IndicesPutTemplate::new(self.transport(), parts) } - #[doc = "[Indices Recovery API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/indices-recovery.html)\n\nReturns information about ongoing index shard recoveries."] + #[doc = "[Indices Recovery API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/indices-recovery.html)\n\nReturns information about ongoing index shard recoveries."] pub fn recovery<'b>(&'a self, parts: IndicesRecoveryParts<'b>) -> IndicesRecovery<'a, 'b> { IndicesRecovery::new(self.transport(), parts) } - #[doc = "[Indices Refresh API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/indices-refresh.html)\n\nPerforms the refresh operation in one or more indices."] + #[doc = "[Indices Refresh API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/indices-refresh.html)\n\nPerforms the refresh operation in one or more indices."] pub fn refresh<'b>(&'a self, parts: IndicesRefreshParts<'b>) -> IndicesRefresh<'a, 'b, ()> { IndicesRefresh::new(self.transport(), parts) } - #[doc = "[Indices Reload Search Analyzers API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/indices-reload-analyzers.html)\n\nReloads an index's search analyzers and their resources."] + #[doc = "[Indices Reload Search Analyzers API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/indices-reload-analyzers.html)\n\nReloads an index's search analyzers and their resources."] pub fn reload_search_analyzers<'b>( &'a self, parts: IndicesReloadSearchAnalyzersParts<'b>, ) -> IndicesReloadSearchAnalyzers<'a, 'b, ()> { IndicesReloadSearchAnalyzers::new(self.transport(), parts) } - #[doc = "[Indices Rollover API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/indices-rollover-index.html)\n\nUpdates an alias to point to a new index when the existing index\nis considered to be too large or too old."] + #[doc = "[Indices Resolve Index API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/indices-resolve-index-api.html)\n\nReturns information about any matching indices, aliases, and data streams"] + #[doc = " \n# Optional, experimental\nThis requires the `experimental-apis` feature. Can have breaking changes in future\nversions or might even be removed entirely.\n "] + #[cfg(feature = "experimental-apis")] + pub fn resolve_index<'b>( + &'a self, + parts: IndicesResolveIndexParts<'b>, + ) -> IndicesResolveIndex<'a, 'b> { + IndicesResolveIndex::new(self.transport(), parts) + } + #[doc = "[Indices Rollover API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/indices-rollover-index.html)\n\nUpdates an alias to point to a new index when the existing index\nis considered to be too large or too old."] pub fn rollover<'b>(&'a self, parts: IndicesRolloverParts<'b>) -> IndicesRollover<'a, 'b, ()> { IndicesRollover::new(self.transport(), parts) } - #[doc = "[Indices Segments API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/indices-segments.html)\n\nProvides low-level information about segments in a Lucene index."] + #[doc = "[Indices Segments API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/indices-segments.html)\n\nProvides low-level information about segments in a Lucene index."] pub fn segments<'b>(&'a self, parts: IndicesSegmentsParts<'b>) -> IndicesSegments<'a, 'b> { IndicesSegments::new(self.transport(), parts) } - #[doc = "[Indices Shard Stores API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/indices-shards-stores.html)\n\nProvides store information for shard copies of indices."] + #[doc = "[Indices Shard Stores API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/indices-shards-stores.html)\n\nProvides store information for shard copies of indices."] pub fn shard_stores<'b>( &'a self, parts: IndicesShardStoresParts<'b>, ) -> IndicesShardStores<'a, 'b> { IndicesShardStores::new(self.transport(), parts) } - #[doc = "[Indices Shrink API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/indices-shrink-index.html)\n\nAllow to shrink an existing index into a new index with fewer primary shards."] + #[doc = "[Indices Shrink API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/indices-shrink-index.html)\n\nAllow to shrink an existing index into a new index with fewer primary shards."] pub fn shrink<'b>(&'a self, parts: IndicesShrinkParts<'b>) -> IndicesShrink<'a, 'b, ()> { IndicesShrink::new(self.transport(), parts) } - #[doc = "[Indices Split API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/indices-split-index.html)\n\nAllows you to split an existing index into a new index with more primary shards."] + #[doc = "[Indices Simulate Index Template API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/indices-templates.html)\n\nSimulate matching the given index name against the index templates in the system"] + pub fn simulate_index_template<'b>( + &'a self, + parts: IndicesSimulateIndexTemplateParts<'b>, + ) -> IndicesSimulateIndexTemplate<'a, 'b, ()> { + IndicesSimulateIndexTemplate::new(self.transport(), parts) + } + #[doc = "[Indices Simulate Template API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/indices-templates.html)\n\nSimulate resolving the given template name or body"] + pub fn simulate_template<'b>( + &'a self, + parts: IndicesSimulateTemplateParts<'b>, + ) -> IndicesSimulateTemplate<'a, 'b, ()> { + IndicesSimulateTemplate::new(self.transport(), parts) + } + #[doc = "[Indices Split API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/indices-split-index.html)\n\nAllows you to split an existing index into a new index with more primary shards."] pub fn split<'b>(&'a self, parts: IndicesSplitParts<'b>) -> IndicesSplit<'a, 'b, ()> { IndicesSplit::new(self.transport(), parts) } - #[doc = "[Indices Stats API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/indices-stats.html)\n\nProvides statistics on operations happening in an index."] + #[doc = "[Indices Stats API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/indices-stats.html)\n\nProvides statistics on operations happening in an index."] pub fn stats<'b>(&'a self, parts: IndicesStatsParts<'b>) -> IndicesStats<'a, 'b> { IndicesStats::new(self.transport(), parts) } - #[doc = "[Indices Unfreeze API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/unfreeze-index-api.html)\n\nUnfreezes an index. When a frozen index is unfrozen, the index goes through the normal recovery process and becomes writeable again."] + #[doc = "[Indices Unfreeze API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/unfreeze-index-api.html)\n\nUnfreezes an index. When a frozen index is unfrozen, the index goes through the normal recovery process and becomes writeable again."] pub fn unfreeze<'b>(&'a self, parts: IndicesUnfreezeParts<'b>) -> IndicesUnfreeze<'a, 'b, ()> { IndicesUnfreeze::new(self.transport(), parts) } - #[doc = "[Indices Update Aliases API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/indices-aliases.html)\n\nUpdates index aliases."] + #[doc = "[Indices Update Aliases API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/indices-aliases.html)\n\nUpdates index aliases."] pub fn update_aliases<'b>(&'a self) -> IndicesUpdateAliases<'a, 'b, ()> { IndicesUpdateAliases::new(self.transport()) } - #[doc = "[Indices Upgrade API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/indices-upgrade.html)\n\nThe _upgrade API is no longer useful and will be removed."] + #[doc = "[Indices Upgrade API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/indices-upgrade.html)\n\nDEPRECATED Upgrades to the current version of Lucene."] pub fn upgrade<'b>(&'a self, parts: IndicesUpgradeParts<'b>) -> IndicesUpgrade<'a, 'b, ()> { IndicesUpgrade::new(self.transport(), parts) } - #[doc = "[Indices Validate Query API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/search-validate.html)\n\nAllows a user to validate a potentially expensive query without executing it."] + #[doc = "[Indices Validate Query API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/search-validate.html)\n\nAllows a user to validate a potentially expensive query without executing it."] pub fn validate_query<'b>( &'a self, parts: IndicesValidateQueryParts<'b>, diff --git a/elasticsearch/src/ingest.rs b/elasticsearch/src/ingest.rs index 78782068..4823ca34 100644 --- a/elasticsearch/src/ingest.rs +++ b/elasticsearch/src/ingest.rs @@ -42,7 +42,8 @@ //! be conditionally executed, and failures within pipelines can be explicitly handled by defining //! processors to execute in the event of failure. -# ! [ allow ( unused_imports ) ]use crate::{ +#![allow(unused_imports)] +use crate::{ client::Elasticsearch, error::Error, http::{ @@ -77,8 +78,8 @@ impl<'b> IngestDeletePipelineParts<'b> { } } } +#[doc = "Builder for the [Ingest Delete Pipeline API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/delete-pipeline-api.html)\n\nDeletes a pipeline."] #[derive(Clone, Debug)] -#[doc = "Builder for the [Ingest Delete Pipeline API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/delete-pipeline-api.html)\n\nDeletes a pipeline."] pub struct IngestDeletePipeline<'a, 'b> { transport: &'a Transport, parts: IngestDeletePipelineParts<'b>, @@ -216,8 +217,8 @@ impl<'b> IngestGetPipelineParts<'b> { } } } +#[doc = "Builder for the [Ingest Get Pipeline API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/get-pipeline-api.html)\n\nReturns a pipeline."] #[derive(Clone, Debug)] -#[doc = "Builder for the [Ingest Get Pipeline API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/get-pipeline-api.html)\n\nReturns a pipeline."] pub struct IngestGetPipeline<'a, 'b> { transport: &'a Transport, parts: IngestGetPipelineParts<'b>, @@ -337,8 +338,8 @@ impl IngestProcessorGrokParts { } } } +#[doc = "Builder for the [Ingest Processor Grok API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/grok-processor.html#grok-processor-rest-get)\n\nReturns a list of the built-in patterns."] #[derive(Clone, Debug)] -#[doc = "Builder for the [Ingest Processor Grok API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/grok-processor.html#grok-processor-rest-get)\n\nReturns a list of the built-in patterns."] pub struct IngestProcessorGrok<'a, 'b> { transport: &'a Transport, parts: IngestProcessorGrokParts, @@ -455,8 +456,8 @@ impl<'b> IngestPutPipelineParts<'b> { } } } +#[doc = "Builder for the [Ingest Put Pipeline API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/put-pipeline-api.html)\n\nCreates or updates a pipeline."] #[derive(Clone, Debug)] -#[doc = "Builder for the [Ingest Put Pipeline API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/put-pipeline-api.html)\n\nCreates or updates a pipeline."] pub struct IngestPutPipeline<'a, 'b, B> { transport: &'a Transport, parts: IngestPutPipelineParts<'b>, @@ -620,8 +621,8 @@ impl<'b> IngestSimulateParts<'b> { } } } +#[doc = "Builder for the [Ingest Simulate API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/simulate-pipeline-api.html)\n\nAllows to simulate a pipeline with example documents."] #[derive(Clone, Debug)] -#[doc = "Builder for the [Ingest Simulate API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/simulate-pipeline-api.html)\n\nAllows to simulate a pipeline with example documents."] pub struct IngestSimulate<'a, 'b, B> { transport: &'a Transport, parts: IngestSimulateParts<'b>, @@ -766,32 +767,32 @@ impl<'a> Ingest<'a> { pub fn transport(&self) -> &Transport { self.transport } - #[doc = "[Ingest Delete Pipeline API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/delete-pipeline-api.html)\n\nDeletes a pipeline."] + #[doc = "[Ingest Delete Pipeline API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/delete-pipeline-api.html)\n\nDeletes a pipeline."] pub fn delete_pipeline<'b>( &'a self, parts: IngestDeletePipelineParts<'b>, ) -> IngestDeletePipeline<'a, 'b> { IngestDeletePipeline::new(self.transport(), parts) } - #[doc = "[Ingest Get Pipeline API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/get-pipeline-api.html)\n\nReturns a pipeline."] + #[doc = "[Ingest Get Pipeline API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/get-pipeline-api.html)\n\nReturns a pipeline."] pub fn get_pipeline<'b>( &'a self, parts: IngestGetPipelineParts<'b>, ) -> IngestGetPipeline<'a, 'b> { IngestGetPipeline::new(self.transport(), parts) } - #[doc = "[Ingest Processor Grok API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/grok-processor.html#grok-processor-rest-get)\n\nReturns a list of the built-in patterns."] + #[doc = "[Ingest Processor Grok API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/grok-processor.html#grok-processor-rest-get)\n\nReturns a list of the built-in patterns."] pub fn processor_grok<'b>(&'a self) -> IngestProcessorGrok<'a, 'b> { IngestProcessorGrok::new(self.transport()) } - #[doc = "[Ingest Put Pipeline API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/put-pipeline-api.html)\n\nCreates or updates a pipeline."] + #[doc = "[Ingest Put Pipeline API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/put-pipeline-api.html)\n\nCreates or updates a pipeline."] pub fn put_pipeline<'b>( &'a self, parts: IngestPutPipelineParts<'b>, ) -> IngestPutPipeline<'a, 'b, ()> { IngestPutPipeline::new(self.transport(), parts) } - #[doc = "[Ingest Simulate API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/simulate-pipeline-api.html)\n\nAllows to simulate a pipeline with example documents."] + #[doc = "[Ingest Simulate API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/simulate-pipeline-api.html)\n\nAllows to simulate a pipeline with example documents."] pub fn simulate<'b>(&'a self, parts: IngestSimulateParts<'b>) -> IngestSimulate<'a, 'b, ()> { IngestSimulate::new(self.transport(), parts) } diff --git a/elasticsearch/src/lib.rs b/elasticsearch/src/lib.rs index a181c28f..6f03ffd1 100644 --- a/elasticsearch/src/lib.rs +++ b/elasticsearch/src/lib.rs @@ -362,25 +362,32 @@ pub mod params; // Generated code - do not edit until the next GENERATED-END marker pub mod async_search; +pub mod autoscaling; pub mod cat; pub mod ccr; pub mod cluster; pub mod dangling_indices; pub mod enrich; +pub mod eql; pub mod graph; pub mod ilm; pub mod indices; pub mod ingest; pub mod license; +pub mod logstash; pub mod migration; pub mod ml; +pub mod monitoring; pub mod nodes; +pub mod rollup; +pub mod searchable_snapshots; pub mod security; pub mod slm; pub mod snapshot; pub mod sql; pub mod ssl; pub mod tasks; +pub mod text_structure; pub mod transform; pub mod watcher; pub mod xpack; diff --git a/elasticsearch/src/license.rs b/elasticsearch/src/license.rs index a1a88789..a55465e6 100644 --- a/elasticsearch/src/license.rs +++ b/elasticsearch/src/license.rs @@ -33,7 +33,8 @@ //! - Start indefinite use of the Basic license features //! - Get the status of trial and basic license features -# ! [ allow ( unused_imports ) ]use crate::{ +#![allow(unused_imports)] +use crate::{ client::Elasticsearch, error::Error, http::{ @@ -62,8 +63,8 @@ impl LicenseDeleteParts { } } } +#[doc = "Builder for the [License Delete API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/delete-license.html)\n\nDeletes licensing information for the cluster"] #[derive(Clone, Debug)] -#[doc = "Builder for the [License Delete API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/delete-license.html)\n\nDeletes licensing information for the cluster"] pub struct LicenseDelete<'a, 'b> { transport: &'a Transport, parts: LicenseDeleteParts, @@ -174,8 +175,8 @@ impl LicenseGetParts { } } } +#[doc = "Builder for the [License Get API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/get-license.html)\n\nRetrieves licensing information for the cluster"] #[derive(Clone, Debug)] -#[doc = "Builder for the [License Get API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/get-license.html)\n\nRetrieves licensing information for the cluster"] pub struct LicenseGet<'a, 'b> { transport: &'a Transport, parts: LicenseGetParts, @@ -304,8 +305,8 @@ impl LicenseGetBasicStatusParts { } } } +#[doc = "Builder for the [License Get Basic Status API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/get-basic-status.html)\n\nRetrieves information about the status of the basic license."] #[derive(Clone, Debug)] -#[doc = "Builder for the [License Get Basic Status API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/get-basic-status.html)\n\nRetrieves information about the status of the basic license."] pub struct LicenseGetBasicStatus<'a, 'b> { transport: &'a Transport, parts: LicenseGetBasicStatusParts, @@ -416,8 +417,8 @@ impl LicenseGetTrialStatusParts { } } } +#[doc = "Builder for the [License Get Trial Status API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/get-trial-status.html)\n\nRetrieves information about the status of the trial license."] #[derive(Clone, Debug)] -#[doc = "Builder for the [License Get Trial Status API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/get-trial-status.html)\n\nRetrieves information about the status of the trial license."] pub struct LicenseGetTrialStatus<'a, 'b> { transport: &'a Transport, parts: LicenseGetTrialStatusParts, @@ -528,8 +529,8 @@ impl LicensePostParts { } } } +#[doc = "Builder for the [License Post API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/update-license.html)\n\nUpdates the license for the cluster."] #[derive(Clone, Debug)] -#[doc = "Builder for the [License Post API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/update-license.html)\n\nUpdates the license for the cluster."] pub struct LicensePost<'a, 'b, B> { transport: &'a Transport, parts: LicensePostParts, @@ -673,8 +674,8 @@ impl LicensePostStartBasicParts { } } } +#[doc = "Builder for the [License Post Start Basic API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/start-basic.html)\n\nStarts an indefinite basic license."] #[derive(Clone, Debug)] -#[doc = "Builder for the [License Post Start Basic API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/start-basic.html)\n\nStarts an indefinite basic license."] pub struct LicensePostStartBasic<'a, 'b, B> { transport: &'a Transport, parts: LicensePostStartBasicParts, @@ -818,8 +819,8 @@ impl LicensePostStartTrialParts { } } } +#[doc = "Builder for the [License Post Start Trial API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/start-trial.html)\n\nstarts a limited time trial license."] #[derive(Clone, Debug)] -#[doc = "Builder for the [License Post Start Trial API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/start-trial.html)\n\nstarts a limited time trial license."] pub struct LicensePostStartTrial<'a, 'b, B> { transport: &'a Transport, parts: LicensePostStartTrialParts, @@ -972,31 +973,31 @@ impl<'a> License<'a> { pub fn transport(&self) -> &Transport { self.transport } - #[doc = "[License Delete API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/delete-license.html)\n\nDeletes licensing information for the cluster"] + #[doc = "[License Delete API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/delete-license.html)\n\nDeletes licensing information for the cluster"] pub fn delete<'b>(&'a self) -> LicenseDelete<'a, 'b> { LicenseDelete::new(self.transport()) } - #[doc = "[License Get API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/get-license.html)\n\nRetrieves licensing information for the cluster"] + #[doc = "[License Get API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/get-license.html)\n\nRetrieves licensing information for the cluster"] pub fn get<'b>(&'a self) -> LicenseGet<'a, 'b> { LicenseGet::new(self.transport()) } - #[doc = "[License Get Basic Status API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/get-basic-status.html)\n\nRetrieves information about the status of the basic license."] + #[doc = "[License Get Basic Status API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/get-basic-status.html)\n\nRetrieves information about the status of the basic license."] pub fn get_basic_status<'b>(&'a self) -> LicenseGetBasicStatus<'a, 'b> { LicenseGetBasicStatus::new(self.transport()) } - #[doc = "[License Get Trial Status API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/get-trial-status.html)\n\nRetrieves information about the status of the trial license."] + #[doc = "[License Get Trial Status API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/get-trial-status.html)\n\nRetrieves information about the status of the trial license."] pub fn get_trial_status<'b>(&'a self) -> LicenseGetTrialStatus<'a, 'b> { LicenseGetTrialStatus::new(self.transport()) } - #[doc = "[License Post API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/update-license.html)\n\nUpdates the license for the cluster."] + #[doc = "[License Post API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/update-license.html)\n\nUpdates the license for the cluster."] pub fn post<'b>(&'a self) -> LicensePost<'a, 'b, ()> { LicensePost::new(self.transport()) } - #[doc = "[License Post Start Basic API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/start-basic.html)\n\nStarts an indefinite basic license."] + #[doc = "[License Post Start Basic API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/start-basic.html)\n\nStarts an indefinite basic license."] pub fn post_start_basic<'b>(&'a self) -> LicensePostStartBasic<'a, 'b, ()> { LicensePostStartBasic::new(self.transport()) } - #[doc = "[License Post Start Trial API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/start-trial.html)\n\nstarts a limited time trial license."] + #[doc = "[License Post Start Trial API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/start-trial.html)\n\nstarts a limited time trial license."] pub fn post_start_trial<'b>(&'a self) -> LicensePostStartTrial<'a, 'b, ()> { LicensePostStartTrial::new(self.transport()) } diff --git a/elasticsearch/src/logstash.rs b/elasticsearch/src/logstash.rs new file mode 100644 index 00000000..de45d945 --- /dev/null +++ b/elasticsearch/src/logstash.rs @@ -0,0 +1,464 @@ +/* + * Licensed to Elasticsearch B.V. under one or more contributor + * license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright + * ownership. Elasticsearch B.V. licenses this file to you under + * the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +// ----------------------------------------------- +// This file is generated, Please do not edit it manually. +// Run the following in the root of the repo to regenerate: +// +// cargo make generate-api +// ----------------------------------------------- + +//! Logstash APIs +//! +//! The [Logstash APIs](https://www.elastic.co/guide/en/elasticsearch/reference/master/logstash-apis.html) are used to +//! manage pipelines used by Logstash Central Management. + +#![allow(unused_imports)] +use crate::{ + client::Elasticsearch, + error::Error, + http::{ + headers::{HeaderMap, HeaderName, HeaderValue, ACCEPT, CONTENT_TYPE}, + request::{Body, JsonBody, NdBody, PARTS_ENCODED}, + response::Response, + transport::Transport, + Method, + }, + params::*, +}; +use percent_encoding::percent_encode; +use serde::Serialize; +use std::{borrow::Cow, time::Duration}; +#[derive(Debug, Clone, PartialEq)] +#[doc = "API parts for the Logstash Delete Pipeline API"] +pub enum LogstashDeletePipelineParts<'b> { + #[doc = "Id"] + Id(&'b str), +} +impl<'b> LogstashDeletePipelineParts<'b> { + #[doc = "Builds a relative URL path to the Logstash Delete Pipeline API"] + pub fn url(self) -> Cow<'static, str> { + match self { + LogstashDeletePipelineParts::Id(ref id) => { + let encoded_id: Cow = percent_encode(id.as_bytes(), PARTS_ENCODED).into(); + let mut p = String::with_capacity(20usize + encoded_id.len()); + p.push_str("/_logstash/pipeline/"); + p.push_str(encoded_id.as_ref()); + p.into() + } + } + } +} +#[doc = "Builder for the [Logstash Delete Pipeline API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/logstash-api-delete-pipeline.html)\n\nDeletes Logstash Pipelines used by Central Management"] +#[derive(Clone, Debug)] +pub struct LogstashDeletePipeline<'a, 'b> { + transport: &'a Transport, + parts: LogstashDeletePipelineParts<'b>, + error_trace: Option, + filter_path: Option<&'b [&'b str]>, + headers: HeaderMap, + human: Option, + pretty: Option, + request_timeout: Option, + source: Option<&'b str>, +} +impl<'a, 'b> LogstashDeletePipeline<'a, 'b> { + #[doc = "Creates a new instance of [LogstashDeletePipeline] with the specified API parts"] + pub fn new(transport: &'a Transport, parts: LogstashDeletePipelineParts<'b>) -> Self { + let headers = HeaderMap::new(); + LogstashDeletePipeline { + transport, + parts, + headers, + error_trace: None, + filter_path: None, + human: None, + pretty: None, + request_timeout: None, + source: None, + } + } + #[doc = "Include the stack trace of returned errors."] + pub fn error_trace(mut self, error_trace: bool) -> Self { + self.error_trace = Some(error_trace); + self + } + #[doc = "A comma-separated list of filters used to reduce the response."] + pub fn filter_path(mut self, filter_path: &'b [&'b str]) -> Self { + self.filter_path = Some(filter_path); + self + } + #[doc = "Adds a HTTP header"] + pub fn header(mut self, key: HeaderName, value: HeaderValue) -> Self { + self.headers.insert(key, value); + self + } + #[doc = "Return human readable values for statistics."] + pub fn human(mut self, human: bool) -> Self { + self.human = Some(human); + self + } + #[doc = "Pretty format the returned JSON response."] + pub fn pretty(mut self, pretty: bool) -> Self { + self.pretty = Some(pretty); + self + } + #[doc = "Sets a request timeout for this API call.\n\nThe timeout is applied from when the request starts connecting until the response body has finished."] + pub fn request_timeout(mut self, timeout: Duration) -> Self { + self.request_timeout = Some(timeout); + self + } + #[doc = "The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests."] + pub fn source(mut self, source: &'b str) -> Self { + self.source = Some(source); + self + } + #[doc = "Creates an asynchronous call to the Logstash Delete Pipeline API that can be awaited"] + pub async fn send(self) -> Result { + let path = self.parts.url(); + let method = Method::Delete; + let headers = self.headers; + let timeout = self.request_timeout; + let query_string = { + #[serde_with::skip_serializing_none] + #[derive(Serialize)] + struct QueryParams<'b> { + error_trace: Option, + #[serde(serialize_with = "crate::client::serialize_coll_qs")] + filter_path: Option<&'b [&'b str]>, + human: Option, + pretty: Option, + source: Option<&'b str>, + } + let query_params = QueryParams { + error_trace: self.error_trace, + filter_path: self.filter_path, + human: self.human, + pretty: self.pretty, + source: self.source, + }; + Some(query_params) + }; + let body = Option::<()>::None; + let response = self + .transport + .send(method, &path, headers, query_string.as_ref(), body, timeout) + .await?; + Ok(response) + } +} +#[derive(Debug, Clone, PartialEq)] +#[doc = "API parts for the Logstash Get Pipeline API"] +pub enum LogstashGetPipelineParts<'b> { + #[doc = "Id"] + Id(&'b str), +} +impl<'b> LogstashGetPipelineParts<'b> { + #[doc = "Builds a relative URL path to the Logstash Get Pipeline API"] + pub fn url(self) -> Cow<'static, str> { + match self { + LogstashGetPipelineParts::Id(ref id) => { + let encoded_id: Cow = percent_encode(id.as_bytes(), PARTS_ENCODED).into(); + let mut p = String::with_capacity(20usize + encoded_id.len()); + p.push_str("/_logstash/pipeline/"); + p.push_str(encoded_id.as_ref()); + p.into() + } + } + } +} +#[doc = "Builder for the [Logstash Get Pipeline API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/logstash-api-get-pipeline.html)\n\nRetrieves Logstash Pipelines used by Central Management"] +#[derive(Clone, Debug)] +pub struct LogstashGetPipeline<'a, 'b> { + transport: &'a Transport, + parts: LogstashGetPipelineParts<'b>, + error_trace: Option, + filter_path: Option<&'b [&'b str]>, + headers: HeaderMap, + human: Option, + pretty: Option, + request_timeout: Option, + source: Option<&'b str>, +} +impl<'a, 'b> LogstashGetPipeline<'a, 'b> { + #[doc = "Creates a new instance of [LogstashGetPipeline] with the specified API parts"] + pub fn new(transport: &'a Transport, parts: LogstashGetPipelineParts<'b>) -> Self { + let headers = HeaderMap::new(); + LogstashGetPipeline { + transport, + parts, + headers, + error_trace: None, + filter_path: None, + human: None, + pretty: None, + request_timeout: None, + source: None, + } + } + #[doc = "Include the stack trace of returned errors."] + pub fn error_trace(mut self, error_trace: bool) -> Self { + self.error_trace = Some(error_trace); + self + } + #[doc = "A comma-separated list of filters used to reduce the response."] + pub fn filter_path(mut self, filter_path: &'b [&'b str]) -> Self { + self.filter_path = Some(filter_path); + self + } + #[doc = "Adds a HTTP header"] + pub fn header(mut self, key: HeaderName, value: HeaderValue) -> Self { + self.headers.insert(key, value); + self + } + #[doc = "Return human readable values for statistics."] + pub fn human(mut self, human: bool) -> Self { + self.human = Some(human); + self + } + #[doc = "Pretty format the returned JSON response."] + pub fn pretty(mut self, pretty: bool) -> Self { + self.pretty = Some(pretty); + self + } + #[doc = "Sets a request timeout for this API call.\n\nThe timeout is applied from when the request starts connecting until the response body has finished."] + pub fn request_timeout(mut self, timeout: Duration) -> Self { + self.request_timeout = Some(timeout); + self + } + #[doc = "The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests."] + pub fn source(mut self, source: &'b str) -> Self { + self.source = Some(source); + self + } + #[doc = "Creates an asynchronous call to the Logstash Get Pipeline API that can be awaited"] + pub async fn send(self) -> Result { + let path = self.parts.url(); + let method = Method::Get; + let headers = self.headers; + let timeout = self.request_timeout; + let query_string = { + #[serde_with::skip_serializing_none] + #[derive(Serialize)] + struct QueryParams<'b> { + error_trace: Option, + #[serde(serialize_with = "crate::client::serialize_coll_qs")] + filter_path: Option<&'b [&'b str]>, + human: Option, + pretty: Option, + source: Option<&'b str>, + } + let query_params = QueryParams { + error_trace: self.error_trace, + filter_path: self.filter_path, + human: self.human, + pretty: self.pretty, + source: self.source, + }; + Some(query_params) + }; + let body = Option::<()>::None; + let response = self + .transport + .send(method, &path, headers, query_string.as_ref(), body, timeout) + .await?; + Ok(response) + } +} +#[derive(Debug, Clone, PartialEq)] +#[doc = "API parts for the Logstash Put Pipeline API"] +pub enum LogstashPutPipelineParts<'b> { + #[doc = "Id"] + Id(&'b str), +} +impl<'b> LogstashPutPipelineParts<'b> { + #[doc = "Builds a relative URL path to the Logstash Put Pipeline API"] + pub fn url(self) -> Cow<'static, str> { + match self { + LogstashPutPipelineParts::Id(ref id) => { + let encoded_id: Cow = percent_encode(id.as_bytes(), PARTS_ENCODED).into(); + let mut p = String::with_capacity(20usize + encoded_id.len()); + p.push_str("/_logstash/pipeline/"); + p.push_str(encoded_id.as_ref()); + p.into() + } + } + } +} +#[doc = "Builder for the [Logstash Put Pipeline API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/logstash-api-put-pipeline.html)\n\nAdds and updates Logstash Pipelines used for Central Management"] +#[derive(Clone, Debug)] +pub struct LogstashPutPipeline<'a, 'b, B> { + transport: &'a Transport, + parts: LogstashPutPipelineParts<'b>, + body: Option, + error_trace: Option, + filter_path: Option<&'b [&'b str]>, + headers: HeaderMap, + human: Option, + pretty: Option, + request_timeout: Option, + source: Option<&'b str>, +} +impl<'a, 'b, B> LogstashPutPipeline<'a, 'b, B> +where + B: Body, +{ + #[doc = "Creates a new instance of [LogstashPutPipeline] with the specified API parts"] + pub fn new(transport: &'a Transport, parts: LogstashPutPipelineParts<'b>) -> Self { + let headers = HeaderMap::new(); + LogstashPutPipeline { + transport, + parts, + headers, + body: None, + error_trace: None, + filter_path: None, + human: None, + pretty: None, + request_timeout: None, + source: None, + } + } + #[doc = "The body for the API call"] + pub fn body(self, body: T) -> LogstashPutPipeline<'a, 'b, JsonBody> + where + T: Serialize, + { + LogstashPutPipeline { + transport: self.transport, + parts: self.parts, + body: Some(body.into()), + error_trace: self.error_trace, + filter_path: self.filter_path, + headers: self.headers, + human: self.human, + pretty: self.pretty, + request_timeout: self.request_timeout, + source: self.source, + } + } + #[doc = "Include the stack trace of returned errors."] + pub fn error_trace(mut self, error_trace: bool) -> Self { + self.error_trace = Some(error_trace); + self + } + #[doc = "A comma-separated list of filters used to reduce the response."] + pub fn filter_path(mut self, filter_path: &'b [&'b str]) -> Self { + self.filter_path = Some(filter_path); + self + } + #[doc = "Adds a HTTP header"] + pub fn header(mut self, key: HeaderName, value: HeaderValue) -> Self { + self.headers.insert(key, value); + self + } + #[doc = "Return human readable values for statistics."] + pub fn human(mut self, human: bool) -> Self { + self.human = Some(human); + self + } + #[doc = "Pretty format the returned JSON response."] + pub fn pretty(mut self, pretty: bool) -> Self { + self.pretty = Some(pretty); + self + } + #[doc = "Sets a request timeout for this API call.\n\nThe timeout is applied from when the request starts connecting until the response body has finished."] + pub fn request_timeout(mut self, timeout: Duration) -> Self { + self.request_timeout = Some(timeout); + self + } + #[doc = "The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests."] + pub fn source(mut self, source: &'b str) -> Self { + self.source = Some(source); + self + } + #[doc = "Creates an asynchronous call to the Logstash Put Pipeline API that can be awaited"] + pub async fn send(self) -> Result { + let path = self.parts.url(); + let method = Method::Put; + let headers = self.headers; + let timeout = self.request_timeout; + let query_string = { + #[serde_with::skip_serializing_none] + #[derive(Serialize)] + struct QueryParams<'b> { + error_trace: Option, + #[serde(serialize_with = "crate::client::serialize_coll_qs")] + filter_path: Option<&'b [&'b str]>, + human: Option, + pretty: Option, + source: Option<&'b str>, + } + let query_params = QueryParams { + error_trace: self.error_trace, + filter_path: self.filter_path, + human: self.human, + pretty: self.pretty, + source: self.source, + }; + Some(query_params) + }; + let body = self.body; + let response = self + .transport + .send(method, &path, headers, query_string.as_ref(), body, timeout) + .await?; + Ok(response) + } +} +#[doc = "Namespace client for Logstash APIs"] +pub struct Logstash<'a> { + transport: &'a Transport, +} +impl<'a> Logstash<'a> { + #[doc = "Creates a new instance of [Logstash]"] + pub fn new(transport: &'a Transport) -> Self { + Self { transport } + } + pub fn transport(&self) -> &Transport { + self.transport + } + #[doc = "[Logstash Delete Pipeline API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/logstash-api-delete-pipeline.html)\n\nDeletes Logstash Pipelines used by Central Management"] + pub fn delete_pipeline<'b>( + &'a self, + parts: LogstashDeletePipelineParts<'b>, + ) -> LogstashDeletePipeline<'a, 'b> { + LogstashDeletePipeline::new(self.transport(), parts) + } + #[doc = "[Logstash Get Pipeline API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/logstash-api-get-pipeline.html)\n\nRetrieves Logstash Pipelines used by Central Management"] + pub fn get_pipeline<'b>( + &'a self, + parts: LogstashGetPipelineParts<'b>, + ) -> LogstashGetPipeline<'a, 'b> { + LogstashGetPipeline::new(self.transport(), parts) + } + #[doc = "[Logstash Put Pipeline API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/logstash-api-put-pipeline.html)\n\nAdds and updates Logstash Pipelines used for Central Management"] + pub fn put_pipeline<'b>( + &'a self, + parts: LogstashPutPipelineParts<'b>, + ) -> LogstashPutPipeline<'a, 'b, ()> { + LogstashPutPipeline::new(self.transport(), parts) + } +} +impl Elasticsearch { + #[doc = "Creates a namespace client for Logstash APIs"] + pub fn logstash(&self) -> Logstash { + Logstash::new(self.transport()) + } +} diff --git a/elasticsearch/src/migration.rs b/elasticsearch/src/migration.rs index 5143ca3a..104d775a 100644 --- a/elasticsearch/src/migration.rs +++ b/elasticsearch/src/migration.rs @@ -28,7 +28,8 @@ //! //! [Simplify upgrading X-Pack indices from one version to another](https://www.elastic.co/guide/en/elasticsearch/reference/master/migration-api.html). -# ! [ allow ( unused_imports ) ]use crate::{ +#![allow(unused_imports)] +use crate::{ client::Elasticsearch, error::Error, http::{ @@ -68,8 +69,8 @@ impl<'b> MigrationDeprecationsParts<'b> { } } } +#[doc = "Builder for the [Migration Deprecations API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/migration-api-deprecation.html)\n\nRetrieves information about different cluster, node, and index level settings that use deprecated features that will be removed or changed in the next major version."] #[derive(Clone, Debug)] -#[doc = "Builder for the [Migration Deprecations API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/migration-api-deprecation.html)\n\nRetrieves information about different cluster, node, and index level settings that use deprecated features that will be removed or changed in the next major version."] pub struct MigrationDeprecations<'a, 'b> { transport: &'a Transport, parts: MigrationDeprecationsParts<'b>, @@ -178,7 +179,7 @@ impl<'a> Migration<'a> { pub fn transport(&self) -> &Transport { self.transport } - #[doc = "[Migration Deprecations API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/migration-api-deprecation.html)\n\nRetrieves information about different cluster, node, and index level settings that use deprecated features that will be removed or changed in the next major version."] + #[doc = "[Migration Deprecations API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/migration-api-deprecation.html)\n\nRetrieves information about different cluster, node, and index level settings that use deprecated features that will be removed or changed in the next major version."] pub fn deprecations<'b>( &'a self, parts: MigrationDeprecationsParts<'b>, diff --git a/elasticsearch/src/ml.rs b/elasticsearch/src/ml.rs index 3efbb4db..150ba5dd 100644 --- a/elasticsearch/src/ml.rs +++ b/elasticsearch/src/ml.rs @@ -28,7 +28,8 @@ //! //! [Perform machine learning anomaly detection activities](https://www.elastic.co/guide/en/elasticsearch/reference/master/ml-apis.html). -# ! [ allow ( unused_imports ) ]use crate::{ +#![allow(unused_imports)] +use crate::{ client::Elasticsearch, error::Error, http::{ @@ -65,8 +66,8 @@ impl<'b> MlCloseJobParts<'b> { } } } +#[doc = "Builder for the [Ml Close Job API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/ml-close-job.html)\n\nCloses one or more anomaly detection jobs. A job can be opened and closed multiple times throughout its lifecycle."] #[derive(Clone, Debug)] -#[doc = "Builder for the [Ml Close Job API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/ml-close-job.html)\n\nCloses one or more anomaly detection jobs. A job can be opened and closed multiple times throughout its lifecycle."] pub struct MlCloseJob<'a, 'b, B> { transport: &'a Transport, parts: MlCloseJobParts<'b>, @@ -247,8 +248,8 @@ impl<'b> MlDeleteCalendarParts<'b> { } } } +#[doc = "Builder for the [Ml Delete Calendar API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/ml-delete-calendar.html)\n\nDeletes a calendar."] #[derive(Clone, Debug)] -#[doc = "Builder for the [Ml Delete Calendar API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/ml-delete-calendar.html)\n\nDeletes a calendar."] pub struct MlDeleteCalendar<'a, 'b> { transport: &'a Transport, parts: MlDeleteCalendarParts<'b>, @@ -372,8 +373,8 @@ impl<'b> MlDeleteCalendarEventParts<'b> { } } } +#[doc = "Builder for the [Ml Delete Calendar Event API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/ml-delete-calendar-event.html)\n\nDeletes scheduled events from a calendar."] #[derive(Clone, Debug)] -#[doc = "Builder for the [Ml Delete Calendar Event API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/ml-delete-calendar-event.html)\n\nDeletes scheduled events from a calendar."] pub struct MlDeleteCalendarEvent<'a, 'b> { transport: &'a Transport, parts: MlDeleteCalendarEventParts<'b>, @@ -497,8 +498,8 @@ impl<'b> MlDeleteCalendarJobParts<'b> { } } } +#[doc = "Builder for the [Ml Delete Calendar Job API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/ml-delete-calendar-job.html)\n\nDeletes anomaly detection jobs from a calendar."] #[derive(Clone, Debug)] -#[doc = "Builder for the [Ml Delete Calendar Job API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/ml-delete-calendar-job.html)\n\nDeletes anomaly detection jobs from a calendar."] pub struct MlDeleteCalendarJob<'a, 'b> { transport: &'a Transport, parts: MlDeleteCalendarJobParts<'b>, @@ -595,6 +596,147 @@ impl<'a, 'b> MlDeleteCalendarJob<'a, 'b> { Ok(response) } } +#[cfg(feature = "beta-apis")] +#[derive(Debug, Clone, PartialEq)] +#[doc = "API parts for the Ml Delete Data Frame Analytics API"] +pub enum MlDeleteDataFrameAnalyticsParts<'b> { + #[doc = "Id"] + Id(&'b str), +} +#[cfg(feature = "beta-apis")] +impl<'b> MlDeleteDataFrameAnalyticsParts<'b> { + #[doc = "Builds a relative URL path to the Ml Delete Data Frame Analytics API"] + pub fn url(self) -> Cow<'static, str> { + match self { + MlDeleteDataFrameAnalyticsParts::Id(ref id) => { + let encoded_id: Cow = percent_encode(id.as_bytes(), PARTS_ENCODED).into(); + let mut p = String::with_capacity(26usize + encoded_id.len()); + p.push_str("/_ml/data_frame/analytics/"); + p.push_str(encoded_id.as_ref()); + p.into() + } + } + } +} +#[doc = "Builder for the [Ml Delete Data Frame Analytics API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/delete-dfanalytics.html)\n\nDeletes an existing data frame analytics job."] +#[doc = " \n# Optional, beta\nThis requires the `beta-apis` feature. On track to become stable but breaking changes can\nhappen in minor versions.\n "] +#[cfg(feature = "beta-apis")] +#[derive(Clone, Debug)] +pub struct MlDeleteDataFrameAnalytics<'a, 'b> { + transport: &'a Transport, + parts: MlDeleteDataFrameAnalyticsParts<'b>, + error_trace: Option, + filter_path: Option<&'b [&'b str]>, + force: Option, + headers: HeaderMap, + human: Option, + pretty: Option, + request_timeout: Option, + source: Option<&'b str>, + timeout: Option<&'b str>, +} +#[cfg(feature = "beta-apis")] +impl<'a, 'b> MlDeleteDataFrameAnalytics<'a, 'b> { + #[doc = "Creates a new instance of [MlDeleteDataFrameAnalytics] with the specified API parts"] + pub fn new(transport: &'a Transport, parts: MlDeleteDataFrameAnalyticsParts<'b>) -> Self { + let headers = HeaderMap::new(); + MlDeleteDataFrameAnalytics { + transport, + parts, + headers, + error_trace: None, + filter_path: None, + force: None, + human: None, + pretty: None, + request_timeout: None, + source: None, + timeout: None, + } + } + #[doc = "Include the stack trace of returned errors."] + pub fn error_trace(mut self, error_trace: bool) -> Self { + self.error_trace = Some(error_trace); + self + } + #[doc = "A comma-separated list of filters used to reduce the response."] + pub fn filter_path(mut self, filter_path: &'b [&'b str]) -> Self { + self.filter_path = Some(filter_path); + self + } + #[doc = "True if the job should be forcefully deleted"] + pub fn force(mut self, force: bool) -> Self { + self.force = Some(force); + self + } + #[doc = "Adds a HTTP header"] + pub fn header(mut self, key: HeaderName, value: HeaderValue) -> Self { + self.headers.insert(key, value); + self + } + #[doc = "Return human readable values for statistics."] + pub fn human(mut self, human: bool) -> Self { + self.human = Some(human); + self + } + #[doc = "Pretty format the returned JSON response."] + pub fn pretty(mut self, pretty: bool) -> Self { + self.pretty = Some(pretty); + self + } + #[doc = "Sets a request timeout for this API call.\n\nThe timeout is applied from when the request starts connecting until the response body has finished."] + pub fn request_timeout(mut self, timeout: Duration) -> Self { + self.request_timeout = Some(timeout); + self + } + #[doc = "The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests."] + pub fn source(mut self, source: &'b str) -> Self { + self.source = Some(source); + self + } + #[doc = "Controls the time to wait until a job is deleted. Defaults to 1 minute"] + pub fn timeout(mut self, timeout: &'b str) -> Self { + self.timeout = Some(timeout); + self + } + #[doc = "Creates an asynchronous call to the Ml Delete Data Frame Analytics API that can be awaited"] + pub async fn send(self) -> Result { + let path = self.parts.url(); + let method = Method::Delete; + let headers = self.headers; + let timeout = self.request_timeout; + let query_string = { + #[serde_with::skip_serializing_none] + #[derive(Serialize)] + struct QueryParams<'b> { + error_trace: Option, + #[serde(serialize_with = "crate::client::serialize_coll_qs")] + filter_path: Option<&'b [&'b str]>, + force: Option, + human: Option, + pretty: Option, + source: Option<&'b str>, + timeout: Option<&'b str>, + } + let query_params = QueryParams { + error_trace: self.error_trace, + filter_path: self.filter_path, + force: self.force, + human: self.human, + pretty: self.pretty, + source: self.source, + timeout: self.timeout, + }; + Some(query_params) + }; + let body = Option::<()>::None; + let response = self + .transport + .send(method, &path, headers, query_string.as_ref(), body, timeout) + .await?; + Ok(response) + } +} #[derive(Debug, Clone, PartialEq)] #[doc = "API parts for the Ml Delete Datafeed API"] pub enum MlDeleteDatafeedParts<'b> { @@ -616,8 +758,8 @@ impl<'b> MlDeleteDatafeedParts<'b> { } } } +#[doc = "Builder for the [Ml Delete Datafeed API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/ml-delete-datafeed.html)\n\nDeletes an existing datafeed."] #[derive(Clone, Debug)] -#[doc = "Builder for the [Ml Delete Datafeed API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/ml-delete-datafeed.html)\n\nDeletes an existing datafeed."] pub struct MlDeleteDatafeed<'a, 'b> { transport: &'a Transport, parts: MlDeleteDatafeedParts<'b>, @@ -747,8 +889,8 @@ impl<'b> MlDeleteExpiredDataParts<'b> { } } } +#[doc = "Builder for the [Ml Delete Expired Data API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/ml-delete-expired-data.html)\n\nDeletes expired and unused machine learning data."] #[derive(Clone, Debug)] -#[doc = "Builder for the [Ml Delete Expired Data API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/ml-delete-expired-data.html)\n\nDeletes expired and unused machine learning data."] pub struct MlDeleteExpiredData<'a, 'b, B> { transport: &'a Transport, parts: MlDeleteExpiredDataParts<'b>, @@ -909,8 +1051,8 @@ impl<'b> MlDeleteFilterParts<'b> { } } } +#[doc = "Builder for the [Ml Delete Filter API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/ml-delete-filter.html)\n\nDeletes a filter."] #[derive(Clone, Debug)] -#[doc = "Builder for the [Ml Delete Filter API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/ml-delete-filter.html)\n\nDeletes a filter."] pub struct MlDeleteFilter<'a, 'b> { transport: &'a Transport, parts: MlDeleteFilterParts<'b>, @@ -1045,8 +1187,8 @@ impl<'b> MlDeleteForecastParts<'b> { } } } +#[doc = "Builder for the [Ml Delete Forecast API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/ml-delete-forecast.html)\n\nDeletes forecasts from a machine learning job."] #[derive(Clone, Debug)] -#[doc = "Builder for the [Ml Delete Forecast API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/ml-delete-forecast.html)\n\nDeletes forecasts from a machine learning job."] pub struct MlDeleteForecast<'a, 'b> { transport: &'a Transport, parts: MlDeleteForecastParts<'b>, @@ -1182,8 +1324,8 @@ impl<'b> MlDeleteJobParts<'b> { } } } +#[doc = "Builder for the [Ml Delete Job API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/ml-delete-job.html)\n\nDeletes an existing anomaly detection job."] #[derive(Clone, Debug)] -#[doc = "Builder for the [Ml Delete Job API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/ml-delete-job.html)\n\nDeletes an existing anomaly detection job."] pub struct MlDeleteJob<'a, 'b> { transport: &'a Transport, parts: MlDeleteJobParts<'b>, @@ -1325,8 +1467,8 @@ impl<'b> MlDeleteModelSnapshotParts<'b> { } } } +#[doc = "Builder for the [Ml Delete Model Snapshot API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/ml-delete-snapshot.html)\n\nDeletes an existing model snapshot."] #[derive(Clone, Debug)] -#[doc = "Builder for the [Ml Delete Model Snapshot API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/ml-delete-snapshot.html)\n\nDeletes an existing model snapshot."] pub struct MlDeleteModelSnapshot<'a, 'b> { transport: &'a Transport, parts: MlDeleteModelSnapshotParts<'b>, @@ -1423,28 +1565,36 @@ impl<'a, 'b> MlDeleteModelSnapshot<'a, 'b> { Ok(response) } } +#[cfg(feature = "beta-apis")] #[derive(Debug, Clone, PartialEq)] -#[doc = "API parts for the Ml Estimate Model Memory API"] -pub enum MlEstimateModelMemoryParts { - #[doc = "No parts"] - None, -} -impl MlEstimateModelMemoryParts { - #[doc = "Builds a relative URL path to the Ml Estimate Model Memory API"] +#[doc = "API parts for the Ml Delete Trained Model API"] +pub enum MlDeleteTrainedModelParts<'b> { + #[doc = "ModelId"] + ModelId(&'b str), +} +#[cfg(feature = "beta-apis")] +impl<'b> MlDeleteTrainedModelParts<'b> { + #[doc = "Builds a relative URL path to the Ml Delete Trained Model API"] pub fn url(self) -> Cow<'static, str> { match self { - MlEstimateModelMemoryParts::None => { - "/_ml/anomaly_detectors/_estimate_model_memory".into() + MlDeleteTrainedModelParts::ModelId(ref model_id) => { + let encoded_model_id: Cow = + percent_encode(model_id.as_bytes(), PARTS_ENCODED).into(); + let mut p = String::with_capacity(20usize + encoded_model_id.len()); + p.push_str("/_ml/trained_models/"); + p.push_str(encoded_model_id.as_ref()); + p.into() } } } } +#[doc = "Builder for the [Ml Delete Trained Model API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/delete-trained-models.html)\n\nDeletes an existing trained inference model that is currently not referenced by an ingest pipeline."] +#[doc = " \n# Optional, beta\nThis requires the `beta-apis` feature. On track to become stable but breaking changes can\nhappen in minor versions.\n "] +#[cfg(feature = "beta-apis")] #[derive(Clone, Debug)] -#[doc = "Builder for the [Ml Estimate Model Memory API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/ml-apis.html)\n\nEstimates the model memory"] -pub struct MlEstimateModelMemory<'a, 'b, B> { +pub struct MlDeleteTrainedModel<'a, 'b> { transport: &'a Transport, - parts: MlEstimateModelMemoryParts, - body: Option, + parts: MlDeleteTrainedModelParts<'b>, error_trace: Option, filter_path: Option<&'b [&'b str]>, headers: HeaderMap, @@ -1453,18 +1603,15 @@ pub struct MlEstimateModelMemory<'a, 'b, B> { request_timeout: Option, source: Option<&'b str>, } -impl<'a, 'b, B> MlEstimateModelMemory<'a, 'b, B> -where - B: Body, -{ - #[doc = "Creates a new instance of [MlEstimateModelMemory]"] - pub fn new(transport: &'a Transport) -> Self { +#[cfg(feature = "beta-apis")] +impl<'a, 'b> MlDeleteTrainedModel<'a, 'b> { + #[doc = "Creates a new instance of [MlDeleteTrainedModel] with the specified API parts"] + pub fn new(transport: &'a Transport, parts: MlDeleteTrainedModelParts<'b>) -> Self { let headers = HeaderMap::new(); - MlEstimateModelMemory { + MlDeleteTrainedModel { transport, - parts: MlEstimateModelMemoryParts::None, + parts, headers, - body: None, error_trace: None, filter_path: None, human: None, @@ -1473,24 +1620,6 @@ where source: None, } } - #[doc = "The body for the API call"] - pub fn body(self, body: T) -> MlEstimateModelMemory<'a, 'b, JsonBody> - where - T: Serialize, - { - MlEstimateModelMemory { - transport: self.transport, - parts: self.parts, - body: Some(body.into()), - error_trace: self.error_trace, - filter_path: self.filter_path, - headers: self.headers, - human: self.human, - pretty: self.pretty, - request_timeout: self.request_timeout, - source: self.source, - } - } #[doc = "Include the stack trace of returned errors."] pub fn error_trace(mut self, error_trace: bool) -> Self { self.error_trace = Some(error_trace); @@ -1526,10 +1655,10 @@ where self.source = Some(source); self } - #[doc = "Creates an asynchronous call to the Ml Estimate Model Memory API that can be awaited"] + #[doc = "Creates an asynchronous call to the Ml Delete Trained Model API that can be awaited"] pub async fn send(self) -> Result { let path = self.parts.url(); - let method = Method::Post; + let method = Method::Delete; let headers = self.headers; let timeout = self.request_timeout; let query_string = { @@ -1552,7 +1681,7 @@ where }; Some(query_params) }; - let body = self.body; + let body = Option::<()>::None; let response = self .transport .send(method, &path, headers, query_string.as_ref(), body, timeout) @@ -1561,109 +1690,73 @@ where } } #[derive(Debug, Clone, PartialEq)] -#[doc = "API parts for the Ml Flush Job API"] -pub enum MlFlushJobParts<'b> { - #[doc = "JobId"] - JobId(&'b str), +#[doc = "API parts for the Ml Estimate Model Memory API"] +pub enum MlEstimateModelMemoryParts { + #[doc = "No parts"] + None, } -impl<'b> MlFlushJobParts<'b> { - #[doc = "Builds a relative URL path to the Ml Flush Job API"] +impl MlEstimateModelMemoryParts { + #[doc = "Builds a relative URL path to the Ml Estimate Model Memory API"] pub fn url(self) -> Cow<'static, str> { match self { - MlFlushJobParts::JobId(ref job_id) => { - let encoded_job_id: Cow = - percent_encode(job_id.as_bytes(), PARTS_ENCODED).into(); - let mut p = String::with_capacity(30usize + encoded_job_id.len()); - p.push_str("/_ml/anomaly_detectors/"); - p.push_str(encoded_job_id.as_ref()); - p.push_str("/_flush"); - p.into() + MlEstimateModelMemoryParts::None => { + "/_ml/anomaly_detectors/_estimate_model_memory".into() } } } } +#[doc = "Builder for the [Ml Estimate Model Memory API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/ml-apis.html)\n\nEstimates the model memory"] #[derive(Clone, Debug)] -#[doc = "Builder for the [Ml Flush Job API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/ml-flush-job.html)\n\nForces any buffered data to be processed by the job."] -pub struct MlFlushJob<'a, 'b, B> { +pub struct MlEstimateModelMemory<'a, 'b, B> { transport: &'a Transport, - parts: MlFlushJobParts<'b>, - advance_time: Option<&'b str>, + parts: MlEstimateModelMemoryParts, body: Option, - calc_interim: Option, - end: Option<&'b str>, error_trace: Option, filter_path: Option<&'b [&'b str]>, headers: HeaderMap, human: Option, pretty: Option, request_timeout: Option, - skip_time: Option<&'b str>, source: Option<&'b str>, - start: Option<&'b str>, } -impl<'a, 'b, B> MlFlushJob<'a, 'b, B> +impl<'a, 'b, B> MlEstimateModelMemory<'a, 'b, B> where B: Body, { - #[doc = "Creates a new instance of [MlFlushJob] with the specified API parts"] - pub fn new(transport: &'a Transport, parts: MlFlushJobParts<'b>) -> Self { + #[doc = "Creates a new instance of [MlEstimateModelMemory]"] + pub fn new(transport: &'a Transport) -> Self { let headers = HeaderMap::new(); - MlFlushJob { + MlEstimateModelMemory { transport, - parts, + parts: MlEstimateModelMemoryParts::None, headers, - advance_time: None, body: None, - calc_interim: None, - end: None, error_trace: None, filter_path: None, human: None, pretty: None, request_timeout: None, - skip_time: None, source: None, - start: None, } } - #[doc = "Advances time to the given value generating results and updating the model for the advanced interval"] - pub fn advance_time(mut self, advance_time: &'b str) -> Self { - self.advance_time = Some(advance_time); - self - } #[doc = "The body for the API call"] - pub fn body(self, body: T) -> MlFlushJob<'a, 'b, JsonBody> + pub fn body(self, body: T) -> MlEstimateModelMemory<'a, 'b, JsonBody> where T: Serialize, { - MlFlushJob { + MlEstimateModelMemory { transport: self.transport, parts: self.parts, body: Some(body.into()), - advance_time: self.advance_time, - calc_interim: self.calc_interim, - end: self.end, error_trace: self.error_trace, filter_path: self.filter_path, headers: self.headers, human: self.human, pretty: self.pretty, request_timeout: self.request_timeout, - skip_time: self.skip_time, source: self.source, - start: self.start, } } - #[doc = "Calculates interim results for the most recent bucket or all buckets within the latency period"] - pub fn calc_interim(mut self, calc_interim: bool) -> Self { - self.calc_interim = Some(calc_interim); - self - } - #[doc = "When used in conjunction with calc_interim, specifies the range of buckets on which to calculate interim results"] - pub fn end(mut self, end: &'b str) -> Self { - self.end = Some(end); - self - } #[doc = "Include the stack trace of returned errors."] pub fn error_trace(mut self, error_trace: bool) -> Self { self.error_trace = Some(error_trace); @@ -1694,22 +1787,12 @@ where self.request_timeout = Some(timeout); self } - #[doc = "Skips time to the given value without generating results or updating the model for the skipped interval"] - pub fn skip_time(mut self, skip_time: &'b str) -> Self { - self.skip_time = Some(skip_time); - self - } #[doc = "The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests."] pub fn source(mut self, source: &'b str) -> Self { self.source = Some(source); self } - #[doc = "When used in conjunction with calc_interim, specifies the range of buckets on which to calculate interim results"] - pub fn start(mut self, start: &'b str) -> Self { - self.start = Some(start); - self - } - #[doc = "Creates an asynchronous call to the Ml Flush Job API that can be awaited"] + #[doc = "Creates an asynchronous call to the Ml Estimate Model Memory API that can be awaited"] pub async fn send(self) -> Result { let path = self.parts.url(); let method = Method::Post; @@ -1719,29 +1802,19 @@ where #[serde_with::skip_serializing_none] #[derive(Serialize)] struct QueryParams<'b> { - advance_time: Option<&'b str>, - calc_interim: Option, - end: Option<&'b str>, error_trace: Option, #[serde(serialize_with = "crate::client::serialize_coll_qs")] filter_path: Option<&'b [&'b str]>, human: Option, pretty: Option, - skip_time: Option<&'b str>, source: Option<&'b str>, - start: Option<&'b str>, } let query_params = QueryParams { - advance_time: self.advance_time, - calc_interim: self.calc_interim, - end: self.end, error_trace: self.error_trace, filter_path: self.filter_path, human: self.human, pretty: self.pretty, - skip_time: self.skip_time, source: self.source, - start: self.start, }; Some(query_params) }; @@ -1753,104 +1826,82 @@ where Ok(response) } } +#[cfg(feature = "beta-apis")] #[derive(Debug, Clone, PartialEq)] -#[doc = "API parts for the Ml Forecast API"] -pub enum MlForecastParts<'b> { - #[doc = "JobId"] - JobId(&'b str), +#[doc = "API parts for the Ml Evaluate Data Frame API"] +pub enum MlEvaluateDataFrameParts { + #[doc = "No parts"] + None, } -impl<'b> MlForecastParts<'b> { - #[doc = "Builds a relative URL path to the Ml Forecast API"] +#[cfg(feature = "beta-apis")] +impl MlEvaluateDataFrameParts { + #[doc = "Builds a relative URL path to the Ml Evaluate Data Frame API"] pub fn url(self) -> Cow<'static, str> { match self { - MlForecastParts::JobId(ref job_id) => { - let encoded_job_id: Cow = - percent_encode(job_id.as_bytes(), PARTS_ENCODED).into(); - let mut p = String::with_capacity(33usize + encoded_job_id.len()); - p.push_str("/_ml/anomaly_detectors/"); - p.push_str(encoded_job_id.as_ref()); - p.push_str("/_forecast"); - p.into() - } + MlEvaluateDataFrameParts::None => "/_ml/data_frame/_evaluate".into(), } } } +#[doc = "Builder for the [Ml Evaluate Data Frame API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/evaluate-dfanalytics.html)\n\nEvaluates the data frame analytics for an annotated index."] +#[doc = " \n# Optional, beta\nThis requires the `beta-apis` feature. On track to become stable but breaking changes can\nhappen in minor versions.\n "] +#[cfg(feature = "beta-apis")] #[derive(Clone, Debug)] -#[doc = "Builder for the [Ml Forecast API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/ml-forecast.html)\n\nPredicts the future behavior of a time series by using its historical behavior."] -pub struct MlForecast<'a, 'b, B> { +pub struct MlEvaluateDataFrame<'a, 'b, B> { transport: &'a Transport, - parts: MlForecastParts<'b>, + parts: MlEvaluateDataFrameParts, body: Option, - duration: Option<&'b str>, error_trace: Option, - expires_in: Option<&'b str>, filter_path: Option<&'b [&'b str]>, headers: HeaderMap, human: Option, - max_model_memory: Option<&'b str>, pretty: Option, request_timeout: Option, source: Option<&'b str>, } -impl<'a, 'b, B> MlForecast<'a, 'b, B> +#[cfg(feature = "beta-apis")] +impl<'a, 'b, B> MlEvaluateDataFrame<'a, 'b, B> where B: Body, { - #[doc = "Creates a new instance of [MlForecast] with the specified API parts"] - pub fn new(transport: &'a Transport, parts: MlForecastParts<'b>) -> Self { + #[doc = "Creates a new instance of [MlEvaluateDataFrame]"] + pub fn new(transport: &'a Transport) -> Self { let headers = HeaderMap::new(); - MlForecast { + MlEvaluateDataFrame { transport, - parts, + parts: MlEvaluateDataFrameParts::None, headers, body: None, - duration: None, error_trace: None, - expires_in: None, filter_path: None, human: None, - max_model_memory: None, pretty: None, request_timeout: None, source: None, } } #[doc = "The body for the API call"] - pub fn body(self, body: T) -> MlForecast<'a, 'b, JsonBody> + pub fn body(self, body: T) -> MlEvaluateDataFrame<'a, 'b, JsonBody> where T: Serialize, { - MlForecast { + MlEvaluateDataFrame { transport: self.transport, parts: self.parts, body: Some(body.into()), - duration: self.duration, error_trace: self.error_trace, - expires_in: self.expires_in, filter_path: self.filter_path, headers: self.headers, human: self.human, - max_model_memory: self.max_model_memory, pretty: self.pretty, request_timeout: self.request_timeout, source: self.source, } } - #[doc = "The duration of the forecast"] - pub fn duration(mut self, duration: &'b str) -> Self { - self.duration = Some(duration); - self - } #[doc = "Include the stack trace of returned errors."] pub fn error_trace(mut self, error_trace: bool) -> Self { self.error_trace = Some(error_trace); self } - #[doc = "The time interval after which the forecast expires. Expired forecasts will be deleted at the first opportunity."] - pub fn expires_in(mut self, expires_in: &'b str) -> Self { - self.expires_in = Some(expires_in); - self - } #[doc = "A comma-separated list of filters used to reduce the response."] pub fn filter_path(mut self, filter_path: &'b [&'b str]) -> Self { self.filter_path = Some(filter_path); @@ -1866,11 +1917,6 @@ where self.human = Some(human); self } - #[doc = "The max memory able to be used by the forecast. Default is 20mb."] - pub fn max_model_memory(mut self, max_model_memory: &'b str) -> Self { - self.max_model_memory = Some(max_model_memory); - self - } #[doc = "Pretty format the returned JSON response."] pub fn pretty(mut self, pretty: bool) -> Self { self.pretty = Some(pretty); @@ -1886,7 +1932,7 @@ where self.source = Some(source); self } - #[doc = "Creates an asynchronous call to the Ml Forecast API that can be awaited"] + #[doc = "Creates an asynchronous call to the Ml Evaluate Data Frame API that can be awaited"] pub async fn send(self) -> Result { let path = self.parts.url(); let method = Method::Post; @@ -1896,23 +1942,17 @@ where #[serde_with::skip_serializing_none] #[derive(Serialize)] struct QueryParams<'b> { - duration: Option<&'b str>, error_trace: Option, - expires_in: Option<&'b str>, #[serde(serialize_with = "crate::client::serialize_coll_qs")] filter_path: Option<&'b [&'b str]>, human: Option, - max_model_memory: Option<&'b str>, pretty: Option, source: Option<&'b str>, } let query_params = QueryParams { - duration: self.duration, error_trace: self.error_trace, - expires_in: self.expires_in, filter_path: self.filter_path, human: self.human, - max_model_memory: self.max_model_memory, pretty: self.pretty, source: self.source, }; @@ -1926,162 +1966,97 @@ where Ok(response) } } +#[cfg(feature = "beta-apis")] #[derive(Debug, Clone, PartialEq)] -#[doc = "API parts for the Ml Get Buckets API"] -pub enum MlGetBucketsParts<'b> { - #[doc = "JobId and Timestamp"] - JobIdTimestamp(&'b str, &'b str), - #[doc = "JobId"] - JobId(&'b str), +#[doc = "API parts for the Ml Explain Data Frame Analytics API"] +pub enum MlExplainDataFrameAnalyticsParts<'b> { + #[doc = "No parts"] + None, + #[doc = "Id"] + Id(&'b str), } -impl<'b> MlGetBucketsParts<'b> { - #[doc = "Builds a relative URL path to the Ml Get Buckets API"] +#[cfg(feature = "beta-apis")] +impl<'b> MlExplainDataFrameAnalyticsParts<'b> { + #[doc = "Builds a relative URL path to the Ml Explain Data Frame Analytics API"] pub fn url(self) -> Cow<'static, str> { match self { - MlGetBucketsParts::JobIdTimestamp(ref job_id, ref timestamp) => { - let encoded_job_id: Cow = - percent_encode(job_id.as_bytes(), PARTS_ENCODED).into(); - let encoded_timestamp: Cow = - percent_encode(timestamp.as_bytes(), PARTS_ENCODED).into(); - let mut p = - String::with_capacity(40usize + encoded_job_id.len() + encoded_timestamp.len()); - p.push_str("/_ml/anomaly_detectors/"); - p.push_str(encoded_job_id.as_ref()); - p.push_str("/results/buckets/"); - p.push_str(encoded_timestamp.as_ref()); - p.into() - } - MlGetBucketsParts::JobId(ref job_id) => { - let encoded_job_id: Cow = - percent_encode(job_id.as_bytes(), PARTS_ENCODED).into(); - let mut p = String::with_capacity(39usize + encoded_job_id.len()); - p.push_str("/_ml/anomaly_detectors/"); - p.push_str(encoded_job_id.as_ref()); - p.push_str("/results/buckets"); + MlExplainDataFrameAnalyticsParts::None => "/_ml/data_frame/analytics/_explain".into(), + MlExplainDataFrameAnalyticsParts::Id(ref id) => { + let encoded_id: Cow = percent_encode(id.as_bytes(), PARTS_ENCODED).into(); + let mut p = String::with_capacity(35usize + encoded_id.len()); + p.push_str("/_ml/data_frame/analytics/"); + p.push_str(encoded_id.as_ref()); + p.push_str("/_explain"); p.into() } } } } +#[doc = "Builder for the [Ml Explain Data Frame Analytics API](http://www.elastic.co/guide/en/elasticsearch/reference/7.11/explain-dfanalytics.html)\n\nExplains a data frame analytics config."] +#[doc = " \n# Optional, beta\nThis requires the `beta-apis` feature. On track to become stable but breaking changes can\nhappen in minor versions.\n "] +#[cfg(feature = "beta-apis")] #[derive(Clone, Debug)] -#[doc = "Builder for the [Ml Get Buckets API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/ml-get-bucket.html)\n\nRetrieves anomaly detection job results for one or more buckets."] -pub struct MlGetBuckets<'a, 'b, B> { +pub struct MlExplainDataFrameAnalytics<'a, 'b, B> { transport: &'a Transport, - parts: MlGetBucketsParts<'b>, - anomaly_score: Option, + parts: MlExplainDataFrameAnalyticsParts<'b>, body: Option, - desc: Option, - end: Option<&'b str>, error_trace: Option, - exclude_interim: Option, - expand: Option, filter_path: Option<&'b [&'b str]>, - from: Option, headers: HeaderMap, human: Option, pretty: Option, request_timeout: Option, - size: Option, - sort: Option<&'b str>, source: Option<&'b str>, - start: Option<&'b str>, } -impl<'a, 'b, B> MlGetBuckets<'a, 'b, B> +#[cfg(feature = "beta-apis")] +impl<'a, 'b, B> MlExplainDataFrameAnalytics<'a, 'b, B> where B: Body, { - #[doc = "Creates a new instance of [MlGetBuckets] with the specified API parts"] - pub fn new(transport: &'a Transport, parts: MlGetBucketsParts<'b>) -> Self { + #[doc = "Creates a new instance of [MlExplainDataFrameAnalytics] with the specified API parts"] + pub fn new(transport: &'a Transport, parts: MlExplainDataFrameAnalyticsParts<'b>) -> Self { let headers = HeaderMap::new(); - MlGetBuckets { + MlExplainDataFrameAnalytics { transport, parts, headers, - anomaly_score: None, body: None, - desc: None, - end: None, error_trace: None, - exclude_interim: None, - expand: None, filter_path: None, - from: None, human: None, pretty: None, request_timeout: None, - size: None, - sort: None, source: None, - start: None, } } - #[doc = "Filter for the most anomalous buckets"] - pub fn anomaly_score(mut self, anomaly_score: f64) -> Self { - self.anomaly_score = Some(anomaly_score); - self - } #[doc = "The body for the API call"] - pub fn body(self, body: T) -> MlGetBuckets<'a, 'b, JsonBody> + pub fn body(self, body: T) -> MlExplainDataFrameAnalytics<'a, 'b, JsonBody> where T: Serialize, { - MlGetBuckets { + MlExplainDataFrameAnalytics { transport: self.transport, parts: self.parts, body: Some(body.into()), - anomaly_score: self.anomaly_score, - desc: self.desc, - end: self.end, error_trace: self.error_trace, - exclude_interim: self.exclude_interim, - expand: self.expand, filter_path: self.filter_path, - from: self.from, headers: self.headers, human: self.human, pretty: self.pretty, request_timeout: self.request_timeout, - size: self.size, - sort: self.sort, source: self.source, - start: self.start, } } - #[doc = "Set the sort direction"] - pub fn desc(mut self, desc: bool) -> Self { - self.desc = Some(desc); - self - } - #[doc = "End time filter for buckets"] - pub fn end(mut self, end: &'b str) -> Self { - self.end = Some(end); - self - } #[doc = "Include the stack trace of returned errors."] pub fn error_trace(mut self, error_trace: bool) -> Self { self.error_trace = Some(error_trace); self } - #[doc = "Exclude interim results"] - pub fn exclude_interim(mut self, exclude_interim: bool) -> Self { - self.exclude_interim = Some(exclude_interim); - self - } - #[doc = "Include anomaly records"] - pub fn expand(mut self, expand: bool) -> Self { - self.expand = Some(expand); - self - } #[doc = "A comma-separated list of filters used to reduce the response."] pub fn filter_path(mut self, filter_path: &'b [&'b str]) -> Self { self.filter_path = Some(filter_path); self } - #[doc = "skips a number of buckets"] - pub fn from(mut self, from: i32) -> Self { - self.from = Some(from); - self - } #[doc = "Adds a HTTP header"] pub fn header(mut self, key: HeaderName, value: HeaderValue) -> Self { self.headers.insert(key, value); @@ -2102,27 +2077,12 @@ where self.request_timeout = Some(timeout); self } - #[doc = "specifies a max number of buckets to get"] - pub fn size(mut self, size: i32) -> Self { - self.size = Some(size); - self - } - #[doc = "Sort buckets by a particular field"] - pub fn sort(mut self, sort: &'b str) -> Self { - self.sort = Some(sort); - self - } #[doc = "The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests."] pub fn source(mut self, source: &'b str) -> Self { self.source = Some(source); self } - #[doc = "Start time filter for buckets"] - pub fn start(mut self, start: &'b str) -> Self { - self.start = Some(start); - self - } - #[doc = "Creates an asynchronous call to the Ml Get Buckets API that can be awaited"] + #[doc = "Creates an asynchronous call to the Ml Explain Data Frame Analytics API that can be awaited"] pub async fn send(self) -> Result { let path = self.parts.url(); let method = match self.body { @@ -2135,37 +2095,19 @@ where #[serde_with::skip_serializing_none] #[derive(Serialize)] struct QueryParams<'b> { - anomaly_score: Option, - desc: Option, - end: Option<&'b str>, error_trace: Option, - exclude_interim: Option, - expand: Option, #[serde(serialize_with = "crate::client::serialize_coll_qs")] filter_path: Option<&'b [&'b str]>, - from: Option, human: Option, pretty: Option, - size: Option, - sort: Option<&'b str>, source: Option<&'b str>, - start: Option<&'b str>, } let query_params = QueryParams { - anomaly_score: self.anomaly_score, - desc: self.desc, - end: self.end, error_trace: self.error_trace, - exclude_interim: self.exclude_interim, - expand: self.expand, filter_path: self.filter_path, - from: self.from, human: self.human, pretty: self.pretty, - size: self.size, - sort: self.sort, source: self.source, - start: self.start, }; Some(query_params) }; @@ -2178,84 +2120,117 @@ where } } #[derive(Debug, Clone, PartialEq)] -#[doc = "API parts for the Ml Get Calendar Events API"] -pub enum MlGetCalendarEventsParts<'b> { - #[doc = "CalendarId"] - CalendarId(&'b str), +#[doc = "API parts for the Ml Flush Job API"] +pub enum MlFlushJobParts<'b> { + #[doc = "JobId"] + JobId(&'b str), } -impl<'b> MlGetCalendarEventsParts<'b> { - #[doc = "Builds a relative URL path to the Ml Get Calendar Events API"] +impl<'b> MlFlushJobParts<'b> { + #[doc = "Builds a relative URL path to the Ml Flush Job API"] pub fn url(self) -> Cow<'static, str> { match self { - MlGetCalendarEventsParts::CalendarId(ref calendar_id) => { - let encoded_calendar_id: Cow = - percent_encode(calendar_id.as_bytes(), PARTS_ENCODED).into(); - let mut p = String::with_capacity(22usize + encoded_calendar_id.len()); - p.push_str("/_ml/calendars/"); - p.push_str(encoded_calendar_id.as_ref()); - p.push_str("/events"); + MlFlushJobParts::JobId(ref job_id) => { + let encoded_job_id: Cow = + percent_encode(job_id.as_bytes(), PARTS_ENCODED).into(); + let mut p = String::with_capacity(30usize + encoded_job_id.len()); + p.push_str("/_ml/anomaly_detectors/"); + p.push_str(encoded_job_id.as_ref()); + p.push_str("/_flush"); p.into() } } } } +#[doc = "Builder for the [Ml Flush Job API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/ml-flush-job.html)\n\nForces any buffered data to be processed by the job."] #[derive(Clone, Debug)] -#[doc = "Builder for the [Ml Get Calendar Events API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/ml-get-calendar-event.html)\n\nRetrieves information about the scheduled events in calendars."] -pub struct MlGetCalendarEvents<'a, 'b> { +pub struct MlFlushJob<'a, 'b, B> { transport: &'a Transport, - parts: MlGetCalendarEventsParts<'b>, + parts: MlFlushJobParts<'b>, + advance_time: Option<&'b str>, + body: Option, + calc_interim: Option, end: Option<&'b str>, error_trace: Option, filter_path: Option<&'b [&'b str]>, - from: Option, headers: HeaderMap, human: Option, - job_id: Option<&'b str>, pretty: Option, request_timeout: Option, - size: Option, + skip_time: Option<&'b str>, source: Option<&'b str>, start: Option<&'b str>, } -impl<'a, 'b> MlGetCalendarEvents<'a, 'b> { - #[doc = "Creates a new instance of [MlGetCalendarEvents] with the specified API parts"] - pub fn new(transport: &'a Transport, parts: MlGetCalendarEventsParts<'b>) -> Self { +impl<'a, 'b, B> MlFlushJob<'a, 'b, B> +where + B: Body, +{ + #[doc = "Creates a new instance of [MlFlushJob] with the specified API parts"] + pub fn new(transport: &'a Transport, parts: MlFlushJobParts<'b>) -> Self { let headers = HeaderMap::new(); - MlGetCalendarEvents { + MlFlushJob { transport, parts, headers, + advance_time: None, + body: None, + calc_interim: None, end: None, error_trace: None, filter_path: None, - from: None, human: None, - job_id: None, pretty: None, request_timeout: None, - size: None, + skip_time: None, source: None, start: None, } } - #[doc = "Get events before this time"] - pub fn end(mut self, end: &'b str) -> Self { - self.end = Some(end); - self - } - #[doc = "Include the stack trace of returned errors."] - pub fn error_trace(mut self, error_trace: bool) -> Self { - self.error_trace = Some(error_trace); - self - } - #[doc = "A comma-separated list of filters used to reduce the response."] - pub fn filter_path(mut self, filter_path: &'b [&'b str]) -> Self { - self.filter_path = Some(filter_path); + #[doc = "Advances time to the given value generating results and updating the model for the advanced interval"] + pub fn advance_time(mut self, advance_time: &'b str) -> Self { + self.advance_time = Some(advance_time); self } - #[doc = "Skips a number of events"] - pub fn from(mut self, from: i32) -> Self { - self.from = Some(from); + #[doc = "The body for the API call"] + pub fn body(self, body: T) -> MlFlushJob<'a, 'b, JsonBody> + where + T: Serialize, + { + MlFlushJob { + transport: self.transport, + parts: self.parts, + body: Some(body.into()), + advance_time: self.advance_time, + calc_interim: self.calc_interim, + end: self.end, + error_trace: self.error_trace, + filter_path: self.filter_path, + headers: self.headers, + human: self.human, + pretty: self.pretty, + request_timeout: self.request_timeout, + skip_time: self.skip_time, + source: self.source, + start: self.start, + } + } + #[doc = "Calculates interim results for the most recent bucket or all buckets within the latency period"] + pub fn calc_interim(mut self, calc_interim: bool) -> Self { + self.calc_interim = Some(calc_interim); + self + } + #[doc = "When used in conjunction with calc_interim, specifies the range of buckets on which to calculate interim results"] + pub fn end(mut self, end: &'b str) -> Self { + self.end = Some(end); + self + } + #[doc = "Include the stack trace of returned errors."] + pub fn error_trace(mut self, error_trace: bool) -> Self { + self.error_trace = Some(error_trace); + self + } + #[doc = "A comma-separated list of filters used to reduce the response."] + pub fn filter_path(mut self, filter_path: &'b [&'b str]) -> Self { + self.filter_path = Some(filter_path); self } #[doc = "Adds a HTTP header"] @@ -2268,11 +2243,6 @@ impl<'a, 'b> MlGetCalendarEvents<'a, 'b> { self.human = Some(human); self } - #[doc = "Get events for the job. When this option is used calendar_id must be '_all'"] - pub fn job_id(mut self, job_id: &'b str) -> Self { - self.job_id = Some(job_id); - self - } #[doc = "Pretty format the returned JSON response."] pub fn pretty(mut self, pretty: bool) -> Self { self.pretty = Some(pretty); @@ -2283,9 +2253,9 @@ impl<'a, 'b> MlGetCalendarEvents<'a, 'b> { self.request_timeout = Some(timeout); self } - #[doc = "Specifies a max number of events to get"] - pub fn size(mut self, size: i32) -> Self { - self.size = Some(size); + #[doc = "Skips time to the given value without generating results or updating the model for the skipped interval"] + pub fn skip_time(mut self, skip_time: &'b str) -> Self { + self.skip_time = Some(skip_time); self } #[doc = "The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests."] @@ -2293,48 +2263,48 @@ impl<'a, 'b> MlGetCalendarEvents<'a, 'b> { self.source = Some(source); self } - #[doc = "Get events after this time"] + #[doc = "When used in conjunction with calc_interim, specifies the range of buckets on which to calculate interim results"] pub fn start(mut self, start: &'b str) -> Self { self.start = Some(start); self } - #[doc = "Creates an asynchronous call to the Ml Get Calendar Events API that can be awaited"] + #[doc = "Creates an asynchronous call to the Ml Flush Job API that can be awaited"] pub async fn send(self) -> Result { let path = self.parts.url(); - let method = Method::Get; + let method = Method::Post; let headers = self.headers; let timeout = self.request_timeout; let query_string = { #[serde_with::skip_serializing_none] #[derive(Serialize)] struct QueryParams<'b> { + advance_time: Option<&'b str>, + calc_interim: Option, end: Option<&'b str>, error_trace: Option, #[serde(serialize_with = "crate::client::serialize_coll_qs")] filter_path: Option<&'b [&'b str]>, - from: Option, human: Option, - job_id: Option<&'b str>, pretty: Option, - size: Option, + skip_time: Option<&'b str>, source: Option<&'b str>, start: Option<&'b str>, } let query_params = QueryParams { + advance_time: self.advance_time, + calc_interim: self.calc_interim, end: self.end, error_trace: self.error_trace, filter_path: self.filter_path, - from: self.from, human: self.human, - job_id: self.job_id, pretty: self.pretty, - size: self.size, + skip_time: self.skip_time, source: self.source, start: self.start, }; Some(query_params) }; - let body = Option::<()>::None; + let body = self.body; let response = self .transport .send(method, &path, headers, query_string.as_ref(), body, timeout) @@ -2343,102 +2313,108 @@ impl<'a, 'b> MlGetCalendarEvents<'a, 'b> { } } #[derive(Debug, Clone, PartialEq)] -#[doc = "API parts for the Ml Get Calendars API"] -pub enum MlGetCalendarsParts<'b> { - #[doc = "No parts"] - None, - #[doc = "CalendarId"] - CalendarId(&'b str), +#[doc = "API parts for the Ml Forecast API"] +pub enum MlForecastParts<'b> { + #[doc = "JobId"] + JobId(&'b str), } -impl<'b> MlGetCalendarsParts<'b> { - #[doc = "Builds a relative URL path to the Ml Get Calendars API"] +impl<'b> MlForecastParts<'b> { + #[doc = "Builds a relative URL path to the Ml Forecast API"] pub fn url(self) -> Cow<'static, str> { match self { - MlGetCalendarsParts::None => "/_ml/calendars".into(), - MlGetCalendarsParts::CalendarId(ref calendar_id) => { - let encoded_calendar_id: Cow = - percent_encode(calendar_id.as_bytes(), PARTS_ENCODED).into(); - let mut p = String::with_capacity(15usize + encoded_calendar_id.len()); - p.push_str("/_ml/calendars/"); - p.push_str(encoded_calendar_id.as_ref()); + MlForecastParts::JobId(ref job_id) => { + let encoded_job_id: Cow = + percent_encode(job_id.as_bytes(), PARTS_ENCODED).into(); + let mut p = String::with_capacity(33usize + encoded_job_id.len()); + p.push_str("/_ml/anomaly_detectors/"); + p.push_str(encoded_job_id.as_ref()); + p.push_str("/_forecast"); p.into() } } } } +#[doc = "Builder for the [Ml Forecast API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/ml-forecast.html)\n\nPredicts the future behavior of a time series by using its historical behavior."] #[derive(Clone, Debug)] -#[doc = "Builder for the [Ml Get Calendars API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/ml-get-calendar.html)\n\nRetrieves configuration information for calendars."] -pub struct MlGetCalendars<'a, 'b, B> { +pub struct MlForecast<'a, 'b, B> { transport: &'a Transport, - parts: MlGetCalendarsParts<'b>, + parts: MlForecastParts<'b>, body: Option, + duration: Option<&'b str>, error_trace: Option, + expires_in: Option<&'b str>, filter_path: Option<&'b [&'b str]>, - from: Option, headers: HeaderMap, human: Option, + max_model_memory: Option<&'b str>, pretty: Option, request_timeout: Option, - size: Option, source: Option<&'b str>, } -impl<'a, 'b, B> MlGetCalendars<'a, 'b, B> +impl<'a, 'b, B> MlForecast<'a, 'b, B> where B: Body, { - #[doc = "Creates a new instance of [MlGetCalendars] with the specified API parts"] - pub fn new(transport: &'a Transport, parts: MlGetCalendarsParts<'b>) -> Self { + #[doc = "Creates a new instance of [MlForecast] with the specified API parts"] + pub fn new(transport: &'a Transport, parts: MlForecastParts<'b>) -> Self { let headers = HeaderMap::new(); - MlGetCalendars { + MlForecast { transport, parts, headers, body: None, + duration: None, error_trace: None, + expires_in: None, filter_path: None, - from: None, human: None, + max_model_memory: None, pretty: None, request_timeout: None, - size: None, source: None, } } #[doc = "The body for the API call"] - pub fn body(self, body: T) -> MlGetCalendars<'a, 'b, JsonBody> + pub fn body(self, body: T) -> MlForecast<'a, 'b, JsonBody> where T: Serialize, { - MlGetCalendars { + MlForecast { transport: self.transport, parts: self.parts, body: Some(body.into()), + duration: self.duration, error_trace: self.error_trace, + expires_in: self.expires_in, filter_path: self.filter_path, - from: self.from, headers: self.headers, human: self.human, + max_model_memory: self.max_model_memory, pretty: self.pretty, request_timeout: self.request_timeout, - size: self.size, source: self.source, } } + #[doc = "The duration of the forecast"] + pub fn duration(mut self, duration: &'b str) -> Self { + self.duration = Some(duration); + self + } #[doc = "Include the stack trace of returned errors."] pub fn error_trace(mut self, error_trace: bool) -> Self { self.error_trace = Some(error_trace); self } + #[doc = "The time interval after which the forecast expires. Expired forecasts will be deleted at the first opportunity."] + pub fn expires_in(mut self, expires_in: &'b str) -> Self { + self.expires_in = Some(expires_in); + self + } #[doc = "A comma-separated list of filters used to reduce the response."] pub fn filter_path(mut self, filter_path: &'b [&'b str]) -> Self { self.filter_path = Some(filter_path); self } - #[doc = "skips a number of calendars"] - pub fn from(mut self, from: i32) -> Self { - self.from = Some(from); - self - } #[doc = "Adds a HTTP header"] pub fn header(mut self, key: HeaderName, value: HeaderValue) -> Self { self.headers.insert(key, value); @@ -2449,6 +2425,11 @@ where self.human = Some(human); self } + #[doc = "The max memory able to be used by the forecast. Default is 20mb."] + pub fn max_model_memory(mut self, max_model_memory: &'b str) -> Self { + self.max_model_memory = Some(max_model_memory); + self + } #[doc = "Pretty format the returned JSON response."] pub fn pretty(mut self, pretty: bool) -> Self { self.pretty = Some(pretty); @@ -2459,45 +2440,39 @@ where self.request_timeout = Some(timeout); self } - #[doc = "specifies a max number of calendars to get"] - pub fn size(mut self, size: i32) -> Self { - self.size = Some(size); - self - } #[doc = "The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests."] pub fn source(mut self, source: &'b str) -> Self { self.source = Some(source); self } - #[doc = "Creates an asynchronous call to the Ml Get Calendars API that can be awaited"] + #[doc = "Creates an asynchronous call to the Ml Forecast API that can be awaited"] pub async fn send(self) -> Result { let path = self.parts.url(); - let method = match self.body { - Some(_) => Method::Post, - None => Method::Get, - }; + let method = Method::Post; let headers = self.headers; let timeout = self.request_timeout; let query_string = { #[serde_with::skip_serializing_none] #[derive(Serialize)] struct QueryParams<'b> { + duration: Option<&'b str>, error_trace: Option, + expires_in: Option<&'b str>, #[serde(serialize_with = "crate::client::serialize_coll_qs")] filter_path: Option<&'b [&'b str]>, - from: Option, human: Option, + max_model_memory: Option<&'b str>, pretty: Option, - size: Option, source: Option<&'b str>, } let query_params = QueryParams { + duration: self.duration, error_trace: self.error_trace, + expires_in: self.expires_in, filter_path: self.filter_path, - from: self.from, human: self.human, + max_model_memory: self.max_model_memory, pretty: self.pretty, - size: self.size, source: self.source, }; Some(query_params) @@ -2511,116 +2486,157 @@ where } } #[derive(Debug, Clone, PartialEq)] -#[doc = "API parts for the Ml Get Categories API"] -pub enum MlGetCategoriesParts<'b> { - #[doc = "JobId and CategoryId"] - JobIdCategoryId(&'b str, i64), +#[doc = "API parts for the Ml Get Buckets API"] +pub enum MlGetBucketsParts<'b> { + #[doc = "JobId and Timestamp"] + JobIdTimestamp(&'b str, &'b str), #[doc = "JobId"] JobId(&'b str), } -impl<'b> MlGetCategoriesParts<'b> { - #[doc = "Builds a relative URL path to the Ml Get Categories API"] +impl<'b> MlGetBucketsParts<'b> { + #[doc = "Builds a relative URL path to the Ml Get Buckets API"] pub fn url(self) -> Cow<'static, str> { match self { - MlGetCategoriesParts::JobIdCategoryId(ref job_id, ref category_id) => { - let category_id_str = category_id.to_string(); + MlGetBucketsParts::JobIdTimestamp(ref job_id, ref timestamp) => { let encoded_job_id: Cow = percent_encode(job_id.as_bytes(), PARTS_ENCODED).into(); - let encoded_category_id: Cow = - percent_encode(category_id_str.as_bytes(), PARTS_ENCODED).into(); - let mut p = String::with_capacity( - 43usize + encoded_job_id.len() + encoded_category_id.len(), - ); + let encoded_timestamp: Cow = + percent_encode(timestamp.as_bytes(), PARTS_ENCODED).into(); + let mut p = + String::with_capacity(40usize + encoded_job_id.len() + encoded_timestamp.len()); p.push_str("/_ml/anomaly_detectors/"); p.push_str(encoded_job_id.as_ref()); - p.push_str("/results/categories/"); - p.push_str(encoded_category_id.as_ref()); + p.push_str("/results/buckets/"); + p.push_str(encoded_timestamp.as_ref()); p.into() } - MlGetCategoriesParts::JobId(ref job_id) => { + MlGetBucketsParts::JobId(ref job_id) => { let encoded_job_id: Cow = percent_encode(job_id.as_bytes(), PARTS_ENCODED).into(); - let mut p = String::with_capacity(43usize + encoded_job_id.len()); + let mut p = String::with_capacity(39usize + encoded_job_id.len()); p.push_str("/_ml/anomaly_detectors/"); p.push_str(encoded_job_id.as_ref()); - p.push_str("/results/categories/"); + p.push_str("/results/buckets"); p.into() } } } } +#[doc = "Builder for the [Ml Get Buckets API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/ml-get-bucket.html)\n\nRetrieves anomaly detection job results for one or more buckets."] #[derive(Clone, Debug)] -#[doc = "Builder for the [Ml Get Categories API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/ml-get-category.html)\n\nRetrieves anomaly detection job results for one or more categories."] -pub struct MlGetCategories<'a, 'b, B> { +pub struct MlGetBuckets<'a, 'b, B> { transport: &'a Transport, - parts: MlGetCategoriesParts<'b>, + parts: MlGetBucketsParts<'b>, + anomaly_score: Option, body: Option, + desc: Option, + end: Option<&'b str>, error_trace: Option, + exclude_interim: Option, + expand: Option, filter_path: Option<&'b [&'b str]>, from: Option, headers: HeaderMap, human: Option, - partition_field_value: Option<&'b str>, pretty: Option, request_timeout: Option, size: Option, + sort: Option<&'b str>, source: Option<&'b str>, + start: Option<&'b str>, } -impl<'a, 'b, B> MlGetCategories<'a, 'b, B> +impl<'a, 'b, B> MlGetBuckets<'a, 'b, B> where B: Body, { - #[doc = "Creates a new instance of [MlGetCategories] with the specified API parts"] - pub fn new(transport: &'a Transport, parts: MlGetCategoriesParts<'b>) -> Self { + #[doc = "Creates a new instance of [MlGetBuckets] with the specified API parts"] + pub fn new(transport: &'a Transport, parts: MlGetBucketsParts<'b>) -> Self { let headers = HeaderMap::new(); - MlGetCategories { + MlGetBuckets { transport, parts, headers, + anomaly_score: None, body: None, + desc: None, + end: None, error_trace: None, + exclude_interim: None, + expand: None, filter_path: None, from: None, human: None, - partition_field_value: None, pretty: None, request_timeout: None, size: None, + sort: None, source: None, + start: None, } } + #[doc = "Filter for the most anomalous buckets"] + pub fn anomaly_score(mut self, anomaly_score: f64) -> Self { + self.anomaly_score = Some(anomaly_score); + self + } #[doc = "The body for the API call"] - pub fn body(self, body: T) -> MlGetCategories<'a, 'b, JsonBody> + pub fn body(self, body: T) -> MlGetBuckets<'a, 'b, JsonBody> where T: Serialize, { - MlGetCategories { + MlGetBuckets { transport: self.transport, parts: self.parts, body: Some(body.into()), + anomaly_score: self.anomaly_score, + desc: self.desc, + end: self.end, error_trace: self.error_trace, + exclude_interim: self.exclude_interim, + expand: self.expand, filter_path: self.filter_path, from: self.from, headers: self.headers, human: self.human, - partition_field_value: self.partition_field_value, pretty: self.pretty, request_timeout: self.request_timeout, size: self.size, + sort: self.sort, source: self.source, + start: self.start, } } - #[doc = "Include the stack trace of returned errors."] - pub fn error_trace(mut self, error_trace: bool) -> Self { + #[doc = "Set the sort direction"] + pub fn desc(mut self, desc: bool) -> Self { + self.desc = Some(desc); + self + } + #[doc = "End time filter for buckets"] + pub fn end(mut self, end: &'b str) -> Self { + self.end = Some(end); + self + } + #[doc = "Include the stack trace of returned errors."] + pub fn error_trace(mut self, error_trace: bool) -> Self { self.error_trace = Some(error_trace); self } + #[doc = "Exclude interim results"] + pub fn exclude_interim(mut self, exclude_interim: bool) -> Self { + self.exclude_interim = Some(exclude_interim); + self + } + #[doc = "Include anomaly records"] + pub fn expand(mut self, expand: bool) -> Self { + self.expand = Some(expand); + self + } #[doc = "A comma-separated list of filters used to reduce the response."] pub fn filter_path(mut self, filter_path: &'b [&'b str]) -> Self { self.filter_path = Some(filter_path); self } - #[doc = "skips a number of categories"] + #[doc = "skips a number of buckets"] pub fn from(mut self, from: i32) -> Self { self.from = Some(from); self @@ -2635,11 +2651,6 @@ where self.human = Some(human); self } - #[doc = "Specifies the partition to retrieve categories for. This is optional, and should never be used for jobs where per-partition categorization is disabled."] - pub fn partition_field_value(mut self, partition_field_value: &'b str) -> Self { - self.partition_field_value = Some(partition_field_value); - self - } #[doc = "Pretty format the returned JSON response."] pub fn pretty(mut self, pretty: bool) -> Self { self.pretty = Some(pretty); @@ -2650,17 +2661,27 @@ where self.request_timeout = Some(timeout); self } - #[doc = "specifies a max number of categories to get"] + #[doc = "specifies a max number of buckets to get"] pub fn size(mut self, size: i32) -> Self { self.size = Some(size); self } + #[doc = "Sort buckets by a particular field"] + pub fn sort(mut self, sort: &'b str) -> Self { + self.sort = Some(sort); + self + } #[doc = "The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests."] pub fn source(mut self, source: &'b str) -> Self { self.source = Some(source); self } - #[doc = "Creates an asynchronous call to the Ml Get Categories API that can be awaited"] + #[doc = "Start time filter for buckets"] + pub fn start(mut self, start: &'b str) -> Self { + self.start = Some(start); + self + } + #[doc = "Creates an asynchronous call to the Ml Get Buckets API that can be awaited"] pub async fn send(self) -> Result { let path = self.parts.url(); let method = match self.body { @@ -2673,25 +2694,37 @@ where #[serde_with::skip_serializing_none] #[derive(Serialize)] struct QueryParams<'b> { + anomaly_score: Option, + desc: Option, + end: Option<&'b str>, error_trace: Option, + exclude_interim: Option, + expand: Option, #[serde(serialize_with = "crate::client::serialize_coll_qs")] filter_path: Option<&'b [&'b str]>, from: Option, human: Option, - partition_field_value: Option<&'b str>, pretty: Option, size: Option, + sort: Option<&'b str>, source: Option<&'b str>, + start: Option<&'b str>, } let query_params = QueryParams { + anomaly_score: self.anomaly_score, + desc: self.desc, + end: self.end, error_trace: self.error_trace, + exclude_interim: self.exclude_interim, + expand: self.expand, filter_path: self.filter_path, from: self.from, human: self.human, - partition_field_value: self.partition_field_value, pretty: self.pretty, size: self.size, + sort: self.sort, source: self.source, + start: self.start, }; Some(query_params) }; @@ -2704,71 +2737,69 @@ where } } #[derive(Debug, Clone, PartialEq)] -#[doc = "API parts for the Ml Get Datafeed Stats API"] -pub enum MlGetDatafeedStatsParts<'b> { - #[doc = "DatafeedId"] - DatafeedId(&'b str), - #[doc = "No parts"] - None, +#[doc = "API parts for the Ml Get Calendar Events API"] +pub enum MlGetCalendarEventsParts<'b> { + #[doc = "CalendarId"] + CalendarId(&'b str), } -impl<'b> MlGetDatafeedStatsParts<'b> { - #[doc = "Builds a relative URL path to the Ml Get Datafeed Stats API"] +impl<'b> MlGetCalendarEventsParts<'b> { + #[doc = "Builds a relative URL path to the Ml Get Calendar Events API"] pub fn url(self) -> Cow<'static, str> { match self { - MlGetDatafeedStatsParts::DatafeedId(ref datafeed_id) => { - let encoded_datafeed_id: Cow = - percent_encode(datafeed_id.as_bytes(), PARTS_ENCODED).into(); - let mut p = String::with_capacity(22usize + encoded_datafeed_id.len()); - p.push_str("/_ml/datafeeds/"); - p.push_str(encoded_datafeed_id.as_ref()); - p.push_str("/_stats"); + MlGetCalendarEventsParts::CalendarId(ref calendar_id) => { + let encoded_calendar_id: Cow = + percent_encode(calendar_id.as_bytes(), PARTS_ENCODED).into(); + let mut p = String::with_capacity(22usize + encoded_calendar_id.len()); + p.push_str("/_ml/calendars/"); + p.push_str(encoded_calendar_id.as_ref()); + p.push_str("/events"); p.into() } - MlGetDatafeedStatsParts::None => "/_ml/datafeeds/_stats".into(), } } } +#[doc = "Builder for the [Ml Get Calendar Events API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/ml-get-calendar-event.html)\n\nRetrieves information about the scheduled events in calendars."] #[derive(Clone, Debug)] -#[doc = "Builder for the [Ml Get Datafeed Stats API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/ml-get-datafeed-stats.html)\n\nRetrieves usage information for datafeeds."] -pub struct MlGetDatafeedStats<'a, 'b> { +pub struct MlGetCalendarEvents<'a, 'b> { transport: &'a Transport, - parts: MlGetDatafeedStatsParts<'b>, - allow_no_datafeeds: Option, - allow_no_match: Option, + parts: MlGetCalendarEventsParts<'b>, + end: Option<&'b str>, error_trace: Option, filter_path: Option<&'b [&'b str]>, + from: Option, headers: HeaderMap, human: Option, + job_id: Option<&'b str>, pretty: Option, request_timeout: Option, + size: Option, source: Option<&'b str>, + start: Option<&'b str>, } -impl<'a, 'b> MlGetDatafeedStats<'a, 'b> { - #[doc = "Creates a new instance of [MlGetDatafeedStats] with the specified API parts"] - pub fn new(transport: &'a Transport, parts: MlGetDatafeedStatsParts<'b>) -> Self { +impl<'a, 'b> MlGetCalendarEvents<'a, 'b> { + #[doc = "Creates a new instance of [MlGetCalendarEvents] with the specified API parts"] + pub fn new(transport: &'a Transport, parts: MlGetCalendarEventsParts<'b>) -> Self { let headers = HeaderMap::new(); - MlGetDatafeedStats { + MlGetCalendarEvents { transport, parts, headers, - allow_no_datafeeds: None, - allow_no_match: None, + end: None, error_trace: None, filter_path: None, + from: None, human: None, + job_id: None, pretty: None, request_timeout: None, + size: None, source: None, + start: None, } } - #[doc = "Whether to ignore if a wildcard expression matches no datafeeds. (This includes `_all` string or when no datafeeds have been specified)"] - pub fn allow_no_datafeeds(mut self, allow_no_datafeeds: bool) -> Self { - self.allow_no_datafeeds = Some(allow_no_datafeeds); - self - } - #[doc = "Whether to ignore if a wildcard expression matches no datafeeds. (This includes `_all` string or when no datafeeds have been specified)"] - pub fn allow_no_match(mut self, allow_no_match: bool) -> Self { - self.allow_no_match = Some(allow_no_match); + #[doc = "Get events before this time"] + pub fn end(mut self, end: &'b str) -> Self { + self.end = Some(end); self } #[doc = "Include the stack trace of returned errors."] @@ -2781,6 +2812,11 @@ impl<'a, 'b> MlGetDatafeedStats<'a, 'b> { self.filter_path = Some(filter_path); self } + #[doc = "Skips a number of events"] + pub fn from(mut self, from: i32) -> Self { + self.from = Some(from); + self + } #[doc = "Adds a HTTP header"] pub fn header(mut self, key: HeaderName, value: HeaderValue) -> Self { self.headers.insert(key, value); @@ -2791,6 +2827,11 @@ impl<'a, 'b> MlGetDatafeedStats<'a, 'b> { self.human = Some(human); self } + #[doc = "Get events for the job. When this option is used calendar_id must be '_all'"] + pub fn job_id(mut self, job_id: &'b str) -> Self { + self.job_id = Some(job_id); + self + } #[doc = "Pretty format the returned JSON response."] pub fn pretty(mut self, pretty: bool) -> Self { self.pretty = Some(pretty); @@ -2801,12 +2842,22 @@ impl<'a, 'b> MlGetDatafeedStats<'a, 'b> { self.request_timeout = Some(timeout); self } + #[doc = "Specifies a max number of events to get"] + pub fn size(mut self, size: i32) -> Self { + self.size = Some(size); + self + } #[doc = "The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests."] pub fn source(mut self, source: &'b str) -> Self { self.source = Some(source); self } - #[doc = "Creates an asynchronous call to the Ml Get Datafeed Stats API that can be awaited"] + #[doc = "Get events after this time"] + pub fn start(mut self, start: &'b str) -> Self { + self.start = Some(start); + self + } + #[doc = "Creates an asynchronous call to the Ml Get Calendar Events API that can be awaited"] pub async fn send(self) -> Result { let path = self.parts.url(); let method = Method::Get; @@ -2816,23 +2867,29 @@ impl<'a, 'b> MlGetDatafeedStats<'a, 'b> { #[serde_with::skip_serializing_none] #[derive(Serialize)] struct QueryParams<'b> { - allow_no_datafeeds: Option, - allow_no_match: Option, + end: Option<&'b str>, error_trace: Option, #[serde(serialize_with = "crate::client::serialize_coll_qs")] filter_path: Option<&'b [&'b str]>, + from: Option, human: Option, + job_id: Option<&'b str>, pretty: Option, + size: Option, source: Option<&'b str>, + start: Option<&'b str>, } let query_params = QueryParams { - allow_no_datafeeds: self.allow_no_datafeeds, - allow_no_match: self.allow_no_match, + end: self.end, error_trace: self.error_trace, filter_path: self.filter_path, + from: self.from, human: self.human, + job_id: self.job_id, pretty: self.pretty, + size: self.size, source: self.source, + start: self.start, }; Some(query_params) }; @@ -2845,71 +2902,86 @@ impl<'a, 'b> MlGetDatafeedStats<'a, 'b> { } } #[derive(Debug, Clone, PartialEq)] -#[doc = "API parts for the Ml Get Datafeeds API"] -pub enum MlGetDatafeedsParts<'b> { - #[doc = "DatafeedId"] - DatafeedId(&'b str), +#[doc = "API parts for the Ml Get Calendars API"] +pub enum MlGetCalendarsParts<'b> { #[doc = "No parts"] None, + #[doc = "CalendarId"] + CalendarId(&'b str), } -impl<'b> MlGetDatafeedsParts<'b> { - #[doc = "Builds a relative URL path to the Ml Get Datafeeds API"] +impl<'b> MlGetCalendarsParts<'b> { + #[doc = "Builds a relative URL path to the Ml Get Calendars API"] pub fn url(self) -> Cow<'static, str> { match self { - MlGetDatafeedsParts::DatafeedId(ref datafeed_id) => { - let encoded_datafeed_id: Cow = - percent_encode(datafeed_id.as_bytes(), PARTS_ENCODED).into(); - let mut p = String::with_capacity(15usize + encoded_datafeed_id.len()); - p.push_str("/_ml/datafeeds/"); - p.push_str(encoded_datafeed_id.as_ref()); + MlGetCalendarsParts::None => "/_ml/calendars".into(), + MlGetCalendarsParts::CalendarId(ref calendar_id) => { + let encoded_calendar_id: Cow = + percent_encode(calendar_id.as_bytes(), PARTS_ENCODED).into(); + let mut p = String::with_capacity(15usize + encoded_calendar_id.len()); + p.push_str("/_ml/calendars/"); + p.push_str(encoded_calendar_id.as_ref()); p.into() } - MlGetDatafeedsParts::None => "/_ml/datafeeds".into(), } } } +#[doc = "Builder for the [Ml Get Calendars API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/ml-get-calendar.html)\n\nRetrieves configuration information for calendars."] #[derive(Clone, Debug)] -#[doc = "Builder for the [Ml Get Datafeeds API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/ml-get-datafeed.html)\n\nRetrieves configuration information for datafeeds."] -pub struct MlGetDatafeeds<'a, 'b> { +pub struct MlGetCalendars<'a, 'b, B> { transport: &'a Transport, - parts: MlGetDatafeedsParts<'b>, - allow_no_datafeeds: Option, - allow_no_match: Option, + parts: MlGetCalendarsParts<'b>, + body: Option, error_trace: Option, filter_path: Option<&'b [&'b str]>, + from: Option, headers: HeaderMap, human: Option, pretty: Option, request_timeout: Option, + size: Option, source: Option<&'b str>, } -impl<'a, 'b> MlGetDatafeeds<'a, 'b> { - #[doc = "Creates a new instance of [MlGetDatafeeds] with the specified API parts"] - pub fn new(transport: &'a Transport, parts: MlGetDatafeedsParts<'b>) -> Self { +impl<'a, 'b, B> MlGetCalendars<'a, 'b, B> +where + B: Body, +{ + #[doc = "Creates a new instance of [MlGetCalendars] with the specified API parts"] + pub fn new(transport: &'a Transport, parts: MlGetCalendarsParts<'b>) -> Self { let headers = HeaderMap::new(); - MlGetDatafeeds { + MlGetCalendars { transport, parts, headers, - allow_no_datafeeds: None, - allow_no_match: None, + body: None, error_trace: None, filter_path: None, + from: None, human: None, pretty: None, request_timeout: None, + size: None, source: None, } } - #[doc = "Whether to ignore if a wildcard expression matches no datafeeds. (This includes `_all` string or when no datafeeds have been specified)"] - pub fn allow_no_datafeeds(mut self, allow_no_datafeeds: bool) -> Self { - self.allow_no_datafeeds = Some(allow_no_datafeeds); - self - } - #[doc = "Whether to ignore if a wildcard expression matches no datafeeds. (This includes `_all` string or when no datafeeds have been specified)"] - pub fn allow_no_match(mut self, allow_no_match: bool) -> Self { - self.allow_no_match = Some(allow_no_match); - self + #[doc = "The body for the API call"] + pub fn body(self, body: T) -> MlGetCalendars<'a, 'b, JsonBody> + where + T: Serialize, + { + MlGetCalendars { + transport: self.transport, + parts: self.parts, + body: Some(body.into()), + error_trace: self.error_trace, + filter_path: self.filter_path, + from: self.from, + headers: self.headers, + human: self.human, + pretty: self.pretty, + request_timeout: self.request_timeout, + size: self.size, + source: self.source, + } } #[doc = "Include the stack trace of returned errors."] pub fn error_trace(mut self, error_trace: bool) -> Self { @@ -2921,6 +2993,11 @@ impl<'a, 'b> MlGetDatafeeds<'a, 'b> { self.filter_path = Some(filter_path); self } + #[doc = "skips a number of calendars"] + pub fn from(mut self, from: i32) -> Self { + self.from = Some(from); + self + } #[doc = "Adds a HTTP header"] pub fn header(mut self, key: HeaderName, value: HeaderValue) -> Self { self.headers.insert(key, value); @@ -2941,42 +3018,50 @@ impl<'a, 'b> MlGetDatafeeds<'a, 'b> { self.request_timeout = Some(timeout); self } + #[doc = "specifies a max number of calendars to get"] + pub fn size(mut self, size: i32) -> Self { + self.size = Some(size); + self + } #[doc = "The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests."] pub fn source(mut self, source: &'b str) -> Self { self.source = Some(source); self } - #[doc = "Creates an asynchronous call to the Ml Get Datafeeds API that can be awaited"] + #[doc = "Creates an asynchronous call to the Ml Get Calendars API that can be awaited"] pub async fn send(self) -> Result { let path = self.parts.url(); - let method = Method::Get; - let headers = self.headers; - let timeout = self.request_timeout; - let query_string = { + let method = match self.body { + Some(_) => Method::Post, + None => Method::Get, + }; + let headers = self.headers; + let timeout = self.request_timeout; + let query_string = { #[serde_with::skip_serializing_none] #[derive(Serialize)] struct QueryParams<'b> { - allow_no_datafeeds: Option, - allow_no_match: Option, error_trace: Option, #[serde(serialize_with = "crate::client::serialize_coll_qs")] filter_path: Option<&'b [&'b str]>, + from: Option, human: Option, pretty: Option, + size: Option, source: Option<&'b str>, } let query_params = QueryParams { - allow_no_datafeeds: self.allow_no_datafeeds, - allow_no_match: self.allow_no_match, error_trace: self.error_trace, filter_path: self.filter_path, + from: self.from, human: self.human, pretty: self.pretty, + size: self.size, source: self.source, }; Some(query_params) }; - let body = Option::<()>::None; + let body = self.body; let response = self .transport .send(method, &path, headers, query_string.as_ref(), body, timeout) @@ -2985,62 +3070,105 @@ impl<'a, 'b> MlGetDatafeeds<'a, 'b> { } } #[derive(Debug, Clone, PartialEq)] -#[doc = "API parts for the Ml Get Filters API"] -pub enum MlGetFiltersParts<'b> { - #[doc = "No parts"] - None, - #[doc = "FilterId"] - FilterId(&'b str), +#[doc = "API parts for the Ml Get Categories API"] +pub enum MlGetCategoriesParts<'b> { + #[doc = "JobId and CategoryId"] + JobIdCategoryId(&'b str, i64), + #[doc = "JobId"] + JobId(&'b str), } -impl<'b> MlGetFiltersParts<'b> { - #[doc = "Builds a relative URL path to the Ml Get Filters API"] +impl<'b> MlGetCategoriesParts<'b> { + #[doc = "Builds a relative URL path to the Ml Get Categories API"] pub fn url(self) -> Cow<'static, str> { match self { - MlGetFiltersParts::None => "/_ml/filters".into(), - MlGetFiltersParts::FilterId(ref filter_id) => { - let encoded_filter_id: Cow = - percent_encode(filter_id.as_bytes(), PARTS_ENCODED).into(); - let mut p = String::with_capacity(13usize + encoded_filter_id.len()); - p.push_str("/_ml/filters/"); - p.push_str(encoded_filter_id.as_ref()); + MlGetCategoriesParts::JobIdCategoryId(ref job_id, ref category_id) => { + let category_id_str = category_id.to_string(); + let encoded_job_id: Cow = + percent_encode(job_id.as_bytes(), PARTS_ENCODED).into(); + let encoded_category_id: Cow = + percent_encode(category_id_str.as_bytes(), PARTS_ENCODED).into(); + let mut p = String::with_capacity( + 43usize + encoded_job_id.len() + encoded_category_id.len(), + ); + p.push_str("/_ml/anomaly_detectors/"); + p.push_str(encoded_job_id.as_ref()); + p.push_str("/results/categories/"); + p.push_str(encoded_category_id.as_ref()); + p.into() + } + MlGetCategoriesParts::JobId(ref job_id) => { + let encoded_job_id: Cow = + percent_encode(job_id.as_bytes(), PARTS_ENCODED).into(); + let mut p = String::with_capacity(43usize + encoded_job_id.len()); + p.push_str("/_ml/anomaly_detectors/"); + p.push_str(encoded_job_id.as_ref()); + p.push_str("/results/categories/"); p.into() } } } } +#[doc = "Builder for the [Ml Get Categories API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/ml-get-category.html)\n\nRetrieves anomaly detection job results for one or more categories."] #[derive(Clone, Debug)] -#[doc = "Builder for the [Ml Get Filters API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/ml-get-filter.html)\n\nRetrieves filters."] -pub struct MlGetFilters<'a, 'b> { +pub struct MlGetCategories<'a, 'b, B> { transport: &'a Transport, - parts: MlGetFiltersParts<'b>, + parts: MlGetCategoriesParts<'b>, + body: Option, error_trace: Option, filter_path: Option<&'b [&'b str]>, from: Option, headers: HeaderMap, human: Option, + partition_field_value: Option<&'b str>, pretty: Option, request_timeout: Option, size: Option, source: Option<&'b str>, } -impl<'a, 'b> MlGetFilters<'a, 'b> { - #[doc = "Creates a new instance of [MlGetFilters] with the specified API parts"] - pub fn new(transport: &'a Transport, parts: MlGetFiltersParts<'b>) -> Self { +impl<'a, 'b, B> MlGetCategories<'a, 'b, B> +where + B: Body, +{ + #[doc = "Creates a new instance of [MlGetCategories] with the specified API parts"] + pub fn new(transport: &'a Transport, parts: MlGetCategoriesParts<'b>) -> Self { let headers = HeaderMap::new(); - MlGetFilters { + MlGetCategories { transport, parts, headers, + body: None, error_trace: None, filter_path: None, from: None, human: None, + partition_field_value: None, pretty: None, request_timeout: None, size: None, source: None, } } + #[doc = "The body for the API call"] + pub fn body(self, body: T) -> MlGetCategories<'a, 'b, JsonBody> + where + T: Serialize, + { + MlGetCategories { + transport: self.transport, + parts: self.parts, + body: Some(body.into()), + error_trace: self.error_trace, + filter_path: self.filter_path, + from: self.from, + headers: self.headers, + human: self.human, + partition_field_value: self.partition_field_value, + pretty: self.pretty, + request_timeout: self.request_timeout, + size: self.size, + source: self.source, + } + } #[doc = "Include the stack trace of returned errors."] pub fn error_trace(mut self, error_trace: bool) -> Self { self.error_trace = Some(error_trace); @@ -3051,7 +3179,7 @@ impl<'a, 'b> MlGetFilters<'a, 'b> { self.filter_path = Some(filter_path); self } - #[doc = "skips a number of filters"] + #[doc = "skips a number of categories"] pub fn from(mut self, from: i32) -> Self { self.from = Some(from); self @@ -3066,6 +3194,11 @@ impl<'a, 'b> MlGetFilters<'a, 'b> { self.human = Some(human); self } + #[doc = "Specifies the partition to retrieve categories for. This is optional, and should never be used for jobs where per-partition categorization is disabled."] + pub fn partition_field_value(mut self, partition_field_value: &'b str) -> Self { + self.partition_field_value = Some(partition_field_value); + self + } #[doc = "Pretty format the returned JSON response."] pub fn pretty(mut self, pretty: bool) -> Self { self.pretty = Some(pretty); @@ -3076,7 +3209,7 @@ impl<'a, 'b> MlGetFilters<'a, 'b> { self.request_timeout = Some(timeout); self } - #[doc = "specifies a max number of filters to get"] + #[doc = "specifies a max number of categories to get"] pub fn size(mut self, size: i32) -> Self { self.size = Some(size); self @@ -3086,10 +3219,13 @@ impl<'a, 'b> MlGetFilters<'a, 'b> { self.source = Some(source); self } - #[doc = "Creates an asynchronous call to the Ml Get Filters API that can be awaited"] + #[doc = "Creates an asynchronous call to the Ml Get Categories API that can be awaited"] pub async fn send(self) -> Result { let path = self.parts.url(); - let method = Method::Get; + let method = match self.body { + Some(_) => Method::Post, + None => Method::Get, + }; let headers = self.headers; let timeout = self.request_timeout; let query_string = { @@ -3101,6 +3237,7 @@ impl<'a, 'b> MlGetFilters<'a, 'b> { filter_path: Option<&'b [&'b str]>, from: Option, human: Option, + partition_field_value: Option<&'b str>, pretty: Option, size: Option, source: Option<&'b str>, @@ -3110,13 +3247,14 @@ impl<'a, 'b> MlGetFilters<'a, 'b> { filter_path: self.filter_path, from: self.from, human: self.human, + partition_field_value: self.partition_field_value, pretty: self.pretty, size: self.size, source: self.source, }; Some(query_params) }; - let body = Option::<()>::None; + let body = self.body; let response = self .transport .send(method, &path, headers, query_string.as_ref(), body, timeout) @@ -3124,112 +3262,74 @@ impl<'a, 'b> MlGetFilters<'a, 'b> { Ok(response) } } +#[cfg(feature = "beta-apis")] #[derive(Debug, Clone, PartialEq)] -#[doc = "API parts for the Ml Get Influencers API"] -pub enum MlGetInfluencersParts<'b> { - #[doc = "JobId"] - JobId(&'b str), +#[doc = "API parts for the Ml Get Data Frame Analytics API"] +pub enum MlGetDataFrameAnalyticsParts<'b> { + #[doc = "Id"] + Id(&'b str), + #[doc = "No parts"] + None, } -impl<'b> MlGetInfluencersParts<'b> { - #[doc = "Builds a relative URL path to the Ml Get Influencers API"] +#[cfg(feature = "beta-apis")] +impl<'b> MlGetDataFrameAnalyticsParts<'b> { + #[doc = "Builds a relative URL path to the Ml Get Data Frame Analytics API"] pub fn url(self) -> Cow<'static, str> { match self { - MlGetInfluencersParts::JobId(ref job_id) => { - let encoded_job_id: Cow = - percent_encode(job_id.as_bytes(), PARTS_ENCODED).into(); - let mut p = String::with_capacity(43usize + encoded_job_id.len()); - p.push_str("/_ml/anomaly_detectors/"); - p.push_str(encoded_job_id.as_ref()); - p.push_str("/results/influencers"); + MlGetDataFrameAnalyticsParts::Id(ref id) => { + let encoded_id: Cow = percent_encode(id.as_bytes(), PARTS_ENCODED).into(); + let mut p = String::with_capacity(26usize + encoded_id.len()); + p.push_str("/_ml/data_frame/analytics/"); + p.push_str(encoded_id.as_ref()); p.into() } + MlGetDataFrameAnalyticsParts::None => "/_ml/data_frame/analytics".into(), } } } +#[doc = "Builder for the [Ml Get Data Frame Analytics API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/get-dfanalytics.html)\n\nRetrieves configuration information for data frame analytics jobs."] +#[doc = " \n# Optional, beta\nThis requires the `beta-apis` feature. On track to become stable but breaking changes can\nhappen in minor versions.\n "] +#[cfg(feature = "beta-apis")] #[derive(Clone, Debug)] -#[doc = "Builder for the [Ml Get Influencers API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/ml-get-influencer.html)\n\nRetrieves anomaly detection job results for one or more influencers."] -pub struct MlGetInfluencers<'a, 'b, B> { +pub struct MlGetDataFrameAnalytics<'a, 'b> { transport: &'a Transport, - parts: MlGetInfluencersParts<'b>, - body: Option, - desc: Option, - end: Option<&'b str>, + parts: MlGetDataFrameAnalyticsParts<'b>, + allow_no_match: Option, error_trace: Option, - exclude_interim: Option, + exclude_generated: Option, filter_path: Option<&'b [&'b str]>, from: Option, headers: HeaderMap, human: Option, - influencer_score: Option, pretty: Option, request_timeout: Option, size: Option, - sort: Option<&'b str>, source: Option<&'b str>, - start: Option<&'b str>, } -impl<'a, 'b, B> MlGetInfluencers<'a, 'b, B> -where - B: Body, -{ - #[doc = "Creates a new instance of [MlGetInfluencers] with the specified API parts"] - pub fn new(transport: &'a Transport, parts: MlGetInfluencersParts<'b>) -> Self { +#[cfg(feature = "beta-apis")] +impl<'a, 'b> MlGetDataFrameAnalytics<'a, 'b> { + #[doc = "Creates a new instance of [MlGetDataFrameAnalytics] with the specified API parts"] + pub fn new(transport: &'a Transport, parts: MlGetDataFrameAnalyticsParts<'b>) -> Self { let headers = HeaderMap::new(); - MlGetInfluencers { + MlGetDataFrameAnalytics { transport, parts, headers, - body: None, - desc: None, - end: None, + allow_no_match: None, error_trace: None, - exclude_interim: None, + exclude_generated: None, filter_path: None, from: None, human: None, - influencer_score: None, pretty: None, request_timeout: None, size: None, - sort: None, source: None, - start: None, - } - } - #[doc = "The body for the API call"] - pub fn body(self, body: T) -> MlGetInfluencers<'a, 'b, JsonBody> - where - T: Serialize, - { - MlGetInfluencers { - transport: self.transport, - parts: self.parts, - body: Some(body.into()), - desc: self.desc, - end: self.end, - error_trace: self.error_trace, - exclude_interim: self.exclude_interim, - filter_path: self.filter_path, - from: self.from, - headers: self.headers, - human: self.human, - influencer_score: self.influencer_score, - pretty: self.pretty, - request_timeout: self.request_timeout, - size: self.size, - sort: self.sort, - source: self.source, - start: self.start, } } - #[doc = "whether the results should be sorted in decending order"] - pub fn desc(mut self, desc: bool) -> Self { - self.desc = Some(desc); - self - } - #[doc = "end timestamp for the requested influencers"] - pub fn end(mut self, end: &'b str) -> Self { - self.end = Some(end); + #[doc = "Whether to ignore if a wildcard expression matches no data frame analytics. (This includes `_all` string or when no data frame analytics have been specified)"] + pub fn allow_no_match(mut self, allow_no_match: bool) -> Self { + self.allow_no_match = Some(allow_no_match); self } #[doc = "Include the stack trace of returned errors."] @@ -3237,9 +3337,9 @@ where self.error_trace = Some(error_trace); self } - #[doc = "Exclude interim results"] - pub fn exclude_interim(mut self, exclude_interim: bool) -> Self { - self.exclude_interim = Some(exclude_interim); + #[doc = "Omits fields that are illegal to set on data frame analytics PUT"] + pub fn exclude_generated(mut self, exclude_generated: bool) -> Self { + self.exclude_generated = Some(exclude_generated); self } #[doc = "A comma-separated list of filters used to reduce the response."] @@ -3247,7 +3347,7 @@ where self.filter_path = Some(filter_path); self } - #[doc = "skips a number of influencers"] + #[doc = "skips a number of analytics"] pub fn from(mut self, from: i32) -> Self { self.from = Some(from); self @@ -3262,11 +3362,6 @@ where self.human = Some(human); self } - #[doc = "influencer score threshold for the requested influencers"] - pub fn influencer_score(mut self, influencer_score: f64) -> Self { - self.influencer_score = Some(influencer_score); - self - } #[doc = "Pretty format the returned JSON response."] pub fn pretty(mut self, pretty: bool) -> Self { self.pretty = Some(pretty); @@ -3277,72 +3372,51 @@ where self.request_timeout = Some(timeout); self } - #[doc = "specifies a max number of influencers to get"] + #[doc = "specifies a max number of analytics to get"] pub fn size(mut self, size: i32) -> Self { self.size = Some(size); self } - #[doc = "sort field for the requested influencers"] - pub fn sort(mut self, sort: &'b str) -> Self { - self.sort = Some(sort); - self - } #[doc = "The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests."] pub fn source(mut self, source: &'b str) -> Self { self.source = Some(source); self } - #[doc = "start timestamp for the requested influencers"] - pub fn start(mut self, start: &'b str) -> Self { - self.start = Some(start); - self - } - #[doc = "Creates an asynchronous call to the Ml Get Influencers API that can be awaited"] + #[doc = "Creates an asynchronous call to the Ml Get Data Frame Analytics API that can be awaited"] pub async fn send(self) -> Result { let path = self.parts.url(); - let method = match self.body { - Some(_) => Method::Post, - None => Method::Get, - }; + let method = Method::Get; let headers = self.headers; let timeout = self.request_timeout; let query_string = { #[serde_with::skip_serializing_none] #[derive(Serialize)] struct QueryParams<'b> { - desc: Option, - end: Option<&'b str>, + allow_no_match: Option, error_trace: Option, - exclude_interim: Option, + exclude_generated: Option, #[serde(serialize_with = "crate::client::serialize_coll_qs")] filter_path: Option<&'b [&'b str]>, from: Option, human: Option, - influencer_score: Option, pretty: Option, size: Option, - sort: Option<&'b str>, source: Option<&'b str>, - start: Option<&'b str>, } let query_params = QueryParams { - desc: self.desc, - end: self.end, + allow_no_match: self.allow_no_match, error_trace: self.error_trace, - exclude_interim: self.exclude_interim, + exclude_generated: self.exclude_generated, filter_path: self.filter_path, from: self.from, human: self.human, - influencer_score: self.influencer_score, pretty: self.pretty, size: self.size, - sort: self.sort, source: self.source, - start: self.start, }; Some(query_params) }; - let body = self.body; + let body = Option::<()>::None; let response = self .transport .send(method, &path, headers, query_string.as_ref(), body, timeout) @@ -3350,70 +3424,73 @@ where Ok(response) } } +#[cfg(feature = "beta-apis")] #[derive(Debug, Clone, PartialEq)] -#[doc = "API parts for the Ml Get Job Stats API"] -pub enum MlGetJobStatsParts<'b> { +#[doc = "API parts for the Ml Get Data Frame Analytics Stats API"] +pub enum MlGetDataFrameAnalyticsStatsParts<'b> { #[doc = "No parts"] None, - #[doc = "JobId"] - JobId(&'b str), + #[doc = "Id"] + Id(&'b str), } -impl<'b> MlGetJobStatsParts<'b> { - #[doc = "Builds a relative URL path to the Ml Get Job Stats API"] +#[cfg(feature = "beta-apis")] +impl<'b> MlGetDataFrameAnalyticsStatsParts<'b> { + #[doc = "Builds a relative URL path to the Ml Get Data Frame Analytics Stats API"] pub fn url(self) -> Cow<'static, str> { match self { - MlGetJobStatsParts::None => "/_ml/anomaly_detectors/_stats".into(), - MlGetJobStatsParts::JobId(ref job_id) => { - let encoded_job_id: Cow = - percent_encode(job_id.as_bytes(), PARTS_ENCODED).into(); - let mut p = String::with_capacity(30usize + encoded_job_id.len()); - p.push_str("/_ml/anomaly_detectors/"); - p.push_str(encoded_job_id.as_ref()); + MlGetDataFrameAnalyticsStatsParts::None => "/_ml/data_frame/analytics/_stats".into(), + MlGetDataFrameAnalyticsStatsParts::Id(ref id) => { + let encoded_id: Cow = percent_encode(id.as_bytes(), PARTS_ENCODED).into(); + let mut p = String::with_capacity(33usize + encoded_id.len()); + p.push_str("/_ml/data_frame/analytics/"); + p.push_str(encoded_id.as_ref()); p.push_str("/_stats"); p.into() } } } } +#[doc = "Builder for the [Ml Get Data Frame Analytics Stats API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/get-dfanalytics-stats.html)\n\nRetrieves usage information for data frame analytics jobs."] +#[doc = " \n# Optional, beta\nThis requires the `beta-apis` feature. On track to become stable but breaking changes can\nhappen in minor versions.\n "] +#[cfg(feature = "beta-apis")] #[derive(Clone, Debug)] -#[doc = "Builder for the [Ml Get Job Stats API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/ml-get-job-stats.html)\n\nRetrieves usage information for anomaly detection jobs."] -pub struct MlGetJobStats<'a, 'b> { +pub struct MlGetDataFrameAnalyticsStats<'a, 'b> { transport: &'a Transport, - parts: MlGetJobStatsParts<'b>, - allow_no_jobs: Option, + parts: MlGetDataFrameAnalyticsStatsParts<'b>, allow_no_match: Option, error_trace: Option, filter_path: Option<&'b [&'b str]>, + from: Option, headers: HeaderMap, human: Option, pretty: Option, request_timeout: Option, + size: Option, source: Option<&'b str>, + verbose: Option, } -impl<'a, 'b> MlGetJobStats<'a, 'b> { - #[doc = "Creates a new instance of [MlGetJobStats] with the specified API parts"] - pub fn new(transport: &'a Transport, parts: MlGetJobStatsParts<'b>) -> Self { +#[cfg(feature = "beta-apis")] +impl<'a, 'b> MlGetDataFrameAnalyticsStats<'a, 'b> { + #[doc = "Creates a new instance of [MlGetDataFrameAnalyticsStats] with the specified API parts"] + pub fn new(transport: &'a Transport, parts: MlGetDataFrameAnalyticsStatsParts<'b>) -> Self { let headers = HeaderMap::new(); - MlGetJobStats { + MlGetDataFrameAnalyticsStats { transport, parts, headers, - allow_no_jobs: None, allow_no_match: None, error_trace: None, filter_path: None, + from: None, human: None, pretty: None, request_timeout: None, + size: None, source: None, + verbose: None, } } - #[doc = "Whether to ignore if a wildcard expression matches no jobs. (This includes `_all` string or when no jobs have been specified)"] - pub fn allow_no_jobs(mut self, allow_no_jobs: bool) -> Self { - self.allow_no_jobs = Some(allow_no_jobs); - self - } - #[doc = "Whether to ignore if a wildcard expression matches no jobs. (This includes `_all` string or when no jobs have been specified)"] + #[doc = "Whether to ignore if a wildcard expression matches no data frame analytics. (This includes `_all` string or when no data frame analytics have been specified)"] pub fn allow_no_match(mut self, allow_no_match: bool) -> Self { self.allow_no_match = Some(allow_no_match); self @@ -3428,6 +3505,11 @@ impl<'a, 'b> MlGetJobStats<'a, 'b> { self.filter_path = Some(filter_path); self } + #[doc = "skips a number of analytics"] + pub fn from(mut self, from: i32) -> Self { + self.from = Some(from); + self + } #[doc = "Adds a HTTP header"] pub fn header(mut self, key: HeaderName, value: HeaderValue) -> Self { self.headers.insert(key, value); @@ -3448,12 +3530,22 @@ impl<'a, 'b> MlGetJobStats<'a, 'b> { self.request_timeout = Some(timeout); self } + #[doc = "specifies a max number of analytics to get"] + pub fn size(mut self, size: i32) -> Self { + self.size = Some(size); + self + } #[doc = "The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests."] pub fn source(mut self, source: &'b str) -> Self { self.source = Some(source); self } - #[doc = "Creates an asynchronous call to the Ml Get Job Stats API that can be awaited"] + #[doc = "whether the stats response should be verbose"] + pub fn verbose(mut self, verbose: bool) -> Self { + self.verbose = Some(verbose); + self + } + #[doc = "Creates an asynchronous call to the Ml Get Data Frame Analytics Stats API that can be awaited"] pub async fn send(self) -> Result { let path = self.parts.url(); let method = Method::Get; @@ -3463,23 +3555,27 @@ impl<'a, 'b> MlGetJobStats<'a, 'b> { #[serde_with::skip_serializing_none] #[derive(Serialize)] struct QueryParams<'b> { - allow_no_jobs: Option, allow_no_match: Option, error_trace: Option, #[serde(serialize_with = "crate::client::serialize_coll_qs")] filter_path: Option<&'b [&'b str]>, + from: Option, human: Option, pretty: Option, + size: Option, source: Option<&'b str>, + verbose: Option, } let query_params = QueryParams { - allow_no_jobs: self.allow_no_jobs, allow_no_match: self.allow_no_match, error_trace: self.error_trace, filter_path: self.filter_path, + from: self.from, human: self.human, pretty: self.pretty, + size: self.size, source: self.source, + verbose: self.verbose, }; Some(query_params) }; @@ -3492,35 +3588,36 @@ impl<'a, 'b> MlGetJobStats<'a, 'b> { } } #[derive(Debug, Clone, PartialEq)] -#[doc = "API parts for the Ml Get Jobs API"] -pub enum MlGetJobsParts<'b> { - #[doc = "JobId"] - JobId(&'b str), +#[doc = "API parts for the Ml Get Datafeed Stats API"] +pub enum MlGetDatafeedStatsParts<'b> { + #[doc = "DatafeedId"] + DatafeedId(&'b str), #[doc = "No parts"] None, } -impl<'b> MlGetJobsParts<'b> { - #[doc = "Builds a relative URL path to the Ml Get Jobs API"] +impl<'b> MlGetDatafeedStatsParts<'b> { + #[doc = "Builds a relative URL path to the Ml Get Datafeed Stats API"] pub fn url(self) -> Cow<'static, str> { match self { - MlGetJobsParts::JobId(ref job_id) => { - let encoded_job_id: Cow = - percent_encode(job_id.as_bytes(), PARTS_ENCODED).into(); - let mut p = String::with_capacity(23usize + encoded_job_id.len()); - p.push_str("/_ml/anomaly_detectors/"); - p.push_str(encoded_job_id.as_ref()); + MlGetDatafeedStatsParts::DatafeedId(ref datafeed_id) => { + let encoded_datafeed_id: Cow = + percent_encode(datafeed_id.as_bytes(), PARTS_ENCODED).into(); + let mut p = String::with_capacity(22usize + encoded_datafeed_id.len()); + p.push_str("/_ml/datafeeds/"); + p.push_str(encoded_datafeed_id.as_ref()); + p.push_str("/_stats"); p.into() } - MlGetJobsParts::None => "/_ml/anomaly_detectors".into(), + MlGetDatafeedStatsParts::None => "/_ml/datafeeds/_stats".into(), } } } +#[doc = "Builder for the [Ml Get Datafeed Stats API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/ml-get-datafeed-stats.html)\n\nRetrieves usage information for datafeeds."] #[derive(Clone, Debug)] -#[doc = "Builder for the [Ml Get Jobs API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/ml-get-job.html)\n\nRetrieves configuration information for anomaly detection jobs."] -pub struct MlGetJobs<'a, 'b> { +pub struct MlGetDatafeedStats<'a, 'b> { transport: &'a Transport, - parts: MlGetJobsParts<'b>, - allow_no_jobs: Option, + parts: MlGetDatafeedStatsParts<'b>, + allow_no_datafeeds: Option, allow_no_match: Option, error_trace: Option, filter_path: Option<&'b [&'b str]>, @@ -3530,15 +3627,15 @@ pub struct MlGetJobs<'a, 'b> { request_timeout: Option, source: Option<&'b str>, } -impl<'a, 'b> MlGetJobs<'a, 'b> { - #[doc = "Creates a new instance of [MlGetJobs] with the specified API parts"] - pub fn new(transport: &'a Transport, parts: MlGetJobsParts<'b>) -> Self { +impl<'a, 'b> MlGetDatafeedStats<'a, 'b> { + #[doc = "Creates a new instance of [MlGetDatafeedStats] with the specified API parts"] + pub fn new(transport: &'a Transport, parts: MlGetDatafeedStatsParts<'b>) -> Self { let headers = HeaderMap::new(); - MlGetJobs { + MlGetDatafeedStats { transport, parts, headers, - allow_no_jobs: None, + allow_no_datafeeds: None, allow_no_match: None, error_trace: None, filter_path: None, @@ -3548,12 +3645,12 @@ impl<'a, 'b> MlGetJobs<'a, 'b> { source: None, } } - #[doc = "Whether to ignore if a wildcard expression matches no jobs. (This includes `_all` string or when no jobs have been specified)"] - pub fn allow_no_jobs(mut self, allow_no_jobs: bool) -> Self { - self.allow_no_jobs = Some(allow_no_jobs); + #[doc = "Whether to ignore if a wildcard expression matches no datafeeds. (This includes `_all` string or when no datafeeds have been specified)"] + pub fn allow_no_datafeeds(mut self, allow_no_datafeeds: bool) -> Self { + self.allow_no_datafeeds = Some(allow_no_datafeeds); self } - #[doc = "Whether to ignore if a wildcard expression matches no jobs. (This includes `_all` string or when no jobs have been specified)"] + #[doc = "Whether to ignore if a wildcard expression matches no datafeeds. (This includes `_all` string or when no datafeeds have been specified)"] pub fn allow_no_match(mut self, allow_no_match: bool) -> Self { self.allow_no_match = Some(allow_no_match); self @@ -3593,7 +3690,7 @@ impl<'a, 'b> MlGetJobs<'a, 'b> { self.source = Some(source); self } - #[doc = "Creates an asynchronous call to the Ml Get Jobs API that can be awaited"] + #[doc = "Creates an asynchronous call to the Ml Get Datafeed Stats API that can be awaited"] pub async fn send(self) -> Result { let path = self.parts.url(); let method = Method::Get; @@ -3603,7 +3700,7 @@ impl<'a, 'b> MlGetJobs<'a, 'b> { #[serde_with::skip_serializing_none] #[derive(Serialize)] struct QueryParams<'b> { - allow_no_jobs: Option, + allow_no_datafeeds: Option, allow_no_match: Option, error_trace: Option, #[serde(serialize_with = "crate::client::serialize_coll_qs")] @@ -3613,7 +3710,7 @@ impl<'a, 'b> MlGetJobs<'a, 'b> { source: Option<&'b str>, } let query_params = QueryParams { - allow_no_jobs: self.allow_no_jobs, + allow_no_datafeeds: self.allow_no_datafeeds, allow_no_match: self.allow_no_match, error_trace: self.error_trace, filter_path: self.filter_path, @@ -3632,121 +3729,72 @@ impl<'a, 'b> MlGetJobs<'a, 'b> { } } #[derive(Debug, Clone, PartialEq)] -#[doc = "API parts for the Ml Get Model Snapshots API"] -pub enum MlGetModelSnapshotsParts<'b> { - #[doc = "JobId and SnapshotId"] - JobIdSnapshotId(&'b str, &'b str), - #[doc = "JobId"] - JobId(&'b str), +#[doc = "API parts for the Ml Get Datafeeds API"] +pub enum MlGetDatafeedsParts<'b> { + #[doc = "DatafeedId"] + DatafeedId(&'b str), + #[doc = "No parts"] + None, } -impl<'b> MlGetModelSnapshotsParts<'b> { - #[doc = "Builds a relative URL path to the Ml Get Model Snapshots API"] +impl<'b> MlGetDatafeedsParts<'b> { + #[doc = "Builds a relative URL path to the Ml Get Datafeeds API"] pub fn url(self) -> Cow<'static, str> { match self { - MlGetModelSnapshotsParts::JobIdSnapshotId(ref job_id, ref snapshot_id) => { - let encoded_job_id: Cow = - percent_encode(job_id.as_bytes(), PARTS_ENCODED).into(); - let encoded_snapshot_id: Cow = - percent_encode(snapshot_id.as_bytes(), PARTS_ENCODED).into(); - let mut p = String::with_capacity( - 40usize + encoded_job_id.len() + encoded_snapshot_id.len(), - ); - p.push_str("/_ml/anomaly_detectors/"); - p.push_str(encoded_job_id.as_ref()); - p.push_str("/model_snapshots/"); - p.push_str(encoded_snapshot_id.as_ref()); - p.into() - } - MlGetModelSnapshotsParts::JobId(ref job_id) => { - let encoded_job_id: Cow = - percent_encode(job_id.as_bytes(), PARTS_ENCODED).into(); - let mut p = String::with_capacity(39usize + encoded_job_id.len()); - p.push_str("/_ml/anomaly_detectors/"); - p.push_str(encoded_job_id.as_ref()); - p.push_str("/model_snapshots"); + MlGetDatafeedsParts::DatafeedId(ref datafeed_id) => { + let encoded_datafeed_id: Cow = + percent_encode(datafeed_id.as_bytes(), PARTS_ENCODED).into(); + let mut p = String::with_capacity(15usize + encoded_datafeed_id.len()); + p.push_str("/_ml/datafeeds/"); + p.push_str(encoded_datafeed_id.as_ref()); p.into() } + MlGetDatafeedsParts::None => "/_ml/datafeeds".into(), } } } +#[doc = "Builder for the [Ml Get Datafeeds API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/ml-get-datafeed.html)\n\nRetrieves configuration information for datafeeds."] #[derive(Clone, Debug)] -#[doc = "Builder for the [Ml Get Model Snapshots API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/ml-get-snapshot.html)\n\nRetrieves information about model snapshots."] -pub struct MlGetModelSnapshots<'a, 'b, B> { +pub struct MlGetDatafeeds<'a, 'b> { transport: &'a Transport, - parts: MlGetModelSnapshotsParts<'b>, - body: Option, - desc: Option, - end: Option<&'b str>, + parts: MlGetDatafeedsParts<'b>, + allow_no_datafeeds: Option, + allow_no_match: Option, error_trace: Option, + exclude_generated: Option, filter_path: Option<&'b [&'b str]>, - from: Option, headers: HeaderMap, human: Option, pretty: Option, request_timeout: Option, - size: Option, - sort: Option<&'b str>, source: Option<&'b str>, - start: Option<&'b str>, } -impl<'a, 'b, B> MlGetModelSnapshots<'a, 'b, B> -where - B: Body, -{ - #[doc = "Creates a new instance of [MlGetModelSnapshots] with the specified API parts"] - pub fn new(transport: &'a Transport, parts: MlGetModelSnapshotsParts<'b>) -> Self { +impl<'a, 'b> MlGetDatafeeds<'a, 'b> { + #[doc = "Creates a new instance of [MlGetDatafeeds] with the specified API parts"] + pub fn new(transport: &'a Transport, parts: MlGetDatafeedsParts<'b>) -> Self { let headers = HeaderMap::new(); - MlGetModelSnapshots { + MlGetDatafeeds { transport, parts, headers, - body: None, - desc: None, - end: None, + allow_no_datafeeds: None, + allow_no_match: None, error_trace: None, + exclude_generated: None, filter_path: None, - from: None, human: None, pretty: None, request_timeout: None, - size: None, - sort: None, source: None, - start: None, - } - } - #[doc = "The body for the API call"] - pub fn body(self, body: T) -> MlGetModelSnapshots<'a, 'b, JsonBody> - where - T: Serialize, - { - MlGetModelSnapshots { - transport: self.transport, - parts: self.parts, - body: Some(body.into()), - desc: self.desc, - end: self.end, - error_trace: self.error_trace, - filter_path: self.filter_path, - from: self.from, - headers: self.headers, - human: self.human, - pretty: self.pretty, - request_timeout: self.request_timeout, - size: self.size, - sort: self.sort, - source: self.source, - start: self.start, } } - #[doc = "True if the results should be sorted in descending order"] - pub fn desc(mut self, desc: bool) -> Self { - self.desc = Some(desc); + #[doc = "Whether to ignore if a wildcard expression matches no datafeeds. (This includes `_all` string or when no datafeeds have been specified)"] + pub fn allow_no_datafeeds(mut self, allow_no_datafeeds: bool) -> Self { + self.allow_no_datafeeds = Some(allow_no_datafeeds); self } - #[doc = "The filter 'end' query parameter"] - pub fn end(mut self, end: &'b str) -> Self { - self.end = Some(end); + #[doc = "Whether to ignore if a wildcard expression matches no datafeeds. (This includes `_all` string or when no datafeeds have been specified)"] + pub fn allow_no_match(mut self, allow_no_match: bool) -> Self { + self.allow_no_match = Some(allow_no_match); self } #[doc = "Include the stack trace of returned errors."] @@ -3754,16 +3802,16 @@ where self.error_trace = Some(error_trace); self } + #[doc = "Omits fields that are illegal to set on datafeed PUT"] + pub fn exclude_generated(mut self, exclude_generated: bool) -> Self { + self.exclude_generated = Some(exclude_generated); + self + } #[doc = "A comma-separated list of filters used to reduce the response."] pub fn filter_path(mut self, filter_path: &'b [&'b str]) -> Self { self.filter_path = Some(filter_path); self } - #[doc = "Skips a number of documents"] - pub fn from(mut self, from: i32) -> Self { - self.from = Some(from); - self - } #[doc = "Adds a HTTP header"] pub fn header(mut self, key: HeaderName, value: HeaderValue) -> Self { self.headers.insert(key, value); @@ -3784,68 +3832,44 @@ where self.request_timeout = Some(timeout); self } - #[doc = "The default number of documents returned in queries as a string."] - pub fn size(mut self, size: i32) -> Self { - self.size = Some(size); - self - } - #[doc = "Name of the field to sort on"] - pub fn sort(mut self, sort: &'b str) -> Self { - self.sort = Some(sort); - self - } #[doc = "The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests."] pub fn source(mut self, source: &'b str) -> Self { self.source = Some(source); self } - #[doc = "The filter 'start' query parameter"] - pub fn start(mut self, start: &'b str) -> Self { - self.start = Some(start); - self - } - #[doc = "Creates an asynchronous call to the Ml Get Model Snapshots API that can be awaited"] + #[doc = "Creates an asynchronous call to the Ml Get Datafeeds API that can be awaited"] pub async fn send(self) -> Result { let path = self.parts.url(); - let method = match self.body { - Some(_) => Method::Post, - None => Method::Get, - }; + let method = Method::Get; let headers = self.headers; let timeout = self.request_timeout; let query_string = { #[serde_with::skip_serializing_none] #[derive(Serialize)] struct QueryParams<'b> { - desc: Option, - end: Option<&'b str>, + allow_no_datafeeds: Option, + allow_no_match: Option, error_trace: Option, + exclude_generated: Option, #[serde(serialize_with = "crate::client::serialize_coll_qs")] filter_path: Option<&'b [&'b str]>, - from: Option, human: Option, pretty: Option, - size: Option, - sort: Option<&'b str>, source: Option<&'b str>, - start: Option<&'b str>, } let query_params = QueryParams { - desc: self.desc, - end: self.end, + allow_no_datafeeds: self.allow_no_datafeeds, + allow_no_match: self.allow_no_match, error_trace: self.error_trace, + exclude_generated: self.exclude_generated, filter_path: self.filter_path, - from: self.from, human: self.human, pretty: self.pretty, - size: self.size, - sort: self.sort, source: self.source, - start: self.start, }; Some(query_params) }; - let body = self.body; + let body = Option::<()>::None; let response = self .transport .send(method, &path, headers, query_string.as_ref(), body, timeout) @@ -3854,138 +3878,77 @@ where } } #[derive(Debug, Clone, PartialEq)] -#[doc = "API parts for the Ml Get Overall Buckets API"] -pub enum MlGetOverallBucketsParts<'b> { - #[doc = "JobId"] - JobId(&'b str), -} -impl<'b> MlGetOverallBucketsParts<'b> { - #[doc = "Builds a relative URL path to the Ml Get Overall Buckets API"] +#[doc = "API parts for the Ml Get Filters API"] +pub enum MlGetFiltersParts<'b> { + #[doc = "No parts"] + None, + #[doc = "FilterId"] + FilterId(&'b str), +} +impl<'b> MlGetFiltersParts<'b> { + #[doc = "Builds a relative URL path to the Ml Get Filters API"] pub fn url(self) -> Cow<'static, str> { match self { - MlGetOverallBucketsParts::JobId(ref job_id) => { - let encoded_job_id: Cow = - percent_encode(job_id.as_bytes(), PARTS_ENCODED).into(); - let mut p = String::with_capacity(47usize + encoded_job_id.len()); - p.push_str("/_ml/anomaly_detectors/"); - p.push_str(encoded_job_id.as_ref()); - p.push_str("/results/overall_buckets"); + MlGetFiltersParts::None => "/_ml/filters".into(), + MlGetFiltersParts::FilterId(ref filter_id) => { + let encoded_filter_id: Cow = + percent_encode(filter_id.as_bytes(), PARTS_ENCODED).into(); + let mut p = String::with_capacity(13usize + encoded_filter_id.len()); + p.push_str("/_ml/filters/"); + p.push_str(encoded_filter_id.as_ref()); p.into() } } } } +#[doc = "Builder for the [Ml Get Filters API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/ml-get-filter.html)\n\nRetrieves filters."] #[derive(Clone, Debug)] -#[doc = "Builder for the [Ml Get Overall Buckets API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/ml-get-overall-buckets.html)\n\nRetrieves overall bucket results that summarize the bucket results of multiple anomaly detection jobs."] -pub struct MlGetOverallBuckets<'a, 'b, B> { +pub struct MlGetFilters<'a, 'b> { transport: &'a Transport, - parts: MlGetOverallBucketsParts<'b>, - allow_no_jobs: Option, - allow_no_match: Option, - body: Option, - bucket_span: Option<&'b str>, - end: Option<&'b str>, + parts: MlGetFiltersParts<'b>, error_trace: Option, - exclude_interim: Option, filter_path: Option<&'b [&'b str]>, + from: Option, headers: HeaderMap, human: Option, - overall_score: Option, pretty: Option, request_timeout: Option, + size: Option, source: Option<&'b str>, - start: Option<&'b str>, - top_n: Option, } -impl<'a, 'b, B> MlGetOverallBuckets<'a, 'b, B> -where - B: Body, -{ - #[doc = "Creates a new instance of [MlGetOverallBuckets] with the specified API parts"] - pub fn new(transport: &'a Transport, parts: MlGetOverallBucketsParts<'b>) -> Self { +impl<'a, 'b> MlGetFilters<'a, 'b> { + #[doc = "Creates a new instance of [MlGetFilters] with the specified API parts"] + pub fn new(transport: &'a Transport, parts: MlGetFiltersParts<'b>) -> Self { let headers = HeaderMap::new(); - MlGetOverallBuckets { + MlGetFilters { transport, parts, headers, - allow_no_jobs: None, - allow_no_match: None, - body: None, - bucket_span: None, - end: None, error_trace: None, - exclude_interim: None, filter_path: None, + from: None, human: None, - overall_score: None, pretty: None, request_timeout: None, + size: None, source: None, - start: None, - top_n: None, - } - } - #[doc = "Whether to ignore if a wildcard expression matches no jobs. (This includes `_all` string or when no jobs have been specified)"] - pub fn allow_no_jobs(mut self, allow_no_jobs: bool) -> Self { - self.allow_no_jobs = Some(allow_no_jobs); - self - } - #[doc = "Whether to ignore if a wildcard expression matches no jobs. (This includes `_all` string or when no jobs have been specified)"] - pub fn allow_no_match(mut self, allow_no_match: bool) -> Self { - self.allow_no_match = Some(allow_no_match); - self - } - #[doc = "The body for the API call"] - pub fn body(self, body: T) -> MlGetOverallBuckets<'a, 'b, JsonBody> - where - T: Serialize, - { - MlGetOverallBuckets { - transport: self.transport, - parts: self.parts, - body: Some(body.into()), - allow_no_jobs: self.allow_no_jobs, - allow_no_match: self.allow_no_match, - bucket_span: self.bucket_span, - end: self.end, - error_trace: self.error_trace, - exclude_interim: self.exclude_interim, - filter_path: self.filter_path, - headers: self.headers, - human: self.human, - overall_score: self.overall_score, - pretty: self.pretty, - request_timeout: self.request_timeout, - source: self.source, - start: self.start, - top_n: self.top_n, } } - #[doc = "The span of the overall buckets. Defaults to the longest job bucket_span"] - pub fn bucket_span(mut self, bucket_span: &'b str) -> Self { - self.bucket_span = Some(bucket_span); - self - } - #[doc = "Returns overall buckets with timestamps earlier than this time"] - pub fn end(mut self, end: &'b str) -> Self { - self.end = Some(end); - self - } #[doc = "Include the stack trace of returned errors."] pub fn error_trace(mut self, error_trace: bool) -> Self { self.error_trace = Some(error_trace); self } - #[doc = "If true overall buckets that include interim buckets will be excluded"] - pub fn exclude_interim(mut self, exclude_interim: bool) -> Self { - self.exclude_interim = Some(exclude_interim); - self - } #[doc = "A comma-separated list of filters used to reduce the response."] pub fn filter_path(mut self, filter_path: &'b [&'b str]) -> Self { self.filter_path = Some(filter_path); self } + #[doc = "skips a number of filters"] + pub fn from(mut self, from: i32) -> Self { + self.from = Some(from); + self + } #[doc = "Adds a HTTP header"] pub fn header(mut self, key: HeaderName, value: HeaderValue) -> Self { self.headers.insert(key, value); @@ -3996,11 +3959,6 @@ where self.human = Some(human); self } - #[doc = "Returns overall buckets with overall scores higher than this value"] - pub fn overall_score(mut self, overall_score: f64) -> Self { - self.overall_score = Some(overall_score); - self - } #[doc = "Pretty format the returned JSON response."] pub fn pretty(mut self, pretty: bool) -> Self { self.pretty = Some(pretty); @@ -4011,67 +3969,47 @@ where self.request_timeout = Some(timeout); self } + #[doc = "specifies a max number of filters to get"] + pub fn size(mut self, size: i32) -> Self { + self.size = Some(size); + self + } #[doc = "The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests."] pub fn source(mut self, source: &'b str) -> Self { self.source = Some(source); self } - #[doc = "Returns overall buckets with timestamps after this time"] - pub fn start(mut self, start: &'b str) -> Self { - self.start = Some(start); - self - } - #[doc = "The number of top job bucket scores to be used in the overall_score calculation"] - pub fn top_n(mut self, top_n: i32) -> Self { - self.top_n = Some(top_n); - self - } - #[doc = "Creates an asynchronous call to the Ml Get Overall Buckets API that can be awaited"] + #[doc = "Creates an asynchronous call to the Ml Get Filters API that can be awaited"] pub async fn send(self) -> Result { let path = self.parts.url(); - let method = match self.body { - Some(_) => Method::Post, - None => Method::Get, - }; + let method = Method::Get; let headers = self.headers; let timeout = self.request_timeout; let query_string = { #[serde_with::skip_serializing_none] #[derive(Serialize)] struct QueryParams<'b> { - allow_no_jobs: Option, - allow_no_match: Option, - bucket_span: Option<&'b str>, - end: Option<&'b str>, error_trace: Option, - exclude_interim: Option, #[serde(serialize_with = "crate::client::serialize_coll_qs")] filter_path: Option<&'b [&'b str]>, + from: Option, human: Option, - overall_score: Option, pretty: Option, + size: Option, source: Option<&'b str>, - start: Option<&'b str>, - top_n: Option, } let query_params = QueryParams { - allow_no_jobs: self.allow_no_jobs, - allow_no_match: self.allow_no_match, - bucket_span: self.bucket_span, - end: self.end, error_trace: self.error_trace, - exclude_interim: self.exclude_interim, filter_path: self.filter_path, + from: self.from, human: self.human, - overall_score: self.overall_score, pretty: self.pretty, + size: self.size, source: self.source, - start: self.start, - top_n: self.top_n, }; Some(query_params) }; - let body = self.body; + let body = Option::<()>::None; let response = self .transport .send(method, &path, headers, query_string.as_ref(), body, timeout) @@ -4080,32 +4018,32 @@ where } } #[derive(Debug, Clone, PartialEq)] -#[doc = "API parts for the Ml Get Records API"] -pub enum MlGetRecordsParts<'b> { +#[doc = "API parts for the Ml Get Influencers API"] +pub enum MlGetInfluencersParts<'b> { #[doc = "JobId"] JobId(&'b str), } -impl<'b> MlGetRecordsParts<'b> { - #[doc = "Builds a relative URL path to the Ml Get Records API"] +impl<'b> MlGetInfluencersParts<'b> { + #[doc = "Builds a relative URL path to the Ml Get Influencers API"] pub fn url(self) -> Cow<'static, str> { match self { - MlGetRecordsParts::JobId(ref job_id) => { + MlGetInfluencersParts::JobId(ref job_id) => { let encoded_job_id: Cow = percent_encode(job_id.as_bytes(), PARTS_ENCODED).into(); - let mut p = String::with_capacity(39usize + encoded_job_id.len()); + let mut p = String::with_capacity(43usize + encoded_job_id.len()); p.push_str("/_ml/anomaly_detectors/"); p.push_str(encoded_job_id.as_ref()); - p.push_str("/results/records"); + p.push_str("/results/influencers"); p.into() } } } } +#[doc = "Builder for the [Ml Get Influencers API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/ml-get-influencer.html)\n\nRetrieves anomaly detection job results for one or more influencers."] #[derive(Clone, Debug)] -#[doc = "Builder for the [Ml Get Records API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/ml-get-record.html)\n\nRetrieves anomaly records for an anomaly detection job."] -pub struct MlGetRecords<'a, 'b, B> { +pub struct MlGetInfluencers<'a, 'b, B> { transport: &'a Transport, - parts: MlGetRecordsParts<'b>, + parts: MlGetInfluencersParts<'b>, body: Option, desc: Option, end: Option<&'b str>, @@ -4115,22 +4053,22 @@ pub struct MlGetRecords<'a, 'b, B> { from: Option, headers: HeaderMap, human: Option, + influencer_score: Option, pretty: Option, - record_score: Option, request_timeout: Option, size: Option, sort: Option<&'b str>, source: Option<&'b str>, start: Option<&'b str>, } -impl<'a, 'b, B> MlGetRecords<'a, 'b, B> +impl<'a, 'b, B> MlGetInfluencers<'a, 'b, B> where B: Body, { - #[doc = "Creates a new instance of [MlGetRecords] with the specified API parts"] - pub fn new(transport: &'a Transport, parts: MlGetRecordsParts<'b>) -> Self { + #[doc = "Creates a new instance of [MlGetInfluencers] with the specified API parts"] + pub fn new(transport: &'a Transport, parts: MlGetInfluencersParts<'b>) -> Self { let headers = HeaderMap::new(); - MlGetRecords { + MlGetInfluencers { transport, parts, headers, @@ -4142,8 +4080,8 @@ where filter_path: None, from: None, human: None, + influencer_score: None, pretty: None, - record_score: None, request_timeout: None, size: None, sort: None, @@ -4152,11 +4090,11 @@ where } } #[doc = "The body for the API call"] - pub fn body(self, body: T) -> MlGetRecords<'a, 'b, JsonBody> + pub fn body(self, body: T) -> MlGetInfluencers<'a, 'b, JsonBody> where T: Serialize, { - MlGetRecords { + MlGetInfluencers { transport: self.transport, parts: self.parts, body: Some(body.into()), @@ -4168,8 +4106,8 @@ where from: self.from, headers: self.headers, human: self.human, + influencer_score: self.influencer_score, pretty: self.pretty, - record_score: self.record_score, request_timeout: self.request_timeout, size: self.size, sort: self.sort, @@ -4177,12 +4115,12 @@ where start: self.start, } } - #[doc = "Set the sort direction"] + #[doc = "whether the results should be sorted in decending order"] pub fn desc(mut self, desc: bool) -> Self { self.desc = Some(desc); self } - #[doc = "End time filter for records"] + #[doc = "end timestamp for the requested influencers"] pub fn end(mut self, end: &'b str) -> Self { self.end = Some(end); self @@ -4202,7 +4140,7 @@ where self.filter_path = Some(filter_path); self } - #[doc = "skips a number of records"] + #[doc = "skips a number of influencers"] pub fn from(mut self, from: i32) -> Self { self.from = Some(from); self @@ -4217,27 +4155,27 @@ where self.human = Some(human); self } + #[doc = "influencer score threshold for the requested influencers"] + pub fn influencer_score(mut self, influencer_score: f64) -> Self { + self.influencer_score = Some(influencer_score); + self + } #[doc = "Pretty format the returned JSON response."] pub fn pretty(mut self, pretty: bool) -> Self { self.pretty = Some(pretty); self } - #[doc = "Returns records with anomaly scores greater or equal than this value"] - pub fn record_score(mut self, record_score: f64) -> Self { - self.record_score = Some(record_score); - self - } #[doc = "Sets a request timeout for this API call.\n\nThe timeout is applied from when the request starts connecting until the response body has finished."] pub fn request_timeout(mut self, timeout: Duration) -> Self { self.request_timeout = Some(timeout); self } - #[doc = "specifies a max number of records to get"] + #[doc = "specifies a max number of influencers to get"] pub fn size(mut self, size: i32) -> Self { self.size = Some(size); self } - #[doc = "Sort records by a particular field"] + #[doc = "sort field for the requested influencers"] pub fn sort(mut self, sort: &'b str) -> Self { self.sort = Some(sort); self @@ -4247,12 +4185,12 @@ where self.source = Some(source); self } - #[doc = "Start time filter for records"] + #[doc = "start timestamp for the requested influencers"] pub fn start(mut self, start: &'b str) -> Self { self.start = Some(start); self } - #[doc = "Creates an asynchronous call to the Ml Get Records API that can be awaited"] + #[doc = "Creates an asynchronous call to the Ml Get Influencers API that can be awaited"] pub async fn send(self) -> Result { let path = self.parts.url(); let method = match self.body { @@ -4273,8 +4211,8 @@ where filter_path: Option<&'b [&'b str]>, from: Option, human: Option, + influencer_score: Option, pretty: Option, - record_score: Option, size: Option, sort: Option<&'b str>, source: Option<&'b str>, @@ -4288,8 +4226,8 @@ where filter_path: self.filter_path, from: self.from, human: self.human, + influencer_score: self.influencer_score, pretty: self.pretty, - record_score: self.record_score, size: self.size, sort: self.sort, source: self.source, @@ -4306,24 +4244,2032 @@ where } } #[derive(Debug, Clone, PartialEq)] -#[doc = "API parts for the Ml Info API"] -pub enum MlInfoParts { +#[doc = "API parts for the Ml Get Job Stats API"] +pub enum MlGetJobStatsParts<'b> { #[doc = "No parts"] None, + #[doc = "JobId"] + JobId(&'b str), } -impl MlInfoParts { - #[doc = "Builds a relative URL path to the Ml Info API"] +impl<'b> MlGetJobStatsParts<'b> { + #[doc = "Builds a relative URL path to the Ml Get Job Stats API"] pub fn url(self) -> Cow<'static, str> { match self { - MlInfoParts::None => "/_ml/info".into(), + MlGetJobStatsParts::None => "/_ml/anomaly_detectors/_stats".into(), + MlGetJobStatsParts::JobId(ref job_id) => { + let encoded_job_id: Cow = + percent_encode(job_id.as_bytes(), PARTS_ENCODED).into(); + let mut p = String::with_capacity(30usize + encoded_job_id.len()); + p.push_str("/_ml/anomaly_detectors/"); + p.push_str(encoded_job_id.as_ref()); + p.push_str("/_stats"); + p.into() + } } } } +#[doc = "Builder for the [Ml Get Job Stats API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/ml-get-job-stats.html)\n\nRetrieves usage information for anomaly detection jobs."] #[derive(Clone, Debug)] -#[doc = "Builder for the [Ml Info API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/get-ml-info.html)\n\nReturns defaults and limits used by machine learning."] -pub struct MlInfo<'a, 'b> { +pub struct MlGetJobStats<'a, 'b> { + transport: &'a Transport, + parts: MlGetJobStatsParts<'b>, + allow_no_jobs: Option, + allow_no_match: Option, + error_trace: Option, + filter_path: Option<&'b [&'b str]>, + headers: HeaderMap, + human: Option, + pretty: Option, + request_timeout: Option, + source: Option<&'b str>, +} +impl<'a, 'b> MlGetJobStats<'a, 'b> { + #[doc = "Creates a new instance of [MlGetJobStats] with the specified API parts"] + pub fn new(transport: &'a Transport, parts: MlGetJobStatsParts<'b>) -> Self { + let headers = HeaderMap::new(); + MlGetJobStats { + transport, + parts, + headers, + allow_no_jobs: None, + allow_no_match: None, + error_trace: None, + filter_path: None, + human: None, + pretty: None, + request_timeout: None, + source: None, + } + } + #[doc = "Whether to ignore if a wildcard expression matches no jobs. (This includes `_all` string or when no jobs have been specified)"] + pub fn allow_no_jobs(mut self, allow_no_jobs: bool) -> Self { + self.allow_no_jobs = Some(allow_no_jobs); + self + } + #[doc = "Whether to ignore if a wildcard expression matches no jobs. (This includes `_all` string or when no jobs have been specified)"] + pub fn allow_no_match(mut self, allow_no_match: bool) -> Self { + self.allow_no_match = Some(allow_no_match); + self + } + #[doc = "Include the stack trace of returned errors."] + pub fn error_trace(mut self, error_trace: bool) -> Self { + self.error_trace = Some(error_trace); + self + } + #[doc = "A comma-separated list of filters used to reduce the response."] + pub fn filter_path(mut self, filter_path: &'b [&'b str]) -> Self { + self.filter_path = Some(filter_path); + self + } + #[doc = "Adds a HTTP header"] + pub fn header(mut self, key: HeaderName, value: HeaderValue) -> Self { + self.headers.insert(key, value); + self + } + #[doc = "Return human readable values for statistics."] + pub fn human(mut self, human: bool) -> Self { + self.human = Some(human); + self + } + #[doc = "Pretty format the returned JSON response."] + pub fn pretty(mut self, pretty: bool) -> Self { + self.pretty = Some(pretty); + self + } + #[doc = "Sets a request timeout for this API call.\n\nThe timeout is applied from when the request starts connecting until the response body has finished."] + pub fn request_timeout(mut self, timeout: Duration) -> Self { + self.request_timeout = Some(timeout); + self + } + #[doc = "The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests."] + pub fn source(mut self, source: &'b str) -> Self { + self.source = Some(source); + self + } + #[doc = "Creates an asynchronous call to the Ml Get Job Stats API that can be awaited"] + pub async fn send(self) -> Result { + let path = self.parts.url(); + let method = Method::Get; + let headers = self.headers; + let timeout = self.request_timeout; + let query_string = { + #[serde_with::skip_serializing_none] + #[derive(Serialize)] + struct QueryParams<'b> { + allow_no_jobs: Option, + allow_no_match: Option, + error_trace: Option, + #[serde(serialize_with = "crate::client::serialize_coll_qs")] + filter_path: Option<&'b [&'b str]>, + human: Option, + pretty: Option, + source: Option<&'b str>, + } + let query_params = QueryParams { + allow_no_jobs: self.allow_no_jobs, + allow_no_match: self.allow_no_match, + error_trace: self.error_trace, + filter_path: self.filter_path, + human: self.human, + pretty: self.pretty, + source: self.source, + }; + Some(query_params) + }; + let body = Option::<()>::None; + let response = self + .transport + .send(method, &path, headers, query_string.as_ref(), body, timeout) + .await?; + Ok(response) + } +} +#[derive(Debug, Clone, PartialEq)] +#[doc = "API parts for the Ml Get Jobs API"] +pub enum MlGetJobsParts<'b> { + #[doc = "JobId"] + JobId(&'b str), + #[doc = "No parts"] + None, +} +impl<'b> MlGetJobsParts<'b> { + #[doc = "Builds a relative URL path to the Ml Get Jobs API"] + pub fn url(self) -> Cow<'static, str> { + match self { + MlGetJobsParts::JobId(ref job_id) => { + let encoded_job_id: Cow = + percent_encode(job_id.as_bytes(), PARTS_ENCODED).into(); + let mut p = String::with_capacity(23usize + encoded_job_id.len()); + p.push_str("/_ml/anomaly_detectors/"); + p.push_str(encoded_job_id.as_ref()); + p.into() + } + MlGetJobsParts::None => "/_ml/anomaly_detectors".into(), + } + } +} +#[doc = "Builder for the [Ml Get Jobs API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/ml-get-job.html)\n\nRetrieves configuration information for anomaly detection jobs."] +#[derive(Clone, Debug)] +pub struct MlGetJobs<'a, 'b> { + transport: &'a Transport, + parts: MlGetJobsParts<'b>, + allow_no_jobs: Option, + allow_no_match: Option, + error_trace: Option, + exclude_generated: Option, + filter_path: Option<&'b [&'b str]>, + headers: HeaderMap, + human: Option, + pretty: Option, + request_timeout: Option, + source: Option<&'b str>, +} +impl<'a, 'b> MlGetJobs<'a, 'b> { + #[doc = "Creates a new instance of [MlGetJobs] with the specified API parts"] + pub fn new(transport: &'a Transport, parts: MlGetJobsParts<'b>) -> Self { + let headers = HeaderMap::new(); + MlGetJobs { + transport, + parts, + headers, + allow_no_jobs: None, + allow_no_match: None, + error_trace: None, + exclude_generated: None, + filter_path: None, + human: None, + pretty: None, + request_timeout: None, + source: None, + } + } + #[doc = "Whether to ignore if a wildcard expression matches no jobs. (This includes `_all` string or when no jobs have been specified)"] + pub fn allow_no_jobs(mut self, allow_no_jobs: bool) -> Self { + self.allow_no_jobs = Some(allow_no_jobs); + self + } + #[doc = "Whether to ignore if a wildcard expression matches no jobs. (This includes `_all` string or when no jobs have been specified)"] + pub fn allow_no_match(mut self, allow_no_match: bool) -> Self { + self.allow_no_match = Some(allow_no_match); + self + } + #[doc = "Include the stack trace of returned errors."] + pub fn error_trace(mut self, error_trace: bool) -> Self { + self.error_trace = Some(error_trace); + self + } + #[doc = "Omits fields that are illegal to set on job PUT"] + pub fn exclude_generated(mut self, exclude_generated: bool) -> Self { + self.exclude_generated = Some(exclude_generated); + self + } + #[doc = "A comma-separated list of filters used to reduce the response."] + pub fn filter_path(mut self, filter_path: &'b [&'b str]) -> Self { + self.filter_path = Some(filter_path); + self + } + #[doc = "Adds a HTTP header"] + pub fn header(mut self, key: HeaderName, value: HeaderValue) -> Self { + self.headers.insert(key, value); + self + } + #[doc = "Return human readable values for statistics."] + pub fn human(mut self, human: bool) -> Self { + self.human = Some(human); + self + } + #[doc = "Pretty format the returned JSON response."] + pub fn pretty(mut self, pretty: bool) -> Self { + self.pretty = Some(pretty); + self + } + #[doc = "Sets a request timeout for this API call.\n\nThe timeout is applied from when the request starts connecting until the response body has finished."] + pub fn request_timeout(mut self, timeout: Duration) -> Self { + self.request_timeout = Some(timeout); + self + } + #[doc = "The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests."] + pub fn source(mut self, source: &'b str) -> Self { + self.source = Some(source); + self + } + #[doc = "Creates an asynchronous call to the Ml Get Jobs API that can be awaited"] + pub async fn send(self) -> Result { + let path = self.parts.url(); + let method = Method::Get; + let headers = self.headers; + let timeout = self.request_timeout; + let query_string = { + #[serde_with::skip_serializing_none] + #[derive(Serialize)] + struct QueryParams<'b> { + allow_no_jobs: Option, + allow_no_match: Option, + error_trace: Option, + exclude_generated: Option, + #[serde(serialize_with = "crate::client::serialize_coll_qs")] + filter_path: Option<&'b [&'b str]>, + human: Option, + pretty: Option, + source: Option<&'b str>, + } + let query_params = QueryParams { + allow_no_jobs: self.allow_no_jobs, + allow_no_match: self.allow_no_match, + error_trace: self.error_trace, + exclude_generated: self.exclude_generated, + filter_path: self.filter_path, + human: self.human, + pretty: self.pretty, + source: self.source, + }; + Some(query_params) + }; + let body = Option::<()>::None; + let response = self + .transport + .send(method, &path, headers, query_string.as_ref(), body, timeout) + .await?; + Ok(response) + } +} +#[derive(Debug, Clone, PartialEq)] +#[doc = "API parts for the Ml Get Model Snapshots API"] +pub enum MlGetModelSnapshotsParts<'b> { + #[doc = "JobId and SnapshotId"] + JobIdSnapshotId(&'b str, &'b str), + #[doc = "JobId"] + JobId(&'b str), +} +impl<'b> MlGetModelSnapshotsParts<'b> { + #[doc = "Builds a relative URL path to the Ml Get Model Snapshots API"] + pub fn url(self) -> Cow<'static, str> { + match self { + MlGetModelSnapshotsParts::JobIdSnapshotId(ref job_id, ref snapshot_id) => { + let encoded_job_id: Cow = + percent_encode(job_id.as_bytes(), PARTS_ENCODED).into(); + let encoded_snapshot_id: Cow = + percent_encode(snapshot_id.as_bytes(), PARTS_ENCODED).into(); + let mut p = String::with_capacity( + 40usize + encoded_job_id.len() + encoded_snapshot_id.len(), + ); + p.push_str("/_ml/anomaly_detectors/"); + p.push_str(encoded_job_id.as_ref()); + p.push_str("/model_snapshots/"); + p.push_str(encoded_snapshot_id.as_ref()); + p.into() + } + MlGetModelSnapshotsParts::JobId(ref job_id) => { + let encoded_job_id: Cow = + percent_encode(job_id.as_bytes(), PARTS_ENCODED).into(); + let mut p = String::with_capacity(39usize + encoded_job_id.len()); + p.push_str("/_ml/anomaly_detectors/"); + p.push_str(encoded_job_id.as_ref()); + p.push_str("/model_snapshots"); + p.into() + } + } + } +} +#[doc = "Builder for the [Ml Get Model Snapshots API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/ml-get-snapshot.html)\n\nRetrieves information about model snapshots."] +#[derive(Clone, Debug)] +pub struct MlGetModelSnapshots<'a, 'b, B> { + transport: &'a Transport, + parts: MlGetModelSnapshotsParts<'b>, + body: Option, + desc: Option, + end: Option<&'b str>, + error_trace: Option, + filter_path: Option<&'b [&'b str]>, + from: Option, + headers: HeaderMap, + human: Option, + pretty: Option, + request_timeout: Option, + size: Option, + sort: Option<&'b str>, + source: Option<&'b str>, + start: Option<&'b str>, +} +impl<'a, 'b, B> MlGetModelSnapshots<'a, 'b, B> +where + B: Body, +{ + #[doc = "Creates a new instance of [MlGetModelSnapshots] with the specified API parts"] + pub fn new(transport: &'a Transport, parts: MlGetModelSnapshotsParts<'b>) -> Self { + let headers = HeaderMap::new(); + MlGetModelSnapshots { + transport, + parts, + headers, + body: None, + desc: None, + end: None, + error_trace: None, + filter_path: None, + from: None, + human: None, + pretty: None, + request_timeout: None, + size: None, + sort: None, + source: None, + start: None, + } + } + #[doc = "The body for the API call"] + pub fn body(self, body: T) -> MlGetModelSnapshots<'a, 'b, JsonBody> + where + T: Serialize, + { + MlGetModelSnapshots { + transport: self.transport, + parts: self.parts, + body: Some(body.into()), + desc: self.desc, + end: self.end, + error_trace: self.error_trace, + filter_path: self.filter_path, + from: self.from, + headers: self.headers, + human: self.human, + pretty: self.pretty, + request_timeout: self.request_timeout, + size: self.size, + sort: self.sort, + source: self.source, + start: self.start, + } + } + #[doc = "True if the results should be sorted in descending order"] + pub fn desc(mut self, desc: bool) -> Self { + self.desc = Some(desc); + self + } + #[doc = "The filter 'end' query parameter"] + pub fn end(mut self, end: &'b str) -> Self { + self.end = Some(end); + self + } + #[doc = "Include the stack trace of returned errors."] + pub fn error_trace(mut self, error_trace: bool) -> Self { + self.error_trace = Some(error_trace); + self + } + #[doc = "A comma-separated list of filters used to reduce the response."] + pub fn filter_path(mut self, filter_path: &'b [&'b str]) -> Self { + self.filter_path = Some(filter_path); + self + } + #[doc = "Skips a number of documents"] + pub fn from(mut self, from: i32) -> Self { + self.from = Some(from); + self + } + #[doc = "Adds a HTTP header"] + pub fn header(mut self, key: HeaderName, value: HeaderValue) -> Self { + self.headers.insert(key, value); + self + } + #[doc = "Return human readable values for statistics."] + pub fn human(mut self, human: bool) -> Self { + self.human = Some(human); + self + } + #[doc = "Pretty format the returned JSON response."] + pub fn pretty(mut self, pretty: bool) -> Self { + self.pretty = Some(pretty); + self + } + #[doc = "Sets a request timeout for this API call.\n\nThe timeout is applied from when the request starts connecting until the response body has finished."] + pub fn request_timeout(mut self, timeout: Duration) -> Self { + self.request_timeout = Some(timeout); + self + } + #[doc = "The default number of documents returned in queries as a string."] + pub fn size(mut self, size: i32) -> Self { + self.size = Some(size); + self + } + #[doc = "Name of the field to sort on"] + pub fn sort(mut self, sort: &'b str) -> Self { + self.sort = Some(sort); + self + } + #[doc = "The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests."] + pub fn source(mut self, source: &'b str) -> Self { + self.source = Some(source); + self + } + #[doc = "The filter 'start' query parameter"] + pub fn start(mut self, start: &'b str) -> Self { + self.start = Some(start); + self + } + #[doc = "Creates an asynchronous call to the Ml Get Model Snapshots API that can be awaited"] + pub async fn send(self) -> Result { + let path = self.parts.url(); + let method = match self.body { + Some(_) => Method::Post, + None => Method::Get, + }; + let headers = self.headers; + let timeout = self.request_timeout; + let query_string = { + #[serde_with::skip_serializing_none] + #[derive(Serialize)] + struct QueryParams<'b> { + desc: Option, + end: Option<&'b str>, + error_trace: Option, + #[serde(serialize_with = "crate::client::serialize_coll_qs")] + filter_path: Option<&'b [&'b str]>, + from: Option, + human: Option, + pretty: Option, + size: Option, + sort: Option<&'b str>, + source: Option<&'b str>, + start: Option<&'b str>, + } + let query_params = QueryParams { + desc: self.desc, + end: self.end, + error_trace: self.error_trace, + filter_path: self.filter_path, + from: self.from, + human: self.human, + pretty: self.pretty, + size: self.size, + sort: self.sort, + source: self.source, + start: self.start, + }; + Some(query_params) + }; + let body = self.body; + let response = self + .transport + .send(method, &path, headers, query_string.as_ref(), body, timeout) + .await?; + Ok(response) + } +} +#[derive(Debug, Clone, PartialEq)] +#[doc = "API parts for the Ml Get Overall Buckets API"] +pub enum MlGetOverallBucketsParts<'b> { + #[doc = "JobId"] + JobId(&'b str), +} +impl<'b> MlGetOverallBucketsParts<'b> { + #[doc = "Builds a relative URL path to the Ml Get Overall Buckets API"] + pub fn url(self) -> Cow<'static, str> { + match self { + MlGetOverallBucketsParts::JobId(ref job_id) => { + let encoded_job_id: Cow = + percent_encode(job_id.as_bytes(), PARTS_ENCODED).into(); + let mut p = String::with_capacity(47usize + encoded_job_id.len()); + p.push_str("/_ml/anomaly_detectors/"); + p.push_str(encoded_job_id.as_ref()); + p.push_str("/results/overall_buckets"); + p.into() + } + } + } +} +#[doc = "Builder for the [Ml Get Overall Buckets API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/ml-get-overall-buckets.html)\n\nRetrieves overall bucket results that summarize the bucket results of multiple anomaly detection jobs."] +#[derive(Clone, Debug)] +pub struct MlGetOverallBuckets<'a, 'b, B> { + transport: &'a Transport, + parts: MlGetOverallBucketsParts<'b>, + allow_no_jobs: Option, + allow_no_match: Option, + body: Option, + bucket_span: Option<&'b str>, + end: Option<&'b str>, + error_trace: Option, + exclude_interim: Option, + filter_path: Option<&'b [&'b str]>, + headers: HeaderMap, + human: Option, + overall_score: Option, + pretty: Option, + request_timeout: Option, + source: Option<&'b str>, + start: Option<&'b str>, + top_n: Option, +} +impl<'a, 'b, B> MlGetOverallBuckets<'a, 'b, B> +where + B: Body, +{ + #[doc = "Creates a new instance of [MlGetOverallBuckets] with the specified API parts"] + pub fn new(transport: &'a Transport, parts: MlGetOverallBucketsParts<'b>) -> Self { + let headers = HeaderMap::new(); + MlGetOverallBuckets { + transport, + parts, + headers, + allow_no_jobs: None, + allow_no_match: None, + body: None, + bucket_span: None, + end: None, + error_trace: None, + exclude_interim: None, + filter_path: None, + human: None, + overall_score: None, + pretty: None, + request_timeout: None, + source: None, + start: None, + top_n: None, + } + } + #[doc = "Whether to ignore if a wildcard expression matches no jobs. (This includes `_all` string or when no jobs have been specified)"] + pub fn allow_no_jobs(mut self, allow_no_jobs: bool) -> Self { + self.allow_no_jobs = Some(allow_no_jobs); + self + } + #[doc = "Whether to ignore if a wildcard expression matches no jobs. (This includes `_all` string or when no jobs have been specified)"] + pub fn allow_no_match(mut self, allow_no_match: bool) -> Self { + self.allow_no_match = Some(allow_no_match); + self + } + #[doc = "The body for the API call"] + pub fn body(self, body: T) -> MlGetOverallBuckets<'a, 'b, JsonBody> + where + T: Serialize, + { + MlGetOverallBuckets { + transport: self.transport, + parts: self.parts, + body: Some(body.into()), + allow_no_jobs: self.allow_no_jobs, + allow_no_match: self.allow_no_match, + bucket_span: self.bucket_span, + end: self.end, + error_trace: self.error_trace, + exclude_interim: self.exclude_interim, + filter_path: self.filter_path, + headers: self.headers, + human: self.human, + overall_score: self.overall_score, + pretty: self.pretty, + request_timeout: self.request_timeout, + source: self.source, + start: self.start, + top_n: self.top_n, + } + } + #[doc = "The span of the overall buckets. Defaults to the longest job bucket_span"] + pub fn bucket_span(mut self, bucket_span: &'b str) -> Self { + self.bucket_span = Some(bucket_span); + self + } + #[doc = "Returns overall buckets with timestamps earlier than this time"] + pub fn end(mut self, end: &'b str) -> Self { + self.end = Some(end); + self + } + #[doc = "Include the stack trace of returned errors."] + pub fn error_trace(mut self, error_trace: bool) -> Self { + self.error_trace = Some(error_trace); + self + } + #[doc = "If true overall buckets that include interim buckets will be excluded"] + pub fn exclude_interim(mut self, exclude_interim: bool) -> Self { + self.exclude_interim = Some(exclude_interim); + self + } + #[doc = "A comma-separated list of filters used to reduce the response."] + pub fn filter_path(mut self, filter_path: &'b [&'b str]) -> Self { + self.filter_path = Some(filter_path); + self + } + #[doc = "Adds a HTTP header"] + pub fn header(mut self, key: HeaderName, value: HeaderValue) -> Self { + self.headers.insert(key, value); + self + } + #[doc = "Return human readable values for statistics."] + pub fn human(mut self, human: bool) -> Self { + self.human = Some(human); + self + } + #[doc = "Returns overall buckets with overall scores higher than this value"] + pub fn overall_score(mut self, overall_score: f64) -> Self { + self.overall_score = Some(overall_score); + self + } + #[doc = "Pretty format the returned JSON response."] + pub fn pretty(mut self, pretty: bool) -> Self { + self.pretty = Some(pretty); + self + } + #[doc = "Sets a request timeout for this API call.\n\nThe timeout is applied from when the request starts connecting until the response body has finished."] + pub fn request_timeout(mut self, timeout: Duration) -> Self { + self.request_timeout = Some(timeout); + self + } + #[doc = "The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests."] + pub fn source(mut self, source: &'b str) -> Self { + self.source = Some(source); + self + } + #[doc = "Returns overall buckets with timestamps after this time"] + pub fn start(mut self, start: &'b str) -> Self { + self.start = Some(start); + self + } + #[doc = "The number of top job bucket scores to be used in the overall_score calculation"] + pub fn top_n(mut self, top_n: i32) -> Self { + self.top_n = Some(top_n); + self + } + #[doc = "Creates an asynchronous call to the Ml Get Overall Buckets API that can be awaited"] + pub async fn send(self) -> Result { + let path = self.parts.url(); + let method = match self.body { + Some(_) => Method::Post, + None => Method::Get, + }; + let headers = self.headers; + let timeout = self.request_timeout; + let query_string = { + #[serde_with::skip_serializing_none] + #[derive(Serialize)] + struct QueryParams<'b> { + allow_no_jobs: Option, + allow_no_match: Option, + bucket_span: Option<&'b str>, + end: Option<&'b str>, + error_trace: Option, + exclude_interim: Option, + #[serde(serialize_with = "crate::client::serialize_coll_qs")] + filter_path: Option<&'b [&'b str]>, + human: Option, + overall_score: Option, + pretty: Option, + source: Option<&'b str>, + start: Option<&'b str>, + top_n: Option, + } + let query_params = QueryParams { + allow_no_jobs: self.allow_no_jobs, + allow_no_match: self.allow_no_match, + bucket_span: self.bucket_span, + end: self.end, + error_trace: self.error_trace, + exclude_interim: self.exclude_interim, + filter_path: self.filter_path, + human: self.human, + overall_score: self.overall_score, + pretty: self.pretty, + source: self.source, + start: self.start, + top_n: self.top_n, + }; + Some(query_params) + }; + let body = self.body; + let response = self + .transport + .send(method, &path, headers, query_string.as_ref(), body, timeout) + .await?; + Ok(response) + } +} +#[derive(Debug, Clone, PartialEq)] +#[doc = "API parts for the Ml Get Records API"] +pub enum MlGetRecordsParts<'b> { + #[doc = "JobId"] + JobId(&'b str), +} +impl<'b> MlGetRecordsParts<'b> { + #[doc = "Builds a relative URL path to the Ml Get Records API"] + pub fn url(self) -> Cow<'static, str> { + match self { + MlGetRecordsParts::JobId(ref job_id) => { + let encoded_job_id: Cow = + percent_encode(job_id.as_bytes(), PARTS_ENCODED).into(); + let mut p = String::with_capacity(39usize + encoded_job_id.len()); + p.push_str("/_ml/anomaly_detectors/"); + p.push_str(encoded_job_id.as_ref()); + p.push_str("/results/records"); + p.into() + } + } + } +} +#[doc = "Builder for the [Ml Get Records API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/ml-get-record.html)\n\nRetrieves anomaly records for an anomaly detection job."] +#[derive(Clone, Debug)] +pub struct MlGetRecords<'a, 'b, B> { + transport: &'a Transport, + parts: MlGetRecordsParts<'b>, + body: Option, + desc: Option, + end: Option<&'b str>, + error_trace: Option, + exclude_interim: Option, + filter_path: Option<&'b [&'b str]>, + from: Option, + headers: HeaderMap, + human: Option, + pretty: Option, + record_score: Option, + request_timeout: Option, + size: Option, + sort: Option<&'b str>, + source: Option<&'b str>, + start: Option<&'b str>, +} +impl<'a, 'b, B> MlGetRecords<'a, 'b, B> +where + B: Body, +{ + #[doc = "Creates a new instance of [MlGetRecords] with the specified API parts"] + pub fn new(transport: &'a Transport, parts: MlGetRecordsParts<'b>) -> Self { + let headers = HeaderMap::new(); + MlGetRecords { + transport, + parts, + headers, + body: None, + desc: None, + end: None, + error_trace: None, + exclude_interim: None, + filter_path: None, + from: None, + human: None, + pretty: None, + record_score: None, + request_timeout: None, + size: None, + sort: None, + source: None, + start: None, + } + } + #[doc = "The body for the API call"] + pub fn body(self, body: T) -> MlGetRecords<'a, 'b, JsonBody> + where + T: Serialize, + { + MlGetRecords { + transport: self.transport, + parts: self.parts, + body: Some(body.into()), + desc: self.desc, + end: self.end, + error_trace: self.error_trace, + exclude_interim: self.exclude_interim, + filter_path: self.filter_path, + from: self.from, + headers: self.headers, + human: self.human, + pretty: self.pretty, + record_score: self.record_score, + request_timeout: self.request_timeout, + size: self.size, + sort: self.sort, + source: self.source, + start: self.start, + } + } + #[doc = "Set the sort direction"] + pub fn desc(mut self, desc: bool) -> Self { + self.desc = Some(desc); + self + } + #[doc = "End time filter for records"] + pub fn end(mut self, end: &'b str) -> Self { + self.end = Some(end); + self + } + #[doc = "Include the stack trace of returned errors."] + pub fn error_trace(mut self, error_trace: bool) -> Self { + self.error_trace = Some(error_trace); + self + } + #[doc = "Exclude interim results"] + pub fn exclude_interim(mut self, exclude_interim: bool) -> Self { + self.exclude_interim = Some(exclude_interim); + self + } + #[doc = "A comma-separated list of filters used to reduce the response."] + pub fn filter_path(mut self, filter_path: &'b [&'b str]) -> Self { + self.filter_path = Some(filter_path); + self + } + #[doc = "skips a number of records"] + pub fn from(mut self, from: i32) -> Self { + self.from = Some(from); + self + } + #[doc = "Adds a HTTP header"] + pub fn header(mut self, key: HeaderName, value: HeaderValue) -> Self { + self.headers.insert(key, value); + self + } + #[doc = "Return human readable values for statistics."] + pub fn human(mut self, human: bool) -> Self { + self.human = Some(human); + self + } + #[doc = "Pretty format the returned JSON response."] + pub fn pretty(mut self, pretty: bool) -> Self { + self.pretty = Some(pretty); + self + } + #[doc = "Returns records with anomaly scores greater or equal than this value"] + pub fn record_score(mut self, record_score: f64) -> Self { + self.record_score = Some(record_score); + self + } + #[doc = "Sets a request timeout for this API call.\n\nThe timeout is applied from when the request starts connecting until the response body has finished."] + pub fn request_timeout(mut self, timeout: Duration) -> Self { + self.request_timeout = Some(timeout); + self + } + #[doc = "specifies a max number of records to get"] + pub fn size(mut self, size: i32) -> Self { + self.size = Some(size); + self + } + #[doc = "Sort records by a particular field"] + pub fn sort(mut self, sort: &'b str) -> Self { + self.sort = Some(sort); + self + } + #[doc = "The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests."] + pub fn source(mut self, source: &'b str) -> Self { + self.source = Some(source); + self + } + #[doc = "Start time filter for records"] + pub fn start(mut self, start: &'b str) -> Self { + self.start = Some(start); + self + } + #[doc = "Creates an asynchronous call to the Ml Get Records API that can be awaited"] + pub async fn send(self) -> Result { + let path = self.parts.url(); + let method = match self.body { + Some(_) => Method::Post, + None => Method::Get, + }; + let headers = self.headers; + let timeout = self.request_timeout; + let query_string = { + #[serde_with::skip_serializing_none] + #[derive(Serialize)] + struct QueryParams<'b> { + desc: Option, + end: Option<&'b str>, + error_trace: Option, + exclude_interim: Option, + #[serde(serialize_with = "crate::client::serialize_coll_qs")] + filter_path: Option<&'b [&'b str]>, + from: Option, + human: Option, + pretty: Option, + record_score: Option, + size: Option, + sort: Option<&'b str>, + source: Option<&'b str>, + start: Option<&'b str>, + } + let query_params = QueryParams { + desc: self.desc, + end: self.end, + error_trace: self.error_trace, + exclude_interim: self.exclude_interim, + filter_path: self.filter_path, + from: self.from, + human: self.human, + pretty: self.pretty, + record_score: self.record_score, + size: self.size, + sort: self.sort, + source: self.source, + start: self.start, + }; + Some(query_params) + }; + let body = self.body; + let response = self + .transport + .send(method, &path, headers, query_string.as_ref(), body, timeout) + .await?; + Ok(response) + } +} +#[cfg(feature = "beta-apis")] +#[derive(Debug, Clone, PartialEq)] +#[doc = "API parts for the Ml Get Trained Models API"] +pub enum MlGetTrainedModelsParts<'b> { + #[doc = "ModelId"] + ModelId(&'b str), + #[doc = "No parts"] + None, +} +#[cfg(feature = "beta-apis")] +impl<'b> MlGetTrainedModelsParts<'b> { + #[doc = "Builds a relative URL path to the Ml Get Trained Models API"] + pub fn url(self) -> Cow<'static, str> { + match self { + MlGetTrainedModelsParts::ModelId(ref model_id) => { + let encoded_model_id: Cow = + percent_encode(model_id.as_bytes(), PARTS_ENCODED).into(); + let mut p = String::with_capacity(20usize + encoded_model_id.len()); + p.push_str("/_ml/trained_models/"); + p.push_str(encoded_model_id.as_ref()); + p.into() + } + MlGetTrainedModelsParts::None => "/_ml/trained_models".into(), + } + } +} +#[doc = "Builder for the [Ml Get Trained Models API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/get-trained-models.html)\n\nRetrieves configuration information for a trained inference model."] +#[doc = " \n# Optional, beta\nThis requires the `beta-apis` feature. On track to become stable but breaking changes can\nhappen in minor versions.\n "] +#[cfg(feature = "beta-apis")] +#[derive(Clone, Debug)] +pub struct MlGetTrainedModels<'a, 'b> { + transport: &'a Transport, + parts: MlGetTrainedModelsParts<'b>, + allow_no_match: Option, + decompress_definition: Option, + error_trace: Option, + exclude_generated: Option, + filter_path: Option<&'b [&'b str]>, + from: Option, + headers: HeaderMap, + human: Option, + include: Option<&'b str>, + include_model_definition: Option, + pretty: Option, + request_timeout: Option, + size: Option, + source: Option<&'b str>, + tags: Option<&'b [&'b str]>, +} +#[cfg(feature = "beta-apis")] +impl<'a, 'b> MlGetTrainedModels<'a, 'b> { + #[doc = "Creates a new instance of [MlGetTrainedModels] with the specified API parts"] + pub fn new(transport: &'a Transport, parts: MlGetTrainedModelsParts<'b>) -> Self { + let headers = HeaderMap::new(); + MlGetTrainedModels { + transport, + parts, + headers, + allow_no_match: None, + decompress_definition: None, + error_trace: None, + exclude_generated: None, + filter_path: None, + from: None, + human: None, + include: None, + include_model_definition: None, + pretty: None, + request_timeout: None, + size: None, + source: None, + tags: None, + } + } + #[doc = "Whether to ignore if a wildcard expression matches no trained models. (This includes `_all` string or when no trained models have been specified)"] + pub fn allow_no_match(mut self, allow_no_match: bool) -> Self { + self.allow_no_match = Some(allow_no_match); + self + } + #[doc = "Should the model definition be decompressed into valid JSON or returned in a custom compressed format. Defaults to true."] + pub fn decompress_definition(mut self, decompress_definition: bool) -> Self { + self.decompress_definition = Some(decompress_definition); + self + } + #[doc = "Include the stack trace of returned errors."] + pub fn error_trace(mut self, error_trace: bool) -> Self { + self.error_trace = Some(error_trace); + self + } + #[doc = "Omits fields that are illegal to set on model PUT"] + pub fn exclude_generated(mut self, exclude_generated: bool) -> Self { + self.exclude_generated = Some(exclude_generated); + self + } + #[doc = "A comma-separated list of filters used to reduce the response."] + pub fn filter_path(mut self, filter_path: &'b [&'b str]) -> Self { + self.filter_path = Some(filter_path); + self + } + #[doc = "skips a number of trained models"] + pub fn from(mut self, from: i32) -> Self { + self.from = Some(from); + self + } + #[doc = "Adds a HTTP header"] + pub fn header(mut self, key: HeaderName, value: HeaderValue) -> Self { + self.headers.insert(key, value); + self + } + #[doc = "Return human readable values for statistics."] + pub fn human(mut self, human: bool) -> Self { + self.human = Some(human); + self + } + #[doc = "A comma-separate list of fields to optionally include. Valid options are 'definition' and 'total_feature_importance'. Default is none."] + pub fn include(mut self, include: &'b str) -> Self { + self.include = Some(include); + self + } + #[doc = "Should the full model definition be included in the results. These definitions can be large. So be cautious when including them. Defaults to false."] + pub fn include_model_definition(mut self, include_model_definition: bool) -> Self { + self.include_model_definition = Some(include_model_definition); + self + } + #[doc = "Pretty format the returned JSON response."] + pub fn pretty(mut self, pretty: bool) -> Self { + self.pretty = Some(pretty); + self + } + #[doc = "Sets a request timeout for this API call.\n\nThe timeout is applied from when the request starts connecting until the response body has finished."] + pub fn request_timeout(mut self, timeout: Duration) -> Self { + self.request_timeout = Some(timeout); + self + } + #[doc = "specifies a max number of trained models to get"] + pub fn size(mut self, size: i32) -> Self { + self.size = Some(size); + self + } + #[doc = "The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests."] + pub fn source(mut self, source: &'b str) -> Self { + self.source = Some(source); + self + } + #[doc = "A comma-separated list of tags that the model must have."] + pub fn tags(mut self, tags: &'b [&'b str]) -> Self { + self.tags = Some(tags); + self + } + #[doc = "Creates an asynchronous call to the Ml Get Trained Models API that can be awaited"] + pub async fn send(self) -> Result { + let path = self.parts.url(); + let method = Method::Get; + let headers = self.headers; + let timeout = self.request_timeout; + let query_string = { + #[serde_with::skip_serializing_none] + #[derive(Serialize)] + struct QueryParams<'b> { + allow_no_match: Option, + decompress_definition: Option, + error_trace: Option, + exclude_generated: Option, + #[serde(serialize_with = "crate::client::serialize_coll_qs")] + filter_path: Option<&'b [&'b str]>, + from: Option, + human: Option, + include: Option<&'b str>, + include_model_definition: Option, + pretty: Option, + size: Option, + source: Option<&'b str>, + #[serde(serialize_with = "crate::client::serialize_coll_qs")] + tags: Option<&'b [&'b str]>, + } + let query_params = QueryParams { + allow_no_match: self.allow_no_match, + decompress_definition: self.decompress_definition, + error_trace: self.error_trace, + exclude_generated: self.exclude_generated, + filter_path: self.filter_path, + from: self.from, + human: self.human, + include: self.include, + include_model_definition: self.include_model_definition, + pretty: self.pretty, + size: self.size, + source: self.source, + tags: self.tags, + }; + Some(query_params) + }; + let body = Option::<()>::None; + let response = self + .transport + .send(method, &path, headers, query_string.as_ref(), body, timeout) + .await?; + Ok(response) + } +} +#[cfg(feature = "beta-apis")] +#[derive(Debug, Clone, PartialEq)] +#[doc = "API parts for the Ml Get Trained Models Stats API"] +pub enum MlGetTrainedModelsStatsParts<'b> { + #[doc = "ModelId"] + ModelId(&'b str), + #[doc = "No parts"] + None, +} +#[cfg(feature = "beta-apis")] +impl<'b> MlGetTrainedModelsStatsParts<'b> { + #[doc = "Builds a relative URL path to the Ml Get Trained Models Stats API"] + pub fn url(self) -> Cow<'static, str> { + match self { + MlGetTrainedModelsStatsParts::ModelId(ref model_id) => { + let encoded_model_id: Cow = + percent_encode(model_id.as_bytes(), PARTS_ENCODED).into(); + let mut p = String::with_capacity(27usize + encoded_model_id.len()); + p.push_str("/_ml/trained_models/"); + p.push_str(encoded_model_id.as_ref()); + p.push_str("/_stats"); + p.into() + } + MlGetTrainedModelsStatsParts::None => "/_ml/trained_models/_stats".into(), + } + } +} +#[doc = "Builder for the [Ml Get Trained Models Stats API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/get-trained-models-stats.html)\n\nRetrieves usage information for trained inference models."] +#[doc = " \n# Optional, beta\nThis requires the `beta-apis` feature. On track to become stable but breaking changes can\nhappen in minor versions.\n "] +#[cfg(feature = "beta-apis")] +#[derive(Clone, Debug)] +pub struct MlGetTrainedModelsStats<'a, 'b> { + transport: &'a Transport, + parts: MlGetTrainedModelsStatsParts<'b>, + allow_no_match: Option, + error_trace: Option, + filter_path: Option<&'b [&'b str]>, + from: Option, + headers: HeaderMap, + human: Option, + pretty: Option, + request_timeout: Option, + size: Option, + source: Option<&'b str>, +} +#[cfg(feature = "beta-apis")] +impl<'a, 'b> MlGetTrainedModelsStats<'a, 'b> { + #[doc = "Creates a new instance of [MlGetTrainedModelsStats] with the specified API parts"] + pub fn new(transport: &'a Transport, parts: MlGetTrainedModelsStatsParts<'b>) -> Self { + let headers = HeaderMap::new(); + MlGetTrainedModelsStats { + transport, + parts, + headers, + allow_no_match: None, + error_trace: None, + filter_path: None, + from: None, + human: None, + pretty: None, + request_timeout: None, + size: None, + source: None, + } + } + #[doc = "Whether to ignore if a wildcard expression matches no trained models. (This includes `_all` string or when no trained models have been specified)"] + pub fn allow_no_match(mut self, allow_no_match: bool) -> Self { + self.allow_no_match = Some(allow_no_match); + self + } + #[doc = "Include the stack trace of returned errors."] + pub fn error_trace(mut self, error_trace: bool) -> Self { + self.error_trace = Some(error_trace); + self + } + #[doc = "A comma-separated list of filters used to reduce the response."] + pub fn filter_path(mut self, filter_path: &'b [&'b str]) -> Self { + self.filter_path = Some(filter_path); + self + } + #[doc = "skips a number of trained models"] + pub fn from(mut self, from: i32) -> Self { + self.from = Some(from); + self + } + #[doc = "Adds a HTTP header"] + pub fn header(mut self, key: HeaderName, value: HeaderValue) -> Self { + self.headers.insert(key, value); + self + } + #[doc = "Return human readable values for statistics."] + pub fn human(mut self, human: bool) -> Self { + self.human = Some(human); + self + } + #[doc = "Pretty format the returned JSON response."] + pub fn pretty(mut self, pretty: bool) -> Self { + self.pretty = Some(pretty); + self + } + #[doc = "Sets a request timeout for this API call.\n\nThe timeout is applied from when the request starts connecting until the response body has finished."] + pub fn request_timeout(mut self, timeout: Duration) -> Self { + self.request_timeout = Some(timeout); + self + } + #[doc = "specifies a max number of trained models to get"] + pub fn size(mut self, size: i32) -> Self { + self.size = Some(size); + self + } + #[doc = "The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests."] + pub fn source(mut self, source: &'b str) -> Self { + self.source = Some(source); + self + } + #[doc = "Creates an asynchronous call to the Ml Get Trained Models Stats API that can be awaited"] + pub async fn send(self) -> Result { + let path = self.parts.url(); + let method = Method::Get; + let headers = self.headers; + let timeout = self.request_timeout; + let query_string = { + #[serde_with::skip_serializing_none] + #[derive(Serialize)] + struct QueryParams<'b> { + allow_no_match: Option, + error_trace: Option, + #[serde(serialize_with = "crate::client::serialize_coll_qs")] + filter_path: Option<&'b [&'b str]>, + from: Option, + human: Option, + pretty: Option, + size: Option, + source: Option<&'b str>, + } + let query_params = QueryParams { + allow_no_match: self.allow_no_match, + error_trace: self.error_trace, + filter_path: self.filter_path, + from: self.from, + human: self.human, + pretty: self.pretty, + size: self.size, + source: self.source, + }; + Some(query_params) + }; + let body = Option::<()>::None; + let response = self + .transport + .send(method, &path, headers, query_string.as_ref(), body, timeout) + .await?; + Ok(response) + } +} +#[derive(Debug, Clone, PartialEq)] +#[doc = "API parts for the Ml Info API"] +pub enum MlInfoParts { + #[doc = "No parts"] + None, +} +impl MlInfoParts { + #[doc = "Builds a relative URL path to the Ml Info API"] + pub fn url(self) -> Cow<'static, str> { + match self { + MlInfoParts::None => "/_ml/info".into(), + } + } +} +#[doc = "Builder for the [Ml Info API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/get-ml-info.html)\n\nReturns defaults and limits used by machine learning."] +#[derive(Clone, Debug)] +pub struct MlInfo<'a, 'b> { + transport: &'a Transport, + parts: MlInfoParts, + error_trace: Option, + filter_path: Option<&'b [&'b str]>, + headers: HeaderMap, + human: Option, + pretty: Option, + request_timeout: Option, + source: Option<&'b str>, +} +impl<'a, 'b> MlInfo<'a, 'b> { + #[doc = "Creates a new instance of [MlInfo]"] + pub fn new(transport: &'a Transport) -> Self { + let headers = HeaderMap::new(); + MlInfo { + transport, + parts: MlInfoParts::None, + headers, + error_trace: None, + filter_path: None, + human: None, + pretty: None, + request_timeout: None, + source: None, + } + } + #[doc = "Include the stack trace of returned errors."] + pub fn error_trace(mut self, error_trace: bool) -> Self { + self.error_trace = Some(error_trace); + self + } + #[doc = "A comma-separated list of filters used to reduce the response."] + pub fn filter_path(mut self, filter_path: &'b [&'b str]) -> Self { + self.filter_path = Some(filter_path); + self + } + #[doc = "Adds a HTTP header"] + pub fn header(mut self, key: HeaderName, value: HeaderValue) -> Self { + self.headers.insert(key, value); + self + } + #[doc = "Return human readable values for statistics."] + pub fn human(mut self, human: bool) -> Self { + self.human = Some(human); + self + } + #[doc = "Pretty format the returned JSON response."] + pub fn pretty(mut self, pretty: bool) -> Self { + self.pretty = Some(pretty); + self + } + #[doc = "Sets a request timeout for this API call.\n\nThe timeout is applied from when the request starts connecting until the response body has finished."] + pub fn request_timeout(mut self, timeout: Duration) -> Self { + self.request_timeout = Some(timeout); + self + } + #[doc = "The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests."] + pub fn source(mut self, source: &'b str) -> Self { + self.source = Some(source); + self + } + #[doc = "Creates an asynchronous call to the Ml Info API that can be awaited"] + pub async fn send(self) -> Result { + let path = self.parts.url(); + let method = Method::Get; + let headers = self.headers; + let timeout = self.request_timeout; + let query_string = { + #[serde_with::skip_serializing_none] + #[derive(Serialize)] + struct QueryParams<'b> { + error_trace: Option, + #[serde(serialize_with = "crate::client::serialize_coll_qs")] + filter_path: Option<&'b [&'b str]>, + human: Option, + pretty: Option, + source: Option<&'b str>, + } + let query_params = QueryParams { + error_trace: self.error_trace, + filter_path: self.filter_path, + human: self.human, + pretty: self.pretty, + source: self.source, + }; + Some(query_params) + }; + let body = Option::<()>::None; + let response = self + .transport + .send(method, &path, headers, query_string.as_ref(), body, timeout) + .await?; + Ok(response) + } +} +#[derive(Debug, Clone, PartialEq)] +#[doc = "API parts for the Ml Open Job API"] +pub enum MlOpenJobParts<'b> { + #[doc = "JobId"] + JobId(&'b str), +} +impl<'b> MlOpenJobParts<'b> { + #[doc = "Builds a relative URL path to the Ml Open Job API"] + pub fn url(self) -> Cow<'static, str> { + match self { + MlOpenJobParts::JobId(ref job_id) => { + let encoded_job_id: Cow = + percent_encode(job_id.as_bytes(), PARTS_ENCODED).into(); + let mut p = String::with_capacity(29usize + encoded_job_id.len()); + p.push_str("/_ml/anomaly_detectors/"); + p.push_str(encoded_job_id.as_ref()); + p.push_str("/_open"); + p.into() + } + } + } +} +#[doc = "Builder for the [Ml Open Job API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/ml-open-job.html)\n\nOpens one or more anomaly detection jobs."] +#[derive(Clone, Debug)] +pub struct MlOpenJob<'a, 'b, B> { + transport: &'a Transport, + parts: MlOpenJobParts<'b>, + body: Option, + error_trace: Option, + filter_path: Option<&'b [&'b str]>, + headers: HeaderMap, + human: Option, + pretty: Option, + request_timeout: Option, + source: Option<&'b str>, +} +impl<'a, 'b, B> MlOpenJob<'a, 'b, B> +where + B: Body, +{ + #[doc = "Creates a new instance of [MlOpenJob] with the specified API parts"] + pub fn new(transport: &'a Transport, parts: MlOpenJobParts<'b>) -> Self { + let headers = HeaderMap::new(); + MlOpenJob { + transport, + parts, + headers, + body: None, + error_trace: None, + filter_path: None, + human: None, + pretty: None, + request_timeout: None, + source: None, + } + } + #[doc = "The body for the API call"] + pub fn body(self, body: T) -> MlOpenJob<'a, 'b, JsonBody> + where + T: Serialize, + { + MlOpenJob { + transport: self.transport, + parts: self.parts, + body: Some(body.into()), + error_trace: self.error_trace, + filter_path: self.filter_path, + headers: self.headers, + human: self.human, + pretty: self.pretty, + request_timeout: self.request_timeout, + source: self.source, + } + } + #[doc = "Include the stack trace of returned errors."] + pub fn error_trace(mut self, error_trace: bool) -> Self { + self.error_trace = Some(error_trace); + self + } + #[doc = "A comma-separated list of filters used to reduce the response."] + pub fn filter_path(mut self, filter_path: &'b [&'b str]) -> Self { + self.filter_path = Some(filter_path); + self + } + #[doc = "Adds a HTTP header"] + pub fn header(mut self, key: HeaderName, value: HeaderValue) -> Self { + self.headers.insert(key, value); + self + } + #[doc = "Return human readable values for statistics."] + pub fn human(mut self, human: bool) -> Self { + self.human = Some(human); + self + } + #[doc = "Pretty format the returned JSON response."] + pub fn pretty(mut self, pretty: bool) -> Self { + self.pretty = Some(pretty); + self + } + #[doc = "Sets a request timeout for this API call.\n\nThe timeout is applied from when the request starts connecting until the response body has finished."] + pub fn request_timeout(mut self, timeout: Duration) -> Self { + self.request_timeout = Some(timeout); + self + } + #[doc = "The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests."] + pub fn source(mut self, source: &'b str) -> Self { + self.source = Some(source); + self + } + #[doc = "Creates an asynchronous call to the Ml Open Job API that can be awaited"] + pub async fn send(self) -> Result { + let path = self.parts.url(); + let method = Method::Post; + let headers = self.headers; + let timeout = self.request_timeout; + let query_string = { + #[serde_with::skip_serializing_none] + #[derive(Serialize)] + struct QueryParams<'b> { + error_trace: Option, + #[serde(serialize_with = "crate::client::serialize_coll_qs")] + filter_path: Option<&'b [&'b str]>, + human: Option, + pretty: Option, + source: Option<&'b str>, + } + let query_params = QueryParams { + error_trace: self.error_trace, + filter_path: self.filter_path, + human: self.human, + pretty: self.pretty, + source: self.source, + }; + Some(query_params) + }; + let body = self.body; + let response = self + .transport + .send(method, &path, headers, query_string.as_ref(), body, timeout) + .await?; + Ok(response) + } +} +#[derive(Debug, Clone, PartialEq)] +#[doc = "API parts for the Ml Post Calendar Events API"] +pub enum MlPostCalendarEventsParts<'b> { + #[doc = "CalendarId"] + CalendarId(&'b str), +} +impl<'b> MlPostCalendarEventsParts<'b> { + #[doc = "Builds a relative URL path to the Ml Post Calendar Events API"] + pub fn url(self) -> Cow<'static, str> { + match self { + MlPostCalendarEventsParts::CalendarId(ref calendar_id) => { + let encoded_calendar_id: Cow = + percent_encode(calendar_id.as_bytes(), PARTS_ENCODED).into(); + let mut p = String::with_capacity(22usize + encoded_calendar_id.len()); + p.push_str("/_ml/calendars/"); + p.push_str(encoded_calendar_id.as_ref()); + p.push_str("/events"); + p.into() + } + } + } +} +#[doc = "Builder for the [Ml Post Calendar Events API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/ml-post-calendar-event.html)\n\nPosts scheduled events in a calendar."] +#[derive(Clone, Debug)] +pub struct MlPostCalendarEvents<'a, 'b, B> { + transport: &'a Transport, + parts: MlPostCalendarEventsParts<'b>, + body: Option, + error_trace: Option, + filter_path: Option<&'b [&'b str]>, + headers: HeaderMap, + human: Option, + pretty: Option, + request_timeout: Option, + source: Option<&'b str>, +} +impl<'a, 'b, B> MlPostCalendarEvents<'a, 'b, B> +where + B: Body, +{ + #[doc = "Creates a new instance of [MlPostCalendarEvents] with the specified API parts"] + pub fn new(transport: &'a Transport, parts: MlPostCalendarEventsParts<'b>) -> Self { + let headers = HeaderMap::new(); + MlPostCalendarEvents { + transport, + parts, + headers, + body: None, + error_trace: None, + filter_path: None, + human: None, + pretty: None, + request_timeout: None, + source: None, + } + } + #[doc = "The body for the API call"] + pub fn body(self, body: T) -> MlPostCalendarEvents<'a, 'b, JsonBody> + where + T: Serialize, + { + MlPostCalendarEvents { + transport: self.transport, + parts: self.parts, + body: Some(body.into()), + error_trace: self.error_trace, + filter_path: self.filter_path, + headers: self.headers, + human: self.human, + pretty: self.pretty, + request_timeout: self.request_timeout, + source: self.source, + } + } + #[doc = "Include the stack trace of returned errors."] + pub fn error_trace(mut self, error_trace: bool) -> Self { + self.error_trace = Some(error_trace); + self + } + #[doc = "A comma-separated list of filters used to reduce the response."] + pub fn filter_path(mut self, filter_path: &'b [&'b str]) -> Self { + self.filter_path = Some(filter_path); + self + } + #[doc = "Adds a HTTP header"] + pub fn header(mut self, key: HeaderName, value: HeaderValue) -> Self { + self.headers.insert(key, value); + self + } + #[doc = "Return human readable values for statistics."] + pub fn human(mut self, human: bool) -> Self { + self.human = Some(human); + self + } + #[doc = "Pretty format the returned JSON response."] + pub fn pretty(mut self, pretty: bool) -> Self { + self.pretty = Some(pretty); + self + } + #[doc = "Sets a request timeout for this API call.\n\nThe timeout is applied from when the request starts connecting until the response body has finished."] + pub fn request_timeout(mut self, timeout: Duration) -> Self { + self.request_timeout = Some(timeout); + self + } + #[doc = "The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests."] + pub fn source(mut self, source: &'b str) -> Self { + self.source = Some(source); + self + } + #[doc = "Creates an asynchronous call to the Ml Post Calendar Events API that can be awaited"] + pub async fn send(self) -> Result { + let path = self.parts.url(); + let method = Method::Post; + let headers = self.headers; + let timeout = self.request_timeout; + let query_string = { + #[serde_with::skip_serializing_none] + #[derive(Serialize)] + struct QueryParams<'b> { + error_trace: Option, + #[serde(serialize_with = "crate::client::serialize_coll_qs")] + filter_path: Option<&'b [&'b str]>, + human: Option, + pretty: Option, + source: Option<&'b str>, + } + let query_params = QueryParams { + error_trace: self.error_trace, + filter_path: self.filter_path, + human: self.human, + pretty: self.pretty, + source: self.source, + }; + Some(query_params) + }; + let body = self.body; + let response = self + .transport + .send(method, &path, headers, query_string.as_ref(), body, timeout) + .await?; + Ok(response) + } +} +#[derive(Debug, Clone, PartialEq)] +#[doc = "API parts for the Ml Post Data API"] +pub enum MlPostDataParts<'b> { + #[doc = "JobId"] + JobId(&'b str), +} +impl<'b> MlPostDataParts<'b> { + #[doc = "Builds a relative URL path to the Ml Post Data API"] + pub fn url(self) -> Cow<'static, str> { + match self { + MlPostDataParts::JobId(ref job_id) => { + let encoded_job_id: Cow = + percent_encode(job_id.as_bytes(), PARTS_ENCODED).into(); + let mut p = String::with_capacity(29usize + encoded_job_id.len()); + p.push_str("/_ml/anomaly_detectors/"); + p.push_str(encoded_job_id.as_ref()); + p.push_str("/_data"); + p.into() + } + } + } +} +#[doc = "Builder for the [Ml Post Data API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/ml-post-data.html)\n\nSends data to an anomaly detection job for analysis."] +#[derive(Clone, Debug)] +pub struct MlPostData<'a, 'b, B> { + transport: &'a Transport, + parts: MlPostDataParts<'b>, + body: Option, + error_trace: Option, + filter_path: Option<&'b [&'b str]>, + headers: HeaderMap, + human: Option, + pretty: Option, + request_timeout: Option, + reset_end: Option<&'b str>, + reset_start: Option<&'b str>, + source: Option<&'b str>, +} +impl<'a, 'b, B> MlPostData<'a, 'b, B> +where + B: Body, +{ + #[doc = "Creates a new instance of [MlPostData] with the specified API parts"] + pub fn new(transport: &'a Transport, parts: MlPostDataParts<'b>) -> Self { + let headers = HeaderMap::new(); + MlPostData { + transport, + parts, + headers, + body: None, + error_trace: None, + filter_path: None, + human: None, + pretty: None, + request_timeout: None, + reset_end: None, + reset_start: None, + source: None, + } + } + #[doc = "The body for the API call"] + pub fn body(self, body: Vec) -> MlPostData<'a, 'b, NdBody> + where + T: Body, + { + MlPostData { + transport: self.transport, + parts: self.parts, + body: Some(NdBody(body)), + error_trace: self.error_trace, + filter_path: self.filter_path, + headers: self.headers, + human: self.human, + pretty: self.pretty, + request_timeout: self.request_timeout, + reset_end: self.reset_end, + reset_start: self.reset_start, + source: self.source, + } + } + #[doc = "Include the stack trace of returned errors."] + pub fn error_trace(mut self, error_trace: bool) -> Self { + self.error_trace = Some(error_trace); + self + } + #[doc = "A comma-separated list of filters used to reduce the response."] + pub fn filter_path(mut self, filter_path: &'b [&'b str]) -> Self { + self.filter_path = Some(filter_path); + self + } + #[doc = "Adds a HTTP header"] + pub fn header(mut self, key: HeaderName, value: HeaderValue) -> Self { + self.headers.insert(key, value); + self + } + #[doc = "Return human readable values for statistics."] + pub fn human(mut self, human: bool) -> Self { + self.human = Some(human); + self + } + #[doc = "Pretty format the returned JSON response."] + pub fn pretty(mut self, pretty: bool) -> Self { + self.pretty = Some(pretty); + self + } + #[doc = "Sets a request timeout for this API call.\n\nThe timeout is applied from when the request starts connecting until the response body has finished."] + pub fn request_timeout(mut self, timeout: Duration) -> Self { + self.request_timeout = Some(timeout); + self + } + #[doc = "Optional parameter to specify the end of the bucket resetting range"] + pub fn reset_end(mut self, reset_end: &'b str) -> Self { + self.reset_end = Some(reset_end); + self + } + #[doc = "Optional parameter to specify the start of the bucket resetting range"] + pub fn reset_start(mut self, reset_start: &'b str) -> Self { + self.reset_start = Some(reset_start); + self + } + #[doc = "The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests."] + pub fn source(mut self, source: &'b str) -> Self { + self.source = Some(source); + self + } + #[doc = "Creates an asynchronous call to the Ml Post Data API that can be awaited"] + pub async fn send(self) -> Result { + let path = self.parts.url(); + let method = Method::Post; + let headers = self.headers; + let timeout = self.request_timeout; + let query_string = { + #[serde_with::skip_serializing_none] + #[derive(Serialize)] + struct QueryParams<'b> { + error_trace: Option, + #[serde(serialize_with = "crate::client::serialize_coll_qs")] + filter_path: Option<&'b [&'b str]>, + human: Option, + pretty: Option, + reset_end: Option<&'b str>, + reset_start: Option<&'b str>, + source: Option<&'b str>, + } + let query_params = QueryParams { + error_trace: self.error_trace, + filter_path: self.filter_path, + human: self.human, + pretty: self.pretty, + reset_end: self.reset_end, + reset_start: self.reset_start, + source: self.source, + }; + Some(query_params) + }; + let body = self.body; + let response = self + .transport + .send(method, &path, headers, query_string.as_ref(), body, timeout) + .await?; + Ok(response) + } +} +#[derive(Debug, Clone, PartialEq)] +#[doc = "API parts for the Ml Preview Datafeed API"] +pub enum MlPreviewDatafeedParts<'b> { + #[doc = "DatafeedId"] + DatafeedId(&'b str), +} +impl<'b> MlPreviewDatafeedParts<'b> { + #[doc = "Builds a relative URL path to the Ml Preview Datafeed API"] + pub fn url(self) -> Cow<'static, str> { + match self { + MlPreviewDatafeedParts::DatafeedId(ref datafeed_id) => { + let encoded_datafeed_id: Cow = + percent_encode(datafeed_id.as_bytes(), PARTS_ENCODED).into(); + let mut p = String::with_capacity(24usize + encoded_datafeed_id.len()); + p.push_str("/_ml/datafeeds/"); + p.push_str(encoded_datafeed_id.as_ref()); + p.push_str("/_preview"); + p.into() + } + } + } +} +#[doc = "Builder for the [Ml Preview Datafeed API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/ml-preview-datafeed.html)\n\nPreviews a datafeed."] +#[derive(Clone, Debug)] +pub struct MlPreviewDatafeed<'a, 'b> { + transport: &'a Transport, + parts: MlPreviewDatafeedParts<'b>, + error_trace: Option, + filter_path: Option<&'b [&'b str]>, + headers: HeaderMap, + human: Option, + pretty: Option, + request_timeout: Option, + source: Option<&'b str>, +} +impl<'a, 'b> MlPreviewDatafeed<'a, 'b> { + #[doc = "Creates a new instance of [MlPreviewDatafeed] with the specified API parts"] + pub fn new(transport: &'a Transport, parts: MlPreviewDatafeedParts<'b>) -> Self { + let headers = HeaderMap::new(); + MlPreviewDatafeed { + transport, + parts, + headers, + error_trace: None, + filter_path: None, + human: None, + pretty: None, + request_timeout: None, + source: None, + } + } + #[doc = "Include the stack trace of returned errors."] + pub fn error_trace(mut self, error_trace: bool) -> Self { + self.error_trace = Some(error_trace); + self + } + #[doc = "A comma-separated list of filters used to reduce the response."] + pub fn filter_path(mut self, filter_path: &'b [&'b str]) -> Self { + self.filter_path = Some(filter_path); + self + } + #[doc = "Adds a HTTP header"] + pub fn header(mut self, key: HeaderName, value: HeaderValue) -> Self { + self.headers.insert(key, value); + self + } + #[doc = "Return human readable values for statistics."] + pub fn human(mut self, human: bool) -> Self { + self.human = Some(human); + self + } + #[doc = "Pretty format the returned JSON response."] + pub fn pretty(mut self, pretty: bool) -> Self { + self.pretty = Some(pretty); + self + } + #[doc = "Sets a request timeout for this API call.\n\nThe timeout is applied from when the request starts connecting until the response body has finished."] + pub fn request_timeout(mut self, timeout: Duration) -> Self { + self.request_timeout = Some(timeout); + self + } + #[doc = "The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests."] + pub fn source(mut self, source: &'b str) -> Self { + self.source = Some(source); + self + } + #[doc = "Creates an asynchronous call to the Ml Preview Datafeed API that can be awaited"] + pub async fn send(self) -> Result { + let path = self.parts.url(); + let method = Method::Get; + let headers = self.headers; + let timeout = self.request_timeout; + let query_string = { + #[serde_with::skip_serializing_none] + #[derive(Serialize)] + struct QueryParams<'b> { + error_trace: Option, + #[serde(serialize_with = "crate::client::serialize_coll_qs")] + filter_path: Option<&'b [&'b str]>, + human: Option, + pretty: Option, + source: Option<&'b str>, + } + let query_params = QueryParams { + error_trace: self.error_trace, + filter_path: self.filter_path, + human: self.human, + pretty: self.pretty, + source: self.source, + }; + Some(query_params) + }; + let body = Option::<()>::None; + let response = self + .transport + .send(method, &path, headers, query_string.as_ref(), body, timeout) + .await?; + Ok(response) + } +} +#[derive(Debug, Clone, PartialEq)] +#[doc = "API parts for the Ml Put Calendar API"] +pub enum MlPutCalendarParts<'b> { + #[doc = "CalendarId"] + CalendarId(&'b str), +} +impl<'b> MlPutCalendarParts<'b> { + #[doc = "Builds a relative URL path to the Ml Put Calendar API"] + pub fn url(self) -> Cow<'static, str> { + match self { + MlPutCalendarParts::CalendarId(ref calendar_id) => { + let encoded_calendar_id: Cow = + percent_encode(calendar_id.as_bytes(), PARTS_ENCODED).into(); + let mut p = String::with_capacity(15usize + encoded_calendar_id.len()); + p.push_str("/_ml/calendars/"); + p.push_str(encoded_calendar_id.as_ref()); + p.into() + } + } + } +} +#[doc = "Builder for the [Ml Put Calendar API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/ml-put-calendar.html)\n\nInstantiates a calendar."] +#[derive(Clone, Debug)] +pub struct MlPutCalendar<'a, 'b, B> { transport: &'a Transport, - parts: MlInfoParts, + parts: MlPutCalendarParts<'b>, + body: Option, error_trace: Option, filter_path: Option<&'b [&'b str]>, headers: HeaderMap, @@ -4332,14 +6278,18 @@ pub struct MlInfo<'a, 'b> { request_timeout: Option, source: Option<&'b str>, } -impl<'a, 'b> MlInfo<'a, 'b> { - #[doc = "Creates a new instance of [MlInfo]"] - pub fn new(transport: &'a Transport) -> Self { +impl<'a, 'b, B> MlPutCalendar<'a, 'b, B> +where + B: Body, +{ + #[doc = "Creates a new instance of [MlPutCalendar] with the specified API parts"] + pub fn new(transport: &'a Transport, parts: MlPutCalendarParts<'b>) -> Self { let headers = HeaderMap::new(); - MlInfo { + MlPutCalendar { transport, - parts: MlInfoParts::None, + parts, headers, + body: None, error_trace: None, filter_path: None, human: None, @@ -4348,6 +6298,24 @@ impl<'a, 'b> MlInfo<'a, 'b> { source: None, } } + #[doc = "The body for the API call"] + pub fn body(self, body: T) -> MlPutCalendar<'a, 'b, JsonBody> + where + T: Serialize, + { + MlPutCalendar { + transport: self.transport, + parts: self.parts, + body: Some(body.into()), + error_trace: self.error_trace, + filter_path: self.filter_path, + headers: self.headers, + human: self.human, + pretty: self.pretty, + request_timeout: self.request_timeout, + source: self.source, + } + } #[doc = "Include the stack trace of returned errors."] pub fn error_trace(mut self, error_trace: bool) -> Self { self.error_trace = Some(error_trace); @@ -4383,10 +6351,10 @@ impl<'a, 'b> MlInfo<'a, 'b> { self.source = Some(source); self } - #[doc = "Creates an asynchronous call to the Ml Info API that can be awaited"] + #[doc = "Creates an asynchronous call to the Ml Put Calendar API that can be awaited"] pub async fn send(self) -> Result { let path = self.parts.url(); - let method = Method::Get; + let method = Method::Put; let headers = self.headers; let timeout = self.request_timeout; let query_string = { @@ -4409,7 +6377,7 @@ impl<'a, 'b> MlInfo<'a, 'b> { }; Some(query_params) }; - let body = Option::<()>::None; + let body = self.body; let response = self .transport .send(method, &path, headers, query_string.as_ref(), body, timeout) @@ -4418,32 +6386,37 @@ impl<'a, 'b> MlInfo<'a, 'b> { } } #[derive(Debug, Clone, PartialEq)] -#[doc = "API parts for the Ml Open Job API"] -pub enum MlOpenJobParts<'b> { - #[doc = "JobId"] - JobId(&'b str), +#[doc = "API parts for the Ml Put Calendar Job API"] +pub enum MlPutCalendarJobParts<'b> { + #[doc = "CalendarId and JobId"] + CalendarIdJobId(&'b str, &'b str), } -impl<'b> MlOpenJobParts<'b> { - #[doc = "Builds a relative URL path to the Ml Open Job API"] +impl<'b> MlPutCalendarJobParts<'b> { + #[doc = "Builds a relative URL path to the Ml Put Calendar Job API"] pub fn url(self) -> Cow<'static, str> { match self { - MlOpenJobParts::JobId(ref job_id) => { + MlPutCalendarJobParts::CalendarIdJobId(ref calendar_id, ref job_id) => { + let encoded_calendar_id: Cow = + percent_encode(calendar_id.as_bytes(), PARTS_ENCODED).into(); let encoded_job_id: Cow = percent_encode(job_id.as_bytes(), PARTS_ENCODED).into(); - let mut p = String::with_capacity(29usize + encoded_job_id.len()); - p.push_str("/_ml/anomaly_detectors/"); + let mut p = String::with_capacity( + 21usize + encoded_calendar_id.len() + encoded_job_id.len(), + ); + p.push_str("/_ml/calendars/"); + p.push_str(encoded_calendar_id.as_ref()); + p.push_str("/jobs/"); p.push_str(encoded_job_id.as_ref()); - p.push_str("/_open"); p.into() } } } } +#[doc = "Builder for the [Ml Put Calendar Job API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/ml-put-calendar-job.html)\n\nAdds an anomaly detection job to a calendar."] #[derive(Clone, Debug)] -#[doc = "Builder for the [Ml Open Job API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/ml-open-job.html)\n\nOpens one or more anomaly detection jobs."] -pub struct MlOpenJob<'a, 'b, B> { +pub struct MlPutCalendarJob<'a, 'b, B> { transport: &'a Transport, - parts: MlOpenJobParts<'b>, + parts: MlPutCalendarJobParts<'b>, body: Option, error_trace: Option, filter_path: Option<&'b [&'b str]>, @@ -4453,14 +6426,14 @@ pub struct MlOpenJob<'a, 'b, B> { request_timeout: Option, source: Option<&'b str>, } -impl<'a, 'b, B> MlOpenJob<'a, 'b, B> +impl<'a, 'b, B> MlPutCalendarJob<'a, 'b, B> where B: Body, { - #[doc = "Creates a new instance of [MlOpenJob] with the specified API parts"] - pub fn new(transport: &'a Transport, parts: MlOpenJobParts<'b>) -> Self { + #[doc = "Creates a new instance of [MlPutCalendarJob] with the specified API parts"] + pub fn new(transport: &'a Transport, parts: MlPutCalendarJobParts<'b>) -> Self { let headers = HeaderMap::new(); - MlOpenJob { + MlPutCalendarJob { transport, parts, headers, @@ -4474,11 +6447,11 @@ where } } #[doc = "The body for the API call"] - pub fn body(self, body: T) -> MlOpenJob<'a, 'b, JsonBody> + pub fn body(self, body: T) -> MlPutCalendarJob<'a, 'b, JsonBody> where T: Serialize, { - MlOpenJob { + MlPutCalendarJob { transport: self.transport, parts: self.parts, body: Some(body.into()), @@ -4526,10 +6499,10 @@ where self.source = Some(source); self } - #[doc = "Creates an asynchronous call to the Ml Open Job API that can be awaited"] + #[doc = "Creates an asynchronous call to the Ml Put Calendar Job API that can be awaited"] pub async fn send(self) -> Result { let path = self.parts.url(); - let method = Method::Post; + let method = Method::Put; let headers = self.headers; let timeout = self.request_timeout; let query_string = { @@ -4560,33 +6533,35 @@ where Ok(response) } } +#[cfg(feature = "beta-apis")] #[derive(Debug, Clone, PartialEq)] -#[doc = "API parts for the Ml Post Calendar Events API"] -pub enum MlPostCalendarEventsParts<'b> { - #[doc = "CalendarId"] - CalendarId(&'b str), -} -impl<'b> MlPostCalendarEventsParts<'b> { - #[doc = "Builds a relative URL path to the Ml Post Calendar Events API"] +#[doc = "API parts for the Ml Put Data Frame Analytics API"] +pub enum MlPutDataFrameAnalyticsParts<'b> { + #[doc = "Id"] + Id(&'b str), +} +#[cfg(feature = "beta-apis")] +impl<'b> MlPutDataFrameAnalyticsParts<'b> { + #[doc = "Builds a relative URL path to the Ml Put Data Frame Analytics API"] pub fn url(self) -> Cow<'static, str> { match self { - MlPostCalendarEventsParts::CalendarId(ref calendar_id) => { - let encoded_calendar_id: Cow = - percent_encode(calendar_id.as_bytes(), PARTS_ENCODED).into(); - let mut p = String::with_capacity(22usize + encoded_calendar_id.len()); - p.push_str("/_ml/calendars/"); - p.push_str(encoded_calendar_id.as_ref()); - p.push_str("/events"); + MlPutDataFrameAnalyticsParts::Id(ref id) => { + let encoded_id: Cow = percent_encode(id.as_bytes(), PARTS_ENCODED).into(); + let mut p = String::with_capacity(26usize + encoded_id.len()); + p.push_str("/_ml/data_frame/analytics/"); + p.push_str(encoded_id.as_ref()); p.into() } } } } +#[doc = "Builder for the [Ml Put Data Frame Analytics API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/put-dfanalytics.html)\n\nInstantiates a data frame analytics job."] +#[doc = " \n# Optional, beta\nThis requires the `beta-apis` feature. On track to become stable but breaking changes can\nhappen in minor versions.\n "] +#[cfg(feature = "beta-apis")] #[derive(Clone, Debug)] -#[doc = "Builder for the [Ml Post Calendar Events API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/ml-post-calendar-event.html)\n\nPosts scheduled events in a calendar."] -pub struct MlPostCalendarEvents<'a, 'b, B> { +pub struct MlPutDataFrameAnalytics<'a, 'b, B> { transport: &'a Transport, - parts: MlPostCalendarEventsParts<'b>, + parts: MlPutDataFrameAnalyticsParts<'b>, body: Option, error_trace: Option, filter_path: Option<&'b [&'b str]>, @@ -4596,14 +6571,15 @@ pub struct MlPostCalendarEvents<'a, 'b, B> { request_timeout: Option, source: Option<&'b str>, } -impl<'a, 'b, B> MlPostCalendarEvents<'a, 'b, B> +#[cfg(feature = "beta-apis")] +impl<'a, 'b, B> MlPutDataFrameAnalytics<'a, 'b, B> where B: Body, { - #[doc = "Creates a new instance of [MlPostCalendarEvents] with the specified API parts"] - pub fn new(transport: &'a Transport, parts: MlPostCalendarEventsParts<'b>) -> Self { + #[doc = "Creates a new instance of [MlPutDataFrameAnalytics] with the specified API parts"] + pub fn new(transport: &'a Transport, parts: MlPutDataFrameAnalyticsParts<'b>) -> Self { let headers = HeaderMap::new(); - MlPostCalendarEvents { + MlPutDataFrameAnalytics { transport, parts, headers, @@ -4617,11 +6593,11 @@ where } } #[doc = "The body for the API call"] - pub fn body(self, body: T) -> MlPostCalendarEvents<'a, 'b, JsonBody> + pub fn body(self, body: T) -> MlPutDataFrameAnalytics<'a, 'b, JsonBody> where T: Serialize, { - MlPostCalendarEvents { + MlPutDataFrameAnalytics { transport: self.transport, parts: self.parts, body: Some(body.into()), @@ -4669,10 +6645,10 @@ where self.source = Some(source); self } - #[doc = "Creates an asynchronous call to the Ml Post Calendar Events API that can be awaited"] + #[doc = "Creates an asynchronous call to the Ml Put Data Frame Analytics API that can be awaited"] pub async fn send(self) -> Result { let path = self.parts.url(); - let method = Method::Post; + let method = Method::Put; let headers = self.headers; let timeout = self.request_timeout; let query_string = { @@ -4704,82 +6680,92 @@ where } } #[derive(Debug, Clone, PartialEq)] -#[doc = "API parts for the Ml Post Data API"] -pub enum MlPostDataParts<'b> { - #[doc = "JobId"] - JobId(&'b str), +#[doc = "API parts for the Ml Put Datafeed API"] +pub enum MlPutDatafeedParts<'b> { + #[doc = "DatafeedId"] + DatafeedId(&'b str), } -impl<'b> MlPostDataParts<'b> { - #[doc = "Builds a relative URL path to the Ml Post Data API"] +impl<'b> MlPutDatafeedParts<'b> { + #[doc = "Builds a relative URL path to the Ml Put Datafeed API"] pub fn url(self) -> Cow<'static, str> { match self { - MlPostDataParts::JobId(ref job_id) => { - let encoded_job_id: Cow = - percent_encode(job_id.as_bytes(), PARTS_ENCODED).into(); - let mut p = String::with_capacity(29usize + encoded_job_id.len()); - p.push_str("/_ml/anomaly_detectors/"); - p.push_str(encoded_job_id.as_ref()); - p.push_str("/_data"); + MlPutDatafeedParts::DatafeedId(ref datafeed_id) => { + let encoded_datafeed_id: Cow = + percent_encode(datafeed_id.as_bytes(), PARTS_ENCODED).into(); + let mut p = String::with_capacity(15usize + encoded_datafeed_id.len()); + p.push_str("/_ml/datafeeds/"); + p.push_str(encoded_datafeed_id.as_ref()); p.into() } } } } +#[doc = "Builder for the [Ml Put Datafeed API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/ml-put-datafeed.html)\n\nInstantiates a datafeed."] #[derive(Clone, Debug)] -#[doc = "Builder for the [Ml Post Data API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/ml-post-data.html)\n\nSends data to an anomaly detection job for analysis."] -pub struct MlPostData<'a, 'b, B> { +pub struct MlPutDatafeed<'a, 'b, B> { transport: &'a Transport, - parts: MlPostDataParts<'b>, + parts: MlPutDatafeedParts<'b>, + allow_no_indices: Option, body: Option, error_trace: Option, + expand_wildcards: Option<&'b [ExpandWildcards]>, filter_path: Option<&'b [&'b str]>, headers: HeaderMap, human: Option, + ignore_throttled: Option, + ignore_unavailable: Option, pretty: Option, request_timeout: Option, - reset_end: Option<&'b str>, - reset_start: Option<&'b str>, source: Option<&'b str>, } -impl<'a, 'b, B> MlPostData<'a, 'b, B> +impl<'a, 'b, B> MlPutDatafeed<'a, 'b, B> where B: Body, { - #[doc = "Creates a new instance of [MlPostData] with the specified API parts"] - pub fn new(transport: &'a Transport, parts: MlPostDataParts<'b>) -> Self { + #[doc = "Creates a new instance of [MlPutDatafeed] with the specified API parts"] + pub fn new(transport: &'a Transport, parts: MlPutDatafeedParts<'b>) -> Self { let headers = HeaderMap::new(); - MlPostData { + MlPutDatafeed { transport, parts, headers, + allow_no_indices: None, body: None, error_trace: None, + expand_wildcards: None, filter_path: None, human: None, + ignore_throttled: None, + ignore_unavailable: None, pretty: None, request_timeout: None, - reset_end: None, - reset_start: None, source: None, } } + #[doc = "Ignore if the source indices expressions resolves to no concrete indices (default: true)"] + pub fn allow_no_indices(mut self, allow_no_indices: bool) -> Self { + self.allow_no_indices = Some(allow_no_indices); + self + } #[doc = "The body for the API call"] - pub fn body(self, body: Vec) -> MlPostData<'a, 'b, NdBody> + pub fn body(self, body: T) -> MlPutDatafeed<'a, 'b, JsonBody> where - T: Body, + T: Serialize, { - MlPostData { + MlPutDatafeed { transport: self.transport, parts: self.parts, - body: Some(NdBody(body)), + body: Some(body.into()), + allow_no_indices: self.allow_no_indices, error_trace: self.error_trace, + expand_wildcards: self.expand_wildcards, filter_path: self.filter_path, headers: self.headers, human: self.human, + ignore_throttled: self.ignore_throttled, + ignore_unavailable: self.ignore_unavailable, pretty: self.pretty, request_timeout: self.request_timeout, - reset_end: self.reset_end, - reset_start: self.reset_start, source: self.source, } } @@ -4788,6 +6774,11 @@ where self.error_trace = Some(error_trace); self } + #[doc = "Whether source index expressions should get expanded to open or closed indices (default: open)"] + pub fn expand_wildcards(mut self, expand_wildcards: &'b [ExpandWildcards]) -> Self { + self.expand_wildcards = Some(expand_wildcards); + self + } #[doc = "A comma-separated list of filters used to reduce the response."] pub fn filter_path(mut self, filter_path: &'b [&'b str]) -> Self { self.filter_path = Some(filter_path); @@ -4803,6 +6794,16 @@ where self.human = Some(human); self } + #[doc = "Ignore indices that are marked as throttled (default: true)"] + pub fn ignore_throttled(mut self, ignore_throttled: bool) -> Self { + self.ignore_throttled = Some(ignore_throttled); + self + } + #[doc = "Ignore unavailable indexes (default: false)"] + pub fn ignore_unavailable(mut self, ignore_unavailable: bool) -> Self { + self.ignore_unavailable = Some(ignore_unavailable); + self + } #[doc = "Pretty format the returned JSON response."] pub fn pretty(mut self, pretty: bool) -> Self { self.pretty = Some(pretty); @@ -4813,47 +6814,42 @@ where self.request_timeout = Some(timeout); self } - #[doc = "Optional parameter to specify the end of the bucket resetting range"] - pub fn reset_end(mut self, reset_end: &'b str) -> Self { - self.reset_end = Some(reset_end); - self - } - #[doc = "Optional parameter to specify the start of the bucket resetting range"] - pub fn reset_start(mut self, reset_start: &'b str) -> Self { - self.reset_start = Some(reset_start); - self - } #[doc = "The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests."] pub fn source(mut self, source: &'b str) -> Self { self.source = Some(source); self } - #[doc = "Creates an asynchronous call to the Ml Post Data API that can be awaited"] + #[doc = "Creates an asynchronous call to the Ml Put Datafeed API that can be awaited"] pub async fn send(self) -> Result { let path = self.parts.url(); - let method = Method::Post; + let method = Method::Put; let headers = self.headers; let timeout = self.request_timeout; let query_string = { #[serde_with::skip_serializing_none] #[derive(Serialize)] struct QueryParams<'b> { + allow_no_indices: Option, error_trace: Option, #[serde(serialize_with = "crate::client::serialize_coll_qs")] + expand_wildcards: Option<&'b [ExpandWildcards]>, + #[serde(serialize_with = "crate::client::serialize_coll_qs")] filter_path: Option<&'b [&'b str]>, human: Option, + ignore_throttled: Option, + ignore_unavailable: Option, pretty: Option, - reset_end: Option<&'b str>, - reset_start: Option<&'b str>, source: Option<&'b str>, } let query_params = QueryParams { + allow_no_indices: self.allow_no_indices, error_trace: self.error_trace, + expand_wildcards: self.expand_wildcards, filter_path: self.filter_path, human: self.human, + ignore_throttled: self.ignore_throttled, + ignore_unavailable: self.ignore_unavailable, pretty: self.pretty, - reset_end: self.reset_end, - reset_start: self.reset_start, source: self.source, }; Some(query_params) @@ -4867,32 +6863,32 @@ where } } #[derive(Debug, Clone, PartialEq)] -#[doc = "API parts for the Ml Preview Datafeed API"] -pub enum MlPreviewDatafeedParts<'b> { - #[doc = "DatafeedId"] - DatafeedId(&'b str), +#[doc = "API parts for the Ml Put Filter API"] +pub enum MlPutFilterParts<'b> { + #[doc = "FilterId"] + FilterId(&'b str), } -impl<'b> MlPreviewDatafeedParts<'b> { - #[doc = "Builds a relative URL path to the Ml Preview Datafeed API"] +impl<'b> MlPutFilterParts<'b> { + #[doc = "Builds a relative URL path to the Ml Put Filter API"] pub fn url(self) -> Cow<'static, str> { match self { - MlPreviewDatafeedParts::DatafeedId(ref datafeed_id) => { - let encoded_datafeed_id: Cow = - percent_encode(datafeed_id.as_bytes(), PARTS_ENCODED).into(); - let mut p = String::with_capacity(24usize + encoded_datafeed_id.len()); - p.push_str("/_ml/datafeeds/"); - p.push_str(encoded_datafeed_id.as_ref()); - p.push_str("/_preview"); + MlPutFilterParts::FilterId(ref filter_id) => { + let encoded_filter_id: Cow = + percent_encode(filter_id.as_bytes(), PARTS_ENCODED).into(); + let mut p = String::with_capacity(13usize + encoded_filter_id.len()); + p.push_str("/_ml/filters/"); + p.push_str(encoded_filter_id.as_ref()); p.into() } } } } +#[doc = "Builder for the [Ml Put Filter API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/ml-put-filter.html)\n\nInstantiates a filter."] #[derive(Clone, Debug)] -#[doc = "Builder for the [Ml Preview Datafeed API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/ml-preview-datafeed.html)\n\nPreviews a datafeed."] -pub struct MlPreviewDatafeed<'a, 'b> { +pub struct MlPutFilter<'a, 'b, B> { transport: &'a Transport, - parts: MlPreviewDatafeedParts<'b>, + parts: MlPutFilterParts<'b>, + body: Option, error_trace: Option, filter_path: Option<&'b [&'b str]>, headers: HeaderMap, @@ -4901,14 +6897,18 @@ pub struct MlPreviewDatafeed<'a, 'b> { request_timeout: Option, source: Option<&'b str>, } -impl<'a, 'b> MlPreviewDatafeed<'a, 'b> { - #[doc = "Creates a new instance of [MlPreviewDatafeed] with the specified API parts"] - pub fn new(transport: &'a Transport, parts: MlPreviewDatafeedParts<'b>) -> Self { +impl<'a, 'b, B> MlPutFilter<'a, 'b, B> +where + B: Body, +{ + #[doc = "Creates a new instance of [MlPutFilter] with the specified API parts"] + pub fn new(transport: &'a Transport, parts: MlPutFilterParts<'b>) -> Self { let headers = HeaderMap::new(); - MlPreviewDatafeed { + MlPutFilter { transport, parts, headers, + body: None, error_trace: None, filter_path: None, human: None, @@ -4917,6 +6917,24 @@ impl<'a, 'b> MlPreviewDatafeed<'a, 'b> { source: None, } } + #[doc = "The body for the API call"] + pub fn body(self, body: T) -> MlPutFilter<'a, 'b, JsonBody> + where + T: Serialize, + { + MlPutFilter { + transport: self.transport, + parts: self.parts, + body: Some(body.into()), + error_trace: self.error_trace, + filter_path: self.filter_path, + headers: self.headers, + human: self.human, + pretty: self.pretty, + request_timeout: self.request_timeout, + source: self.source, + } + } #[doc = "Include the stack trace of returned errors."] pub fn error_trace(mut self, error_trace: bool) -> Self { self.error_trace = Some(error_trace); @@ -4952,10 +6970,10 @@ impl<'a, 'b> MlPreviewDatafeed<'a, 'b> { self.source = Some(source); self } - #[doc = "Creates an asynchronous call to the Ml Preview Datafeed API that can be awaited"] + #[doc = "Creates an asynchronous call to the Ml Put Filter API that can be awaited"] pub async fn send(self) -> Result { let path = self.parts.url(); - let method = Method::Get; + let method = Method::Put; let headers = self.headers; let timeout = self.request_timeout; let query_string = { @@ -4978,7 +6996,7 @@ impl<'a, 'b> MlPreviewDatafeed<'a, 'b> { }; Some(query_params) }; - let body = Option::<()>::None; + let body = self.body; let response = self .transport .send(method, &path, headers, query_string.as_ref(), body, timeout) @@ -4987,31 +7005,31 @@ impl<'a, 'b> MlPreviewDatafeed<'a, 'b> { } } #[derive(Debug, Clone, PartialEq)] -#[doc = "API parts for the Ml Put Calendar API"] -pub enum MlPutCalendarParts<'b> { - #[doc = "CalendarId"] - CalendarId(&'b str), +#[doc = "API parts for the Ml Put Job API"] +pub enum MlPutJobParts<'b> { + #[doc = "JobId"] + JobId(&'b str), } -impl<'b> MlPutCalendarParts<'b> { - #[doc = "Builds a relative URL path to the Ml Put Calendar API"] +impl<'b> MlPutJobParts<'b> { + #[doc = "Builds a relative URL path to the Ml Put Job API"] pub fn url(self) -> Cow<'static, str> { match self { - MlPutCalendarParts::CalendarId(ref calendar_id) => { - let encoded_calendar_id: Cow = - percent_encode(calendar_id.as_bytes(), PARTS_ENCODED).into(); - let mut p = String::with_capacity(15usize + encoded_calendar_id.len()); - p.push_str("/_ml/calendars/"); - p.push_str(encoded_calendar_id.as_ref()); + MlPutJobParts::JobId(ref job_id) => { + let encoded_job_id: Cow = + percent_encode(job_id.as_bytes(), PARTS_ENCODED).into(); + let mut p = String::with_capacity(23usize + encoded_job_id.len()); + p.push_str("/_ml/anomaly_detectors/"); + p.push_str(encoded_job_id.as_ref()); p.into() } } } } +#[doc = "Builder for the [Ml Put Job API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/ml-put-job.html)\n\nInstantiates an anomaly detection job."] #[derive(Clone, Debug)] -#[doc = "Builder for the [Ml Put Calendar API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/ml-put-calendar.html)\n\nInstantiates a calendar."] -pub struct MlPutCalendar<'a, 'b, B> { +pub struct MlPutJob<'a, 'b, B> { transport: &'a Transport, - parts: MlPutCalendarParts<'b>, + parts: MlPutJobParts<'b>, body: Option, error_trace: Option, filter_path: Option<&'b [&'b str]>, @@ -5021,14 +7039,14 @@ pub struct MlPutCalendar<'a, 'b, B> { request_timeout: Option, source: Option<&'b str>, } -impl<'a, 'b, B> MlPutCalendar<'a, 'b, B> +impl<'a, 'b, B> MlPutJob<'a, 'b, B> where B: Body, { - #[doc = "Creates a new instance of [MlPutCalendar] with the specified API parts"] - pub fn new(transport: &'a Transport, parts: MlPutCalendarParts<'b>) -> Self { + #[doc = "Creates a new instance of [MlPutJob] with the specified API parts"] + pub fn new(transport: &'a Transport, parts: MlPutJobParts<'b>) -> Self { let headers = HeaderMap::new(); - MlPutCalendar { + MlPutJob { transport, parts, headers, @@ -5042,11 +7060,11 @@ where } } #[doc = "The body for the API call"] - pub fn body(self, body: T) -> MlPutCalendar<'a, 'b, JsonBody> + pub fn body(self, body: T) -> MlPutJob<'a, 'b, JsonBody> where T: Serialize, { - MlPutCalendar { + MlPutJob { transport: self.transport, parts: self.parts, body: Some(body.into()), @@ -5094,7 +7112,7 @@ where self.source = Some(source); self } - #[doc = "Creates an asynchronous call to the Ml Put Calendar API that can be awaited"] + #[doc = "Creates an asynchronous call to the Ml Put Job API that can be awaited"] pub async fn send(self) -> Result { let path = self.parts.url(); let method = Method::Put; @@ -5128,38 +7146,36 @@ where Ok(response) } } +#[cfg(feature = "beta-apis")] #[derive(Debug, Clone, PartialEq)] -#[doc = "API parts for the Ml Put Calendar Job API"] -pub enum MlPutCalendarJobParts<'b> { - #[doc = "CalendarId and JobId"] - CalendarIdJobId(&'b str, &'b str), -} -impl<'b> MlPutCalendarJobParts<'b> { - #[doc = "Builds a relative URL path to the Ml Put Calendar Job API"] +#[doc = "API parts for the Ml Put Trained Model API"] +pub enum MlPutTrainedModelParts<'b> { + #[doc = "ModelId"] + ModelId(&'b str), +} +#[cfg(feature = "beta-apis")] +impl<'b> MlPutTrainedModelParts<'b> { + #[doc = "Builds a relative URL path to the Ml Put Trained Model API"] pub fn url(self) -> Cow<'static, str> { match self { - MlPutCalendarJobParts::CalendarIdJobId(ref calendar_id, ref job_id) => { - let encoded_calendar_id: Cow = - percent_encode(calendar_id.as_bytes(), PARTS_ENCODED).into(); - let encoded_job_id: Cow = - percent_encode(job_id.as_bytes(), PARTS_ENCODED).into(); - let mut p = String::with_capacity( - 21usize + encoded_calendar_id.len() + encoded_job_id.len(), - ); - p.push_str("/_ml/calendars/"); - p.push_str(encoded_calendar_id.as_ref()); - p.push_str("/jobs/"); - p.push_str(encoded_job_id.as_ref()); + MlPutTrainedModelParts::ModelId(ref model_id) => { + let encoded_model_id: Cow = + percent_encode(model_id.as_bytes(), PARTS_ENCODED).into(); + let mut p = String::with_capacity(20usize + encoded_model_id.len()); + p.push_str("/_ml/trained_models/"); + p.push_str(encoded_model_id.as_ref()); p.into() } } } } +#[doc = "Builder for the [Ml Put Trained Model API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/put-trained-models.html)\n\nCreates an inference trained model."] +#[doc = " \n# Optional, beta\nThis requires the `beta-apis` feature. On track to become stable but breaking changes can\nhappen in minor versions.\n "] +#[cfg(feature = "beta-apis")] #[derive(Clone, Debug)] -#[doc = "Builder for the [Ml Put Calendar Job API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/ml-put-calendar-job.html)\n\nAdds an anomaly detection job to a calendar."] -pub struct MlPutCalendarJob<'a, 'b, B> { +pub struct MlPutTrainedModel<'a, 'b, B> { transport: &'a Transport, - parts: MlPutCalendarJobParts<'b>, + parts: MlPutTrainedModelParts<'b>, body: Option, error_trace: Option, filter_path: Option<&'b [&'b str]>, @@ -5169,14 +7185,15 @@ pub struct MlPutCalendarJob<'a, 'b, B> { request_timeout: Option, source: Option<&'b str>, } -impl<'a, 'b, B> MlPutCalendarJob<'a, 'b, B> +#[cfg(feature = "beta-apis")] +impl<'a, 'b, B> MlPutTrainedModel<'a, 'b, B> where B: Body, { - #[doc = "Creates a new instance of [MlPutCalendarJob] with the specified API parts"] - pub fn new(transport: &'a Transport, parts: MlPutCalendarJobParts<'b>) -> Self { + #[doc = "Creates a new instance of [MlPutTrainedModel] with the specified API parts"] + pub fn new(transport: &'a Transport, parts: MlPutTrainedModelParts<'b>) -> Self { let headers = HeaderMap::new(); - MlPutCalendarJob { + MlPutTrainedModel { transport, parts, headers, @@ -5190,11 +7207,11 @@ where } } #[doc = "The body for the API call"] - pub fn body(self, body: T) -> MlPutCalendarJob<'a, 'b, JsonBody> + pub fn body(self, body: T) -> MlPutTrainedModel<'a, 'b, JsonBody> where T: Serialize, { - MlPutCalendarJob { + MlPutTrainedModel { transport: self.transport, parts: self.parts, body: Some(body.into()), @@ -5242,7 +7259,7 @@ where self.source = Some(source); self } - #[doc = "Creates an asynchronous call to the Ml Put Calendar Job API that can be awaited"] + #[doc = "Creates an asynchronous call to the Ml Put Trained Model API that can be awaited"] pub async fn send(self) -> Result { let path = self.parts.url(); let method = Method::Put; @@ -5277,105 +7294,98 @@ where } } #[derive(Debug, Clone, PartialEq)] -#[doc = "API parts for the Ml Put Datafeed API"] -pub enum MlPutDatafeedParts<'b> { - #[doc = "DatafeedId"] - DatafeedId(&'b str), +#[doc = "API parts for the Ml Revert Model Snapshot API"] +pub enum MlRevertModelSnapshotParts<'b> { + #[doc = "JobId and SnapshotId"] + JobIdSnapshotId(&'b str, &'b str), } -impl<'b> MlPutDatafeedParts<'b> { - #[doc = "Builds a relative URL path to the Ml Put Datafeed API"] +impl<'b> MlRevertModelSnapshotParts<'b> { + #[doc = "Builds a relative URL path to the Ml Revert Model Snapshot API"] pub fn url(self) -> Cow<'static, str> { match self { - MlPutDatafeedParts::DatafeedId(ref datafeed_id) => { - let encoded_datafeed_id: Cow = - percent_encode(datafeed_id.as_bytes(), PARTS_ENCODED).into(); - let mut p = String::with_capacity(15usize + encoded_datafeed_id.len()); - p.push_str("/_ml/datafeeds/"); - p.push_str(encoded_datafeed_id.as_ref()); + MlRevertModelSnapshotParts::JobIdSnapshotId(ref job_id, ref snapshot_id) => { + let encoded_job_id: Cow = + percent_encode(job_id.as_bytes(), PARTS_ENCODED).into(); + let encoded_snapshot_id: Cow = + percent_encode(snapshot_id.as_bytes(), PARTS_ENCODED).into(); + let mut p = String::with_capacity( + 48usize + encoded_job_id.len() + encoded_snapshot_id.len(), + ); + p.push_str("/_ml/anomaly_detectors/"); + p.push_str(encoded_job_id.as_ref()); + p.push_str("/model_snapshots/"); + p.push_str(encoded_snapshot_id.as_ref()); + p.push_str("/_revert"); p.into() } } } } +#[doc = "Builder for the [Ml Revert Model Snapshot API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/ml-revert-snapshot.html)\n\nReverts to a specific snapshot."] #[derive(Clone, Debug)] -#[doc = "Builder for the [Ml Put Datafeed API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/ml-put-datafeed.html)\n\nInstantiates a datafeed."] -pub struct MlPutDatafeed<'a, 'b, B> { +pub struct MlRevertModelSnapshot<'a, 'b, B> { transport: &'a Transport, - parts: MlPutDatafeedParts<'b>, - allow_no_indices: Option, + parts: MlRevertModelSnapshotParts<'b>, body: Option, + delete_intervening_results: Option, error_trace: Option, - expand_wildcards: Option<&'b [ExpandWildcards]>, filter_path: Option<&'b [&'b str]>, headers: HeaderMap, human: Option, - ignore_throttled: Option, - ignore_unavailable: Option, pretty: Option, request_timeout: Option, source: Option<&'b str>, } -impl<'a, 'b, B> MlPutDatafeed<'a, 'b, B> +impl<'a, 'b, B> MlRevertModelSnapshot<'a, 'b, B> where B: Body, { - #[doc = "Creates a new instance of [MlPutDatafeed] with the specified API parts"] - pub fn new(transport: &'a Transport, parts: MlPutDatafeedParts<'b>) -> Self { + #[doc = "Creates a new instance of [MlRevertModelSnapshot] with the specified API parts"] + pub fn new(transport: &'a Transport, parts: MlRevertModelSnapshotParts<'b>) -> Self { let headers = HeaderMap::new(); - MlPutDatafeed { + MlRevertModelSnapshot { transport, parts, headers, - allow_no_indices: None, body: None, + delete_intervening_results: None, error_trace: None, - expand_wildcards: None, filter_path: None, human: None, - ignore_throttled: None, - ignore_unavailable: None, pretty: None, request_timeout: None, source: None, } } - #[doc = "Ignore if the source indices expressions resolves to no concrete indices (default: true)"] - pub fn allow_no_indices(mut self, allow_no_indices: bool) -> Self { - self.allow_no_indices = Some(allow_no_indices); - self - } #[doc = "The body for the API call"] - pub fn body(self, body: T) -> MlPutDatafeed<'a, 'b, JsonBody> + pub fn body(self, body: T) -> MlRevertModelSnapshot<'a, 'b, JsonBody> where T: Serialize, { - MlPutDatafeed { + MlRevertModelSnapshot { transport: self.transport, parts: self.parts, body: Some(body.into()), - allow_no_indices: self.allow_no_indices, + delete_intervening_results: self.delete_intervening_results, error_trace: self.error_trace, - expand_wildcards: self.expand_wildcards, filter_path: self.filter_path, headers: self.headers, human: self.human, - ignore_throttled: self.ignore_throttled, - ignore_unavailable: self.ignore_unavailable, pretty: self.pretty, request_timeout: self.request_timeout, source: self.source, } } + #[doc = "Should we reset the results back to the time of the snapshot?"] + pub fn delete_intervening_results(mut self, delete_intervening_results: bool) -> Self { + self.delete_intervening_results = Some(delete_intervening_results); + self + } #[doc = "Include the stack trace of returned errors."] pub fn error_trace(mut self, error_trace: bool) -> Self { self.error_trace = Some(error_trace); self } - #[doc = "Whether source index expressions should get expanded to open or closed indices (default: open)"] - pub fn expand_wildcards(mut self, expand_wildcards: &'b [ExpandWildcards]) -> Self { - self.expand_wildcards = Some(expand_wildcards); - self - } #[doc = "A comma-separated list of filters used to reduce the response."] pub fn filter_path(mut self, filter_path: &'b [&'b str]) -> Self { self.filter_path = Some(filter_path); @@ -5391,16 +7401,6 @@ where self.human = Some(human); self } - #[doc = "Ignore indices that are marked as throttled (default: true)"] - pub fn ignore_throttled(mut self, ignore_throttled: bool) -> Self { - self.ignore_throttled = Some(ignore_throttled); - self - } - #[doc = "Ignore unavailable indexes (default: false)"] - pub fn ignore_unavailable(mut self, ignore_unavailable: bool) -> Self { - self.ignore_unavailable = Some(ignore_unavailable); - self - } #[doc = "Pretty format the returned JSON response."] pub fn pretty(mut self, pretty: bool) -> Self { self.pretty = Some(pretty); @@ -5416,36 +7416,29 @@ where self.source = Some(source); self } - #[doc = "Creates an asynchronous call to the Ml Put Datafeed API that can be awaited"] + #[doc = "Creates an asynchronous call to the Ml Revert Model Snapshot API that can be awaited"] pub async fn send(self) -> Result { let path = self.parts.url(); - let method = Method::Put; + let method = Method::Post; let headers = self.headers; let timeout = self.request_timeout; let query_string = { #[serde_with::skip_serializing_none] #[derive(Serialize)] struct QueryParams<'b> { - allow_no_indices: Option, + delete_intervening_results: Option, error_trace: Option, #[serde(serialize_with = "crate::client::serialize_coll_qs")] - expand_wildcards: Option<&'b [ExpandWildcards]>, - #[serde(serialize_with = "crate::client::serialize_coll_qs")] filter_path: Option<&'b [&'b str]>, human: Option, - ignore_throttled: Option, - ignore_unavailable: Option, pretty: Option, source: Option<&'b str>, } let query_params = QueryParams { - allow_no_indices: self.allow_no_indices, + delete_intervening_results: self.delete_intervening_results, error_trace: self.error_trace, - expand_wildcards: self.expand_wildcards, filter_path: self.filter_path, human: self.human, - ignore_throttled: self.ignore_throttled, - ignore_unavailable: self.ignore_unavailable, pretty: self.pretty, source: self.source, }; @@ -5460,32 +7453,26 @@ where } } #[derive(Debug, Clone, PartialEq)] -#[doc = "API parts for the Ml Put Filter API"] -pub enum MlPutFilterParts<'b> { - #[doc = "FilterId"] - FilterId(&'b str), +#[doc = "API parts for the Ml Set Upgrade Mode API"] +pub enum MlSetUpgradeModeParts { + #[doc = "No parts"] + None, } -impl<'b> MlPutFilterParts<'b> { - #[doc = "Builds a relative URL path to the Ml Put Filter API"] +impl MlSetUpgradeModeParts { + #[doc = "Builds a relative URL path to the Ml Set Upgrade Mode API"] pub fn url(self) -> Cow<'static, str> { match self { - MlPutFilterParts::FilterId(ref filter_id) => { - let encoded_filter_id: Cow = - percent_encode(filter_id.as_bytes(), PARTS_ENCODED).into(); - let mut p = String::with_capacity(13usize + encoded_filter_id.len()); - p.push_str("/_ml/filters/"); - p.push_str(encoded_filter_id.as_ref()); - p.into() - } + MlSetUpgradeModeParts::None => "/_ml/set_upgrade_mode".into(), } } } +#[doc = "Builder for the [Ml Set Upgrade Mode API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/ml-set-upgrade-mode.html)\n\nSets a cluster wide upgrade_mode setting that prepares machine learning indices for an upgrade."] #[derive(Clone, Debug)] -#[doc = "Builder for the [Ml Put Filter API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/ml-put-filter.html)\n\nInstantiates a filter."] -pub struct MlPutFilter<'a, 'b, B> { +pub struct MlSetUpgradeMode<'a, 'b, B> { transport: &'a Transport, - parts: MlPutFilterParts<'b>, + parts: MlSetUpgradeModeParts, body: Option, + enabled: Option, error_trace: Option, filter_path: Option<&'b [&'b str]>, headers: HeaderMap, @@ -5493,36 +7480,40 @@ pub struct MlPutFilter<'a, 'b, B> { pretty: Option, request_timeout: Option, source: Option<&'b str>, + timeout: Option<&'b str>, } -impl<'a, 'b, B> MlPutFilter<'a, 'b, B> +impl<'a, 'b, B> MlSetUpgradeMode<'a, 'b, B> where B: Body, { - #[doc = "Creates a new instance of [MlPutFilter] with the specified API parts"] - pub fn new(transport: &'a Transport, parts: MlPutFilterParts<'b>) -> Self { + #[doc = "Creates a new instance of [MlSetUpgradeMode]"] + pub fn new(transport: &'a Transport) -> Self { let headers = HeaderMap::new(); - MlPutFilter { + MlSetUpgradeMode { transport, - parts, + parts: MlSetUpgradeModeParts::None, headers, body: None, + enabled: None, error_trace: None, filter_path: None, human: None, pretty: None, request_timeout: None, source: None, + timeout: None, } } #[doc = "The body for the API call"] - pub fn body(self, body: T) -> MlPutFilter<'a, 'b, JsonBody> + pub fn body(self, body: T) -> MlSetUpgradeMode<'a, 'b, JsonBody> where T: Serialize, { - MlPutFilter { + MlSetUpgradeMode { transport: self.transport, parts: self.parts, body: Some(body.into()), + enabled: self.enabled, error_trace: self.error_trace, filter_path: self.filter_path, headers: self.headers, @@ -5530,8 +7521,14 @@ where pretty: self.pretty, request_timeout: self.request_timeout, source: self.source, + timeout: self.timeout, } } + #[doc = "Whether to enable upgrade_mode ML setting or not. Defaults to false."] + pub fn enabled(mut self, enabled: bool) -> Self { + self.enabled = Some(enabled); + self + } #[doc = "Include the stack trace of returned errors."] pub fn error_trace(mut self, error_trace: bool) -> Self { self.error_trace = Some(error_trace); @@ -5567,29 +7564,38 @@ where self.source = Some(source); self } - #[doc = "Creates an asynchronous call to the Ml Put Filter API that can be awaited"] + #[doc = "Controls the time to wait before action times out. Defaults to 30 seconds"] + pub fn timeout(mut self, timeout: &'b str) -> Self { + self.timeout = Some(timeout); + self + } + #[doc = "Creates an asynchronous call to the Ml Set Upgrade Mode API that can be awaited"] pub async fn send(self) -> Result { let path = self.parts.url(); - let method = Method::Put; + let method = Method::Post; let headers = self.headers; let timeout = self.request_timeout; let query_string = { #[serde_with::skip_serializing_none] #[derive(Serialize)] struct QueryParams<'b> { + enabled: Option, error_trace: Option, #[serde(serialize_with = "crate::client::serialize_coll_qs")] filter_path: Option<&'b [&'b str]>, human: Option, pretty: Option, source: Option<&'b str>, + timeout: Option<&'b str>, } let query_params = QueryParams { + enabled: self.enabled, error_trace: self.error_trace, filter_path: self.filter_path, human: self.human, pretty: self.pretty, source: self.source, + timeout: self.timeout, }; Some(query_params) }; @@ -5601,32 +7607,36 @@ where Ok(response) } } +#[cfg(feature = "beta-apis")] #[derive(Debug, Clone, PartialEq)] -#[doc = "API parts for the Ml Put Job API"] -pub enum MlPutJobParts<'b> { - #[doc = "JobId"] - JobId(&'b str), -} -impl<'b> MlPutJobParts<'b> { - #[doc = "Builds a relative URL path to the Ml Put Job API"] +#[doc = "API parts for the Ml Start Data Frame Analytics API"] +pub enum MlStartDataFrameAnalyticsParts<'b> { + #[doc = "Id"] + Id(&'b str), +} +#[cfg(feature = "beta-apis")] +impl<'b> MlStartDataFrameAnalyticsParts<'b> { + #[doc = "Builds a relative URL path to the Ml Start Data Frame Analytics API"] pub fn url(self) -> Cow<'static, str> { match self { - MlPutJobParts::JobId(ref job_id) => { - let encoded_job_id: Cow = - percent_encode(job_id.as_bytes(), PARTS_ENCODED).into(); - let mut p = String::with_capacity(23usize + encoded_job_id.len()); - p.push_str("/_ml/anomaly_detectors/"); - p.push_str(encoded_job_id.as_ref()); + MlStartDataFrameAnalyticsParts::Id(ref id) => { + let encoded_id: Cow = percent_encode(id.as_bytes(), PARTS_ENCODED).into(); + let mut p = String::with_capacity(33usize + encoded_id.len()); + p.push_str("/_ml/data_frame/analytics/"); + p.push_str(encoded_id.as_ref()); + p.push_str("/_start"); p.into() } } } } +#[doc = "Builder for the [Ml Start Data Frame Analytics API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/start-dfanalytics.html)\n\nStarts a data frame analytics job."] +#[doc = " \n# Optional, beta\nThis requires the `beta-apis` feature. On track to become stable but breaking changes can\nhappen in minor versions.\n "] +#[cfg(feature = "beta-apis")] #[derive(Clone, Debug)] -#[doc = "Builder for the [Ml Put Job API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/ml-put-job.html)\n\nInstantiates an anomaly detection job."] -pub struct MlPutJob<'a, 'b, B> { +pub struct MlStartDataFrameAnalytics<'a, 'b, B> { transport: &'a Transport, - parts: MlPutJobParts<'b>, + parts: MlStartDataFrameAnalyticsParts<'b>, body: Option, error_trace: Option, filter_path: Option<&'b [&'b str]>, @@ -5635,15 +7645,17 @@ pub struct MlPutJob<'a, 'b, B> { pretty: Option, request_timeout: Option, source: Option<&'b str>, + timeout: Option<&'b str>, } -impl<'a, 'b, B> MlPutJob<'a, 'b, B> +#[cfg(feature = "beta-apis")] +impl<'a, 'b, B> MlStartDataFrameAnalytics<'a, 'b, B> where B: Body, { - #[doc = "Creates a new instance of [MlPutJob] with the specified API parts"] - pub fn new(transport: &'a Transport, parts: MlPutJobParts<'b>) -> Self { + #[doc = "Creates a new instance of [MlStartDataFrameAnalytics] with the specified API parts"] + pub fn new(transport: &'a Transport, parts: MlStartDataFrameAnalyticsParts<'b>) -> Self { let headers = HeaderMap::new(); - MlPutJob { + MlStartDataFrameAnalytics { transport, parts, headers, @@ -5654,14 +7666,15 @@ where pretty: None, request_timeout: None, source: None, + timeout: None, } } #[doc = "The body for the API call"] - pub fn body(self, body: T) -> MlPutJob<'a, 'b, JsonBody> + pub fn body(self, body: T) -> MlStartDataFrameAnalytics<'a, 'b, JsonBody> where T: Serialize, { - MlPutJob { + MlStartDataFrameAnalytics { transport: self.transport, parts: self.parts, body: Some(body.into()), @@ -5672,6 +7685,7 @@ where pretty: self.pretty, request_timeout: self.request_timeout, source: self.source, + timeout: self.timeout, } } #[doc = "Include the stack trace of returned errors."] @@ -5709,10 +7723,15 @@ where self.source = Some(source); self } - #[doc = "Creates an asynchronous call to the Ml Put Job API that can be awaited"] + #[doc = "Controls the time to wait until the task has started. Defaults to 20 seconds"] + pub fn timeout(mut self, timeout: &'b str) -> Self { + self.timeout = Some(timeout); + self + } + #[doc = "Creates an asynchronous call to the Ml Start Data Frame Analytics API that can be awaited"] pub async fn send(self) -> Result { let path = self.parts.url(); - let method = Method::Put; + let method = Method::Post; let headers = self.headers; let timeout = self.request_timeout; let query_string = { @@ -5725,6 +7744,7 @@ where human: Option, pretty: Option, source: Option<&'b str>, + timeout: Option<&'b str>, } let query_params = QueryParams { error_trace: self.error_trace, @@ -5732,6 +7752,7 @@ where human: self.human, pretty: self.pretty, source: self.source, + timeout: self.timeout, }; Some(query_params) }; @@ -5744,40 +7765,34 @@ where } } #[derive(Debug, Clone, PartialEq)] -#[doc = "API parts for the Ml Revert Model Snapshot API"] -pub enum MlRevertModelSnapshotParts<'b> { - #[doc = "JobId and SnapshotId"] - JobIdSnapshotId(&'b str, &'b str), +#[doc = "API parts for the Ml Start Datafeed API"] +pub enum MlStartDatafeedParts<'b> { + #[doc = "DatafeedId"] + DatafeedId(&'b str), } -impl<'b> MlRevertModelSnapshotParts<'b> { - #[doc = "Builds a relative URL path to the Ml Revert Model Snapshot API"] +impl<'b> MlStartDatafeedParts<'b> { + #[doc = "Builds a relative URL path to the Ml Start Datafeed API"] pub fn url(self) -> Cow<'static, str> { match self { - MlRevertModelSnapshotParts::JobIdSnapshotId(ref job_id, ref snapshot_id) => { - let encoded_job_id: Cow = - percent_encode(job_id.as_bytes(), PARTS_ENCODED).into(); - let encoded_snapshot_id: Cow = - percent_encode(snapshot_id.as_bytes(), PARTS_ENCODED).into(); - let mut p = String::with_capacity( - 48usize + encoded_job_id.len() + encoded_snapshot_id.len(), - ); - p.push_str("/_ml/anomaly_detectors/"); - p.push_str(encoded_job_id.as_ref()); - p.push_str("/model_snapshots/"); - p.push_str(encoded_snapshot_id.as_ref()); - p.push_str("/_revert"); + MlStartDatafeedParts::DatafeedId(ref datafeed_id) => { + let encoded_datafeed_id: Cow = + percent_encode(datafeed_id.as_bytes(), PARTS_ENCODED).into(); + let mut p = String::with_capacity(22usize + encoded_datafeed_id.len()); + p.push_str("/_ml/datafeeds/"); + p.push_str(encoded_datafeed_id.as_ref()); + p.push_str("/_start"); p.into() } } } } +#[doc = "Builder for the [Ml Start Datafeed API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/ml-start-datafeed.html)\n\nStarts one or more datafeeds."] #[derive(Clone, Debug)] -#[doc = "Builder for the [Ml Revert Model Snapshot API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/ml-revert-snapshot.html)\n\nReverts to a specific snapshot."] -pub struct MlRevertModelSnapshot<'a, 'b, B> { +pub struct MlStartDatafeed<'a, 'b, B> { transport: &'a Transport, - parts: MlRevertModelSnapshotParts<'b>, + parts: MlStartDatafeedParts<'b>, body: Option, - delete_intervening_results: Option, + end: Option<&'b str>, error_trace: Option, filter_path: Option<&'b [&'b str]>, headers: HeaderMap, @@ -5785,38 +7800,42 @@ pub struct MlRevertModelSnapshot<'a, 'b, B> { pretty: Option, request_timeout: Option, source: Option<&'b str>, + start: Option<&'b str>, + timeout: Option<&'b str>, } -impl<'a, 'b, B> MlRevertModelSnapshot<'a, 'b, B> +impl<'a, 'b, B> MlStartDatafeed<'a, 'b, B> where B: Body, { - #[doc = "Creates a new instance of [MlRevertModelSnapshot] with the specified API parts"] - pub fn new(transport: &'a Transport, parts: MlRevertModelSnapshotParts<'b>) -> Self { + #[doc = "Creates a new instance of [MlStartDatafeed] with the specified API parts"] + pub fn new(transport: &'a Transport, parts: MlStartDatafeedParts<'b>) -> Self { let headers = HeaderMap::new(); - MlRevertModelSnapshot { + MlStartDatafeed { transport, parts, headers, body: None, - delete_intervening_results: None, + end: None, error_trace: None, filter_path: None, human: None, pretty: None, request_timeout: None, source: None, + start: None, + timeout: None, } } #[doc = "The body for the API call"] - pub fn body(self, body: T) -> MlRevertModelSnapshot<'a, 'b, JsonBody> + pub fn body(self, body: T) -> MlStartDatafeed<'a, 'b, JsonBody> where T: Serialize, { - MlRevertModelSnapshot { + MlStartDatafeed { transport: self.transport, parts: self.parts, body: Some(body.into()), - delete_intervening_results: self.delete_intervening_results, + end: self.end, error_trace: self.error_trace, filter_path: self.filter_path, headers: self.headers, @@ -5824,11 +7843,13 @@ where pretty: self.pretty, request_timeout: self.request_timeout, source: self.source, + start: self.start, + timeout: self.timeout, } } - #[doc = "Should we reset the results back to the time of the snapshot?"] - pub fn delete_intervening_results(mut self, delete_intervening_results: bool) -> Self { - self.delete_intervening_results = Some(delete_intervening_results); + #[doc = "The end time when the datafeed should stop. When not set, the datafeed continues in real time"] + pub fn end(mut self, end: &'b str) -> Self { + self.end = Some(end); self } #[doc = "Include the stack trace of returned errors."] @@ -5866,7 +7887,17 @@ where self.source = Some(source); self } - #[doc = "Creates an asynchronous call to the Ml Revert Model Snapshot API that can be awaited"] + #[doc = "The start time from where the datafeed should begin"] + pub fn start(mut self, start: &'b str) -> Self { + self.start = Some(start); + self + } + #[doc = "Controls the time to wait until a datafeed has started. Default to 20 seconds"] + pub fn timeout(mut self, timeout: &'b str) -> Self { + self.timeout = Some(timeout); + self + } + #[doc = "Creates an asynchronous call to the Ml Start Datafeed API that can be awaited"] pub async fn send(self) -> Result { let path = self.parts.url(); let method = Method::Post; @@ -5876,21 +7907,25 @@ where #[serde_with::skip_serializing_none] #[derive(Serialize)] struct QueryParams<'b> { - delete_intervening_results: Option, + end: Option<&'b str>, error_trace: Option, #[serde(serialize_with = "crate::client::serialize_coll_qs")] filter_path: Option<&'b [&'b str]>, human: Option, pretty: Option, source: Option<&'b str>, + start: Option<&'b str>, + timeout: Option<&'b str>, } let query_params = QueryParams { - delete_intervening_results: self.delete_intervening_results, + end: self.end, error_trace: self.error_trace, filter_path: self.filter_path, human: self.human, pretty: self.pretty, source: self.source, + start: self.start, + timeout: self.timeout, }; Some(query_params) }; @@ -5902,29 +7937,41 @@ where Ok(response) } } +#[cfg(feature = "beta-apis")] #[derive(Debug, Clone, PartialEq)] -#[doc = "API parts for the Ml Set Upgrade Mode API"] -pub enum MlSetUpgradeModeParts { - #[doc = "No parts"] - None, -} -impl MlSetUpgradeModeParts { - #[doc = "Builds a relative URL path to the Ml Set Upgrade Mode API"] +#[doc = "API parts for the Ml Stop Data Frame Analytics API"] +pub enum MlStopDataFrameAnalyticsParts<'b> { + #[doc = "Id"] + Id(&'b str), +} +#[cfg(feature = "beta-apis")] +impl<'b> MlStopDataFrameAnalyticsParts<'b> { + #[doc = "Builds a relative URL path to the Ml Stop Data Frame Analytics API"] pub fn url(self) -> Cow<'static, str> { match self { - MlSetUpgradeModeParts::None => "/_ml/set_upgrade_mode".into(), + MlStopDataFrameAnalyticsParts::Id(ref id) => { + let encoded_id: Cow = percent_encode(id.as_bytes(), PARTS_ENCODED).into(); + let mut p = String::with_capacity(32usize + encoded_id.len()); + p.push_str("/_ml/data_frame/analytics/"); + p.push_str(encoded_id.as_ref()); + p.push_str("/_stop"); + p.into() + } } } } +#[doc = "Builder for the [Ml Stop Data Frame Analytics API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/stop-dfanalytics.html)\n\nStops one or more data frame analytics jobs."] +#[doc = " \n# Optional, beta\nThis requires the `beta-apis` feature. On track to become stable but breaking changes can\nhappen in minor versions.\n "] +#[cfg(feature = "beta-apis")] #[derive(Clone, Debug)] -#[doc = "Builder for the [Ml Set Upgrade Mode API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/ml-set-upgrade-mode.html)\n\nSets a cluster wide upgrade_mode setting that prepares machine learning indices for an upgrade."] -pub struct MlSetUpgradeMode<'a, 'b, B> { +pub struct MlStopDataFrameAnalytics<'a, 'b, B> { transport: &'a Transport, - parts: MlSetUpgradeModeParts, + parts: MlStopDataFrameAnalyticsParts<'b>, + allow_no_match: Option, body: Option, - enabled: Option, error_trace: Option, filter_path: Option<&'b [&'b str]>, + force: Option, headers: HeaderMap, human: Option, pretty: Option, @@ -5932,21 +7979,23 @@ pub struct MlSetUpgradeMode<'a, 'b, B> { source: Option<&'b str>, timeout: Option<&'b str>, } -impl<'a, 'b, B> MlSetUpgradeMode<'a, 'b, B> +#[cfg(feature = "beta-apis")] +impl<'a, 'b, B> MlStopDataFrameAnalytics<'a, 'b, B> where B: Body, { - #[doc = "Creates a new instance of [MlSetUpgradeMode]"] - pub fn new(transport: &'a Transport) -> Self { + #[doc = "Creates a new instance of [MlStopDataFrameAnalytics] with the specified API parts"] + pub fn new(transport: &'a Transport, parts: MlStopDataFrameAnalyticsParts<'b>) -> Self { let headers = HeaderMap::new(); - MlSetUpgradeMode { + MlStopDataFrameAnalytics { transport, - parts: MlSetUpgradeModeParts::None, + parts, headers, + allow_no_match: None, body: None, - enabled: None, error_trace: None, filter_path: None, + force: None, human: None, pretty: None, request_timeout: None, @@ -5954,18 +8003,24 @@ where timeout: None, } } + #[doc = "Whether to ignore if a wildcard expression matches no data frame analytics. (This includes `_all` string or when no data frame analytics have been specified)"] + pub fn allow_no_match(mut self, allow_no_match: bool) -> Self { + self.allow_no_match = Some(allow_no_match); + self + } #[doc = "The body for the API call"] - pub fn body(self, body: T) -> MlSetUpgradeMode<'a, 'b, JsonBody> + pub fn body(self, body: T) -> MlStopDataFrameAnalytics<'a, 'b, JsonBody> where T: Serialize, { - MlSetUpgradeMode { + MlStopDataFrameAnalytics { transport: self.transport, parts: self.parts, body: Some(body.into()), - enabled: self.enabled, + allow_no_match: self.allow_no_match, error_trace: self.error_trace, filter_path: self.filter_path, + force: self.force, headers: self.headers, human: self.human, pretty: self.pretty, @@ -5974,11 +8029,6 @@ where timeout: self.timeout, } } - #[doc = "Whether to enable upgrade_mode ML setting or not. Defaults to false."] - pub fn enabled(mut self, enabled: bool) -> Self { - self.enabled = Some(enabled); - self - } #[doc = "Include the stack trace of returned errors."] pub fn error_trace(mut self, error_trace: bool) -> Self { self.error_trace = Some(error_trace); @@ -5989,6 +8039,11 @@ where self.filter_path = Some(filter_path); self } + #[doc = "True if the data frame analytics should be forcefully stopped"] + pub fn force(mut self, force: bool) -> Self { + self.force = Some(force); + self + } #[doc = "Adds a HTTP header"] pub fn header(mut self, key: HeaderName, value: HeaderValue) -> Self { self.headers.insert(key, value); @@ -6014,12 +8069,12 @@ where self.source = Some(source); self } - #[doc = "Controls the time to wait before action times out. Defaults to 30 seconds"] + #[doc = "Controls the time to wait until the task has stopped. Defaults to 20 seconds"] pub fn timeout(mut self, timeout: &'b str) -> Self { self.timeout = Some(timeout); self } - #[doc = "Creates an asynchronous call to the Ml Set Upgrade Mode API that can be awaited"] + #[doc = "Creates an asynchronous call to the Ml Stop Data Frame Analytics API that can be awaited"] pub async fn send(self) -> Result { let path = self.parts.url(); let method = Method::Post; @@ -6029,19 +8084,21 @@ where #[serde_with::skip_serializing_none] #[derive(Serialize)] struct QueryParams<'b> { - enabled: Option, + allow_no_match: Option, error_trace: Option, #[serde(serialize_with = "crate::client::serialize_coll_qs")] filter_path: Option<&'b [&'b str]>, + force: Option, human: Option, pretty: Option, source: Option<&'b str>, timeout: Option<&'b str>, } let query_params = QueryParams { - enabled: self.enabled, + allow_no_match: self.allow_no_match, error_trace: self.error_trace, filter_path: self.filter_path, + force: self.force, human: self.human, pretty: self.pretty, source: self.source, @@ -6058,93 +8115,101 @@ where } } #[derive(Debug, Clone, PartialEq)] -#[doc = "API parts for the Ml Start Datafeed API"] -pub enum MlStartDatafeedParts<'b> { +#[doc = "API parts for the Ml Stop Datafeed API"] +pub enum MlStopDatafeedParts<'b> { #[doc = "DatafeedId"] DatafeedId(&'b str), } -impl<'b> MlStartDatafeedParts<'b> { - #[doc = "Builds a relative URL path to the Ml Start Datafeed API"] +impl<'b> MlStopDatafeedParts<'b> { + #[doc = "Builds a relative URL path to the Ml Stop Datafeed API"] pub fn url(self) -> Cow<'static, str> { match self { - MlStartDatafeedParts::DatafeedId(ref datafeed_id) => { + MlStopDatafeedParts::DatafeedId(ref datafeed_id) => { let encoded_datafeed_id: Cow = percent_encode(datafeed_id.as_bytes(), PARTS_ENCODED).into(); - let mut p = String::with_capacity(22usize + encoded_datafeed_id.len()); + let mut p = String::with_capacity(21usize + encoded_datafeed_id.len()); p.push_str("/_ml/datafeeds/"); p.push_str(encoded_datafeed_id.as_ref()); - p.push_str("/_start"); + p.push_str("/_stop"); p.into() } } } } +#[doc = "Builder for the [Ml Stop Datafeed API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/ml-stop-datafeed.html)\n\nStops one or more datafeeds."] #[derive(Clone, Debug)] -#[doc = "Builder for the [Ml Start Datafeed API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/ml-start-datafeed.html)\n\nStarts one or more datafeeds."] -pub struct MlStartDatafeed<'a, 'b, B> { +pub struct MlStopDatafeed<'a, 'b, B> { transport: &'a Transport, - parts: MlStartDatafeedParts<'b>, + parts: MlStopDatafeedParts<'b>, + allow_no_datafeeds: Option, + allow_no_match: Option, body: Option, - end: Option<&'b str>, error_trace: Option, filter_path: Option<&'b [&'b str]>, + force: Option, headers: HeaderMap, human: Option, pretty: Option, request_timeout: Option, source: Option<&'b str>, - start: Option<&'b str>, timeout: Option<&'b str>, } -impl<'a, 'b, B> MlStartDatafeed<'a, 'b, B> +impl<'a, 'b, B> MlStopDatafeed<'a, 'b, B> where B: Body, { - #[doc = "Creates a new instance of [MlStartDatafeed] with the specified API parts"] - pub fn new(transport: &'a Transport, parts: MlStartDatafeedParts<'b>) -> Self { + #[doc = "Creates a new instance of [MlStopDatafeed] with the specified API parts"] + pub fn new(transport: &'a Transport, parts: MlStopDatafeedParts<'b>) -> Self { let headers = HeaderMap::new(); - MlStartDatafeed { + MlStopDatafeed { transport, parts, headers, + allow_no_datafeeds: None, + allow_no_match: None, body: None, - end: None, error_trace: None, filter_path: None, + force: None, human: None, pretty: None, request_timeout: None, source: None, - start: None, timeout: None, } } + #[doc = "Whether to ignore if a wildcard expression matches no datafeeds. (This includes `_all` string or when no datafeeds have been specified)"] + pub fn allow_no_datafeeds(mut self, allow_no_datafeeds: bool) -> Self { + self.allow_no_datafeeds = Some(allow_no_datafeeds); + self + } + #[doc = "Whether to ignore if a wildcard expression matches no datafeeds. (This includes `_all` string or when no datafeeds have been specified)"] + pub fn allow_no_match(mut self, allow_no_match: bool) -> Self { + self.allow_no_match = Some(allow_no_match); + self + } #[doc = "The body for the API call"] - pub fn body(self, body: T) -> MlStartDatafeed<'a, 'b, JsonBody> + pub fn body(self, body: T) -> MlStopDatafeed<'a, 'b, JsonBody> where T: Serialize, { - MlStartDatafeed { + MlStopDatafeed { transport: self.transport, parts: self.parts, body: Some(body.into()), - end: self.end, + allow_no_datafeeds: self.allow_no_datafeeds, + allow_no_match: self.allow_no_match, error_trace: self.error_trace, filter_path: self.filter_path, + force: self.force, headers: self.headers, human: self.human, pretty: self.pretty, request_timeout: self.request_timeout, source: self.source, - start: self.start, timeout: self.timeout, } } - #[doc = "The end time when the datafeed should stop. When not set, the datafeed continues in real time"] - pub fn end(mut self, end: &'b str) -> Self { - self.end = Some(end); - self - } #[doc = "Include the stack trace of returned errors."] pub fn error_trace(mut self, error_trace: bool) -> Self { self.error_trace = Some(error_trace); @@ -6155,6 +8220,11 @@ where self.filter_path = Some(filter_path); self } + #[doc = "True if the datafeed should be forcefully stopped."] + pub fn force(mut self, force: bool) -> Self { + self.force = Some(force); + self + } #[doc = "Adds a HTTP header"] pub fn header(mut self, key: HeaderName, value: HeaderValue) -> Self { self.headers.insert(key, value); @@ -6174,23 +8244,18 @@ where pub fn request_timeout(mut self, timeout: Duration) -> Self { self.request_timeout = Some(timeout); self - } - #[doc = "The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests."] - pub fn source(mut self, source: &'b str) -> Self { - self.source = Some(source); - self - } - #[doc = "The start time from where the datafeed should begin"] - pub fn start(mut self, start: &'b str) -> Self { - self.start = Some(start); + } + #[doc = "The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests."] + pub fn source(mut self, source: &'b str) -> Self { + self.source = Some(source); self } - #[doc = "Controls the time to wait until a datafeed has started. Default to 20 seconds"] + #[doc = "Controls the time to wait until a datafeed has stopped. Default to 20 seconds"] pub fn timeout(mut self, timeout: &'b str) -> Self { self.timeout = Some(timeout); self } - #[doc = "Creates an asynchronous call to the Ml Start Datafeed API that can be awaited"] + #[doc = "Creates an asynchronous call to the Ml Stop Datafeed API that can be awaited"] pub async fn send(self) -> Result { let path = self.parts.url(); let method = Method::Post; @@ -6200,24 +8265,26 @@ where #[serde_with::skip_serializing_none] #[derive(Serialize)] struct QueryParams<'b> { - end: Option<&'b str>, + allow_no_datafeeds: Option, + allow_no_match: Option, error_trace: Option, #[serde(serialize_with = "crate::client::serialize_coll_qs")] filter_path: Option<&'b [&'b str]>, + force: Option, human: Option, pretty: Option, source: Option<&'b str>, - start: Option<&'b str>, timeout: Option<&'b str>, } let query_params = QueryParams { - end: self.end, + allow_no_datafeeds: self.allow_no_datafeeds, + allow_no_match: self.allow_no_match, error_trace: self.error_trace, filter_path: self.filter_path, + force: self.force, human: self.human, pretty: self.pretty, source: self.source, - start: self.start, timeout: self.timeout, }; Some(query_params) @@ -6230,100 +8297,82 @@ where Ok(response) } } +#[cfg(feature = "beta-apis")] #[derive(Debug, Clone, PartialEq)] -#[doc = "API parts for the Ml Stop Datafeed API"] -pub enum MlStopDatafeedParts<'b> { - #[doc = "DatafeedId"] - DatafeedId(&'b str), -} -impl<'b> MlStopDatafeedParts<'b> { - #[doc = "Builds a relative URL path to the Ml Stop Datafeed API"] +#[doc = "API parts for the Ml Update Data Frame Analytics API"] +pub enum MlUpdateDataFrameAnalyticsParts<'b> { + #[doc = "Id"] + Id(&'b str), +} +#[cfg(feature = "beta-apis")] +impl<'b> MlUpdateDataFrameAnalyticsParts<'b> { + #[doc = "Builds a relative URL path to the Ml Update Data Frame Analytics API"] pub fn url(self) -> Cow<'static, str> { match self { - MlStopDatafeedParts::DatafeedId(ref datafeed_id) => { - let encoded_datafeed_id: Cow = - percent_encode(datafeed_id.as_bytes(), PARTS_ENCODED).into(); - let mut p = String::with_capacity(21usize + encoded_datafeed_id.len()); - p.push_str("/_ml/datafeeds/"); - p.push_str(encoded_datafeed_id.as_ref()); - p.push_str("/_stop"); + MlUpdateDataFrameAnalyticsParts::Id(ref id) => { + let encoded_id: Cow = percent_encode(id.as_bytes(), PARTS_ENCODED).into(); + let mut p = String::with_capacity(34usize + encoded_id.len()); + p.push_str("/_ml/data_frame/analytics/"); + p.push_str(encoded_id.as_ref()); + p.push_str("/_update"); p.into() } } } } +#[doc = "Builder for the [Ml Update Data Frame Analytics API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/update-dfanalytics.html)\n\nUpdates certain properties of a data frame analytics job."] +#[doc = " \n# Optional, beta\nThis requires the `beta-apis` feature. On track to become stable but breaking changes can\nhappen in minor versions.\n "] +#[cfg(feature = "beta-apis")] #[derive(Clone, Debug)] -#[doc = "Builder for the [Ml Stop Datafeed API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/ml-stop-datafeed.html)\n\nStops one or more datafeeds."] -pub struct MlStopDatafeed<'a, 'b, B> { +pub struct MlUpdateDataFrameAnalytics<'a, 'b, B> { transport: &'a Transport, - parts: MlStopDatafeedParts<'b>, - allow_no_datafeeds: Option, - allow_no_match: Option, + parts: MlUpdateDataFrameAnalyticsParts<'b>, body: Option, error_trace: Option, filter_path: Option<&'b [&'b str]>, - force: Option, headers: HeaderMap, human: Option, pretty: Option, request_timeout: Option, source: Option<&'b str>, - timeout: Option<&'b str>, } -impl<'a, 'b, B> MlStopDatafeed<'a, 'b, B> +#[cfg(feature = "beta-apis")] +impl<'a, 'b, B> MlUpdateDataFrameAnalytics<'a, 'b, B> where B: Body, { - #[doc = "Creates a new instance of [MlStopDatafeed] with the specified API parts"] - pub fn new(transport: &'a Transport, parts: MlStopDatafeedParts<'b>) -> Self { + #[doc = "Creates a new instance of [MlUpdateDataFrameAnalytics] with the specified API parts"] + pub fn new(transport: &'a Transport, parts: MlUpdateDataFrameAnalyticsParts<'b>) -> Self { let headers = HeaderMap::new(); - MlStopDatafeed { + MlUpdateDataFrameAnalytics { transport, parts, headers, - allow_no_datafeeds: None, - allow_no_match: None, body: None, error_trace: None, filter_path: None, - force: None, human: None, pretty: None, request_timeout: None, source: None, - timeout: None, } } - #[doc = "Whether to ignore if a wildcard expression matches no datafeeds. (This includes `_all` string or when no datafeeds have been specified)"] - pub fn allow_no_datafeeds(mut self, allow_no_datafeeds: bool) -> Self { - self.allow_no_datafeeds = Some(allow_no_datafeeds); - self - } - #[doc = "Whether to ignore if a wildcard expression matches no datafeeds. (This includes `_all` string or when no datafeeds have been specified)"] - pub fn allow_no_match(mut self, allow_no_match: bool) -> Self { - self.allow_no_match = Some(allow_no_match); - self - } #[doc = "The body for the API call"] - pub fn body(self, body: T) -> MlStopDatafeed<'a, 'b, JsonBody> + pub fn body(self, body: T) -> MlUpdateDataFrameAnalytics<'a, 'b, JsonBody> where T: Serialize, { - MlStopDatafeed { + MlUpdateDataFrameAnalytics { transport: self.transport, parts: self.parts, body: Some(body.into()), - allow_no_datafeeds: self.allow_no_datafeeds, - allow_no_match: self.allow_no_match, error_trace: self.error_trace, filter_path: self.filter_path, - force: self.force, headers: self.headers, human: self.human, pretty: self.pretty, request_timeout: self.request_timeout, source: self.source, - timeout: self.timeout, } } #[doc = "Include the stack trace of returned errors."] @@ -6336,11 +8385,6 @@ where self.filter_path = Some(filter_path); self } - #[doc = "True if the datafeed should be forcefully stopped."] - pub fn force(mut self, force: bool) -> Self { - self.force = Some(force); - self - } #[doc = "Adds a HTTP header"] pub fn header(mut self, key: HeaderName, value: HeaderValue) -> Self { self.headers.insert(key, value); @@ -6366,12 +8410,7 @@ where self.source = Some(source); self } - #[doc = "Controls the time to wait until a datafeed has stopped. Default to 20 seconds"] - pub fn timeout(mut self, timeout: &'b str) -> Self { - self.timeout = Some(timeout); - self - } - #[doc = "Creates an asynchronous call to the Ml Stop Datafeed API that can be awaited"] + #[doc = "Creates an asynchronous call to the Ml Update Data Frame Analytics API that can be awaited"] pub async fn send(self) -> Result { let path = self.parts.url(); let method = Method::Post; @@ -6381,27 +8420,19 @@ where #[serde_with::skip_serializing_none] #[derive(Serialize)] struct QueryParams<'b> { - allow_no_datafeeds: Option, - allow_no_match: Option, error_trace: Option, #[serde(serialize_with = "crate::client::serialize_coll_qs")] filter_path: Option<&'b [&'b str]>, - force: Option, human: Option, pretty: Option, source: Option<&'b str>, - timeout: Option<&'b str>, } let query_params = QueryParams { - allow_no_datafeeds: self.allow_no_datafeeds, - allow_no_match: self.allow_no_match, error_trace: self.error_trace, filter_path: self.filter_path, - force: self.force, human: self.human, pretty: self.pretty, source: self.source, - timeout: self.timeout, }; Some(query_params) }; @@ -6435,8 +8466,8 @@ impl<'b> MlUpdateDatafeedParts<'b> { } } } +#[doc = "Builder for the [Ml Update Datafeed API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/ml-update-datafeed.html)\n\nUpdates certain properties of a datafeed."] #[derive(Clone, Debug)] -#[doc = "Builder for the [Ml Update Datafeed API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/ml-update-datafeed.html)\n\nUpdates certain properties of a datafeed."] pub struct MlUpdateDatafeed<'a, 'b, B> { transport: &'a Transport, parts: MlUpdateDatafeedParts<'b>, @@ -6619,8 +8650,8 @@ impl<'b> MlUpdateFilterParts<'b> { } } } +#[doc = "Builder for the [Ml Update Filter API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/ml-update-filter.html)\n\nUpdates the description of a filter, adds items, or removes items."] #[derive(Clone, Debug)] -#[doc = "Builder for the [Ml Update Filter API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/ml-update-filter.html)\n\nUpdates the description of a filter, adds items, or removes items."] pub struct MlUpdateFilter<'a, 'b, B> { transport: &'a Transport, parts: MlUpdateFilterParts<'b>, @@ -6762,8 +8793,8 @@ impl<'b> MlUpdateJobParts<'b> { } } } +#[doc = "Builder for the [Ml Update Job API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/ml-update-job.html)\n\nUpdates certain properties of an anomaly detection job."] #[derive(Clone, Debug)] -#[doc = "Builder for the [Ml Update Job API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/ml-update-job.html)\n\nUpdates certain properties of an anomaly detection job."] pub struct MlUpdateJob<'a, 'b, B> { transport: &'a Transport, parts: MlUpdateJobParts<'b>, @@ -6911,8 +8942,8 @@ impl<'b> MlUpdateModelSnapshotParts<'b> { } } } +#[doc = "Builder for the [Ml Update Model Snapshot API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/ml-update-snapshot.html)\n\nUpdates certain properties of a snapshot."] #[derive(Clone, Debug)] -#[doc = "Builder for the [Ml Update Model Snapshot API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/ml-update-snapshot.html)\n\nUpdates certain properties of a snapshot."] pub struct MlUpdateModelSnapshot<'a, 'b, B> { transport: &'a Transport, parts: MlUpdateModelSnapshotParts<'b>, @@ -7033,6 +9064,175 @@ where } } #[derive(Debug, Clone, PartialEq)] +#[doc = "API parts for the Ml Upgrade Job Snapshot API"] +pub enum MlUpgradeJobSnapshotParts<'b> { + #[doc = "JobId and SnapshotId"] + JobIdSnapshotId(&'b str, &'b str), +} +impl<'b> MlUpgradeJobSnapshotParts<'b> { + #[doc = "Builds a relative URL path to the Ml Upgrade Job Snapshot API"] + pub fn url(self) -> Cow<'static, str> { + match self { + MlUpgradeJobSnapshotParts::JobIdSnapshotId(ref job_id, ref snapshot_id) => { + let encoded_job_id: Cow = + percent_encode(job_id.as_bytes(), PARTS_ENCODED).into(); + let encoded_snapshot_id: Cow = + percent_encode(snapshot_id.as_bytes(), PARTS_ENCODED).into(); + let mut p = String::with_capacity( + 49usize + encoded_job_id.len() + encoded_snapshot_id.len(), + ); + p.push_str("/_ml/anomaly_detectors/"); + p.push_str(encoded_job_id.as_ref()); + p.push_str("/model_snapshots/"); + p.push_str(encoded_snapshot_id.as_ref()); + p.push_str("/_upgrade"); + p.into() + } + } + } +} +#[doc = "Builder for the [Ml Upgrade Job Snapshot API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/ml-upgrade-job-model-snapshot.html)\n\nUpgrades a given job snapshot to the current major version."] +#[derive(Clone, Debug)] +pub struct MlUpgradeJobSnapshot<'a, 'b, B> { + transport: &'a Transport, + parts: MlUpgradeJobSnapshotParts<'b>, + body: Option, + error_trace: Option, + filter_path: Option<&'b [&'b str]>, + headers: HeaderMap, + human: Option, + pretty: Option, + request_timeout: Option, + source: Option<&'b str>, + timeout: Option<&'b str>, + wait_for_completion: Option, +} +impl<'a, 'b, B> MlUpgradeJobSnapshot<'a, 'b, B> +where + B: Body, +{ + #[doc = "Creates a new instance of [MlUpgradeJobSnapshot] with the specified API parts"] + pub fn new(transport: &'a Transport, parts: MlUpgradeJobSnapshotParts<'b>) -> Self { + let headers = HeaderMap::new(); + MlUpgradeJobSnapshot { + transport, + parts, + headers, + body: None, + error_trace: None, + filter_path: None, + human: None, + pretty: None, + request_timeout: None, + source: None, + timeout: None, + wait_for_completion: None, + } + } + #[doc = "The body for the API call"] + pub fn body(self, body: T) -> MlUpgradeJobSnapshot<'a, 'b, JsonBody> + where + T: Serialize, + { + MlUpgradeJobSnapshot { + transport: self.transport, + parts: self.parts, + body: Some(body.into()), + error_trace: self.error_trace, + filter_path: self.filter_path, + headers: self.headers, + human: self.human, + pretty: self.pretty, + request_timeout: self.request_timeout, + source: self.source, + timeout: self.timeout, + wait_for_completion: self.wait_for_completion, + } + } + #[doc = "Include the stack trace of returned errors."] + pub fn error_trace(mut self, error_trace: bool) -> Self { + self.error_trace = Some(error_trace); + self + } + #[doc = "A comma-separated list of filters used to reduce the response."] + pub fn filter_path(mut self, filter_path: &'b [&'b str]) -> Self { + self.filter_path = Some(filter_path); + self + } + #[doc = "Adds a HTTP header"] + pub fn header(mut self, key: HeaderName, value: HeaderValue) -> Self { + self.headers.insert(key, value); + self + } + #[doc = "Return human readable values for statistics."] + pub fn human(mut self, human: bool) -> Self { + self.human = Some(human); + self + } + #[doc = "Pretty format the returned JSON response."] + pub fn pretty(mut self, pretty: bool) -> Self { + self.pretty = Some(pretty); + self + } + #[doc = "Sets a request timeout for this API call.\n\nThe timeout is applied from when the request starts connecting until the response body has finished."] + pub fn request_timeout(mut self, timeout: Duration) -> Self { + self.request_timeout = Some(timeout); + self + } + #[doc = "The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests."] + pub fn source(mut self, source: &'b str) -> Self { + self.source = Some(source); + self + } + #[doc = "How long should the API wait for the job to be opened and the old snapshot to be loaded."] + pub fn timeout(mut self, timeout: &'b str) -> Self { + self.timeout = Some(timeout); + self + } + #[doc = "Should the request wait until the task is complete before responding to the caller. Default is false."] + pub fn wait_for_completion(mut self, wait_for_completion: bool) -> Self { + self.wait_for_completion = Some(wait_for_completion); + self + } + #[doc = "Creates an asynchronous call to the Ml Upgrade Job Snapshot API that can be awaited"] + pub async fn send(self) -> Result { + let path = self.parts.url(); + let method = Method::Post; + let headers = self.headers; + let timeout = self.request_timeout; + let query_string = { + #[serde_with::skip_serializing_none] + #[derive(Serialize)] + struct QueryParams<'b> { + error_trace: Option, + #[serde(serialize_with = "crate::client::serialize_coll_qs")] + filter_path: Option<&'b [&'b str]>, + human: Option, + pretty: Option, + source: Option<&'b str>, + timeout: Option<&'b str>, + wait_for_completion: Option, + } + let query_params = QueryParams { + error_trace: self.error_trace, + filter_path: self.filter_path, + human: self.human, + pretty: self.pretty, + source: self.source, + timeout: self.timeout, + wait_for_completion: self.wait_for_completion, + }; + Some(query_params) + }; + let body = self.body; + let response = self + .transport + .send(method, &path, headers, query_string.as_ref(), body, timeout) + .await?; + Ok(response) + } +} +#[derive(Debug, Clone, PartialEq)] #[doc = "API parts for the Ml Validate API"] pub enum MlValidateParts { #[doc = "No parts"] @@ -7046,8 +9246,8 @@ impl MlValidateParts { } } } +#[doc = "Builder for the [Ml Validate API](https://www.elastic.co/guide/en/machine-learning/7.11/ml-jobs.html)\n\nValidates an anomaly detection job."] #[derive(Clone, Debug)] -#[doc = "Builder for the [Ml Validate API](https://www.elastic.co/guide/en/machine-learning/7.10/ml-jobs.html)\n\nValidates an anomaly detection job."] pub struct MlValidate<'a, 'b, B> { transport: &'a Transport, parts: MlValidateParts, @@ -7181,8 +9381,8 @@ impl MlValidateDetectorParts { } } } +#[doc = "Builder for the [Ml Validate Detector API](https://www.elastic.co/guide/en/machine-learning/7.11/ml-jobs.html)\n\nValidates an anomaly detection detector."] #[derive(Clone, Debug)] -#[doc = "Builder for the [Ml Validate Detector API](https://www.elastic.co/guide/en/machine-learning/7.10/ml-jobs.html)\n\nValidates an anomaly detection detector."] pub struct MlValidateDetector<'a, 'b, B> { transport: &'a Transport, parts: MlValidateDetectorParts, @@ -7314,256 +9514,377 @@ impl<'a> Ml<'a> { pub fn transport(&self) -> &Transport { self.transport } - #[doc = "[Ml Close Job API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/ml-close-job.html)\n\nCloses one or more anomaly detection jobs. A job can be opened and closed multiple times throughout its lifecycle."] + #[doc = "[Ml Close Job API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/ml-close-job.html)\n\nCloses one or more anomaly detection jobs. A job can be opened and closed multiple times throughout its lifecycle."] pub fn close_job<'b>(&'a self, parts: MlCloseJobParts<'b>) -> MlCloseJob<'a, 'b, ()> { MlCloseJob::new(self.transport(), parts) } - #[doc = "[Ml Delete Calendar API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/ml-delete-calendar.html)\n\nDeletes a calendar."] + #[doc = "[Ml Delete Calendar API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/ml-delete-calendar.html)\n\nDeletes a calendar."] pub fn delete_calendar<'b>( &'a self, parts: MlDeleteCalendarParts<'b>, ) -> MlDeleteCalendar<'a, 'b> { MlDeleteCalendar::new(self.transport(), parts) } - #[doc = "[Ml Delete Calendar Event API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/ml-delete-calendar-event.html)\n\nDeletes scheduled events from a calendar."] + #[doc = "[Ml Delete Calendar Event API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/ml-delete-calendar-event.html)\n\nDeletes scheduled events from a calendar."] pub fn delete_calendar_event<'b>( &'a self, parts: MlDeleteCalendarEventParts<'b>, ) -> MlDeleteCalendarEvent<'a, 'b> { MlDeleteCalendarEvent::new(self.transport(), parts) } - #[doc = "[Ml Delete Calendar Job API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/ml-delete-calendar-job.html)\n\nDeletes anomaly detection jobs from a calendar."] + #[doc = "[Ml Delete Calendar Job API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/ml-delete-calendar-job.html)\n\nDeletes anomaly detection jobs from a calendar."] pub fn delete_calendar_job<'b>( &'a self, parts: MlDeleteCalendarJobParts<'b>, ) -> MlDeleteCalendarJob<'a, 'b> { MlDeleteCalendarJob::new(self.transport(), parts) } - #[doc = "[Ml Delete Datafeed API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/ml-delete-datafeed.html)\n\nDeletes an existing datafeed."] + #[doc = "[Ml Delete Data Frame Analytics API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/delete-dfanalytics.html)\n\nDeletes an existing data frame analytics job."] + #[doc = " \n# Optional, beta\nThis requires the `beta-apis` feature. On track to become stable but breaking changes can\nhappen in minor versions.\n "] + #[cfg(feature = "beta-apis")] + pub fn delete_data_frame_analytics<'b>( + &'a self, + parts: MlDeleteDataFrameAnalyticsParts<'b>, + ) -> MlDeleteDataFrameAnalytics<'a, 'b> { + MlDeleteDataFrameAnalytics::new(self.transport(), parts) + } + #[doc = "[Ml Delete Datafeed API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/ml-delete-datafeed.html)\n\nDeletes an existing datafeed."] pub fn delete_datafeed<'b>( &'a self, parts: MlDeleteDatafeedParts<'b>, ) -> MlDeleteDatafeed<'a, 'b> { MlDeleteDatafeed::new(self.transport(), parts) } - #[doc = "[Ml Delete Expired Data API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/ml-delete-expired-data.html)\n\nDeletes expired and unused machine learning data."] + #[doc = "[Ml Delete Expired Data API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/ml-delete-expired-data.html)\n\nDeletes expired and unused machine learning data."] pub fn delete_expired_data<'b>( &'a self, parts: MlDeleteExpiredDataParts<'b>, ) -> MlDeleteExpiredData<'a, 'b, ()> { MlDeleteExpiredData::new(self.transport(), parts) } - #[doc = "[Ml Delete Filter API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/ml-delete-filter.html)\n\nDeletes a filter."] + #[doc = "[Ml Delete Filter API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/ml-delete-filter.html)\n\nDeletes a filter."] pub fn delete_filter<'b>(&'a self, parts: MlDeleteFilterParts<'b>) -> MlDeleteFilter<'a, 'b> { MlDeleteFilter::new(self.transport(), parts) } - #[doc = "[Ml Delete Forecast API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/ml-delete-forecast.html)\n\nDeletes forecasts from a machine learning job."] + #[doc = "[Ml Delete Forecast API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/ml-delete-forecast.html)\n\nDeletes forecasts from a machine learning job."] pub fn delete_forecast<'b>( &'a self, parts: MlDeleteForecastParts<'b>, ) -> MlDeleteForecast<'a, 'b> { MlDeleteForecast::new(self.transport(), parts) } - #[doc = "[Ml Delete Job API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/ml-delete-job.html)\n\nDeletes an existing anomaly detection job."] + #[doc = "[Ml Delete Job API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/ml-delete-job.html)\n\nDeletes an existing anomaly detection job."] pub fn delete_job<'b>(&'a self, parts: MlDeleteJobParts<'b>) -> MlDeleteJob<'a, 'b> { MlDeleteJob::new(self.transport(), parts) } - #[doc = "[Ml Delete Model Snapshot API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/ml-delete-snapshot.html)\n\nDeletes an existing model snapshot."] + #[doc = "[Ml Delete Model Snapshot API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/ml-delete-snapshot.html)\n\nDeletes an existing model snapshot."] pub fn delete_model_snapshot<'b>( &'a self, parts: MlDeleteModelSnapshotParts<'b>, ) -> MlDeleteModelSnapshot<'a, 'b> { MlDeleteModelSnapshot::new(self.transport(), parts) } - #[doc = "[Ml Estimate Model Memory API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/ml-apis.html)\n\nEstimates the model memory"] + #[doc = "[Ml Delete Trained Model API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/delete-trained-models.html)\n\nDeletes an existing trained inference model that is currently not referenced by an ingest pipeline."] + #[doc = " \n# Optional, beta\nThis requires the `beta-apis` feature. On track to become stable but breaking changes can\nhappen in minor versions.\n "] + #[cfg(feature = "beta-apis")] + pub fn delete_trained_model<'b>( + &'a self, + parts: MlDeleteTrainedModelParts<'b>, + ) -> MlDeleteTrainedModel<'a, 'b> { + MlDeleteTrainedModel::new(self.transport(), parts) + } + #[doc = "[Ml Estimate Model Memory API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/ml-apis.html)\n\nEstimates the model memory"] pub fn estimate_model_memory<'b>(&'a self) -> MlEstimateModelMemory<'a, 'b, ()> { MlEstimateModelMemory::new(self.transport()) } - #[doc = "[Ml Flush Job API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/ml-flush-job.html)\n\nForces any buffered data to be processed by the job."] + #[doc = "[Ml Evaluate Data Frame API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/evaluate-dfanalytics.html)\n\nEvaluates the data frame analytics for an annotated index."] + #[doc = " \n# Optional, beta\nThis requires the `beta-apis` feature. On track to become stable but breaking changes can\nhappen in minor versions.\n "] + #[cfg(feature = "beta-apis")] + pub fn evaluate_data_frame<'b>(&'a self) -> MlEvaluateDataFrame<'a, 'b, ()> { + MlEvaluateDataFrame::new(self.transport()) + } + #[doc = "[Ml Explain Data Frame Analytics API](http://www.elastic.co/guide/en/elasticsearch/reference/7.11/explain-dfanalytics.html)\n\nExplains a data frame analytics config."] + #[doc = " \n# Optional, beta\nThis requires the `beta-apis` feature. On track to become stable but breaking changes can\nhappen in minor versions.\n "] + #[cfg(feature = "beta-apis")] + pub fn explain_data_frame_analytics<'b>( + &'a self, + parts: MlExplainDataFrameAnalyticsParts<'b>, + ) -> MlExplainDataFrameAnalytics<'a, 'b, ()> { + MlExplainDataFrameAnalytics::new(self.transport(), parts) + } + #[doc = "[Ml Flush Job API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/ml-flush-job.html)\n\nForces any buffered data to be processed by the job."] pub fn flush_job<'b>(&'a self, parts: MlFlushJobParts<'b>) -> MlFlushJob<'a, 'b, ()> { MlFlushJob::new(self.transport(), parts) } - #[doc = "[Ml Forecast API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/ml-forecast.html)\n\nPredicts the future behavior of a time series by using its historical behavior."] + #[doc = "[Ml Forecast API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/ml-forecast.html)\n\nPredicts the future behavior of a time series by using its historical behavior."] pub fn forecast<'b>(&'a self, parts: MlForecastParts<'b>) -> MlForecast<'a, 'b, ()> { MlForecast::new(self.transport(), parts) } - #[doc = "[Ml Get Buckets API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/ml-get-bucket.html)\n\nRetrieves anomaly detection job results for one or more buckets."] + #[doc = "[Ml Get Buckets API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/ml-get-bucket.html)\n\nRetrieves anomaly detection job results for one or more buckets."] pub fn get_buckets<'b>(&'a self, parts: MlGetBucketsParts<'b>) -> MlGetBuckets<'a, 'b, ()> { MlGetBuckets::new(self.transport(), parts) } - #[doc = "[Ml Get Calendar Events API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/ml-get-calendar-event.html)\n\nRetrieves information about the scheduled events in calendars."] + #[doc = "[Ml Get Calendar Events API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/ml-get-calendar-event.html)\n\nRetrieves information about the scheduled events in calendars."] pub fn get_calendar_events<'b>( &'a self, parts: MlGetCalendarEventsParts<'b>, ) -> MlGetCalendarEvents<'a, 'b> { MlGetCalendarEvents::new(self.transport(), parts) } - #[doc = "[Ml Get Calendars API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/ml-get-calendar.html)\n\nRetrieves configuration information for calendars."] + #[doc = "[Ml Get Calendars API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/ml-get-calendar.html)\n\nRetrieves configuration information for calendars."] pub fn get_calendars<'b>( &'a self, parts: MlGetCalendarsParts<'b>, ) -> MlGetCalendars<'a, 'b, ()> { MlGetCalendars::new(self.transport(), parts) } - #[doc = "[Ml Get Categories API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/ml-get-category.html)\n\nRetrieves anomaly detection job results for one or more categories."] + #[doc = "[Ml Get Categories API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/ml-get-category.html)\n\nRetrieves anomaly detection job results for one or more categories."] pub fn get_categories<'b>( &'a self, parts: MlGetCategoriesParts<'b>, ) -> MlGetCategories<'a, 'b, ()> { MlGetCategories::new(self.transport(), parts) } - #[doc = "[Ml Get Datafeed Stats API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/ml-get-datafeed-stats.html)\n\nRetrieves usage information for datafeeds."] + #[doc = "[Ml Get Data Frame Analytics API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/get-dfanalytics.html)\n\nRetrieves configuration information for data frame analytics jobs."] + #[doc = " \n# Optional, beta\nThis requires the `beta-apis` feature. On track to become stable but breaking changes can\nhappen in minor versions.\n "] + #[cfg(feature = "beta-apis")] + pub fn get_data_frame_analytics<'b>( + &'a self, + parts: MlGetDataFrameAnalyticsParts<'b>, + ) -> MlGetDataFrameAnalytics<'a, 'b> { + MlGetDataFrameAnalytics::new(self.transport(), parts) + } + #[doc = "[Ml Get Data Frame Analytics Stats API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/get-dfanalytics-stats.html)\n\nRetrieves usage information for data frame analytics jobs."] + #[doc = " \n# Optional, beta\nThis requires the `beta-apis` feature. On track to become stable but breaking changes can\nhappen in minor versions.\n "] + #[cfg(feature = "beta-apis")] + pub fn get_data_frame_analytics_stats<'b>( + &'a self, + parts: MlGetDataFrameAnalyticsStatsParts<'b>, + ) -> MlGetDataFrameAnalyticsStats<'a, 'b> { + MlGetDataFrameAnalyticsStats::new(self.transport(), parts) + } + #[doc = "[Ml Get Datafeed Stats API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/ml-get-datafeed-stats.html)\n\nRetrieves usage information for datafeeds."] pub fn get_datafeed_stats<'b>( &'a self, parts: MlGetDatafeedStatsParts<'b>, ) -> MlGetDatafeedStats<'a, 'b> { MlGetDatafeedStats::new(self.transport(), parts) } - #[doc = "[Ml Get Datafeeds API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/ml-get-datafeed.html)\n\nRetrieves configuration information for datafeeds."] + #[doc = "[Ml Get Datafeeds API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/ml-get-datafeed.html)\n\nRetrieves configuration information for datafeeds."] pub fn get_datafeeds<'b>(&'a self, parts: MlGetDatafeedsParts<'b>) -> MlGetDatafeeds<'a, 'b> { MlGetDatafeeds::new(self.transport(), parts) } - #[doc = "[Ml Get Filters API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/ml-get-filter.html)\n\nRetrieves filters."] + #[doc = "[Ml Get Filters API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/ml-get-filter.html)\n\nRetrieves filters."] pub fn get_filters<'b>(&'a self, parts: MlGetFiltersParts<'b>) -> MlGetFilters<'a, 'b> { MlGetFilters::new(self.transport(), parts) } - #[doc = "[Ml Get Influencers API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/ml-get-influencer.html)\n\nRetrieves anomaly detection job results for one or more influencers."] + #[doc = "[Ml Get Influencers API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/ml-get-influencer.html)\n\nRetrieves anomaly detection job results for one or more influencers."] pub fn get_influencers<'b>( &'a self, parts: MlGetInfluencersParts<'b>, ) -> MlGetInfluencers<'a, 'b, ()> { MlGetInfluencers::new(self.transport(), parts) } - #[doc = "[Ml Get Job Stats API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/ml-get-job-stats.html)\n\nRetrieves usage information for anomaly detection jobs."] + #[doc = "[Ml Get Job Stats API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/ml-get-job-stats.html)\n\nRetrieves usage information for anomaly detection jobs."] pub fn get_job_stats<'b>(&'a self, parts: MlGetJobStatsParts<'b>) -> MlGetJobStats<'a, 'b> { MlGetJobStats::new(self.transport(), parts) } - #[doc = "[Ml Get Jobs API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/ml-get-job.html)\n\nRetrieves configuration information for anomaly detection jobs."] + #[doc = "[Ml Get Jobs API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/ml-get-job.html)\n\nRetrieves configuration information for anomaly detection jobs."] pub fn get_jobs<'b>(&'a self, parts: MlGetJobsParts<'b>) -> MlGetJobs<'a, 'b> { MlGetJobs::new(self.transport(), parts) } - #[doc = "[Ml Get Model Snapshots API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/ml-get-snapshot.html)\n\nRetrieves information about model snapshots."] + #[doc = "[Ml Get Model Snapshots API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/ml-get-snapshot.html)\n\nRetrieves information about model snapshots."] pub fn get_model_snapshots<'b>( &'a self, parts: MlGetModelSnapshotsParts<'b>, ) -> MlGetModelSnapshots<'a, 'b, ()> { MlGetModelSnapshots::new(self.transport(), parts) } - #[doc = "[Ml Get Overall Buckets API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/ml-get-overall-buckets.html)\n\nRetrieves overall bucket results that summarize the bucket results of multiple anomaly detection jobs."] + #[doc = "[Ml Get Overall Buckets API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/ml-get-overall-buckets.html)\n\nRetrieves overall bucket results that summarize the bucket results of multiple anomaly detection jobs."] pub fn get_overall_buckets<'b>( &'a self, parts: MlGetOverallBucketsParts<'b>, ) -> MlGetOverallBuckets<'a, 'b, ()> { MlGetOverallBuckets::new(self.transport(), parts) } - #[doc = "[Ml Get Records API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/ml-get-record.html)\n\nRetrieves anomaly records for an anomaly detection job."] + #[doc = "[Ml Get Records API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/ml-get-record.html)\n\nRetrieves anomaly records for an anomaly detection job."] pub fn get_records<'b>(&'a self, parts: MlGetRecordsParts<'b>) -> MlGetRecords<'a, 'b, ()> { MlGetRecords::new(self.transport(), parts) } - #[doc = "[Ml Info API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/get-ml-info.html)\n\nReturns defaults and limits used by machine learning."] + #[doc = "[Ml Get Trained Models API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/get-trained-models.html)\n\nRetrieves configuration information for a trained inference model."] + #[doc = " \n# Optional, beta\nThis requires the `beta-apis` feature. On track to become stable but breaking changes can\nhappen in minor versions.\n "] + #[cfg(feature = "beta-apis")] + pub fn get_trained_models<'b>( + &'a self, + parts: MlGetTrainedModelsParts<'b>, + ) -> MlGetTrainedModels<'a, 'b> { + MlGetTrainedModels::new(self.transport(), parts) + } + #[doc = "[Ml Get Trained Models Stats API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/get-trained-models-stats.html)\n\nRetrieves usage information for trained inference models."] + #[doc = " \n# Optional, beta\nThis requires the `beta-apis` feature. On track to become stable but breaking changes can\nhappen in minor versions.\n "] + #[cfg(feature = "beta-apis")] + pub fn get_trained_models_stats<'b>( + &'a self, + parts: MlGetTrainedModelsStatsParts<'b>, + ) -> MlGetTrainedModelsStats<'a, 'b> { + MlGetTrainedModelsStats::new(self.transport(), parts) + } + #[doc = "[Ml Info API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/get-ml-info.html)\n\nReturns defaults and limits used by machine learning."] pub fn info<'b>(&'a self) -> MlInfo<'a, 'b> { MlInfo::new(self.transport()) } - #[doc = "[Ml Open Job API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/ml-open-job.html)\n\nOpens one or more anomaly detection jobs."] + #[doc = "[Ml Open Job API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/ml-open-job.html)\n\nOpens one or more anomaly detection jobs."] pub fn open_job<'b>(&'a self, parts: MlOpenJobParts<'b>) -> MlOpenJob<'a, 'b, ()> { MlOpenJob::new(self.transport(), parts) } - #[doc = "[Ml Post Calendar Events API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/ml-post-calendar-event.html)\n\nPosts scheduled events in a calendar."] + #[doc = "[Ml Post Calendar Events API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/ml-post-calendar-event.html)\n\nPosts scheduled events in a calendar."] pub fn post_calendar_events<'b>( &'a self, parts: MlPostCalendarEventsParts<'b>, ) -> MlPostCalendarEvents<'a, 'b, ()> { MlPostCalendarEvents::new(self.transport(), parts) } - #[doc = "[Ml Post Data API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/ml-post-data.html)\n\nSends data to an anomaly detection job for analysis."] + #[doc = "[Ml Post Data API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/ml-post-data.html)\n\nSends data to an anomaly detection job for analysis."] pub fn post_data<'b>(&'a self, parts: MlPostDataParts<'b>) -> MlPostData<'a, 'b, ()> { MlPostData::new(self.transport(), parts) } - #[doc = "[Ml Preview Datafeed API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/ml-preview-datafeed.html)\n\nPreviews a datafeed."] + #[doc = "[Ml Preview Datafeed API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/ml-preview-datafeed.html)\n\nPreviews a datafeed."] pub fn preview_datafeed<'b>( &'a self, parts: MlPreviewDatafeedParts<'b>, ) -> MlPreviewDatafeed<'a, 'b> { MlPreviewDatafeed::new(self.transport(), parts) } - #[doc = "[Ml Put Calendar API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/ml-put-calendar.html)\n\nInstantiates a calendar."] + #[doc = "[Ml Put Calendar API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/ml-put-calendar.html)\n\nInstantiates a calendar."] pub fn put_calendar<'b>(&'a self, parts: MlPutCalendarParts<'b>) -> MlPutCalendar<'a, 'b, ()> { MlPutCalendar::new(self.transport(), parts) } - #[doc = "[Ml Put Calendar Job API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/ml-put-calendar-job.html)\n\nAdds an anomaly detection job to a calendar."] + #[doc = "[Ml Put Calendar Job API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/ml-put-calendar-job.html)\n\nAdds an anomaly detection job to a calendar."] pub fn put_calendar_job<'b>( &'a self, parts: MlPutCalendarJobParts<'b>, ) -> MlPutCalendarJob<'a, 'b, ()> { MlPutCalendarJob::new(self.transport(), parts) } - #[doc = "[Ml Put Datafeed API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/ml-put-datafeed.html)\n\nInstantiates a datafeed."] + #[doc = "[Ml Put Data Frame Analytics API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/put-dfanalytics.html)\n\nInstantiates a data frame analytics job."] + #[doc = " \n# Optional, beta\nThis requires the `beta-apis` feature. On track to become stable but breaking changes can\nhappen in minor versions.\n "] + #[cfg(feature = "beta-apis")] + pub fn put_data_frame_analytics<'b>( + &'a self, + parts: MlPutDataFrameAnalyticsParts<'b>, + ) -> MlPutDataFrameAnalytics<'a, 'b, ()> { + MlPutDataFrameAnalytics::new(self.transport(), parts) + } + #[doc = "[Ml Put Datafeed API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/ml-put-datafeed.html)\n\nInstantiates a datafeed."] pub fn put_datafeed<'b>(&'a self, parts: MlPutDatafeedParts<'b>) -> MlPutDatafeed<'a, 'b, ()> { MlPutDatafeed::new(self.transport(), parts) } - #[doc = "[Ml Put Filter API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/ml-put-filter.html)\n\nInstantiates a filter."] + #[doc = "[Ml Put Filter API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/ml-put-filter.html)\n\nInstantiates a filter."] pub fn put_filter<'b>(&'a self, parts: MlPutFilterParts<'b>) -> MlPutFilter<'a, 'b, ()> { MlPutFilter::new(self.transport(), parts) } - #[doc = "[Ml Put Job API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/ml-put-job.html)\n\nInstantiates an anomaly detection job."] + #[doc = "[Ml Put Job API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/ml-put-job.html)\n\nInstantiates an anomaly detection job."] pub fn put_job<'b>(&'a self, parts: MlPutJobParts<'b>) -> MlPutJob<'a, 'b, ()> { MlPutJob::new(self.transport(), parts) } - #[doc = "[Ml Revert Model Snapshot API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/ml-revert-snapshot.html)\n\nReverts to a specific snapshot."] + #[doc = "[Ml Put Trained Model API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/put-trained-models.html)\n\nCreates an inference trained model."] + #[doc = " \n# Optional, beta\nThis requires the `beta-apis` feature. On track to become stable but breaking changes can\nhappen in minor versions.\n "] + #[cfg(feature = "beta-apis")] + pub fn put_trained_model<'b>( + &'a self, + parts: MlPutTrainedModelParts<'b>, + ) -> MlPutTrainedModel<'a, 'b, ()> { + MlPutTrainedModel::new(self.transport(), parts) + } + #[doc = "[Ml Revert Model Snapshot API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/ml-revert-snapshot.html)\n\nReverts to a specific snapshot."] pub fn revert_model_snapshot<'b>( &'a self, parts: MlRevertModelSnapshotParts<'b>, ) -> MlRevertModelSnapshot<'a, 'b, ()> { MlRevertModelSnapshot::new(self.transport(), parts) } - #[doc = "[Ml Set Upgrade Mode API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/ml-set-upgrade-mode.html)\n\nSets a cluster wide upgrade_mode setting that prepares machine learning indices for an upgrade."] + #[doc = "[Ml Set Upgrade Mode API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/ml-set-upgrade-mode.html)\n\nSets a cluster wide upgrade_mode setting that prepares machine learning indices for an upgrade."] pub fn set_upgrade_mode<'b>(&'a self) -> MlSetUpgradeMode<'a, 'b, ()> { MlSetUpgradeMode::new(self.transport()) } - #[doc = "[Ml Start Datafeed API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/ml-start-datafeed.html)\n\nStarts one or more datafeeds."] + #[doc = "[Ml Start Data Frame Analytics API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/start-dfanalytics.html)\n\nStarts a data frame analytics job."] + #[doc = " \n# Optional, beta\nThis requires the `beta-apis` feature. On track to become stable but breaking changes can\nhappen in minor versions.\n "] + #[cfg(feature = "beta-apis")] + pub fn start_data_frame_analytics<'b>( + &'a self, + parts: MlStartDataFrameAnalyticsParts<'b>, + ) -> MlStartDataFrameAnalytics<'a, 'b, ()> { + MlStartDataFrameAnalytics::new(self.transport(), parts) + } + #[doc = "[Ml Start Datafeed API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/ml-start-datafeed.html)\n\nStarts one or more datafeeds."] pub fn start_datafeed<'b>( &'a self, parts: MlStartDatafeedParts<'b>, ) -> MlStartDatafeed<'a, 'b, ()> { MlStartDatafeed::new(self.transport(), parts) } - #[doc = "[Ml Stop Datafeed API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/ml-stop-datafeed.html)\n\nStops one or more datafeeds."] + #[doc = "[Ml Stop Data Frame Analytics API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/stop-dfanalytics.html)\n\nStops one or more data frame analytics jobs."] + #[doc = " \n# Optional, beta\nThis requires the `beta-apis` feature. On track to become stable but breaking changes can\nhappen in minor versions.\n "] + #[cfg(feature = "beta-apis")] + pub fn stop_data_frame_analytics<'b>( + &'a self, + parts: MlStopDataFrameAnalyticsParts<'b>, + ) -> MlStopDataFrameAnalytics<'a, 'b, ()> { + MlStopDataFrameAnalytics::new(self.transport(), parts) + } + #[doc = "[Ml Stop Datafeed API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/ml-stop-datafeed.html)\n\nStops one or more datafeeds."] pub fn stop_datafeed<'b>( &'a self, parts: MlStopDatafeedParts<'b>, ) -> MlStopDatafeed<'a, 'b, ()> { MlStopDatafeed::new(self.transport(), parts) } - #[doc = "[Ml Update Datafeed API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/ml-update-datafeed.html)\n\nUpdates certain properties of a datafeed."] + #[doc = "[Ml Update Data Frame Analytics API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/update-dfanalytics.html)\n\nUpdates certain properties of a data frame analytics job."] + #[doc = " \n# Optional, beta\nThis requires the `beta-apis` feature. On track to become stable but breaking changes can\nhappen in minor versions.\n "] + #[cfg(feature = "beta-apis")] + pub fn update_data_frame_analytics<'b>( + &'a self, + parts: MlUpdateDataFrameAnalyticsParts<'b>, + ) -> MlUpdateDataFrameAnalytics<'a, 'b, ()> { + MlUpdateDataFrameAnalytics::new(self.transport(), parts) + } + #[doc = "[Ml Update Datafeed API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/ml-update-datafeed.html)\n\nUpdates certain properties of a datafeed."] pub fn update_datafeed<'b>( &'a self, parts: MlUpdateDatafeedParts<'b>, ) -> MlUpdateDatafeed<'a, 'b, ()> { MlUpdateDatafeed::new(self.transport(), parts) } - #[doc = "[Ml Update Filter API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/ml-update-filter.html)\n\nUpdates the description of a filter, adds items, or removes items."] + #[doc = "[Ml Update Filter API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/ml-update-filter.html)\n\nUpdates the description of a filter, adds items, or removes items."] pub fn update_filter<'b>( &'a self, parts: MlUpdateFilterParts<'b>, ) -> MlUpdateFilter<'a, 'b, ()> { MlUpdateFilter::new(self.transport(), parts) } - #[doc = "[Ml Update Job API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/ml-update-job.html)\n\nUpdates certain properties of an anomaly detection job."] + #[doc = "[Ml Update Job API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/ml-update-job.html)\n\nUpdates certain properties of an anomaly detection job."] pub fn update_job<'b>(&'a self, parts: MlUpdateJobParts<'b>) -> MlUpdateJob<'a, 'b, ()> { MlUpdateJob::new(self.transport(), parts) } - #[doc = "[Ml Update Model Snapshot API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/ml-update-snapshot.html)\n\nUpdates certain properties of a snapshot."] + #[doc = "[Ml Update Model Snapshot API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/ml-update-snapshot.html)\n\nUpdates certain properties of a snapshot."] pub fn update_model_snapshot<'b>( &'a self, parts: MlUpdateModelSnapshotParts<'b>, ) -> MlUpdateModelSnapshot<'a, 'b, ()> { MlUpdateModelSnapshot::new(self.transport(), parts) } - #[doc = "[Ml Validate API](https://www.elastic.co/guide/en/machine-learning/7.10/ml-jobs.html)\n\nValidates an anomaly detection job."] + #[doc = "[Ml Upgrade Job Snapshot API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/ml-upgrade-job-model-snapshot.html)\n\nUpgrades a given job snapshot to the current major version."] + pub fn upgrade_job_snapshot<'b>( + &'a self, + parts: MlUpgradeJobSnapshotParts<'b>, + ) -> MlUpgradeJobSnapshot<'a, 'b, ()> { + MlUpgradeJobSnapshot::new(self.transport(), parts) + } + #[doc = "[Ml Validate API](https://www.elastic.co/guide/en/machine-learning/7.11/ml-jobs.html)\n\nValidates an anomaly detection job."] pub fn validate<'b>(&'a self) -> MlValidate<'a, 'b, ()> { MlValidate::new(self.transport()) } - #[doc = "[Ml Validate Detector API](https://www.elastic.co/guide/en/machine-learning/7.10/ml-jobs.html)\n\nValidates an anomaly detection detector."] + #[doc = "[Ml Validate Detector API](https://www.elastic.co/guide/en/machine-learning/7.11/ml-jobs.html)\n\nValidates an anomaly detection detector."] pub fn validate_detector<'b>(&'a self) -> MlValidateDetector<'a, 'b, ()> { MlValidateDetector::new(self.transport()) } diff --git a/elasticsearch/src/monitoring.rs b/elasticsearch/src/monitoring.rs new file mode 100644 index 00000000..13177afa --- /dev/null +++ b/elasticsearch/src/monitoring.rs @@ -0,0 +1,258 @@ +/* + * Licensed to Elasticsearch B.V. under one or more contributor + * license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright + * ownership. Elasticsearch B.V. licenses this file to you under + * the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +// ----------------------------------------------- +// This file is generated, Please do not edit it manually. +// Run the following in the root of the repo to regenerate: +// +// cargo make generate-api +// ----------------------------------------------- + +//! Monitoring APIs +//! +//! The Elastic Stack [monitoring features](https://www.elastic.co/guide/en/elasticsearch/reference/master/monitor-elasticsearch-cluster.html) +//! provide a way to keep a pulse on thehealth and performance of your Elasticsearch cluster. + +#![cfg(feature = "experimental-apis")] +#![doc = " \n# Optional, experimental\nThis requires the `experimental-apis` feature. Can have breaking changes in future\nversions or might even be removed entirely.\n "] +#![allow(unused_imports)] +use crate::{ + client::Elasticsearch, + error::Error, + http::{ + headers::{HeaderMap, HeaderName, HeaderValue, ACCEPT, CONTENT_TYPE}, + request::{Body, JsonBody, NdBody, PARTS_ENCODED}, + response::Response, + transport::Transport, + Method, + }, + params::*, +}; +use percent_encoding::percent_encode; +use serde::Serialize; +use std::{borrow::Cow, time::Duration}; +#[cfg(feature = "experimental-apis")] +#[derive(Debug, Clone, PartialEq)] +#[doc = "API parts for the Monitoring Bulk API"] +pub enum MonitoringBulkParts<'b> { + #[doc = "No parts"] + None, + #[doc = "Type"] + Type(&'b str), +} +#[cfg(feature = "experimental-apis")] +impl<'b> MonitoringBulkParts<'b> { + #[doc = "Builds a relative URL path to the Monitoring Bulk API"] + pub fn url(self) -> Cow<'static, str> { + match self { + MonitoringBulkParts::None => "/_monitoring/bulk".into(), + MonitoringBulkParts::Type(ref ty) => { + let encoded_ty: Cow = percent_encode(ty.as_bytes(), PARTS_ENCODED).into(); + let mut p = String::with_capacity(18usize + encoded_ty.len()); + p.push_str("/_monitoring/"); + p.push_str(encoded_ty.as_ref()); + p.push_str("/bulk"); + p.into() + } + } + } +} +#[doc = "Builder for the [Monitoring Bulk API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/monitor-elasticsearch-cluster.html)\n\nUsed by the monitoring features to send monitoring data."] +#[doc = " \n# Optional, experimental\nThis requires the `experimental-apis` feature. Can have breaking changes in future\nversions or might even be removed entirely.\n "] +#[cfg(feature = "experimental-apis")] +#[derive(Clone, Debug)] +pub struct MonitoringBulk<'a, 'b, B> { + transport: &'a Transport, + parts: MonitoringBulkParts<'b>, + body: Option, + error_trace: Option, + filter_path: Option<&'b [&'b str]>, + headers: HeaderMap, + human: Option, + interval: Option<&'b str>, + pretty: Option, + request_timeout: Option, + source: Option<&'b str>, + system_api_version: Option<&'b str>, + system_id: Option<&'b str>, +} +#[cfg(feature = "experimental-apis")] +impl<'a, 'b, B> MonitoringBulk<'a, 'b, B> +where + B: Body, +{ + #[doc = "Creates a new instance of [MonitoringBulk] with the specified API parts"] + pub fn new(transport: &'a Transport, parts: MonitoringBulkParts<'b>) -> Self { + let headers = HeaderMap::new(); + MonitoringBulk { + transport, + parts, + headers, + body: None, + error_trace: None, + filter_path: None, + human: None, + interval: None, + pretty: None, + request_timeout: None, + source: None, + system_api_version: None, + system_id: None, + } + } + #[doc = "The body for the API call"] + pub fn body(self, body: Vec) -> MonitoringBulk<'a, 'b, NdBody> + where + T: Body, + { + MonitoringBulk { + transport: self.transport, + parts: self.parts, + body: Some(NdBody(body)), + error_trace: self.error_trace, + filter_path: self.filter_path, + headers: self.headers, + human: self.human, + interval: self.interval, + pretty: self.pretty, + request_timeout: self.request_timeout, + source: self.source, + system_api_version: self.system_api_version, + system_id: self.system_id, + } + } + #[doc = "Include the stack trace of returned errors."] + pub fn error_trace(mut self, error_trace: bool) -> Self { + self.error_trace = Some(error_trace); + self + } + #[doc = "A comma-separated list of filters used to reduce the response."] + pub fn filter_path(mut self, filter_path: &'b [&'b str]) -> Self { + self.filter_path = Some(filter_path); + self + } + #[doc = "Adds a HTTP header"] + pub fn header(mut self, key: HeaderName, value: HeaderValue) -> Self { + self.headers.insert(key, value); + self + } + #[doc = "Return human readable values for statistics."] + pub fn human(mut self, human: bool) -> Self { + self.human = Some(human); + self + } + #[doc = "Collection interval (e.g., '10s' or '10000ms') of the payload"] + pub fn interval(mut self, interval: &'b str) -> Self { + self.interval = Some(interval); + self + } + #[doc = "Pretty format the returned JSON response."] + pub fn pretty(mut self, pretty: bool) -> Self { + self.pretty = Some(pretty); + self + } + #[doc = "Sets a request timeout for this API call.\n\nThe timeout is applied from when the request starts connecting until the response body has finished."] + pub fn request_timeout(mut self, timeout: Duration) -> Self { + self.request_timeout = Some(timeout); + self + } + #[doc = "The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests."] + pub fn source(mut self, source: &'b str) -> Self { + self.source = Some(source); + self + } + #[doc = "API Version of the monitored system"] + pub fn system_api_version(mut self, system_api_version: &'b str) -> Self { + self.system_api_version = Some(system_api_version); + self + } + #[doc = "Identifier of the monitored system"] + pub fn system_id(mut self, system_id: &'b str) -> Self { + self.system_id = Some(system_id); + self + } + #[doc = "Creates an asynchronous call to the Monitoring Bulk API that can be awaited"] + pub async fn send(self) -> Result { + let path = self.parts.url(); + let method = Method::Post; + let headers = self.headers; + let timeout = self.request_timeout; + let query_string = { + #[serde_with::skip_serializing_none] + #[derive(Serialize)] + struct QueryParams<'b> { + error_trace: Option, + #[serde(serialize_with = "crate::client::serialize_coll_qs")] + filter_path: Option<&'b [&'b str]>, + human: Option, + interval: Option<&'b str>, + pretty: Option, + source: Option<&'b str>, + system_api_version: Option<&'b str>, + system_id: Option<&'b str>, + } + let query_params = QueryParams { + error_trace: self.error_trace, + filter_path: self.filter_path, + human: self.human, + interval: self.interval, + pretty: self.pretty, + source: self.source, + system_api_version: self.system_api_version, + system_id: self.system_id, + }; + Some(query_params) + }; + let body = self.body; + let response = self + .transport + .send(method, &path, headers, query_string.as_ref(), body, timeout) + .await?; + Ok(response) + } +} +#[doc = "Namespace client for Monitoring APIs"] +#[doc = " \n# Optional, experimental\nThis requires the `experimental-apis` feature. Can have breaking changes in future\nversions or might even be removed entirely.\n "] +#[cfg(feature = "experimental-apis")] +pub struct Monitoring<'a> { + transport: &'a Transport, +} +#[cfg(feature = "experimental-apis")] +impl<'a> Monitoring<'a> { + #[doc = "Creates a new instance of [Monitoring]"] + pub fn new(transport: &'a Transport) -> Self { + Self { transport } + } + pub fn transport(&self) -> &Transport { + self.transport + } + #[doc = "[Monitoring Bulk API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/monitor-elasticsearch-cluster.html)\n\nUsed by the monitoring features to send monitoring data."] + #[doc = " \n# Optional, experimental\nThis requires the `experimental-apis` feature. Can have breaking changes in future\nversions or might even be removed entirely.\n "] + #[cfg(feature = "experimental-apis")] + pub fn bulk<'b>(&'a self, parts: MonitoringBulkParts<'b>) -> MonitoringBulk<'a, 'b, ()> { + MonitoringBulk::new(self.transport(), parts) + } +} +#[cfg(feature = "experimental-apis")] +impl Elasticsearch { + #[doc = "Creates a namespace client for Monitoring APIs"] + pub fn monitoring(&self) -> Monitoring { + Monitoring::new(self.transport()) + } +} diff --git a/elasticsearch/src/nodes.rs b/elasticsearch/src/nodes.rs index 28b7dc3f..3e1b1ba5 100644 --- a/elasticsearch/src/nodes.rs +++ b/elasticsearch/src/nodes.rs @@ -29,7 +29,8 @@ //! Manage settings, perform operations, and retrieve information about the //! [nodes in an Elasticsearch cluster](https://www.elastic.co/guide/en/elasticsearch/reference/master/cluster.html). -# ! [ allow ( unused_imports ) ]use crate::{ +#![allow(unused_imports)] +use crate::{ client::Elasticsearch, error::Error, http::{ @@ -70,8 +71,8 @@ impl<'b> NodesHotThreadsParts<'b> { } } } +#[doc = "Builder for the [Nodes Hot Threads API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/cluster-nodes-hot-threads.html)\n\nReturns information about hot threads on each node in the cluster."] #[derive(Clone, Debug)] -#[doc = "Builder for the [Nodes Hot Threads API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/cluster-nodes-hot-threads.html)\n\nReturns information about hot threads on each node in the cluster."] pub struct NodesHotThreads<'a, 'b> { transport: &'a Transport, parts: NodesHotThreadsParts<'b>, @@ -276,8 +277,8 @@ impl<'b> NodesInfoParts<'b> { } } } +#[doc = "Builder for the [Nodes Info API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/cluster-nodes-info.html)\n\nReturns information about nodes in the cluster."] #[derive(Clone, Debug)] -#[doc = "Builder for the [Nodes Info API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/cluster-nodes-info.html)\n\nReturns information about nodes in the cluster."] pub struct NodesInfo<'a, 'b> { transport: &'a Transport, parts: NodesInfoParts<'b>, @@ -418,8 +419,8 @@ impl<'b> NodesReloadSecureSettingsParts<'b> { } } } +#[doc = "Builder for the [Nodes Reload Secure Settings API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/secure-settings.html#reloadable-secure-settings)\n\nReloads secure settings."] #[derive(Clone, Debug)] -#[doc = "Builder for the [Nodes Reload Secure Settings API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/secure-settings.html#reloadable-secure-settings)\n\nReloads secure settings."] pub struct NodesReloadSecureSettings<'a, 'b, B> { transport: &'a Transport, parts: NodesReloadSecureSettingsParts<'b>, @@ -647,8 +648,8 @@ impl<'b> NodesStatsParts<'b> { } } } +#[doc = "Builder for the [Nodes Stats API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/cluster-nodes-stats.html)\n\nReturns statistical information about nodes in the cluster."] #[derive(Clone, Debug)] -#[doc = "Builder for the [Nodes Stats API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/cluster-nodes-stats.html)\n\nReturns statistical information about nodes in the cluster."] pub struct NodesStats<'a, 'b> { transport: &'a Transport, parts: NodesStatsParts<'b>, @@ -875,8 +876,8 @@ impl<'b> NodesUsageParts<'b> { } } } +#[doc = "Builder for the [Nodes Usage API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/cluster-nodes-usage.html)\n\nReturns low-level information about REST actions usage on nodes."] #[derive(Clone, Debug)] -#[doc = "Builder for the [Nodes Usage API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/cluster-nodes-usage.html)\n\nReturns low-level information about REST actions usage on nodes."] pub struct NodesUsage<'a, 'b> { transport: &'a Transport, parts: NodesUsageParts<'b>, @@ -994,26 +995,26 @@ impl<'a> Nodes<'a> { pub fn transport(&self) -> &Transport { self.transport } - #[doc = "[Nodes Hot Threads API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/cluster-nodes-hot-threads.html)\n\nReturns information about hot threads on each node in the cluster."] + #[doc = "[Nodes Hot Threads API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/cluster-nodes-hot-threads.html)\n\nReturns information about hot threads on each node in the cluster."] pub fn hot_threads<'b>(&'a self, parts: NodesHotThreadsParts<'b>) -> NodesHotThreads<'a, 'b> { NodesHotThreads::new(self.transport(), parts) } - #[doc = "[Nodes Info API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/cluster-nodes-info.html)\n\nReturns information about nodes in the cluster."] + #[doc = "[Nodes Info API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/cluster-nodes-info.html)\n\nReturns information about nodes in the cluster."] pub fn info<'b>(&'a self, parts: NodesInfoParts<'b>) -> NodesInfo<'a, 'b> { NodesInfo::new(self.transport(), parts) } - #[doc = "[Nodes Reload Secure Settings API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/secure-settings.html#reloadable-secure-settings)\n\nReloads secure settings."] + #[doc = "[Nodes Reload Secure Settings API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/secure-settings.html#reloadable-secure-settings)\n\nReloads secure settings."] pub fn reload_secure_settings<'b>( &'a self, parts: NodesReloadSecureSettingsParts<'b>, ) -> NodesReloadSecureSettings<'a, 'b, ()> { NodesReloadSecureSettings::new(self.transport(), parts) } - #[doc = "[Nodes Stats API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/cluster-nodes-stats.html)\n\nReturns statistical information about nodes in the cluster."] + #[doc = "[Nodes Stats API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/cluster-nodes-stats.html)\n\nReturns statistical information about nodes in the cluster."] pub fn stats<'b>(&'a self, parts: NodesStatsParts<'b>) -> NodesStats<'a, 'b> { NodesStats::new(self.transport(), parts) } - #[doc = "[Nodes Usage API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/cluster-nodes-usage.html)\n\nReturns low-level information about REST actions usage on nodes."] + #[doc = "[Nodes Usage API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/cluster-nodes-usage.html)\n\nReturns low-level information about REST actions usage on nodes."] pub fn usage<'b>(&'a self, parts: NodesUsageParts<'b>) -> NodesUsage<'a, 'b> { NodesUsage::new(self.transport(), parts) } diff --git a/elasticsearch/src/params.rs b/elasticsearch/src/params.rs index 6f902fce..f5188209 100644 --- a/elasticsearch/src/params.rs +++ b/elasticsearch/src/params.rs @@ -25,8 +25,8 @@ use serde::{de, de::Visitor, Deserializer, Serializer}; // Generated code - do not edit until the next GENERATED-END marker use serde::{Deserialize, Serialize}; -#[derive(Debug, PartialEq, Deserialize, Serialize, Clone, Copy)] #[doc = "The unit in which to display byte values"] +#[derive(Debug, PartialEq, Deserialize, Serialize, Clone, Copy)] pub enum Bytes { #[serde(rename = "b")] B, @@ -51,24 +51,24 @@ pub enum Bytes { #[serde(rename = "pb")] Pb, } -#[derive(Debug, PartialEq, Deserialize, Serialize, Clone, Copy)] #[doc = "What to do when the delete by query hits version conflicts?"] +#[derive(Debug, PartialEq, Deserialize, Serialize, Clone, Copy)] pub enum Conflicts { #[serde(rename = "abort")] Abort, #[serde(rename = "proceed")] Proceed, } -#[derive(Debug, PartialEq, Deserialize, Serialize, Clone, Copy)] #[doc = "The default operator for query string query (AND or OR)"] +#[derive(Debug, PartialEq, Deserialize, Serialize, Clone, Copy)] pub enum DefaultOperator { #[serde(rename = "AND")] And, #[serde(rename = "OR")] Or, } -#[derive(Debug, PartialEq, Deserialize, Serialize, Clone, Copy)] #[doc = "Whether to expand wildcard expression to concrete indices that are open, closed or both."] +#[derive(Debug, PartialEq, Deserialize, Serialize, Clone, Copy)] pub enum ExpandWildcards { #[serde(rename = "open")] Open, @@ -81,8 +81,24 @@ pub enum ExpandWildcards { #[serde(rename = "all")] All, } +#[doc = "Optional parameter to specify the high level file format"] +#[doc = " \n# Optional, experimental\nThis requires the `experimental-apis` feature. Can have breaking changes in future\nversions or might even be removed entirely.\n "] +#[cfg(feature = "experimental-apis")] #[derive(Debug, PartialEq, Deserialize, Serialize, Clone, Copy)] +pub enum Format { + #[serde(rename = "ndjson")] + Ndjson, + #[serde(rename = "xml")] + Xml, + #[serde(rename = "delimited")] + Delimited, + #[serde(rename = "semi_structured_text")] + SemiStructuredText, +} #[doc = "Group tasks by nodes or parent/child relationships"] +#[doc = " \n# Optional, experimental\nThis requires the `experimental-apis` feature. Can have breaking changes in future\nversions or might even be removed entirely.\n "] +#[cfg(feature = "experimental-apis")] +#[derive(Debug, PartialEq, Deserialize, Serialize, Clone, Copy)] pub enum GroupBy { #[serde(rename = "nodes")] Nodes, @@ -91,8 +107,8 @@ pub enum GroupBy { #[serde(rename = "none")] None, } -#[derive(Debug, PartialEq, Deserialize, Serialize, Clone, Copy)] #[doc = "A health status (\"green\", \"yellow\", or \"red\" to filter only indices matching the specified health status"] +#[derive(Debug, PartialEq, Deserialize, Serialize, Clone, Copy)] pub enum Health { #[serde(rename = "green")] Green, @@ -101,8 +117,8 @@ pub enum Health { #[serde(rename = "red")] Red, } -#[derive(Debug, PartialEq, Deserialize, Serialize, Clone, Copy)] #[doc = "Specify the level of detail for returned information"] +#[derive(Debug, PartialEq, Deserialize, Serialize, Clone, Copy)] pub enum Level { #[serde(rename = "cluster")] Cluster, @@ -111,16 +127,16 @@ pub enum Level { #[serde(rename = "shards")] Shards, } -#[derive(Debug, PartialEq, Deserialize, Serialize, Clone, Copy)] #[doc = "Explicit operation type. Defaults to `index` for requests with an explicit document ID, and to `create`for requests without an explicit document ID"] +#[derive(Debug, PartialEq, Deserialize, Serialize, Clone, Copy)] pub enum OpType { #[serde(rename = "index")] Index, #[serde(rename = "create")] Create, } +#[doc = "If `true` (the default) then refresh the affected shards to make this operation visible to search, if `wait_for` then wait for a refresh to make this operation visible to search, if `false` then do nothing with refreshes."] #[derive(Debug, PartialEq, Deserialize, Serialize, Clone, Copy)] -#[doc = "If `true` then refresh the affected shards to make this operation visible to search, if `wait_for` then wait for a refresh to make this operation visible to search, if `false` (the default) then do nothing with refreshes."] pub enum Refresh { #[serde(rename = "true")] True, @@ -129,16 +145,16 @@ pub enum Refresh { #[serde(rename = "wait_for")] WaitFor, } -#[derive(Debug, PartialEq, Deserialize, Serialize, Clone, Copy)] #[doc = "Search operation type"] +#[derive(Debug, PartialEq, Deserialize, Serialize, Clone, Copy)] pub enum SearchType { #[serde(rename = "query_then_fetch")] QueryThenFetch, #[serde(rename = "dfs_query_then_fetch")] DfsQueryThenFetch, } -#[derive(Debug, PartialEq, Deserialize, Serialize, Clone, Copy)] #[doc = "The multiplier in which to display values"] +#[derive(Debug, PartialEq, Deserialize, Serialize, Clone, Copy)] pub enum Size { #[serde(rename = "")] Unspecified, @@ -153,8 +169,8 @@ pub enum Size { #[serde(rename = "p")] P, } -#[derive(Debug, PartialEq, Deserialize, Serialize, Clone, Copy)] #[doc = "Specify suggest mode"] +#[derive(Debug, PartialEq, Deserialize, Serialize, Clone, Copy)] pub enum SuggestMode { #[serde(rename = "missing")] Missing, @@ -163,8 +179,8 @@ pub enum SuggestMode { #[serde(rename = "always")] Always, } -#[derive(Debug, PartialEq, Deserialize, Serialize, Clone, Copy)] #[doc = "The unit in which to display time values"] +#[derive(Debug, PartialEq, Deserialize, Serialize, Clone, Copy)] pub enum Time { #[serde(rename = "d")] D, @@ -181,8 +197,8 @@ pub enum Time { #[serde(rename = "nanos")] Nanos, } -#[derive(Debug, PartialEq, Deserialize, Serialize, Clone, Copy)] #[doc = "The type to sample (default: cpu)"] +#[derive(Debug, PartialEq, Deserialize, Serialize, Clone, Copy)] pub enum Type { #[serde(rename = "cpu")] Cpu, @@ -191,8 +207,8 @@ pub enum Type { #[serde(rename = "block")] Block, } -#[derive(Debug, PartialEq, Deserialize, Serialize, Clone, Copy)] #[doc = "Specific version type"] +#[derive(Debug, PartialEq, Deserialize, Serialize, Clone, Copy)] pub enum VersionType { #[serde(rename = "internal")] Internal, @@ -200,9 +216,11 @@ pub enum VersionType { External, #[serde(rename = "external_gte")] ExternalGte, + #[serde(rename = "force")] + Force, } -#[derive(Debug, PartialEq, Deserialize, Serialize, Clone, Copy)] #[doc = "Wait until all currently queued events with the given priority are processed"] +#[derive(Debug, PartialEq, Deserialize, Serialize, Clone, Copy)] pub enum WaitForEvents { #[serde(rename = "immediate")] Immediate, @@ -217,8 +235,8 @@ pub enum WaitForEvents { #[serde(rename = "languid")] Languid, } -#[derive(Debug, PartialEq, Deserialize, Serialize, Clone, Copy)] #[doc = "Wait until cluster is in a specific state"] +#[derive(Debug, PartialEq, Deserialize, Serialize, Clone, Copy)] pub enum WaitForStatus { #[serde(rename = "green")] Green, diff --git a/elasticsearch/src/rollup.rs b/elasticsearch/src/rollup.rs new file mode 100644 index 00000000..581fb7fe --- /dev/null +++ b/elasticsearch/src/rollup.rs @@ -0,0 +1,1423 @@ +/* + * Licensed to Elasticsearch B.V. under one or more contributor + * license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright + * ownership. Elasticsearch B.V. licenses this file to you under + * the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +// ----------------------------------------------- +// This file is generated, Please do not edit it manually. +// Run the following in the root of the repo to regenerate: +// +// cargo make generate-api +// ----------------------------------------------- + +//! Rollup APIs +//! +//! The Elastic Stack [data rollup features](https://www.elastic.co/guide/en/elasticsearch/reference/master/xpack-rollup.html) +//! provide a means to summarize and store historical data so that it can still be used for analysis, but at a fraction of +//! the storage cost of raw data. + +#![allow(unused_imports)] +use crate::{ + client::Elasticsearch, + error::Error, + http::{ + headers::{HeaderMap, HeaderName, HeaderValue, ACCEPT, CONTENT_TYPE}, + request::{Body, JsonBody, NdBody, PARTS_ENCODED}, + response::Response, + transport::Transport, + Method, + }, + params::*, +}; +use percent_encoding::percent_encode; +use serde::Serialize; +use std::{borrow::Cow, time::Duration}; +#[cfg(feature = "experimental-apis")] +#[derive(Debug, Clone, PartialEq)] +#[doc = "API parts for the Rollup Delete Job API"] +pub enum RollupDeleteJobParts<'b> { + #[doc = "Id"] + Id(&'b str), +} +#[cfg(feature = "experimental-apis")] +impl<'b> RollupDeleteJobParts<'b> { + #[doc = "Builds a relative URL path to the Rollup Delete Job API"] + pub fn url(self) -> Cow<'static, str> { + match self { + RollupDeleteJobParts::Id(ref id) => { + let encoded_id: Cow = percent_encode(id.as_bytes(), PARTS_ENCODED).into(); + let mut p = String::with_capacity(13usize + encoded_id.len()); + p.push_str("/_rollup/job/"); + p.push_str(encoded_id.as_ref()); + p.into() + } + } + } +} +#[doc = "Builder for the [Rollup Delete Job API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/rollup-delete-job.html)\n\nDeletes an existing rollup job."] +#[doc = " \n# Optional, experimental\nThis requires the `experimental-apis` feature. Can have breaking changes in future\nversions or might even be removed entirely.\n "] +#[cfg(feature = "experimental-apis")] +#[derive(Clone, Debug)] +pub struct RollupDeleteJob<'a, 'b> { + transport: &'a Transport, + parts: RollupDeleteJobParts<'b>, + error_trace: Option, + filter_path: Option<&'b [&'b str]>, + headers: HeaderMap, + human: Option, + pretty: Option, + request_timeout: Option, + source: Option<&'b str>, +} +#[cfg(feature = "experimental-apis")] +impl<'a, 'b> RollupDeleteJob<'a, 'b> { + #[doc = "Creates a new instance of [RollupDeleteJob] with the specified API parts"] + pub fn new(transport: &'a Transport, parts: RollupDeleteJobParts<'b>) -> Self { + let headers = HeaderMap::new(); + RollupDeleteJob { + transport, + parts, + headers, + error_trace: None, + filter_path: None, + human: None, + pretty: None, + request_timeout: None, + source: None, + } + } + #[doc = "Include the stack trace of returned errors."] + pub fn error_trace(mut self, error_trace: bool) -> Self { + self.error_trace = Some(error_trace); + self + } + #[doc = "A comma-separated list of filters used to reduce the response."] + pub fn filter_path(mut self, filter_path: &'b [&'b str]) -> Self { + self.filter_path = Some(filter_path); + self + } + #[doc = "Adds a HTTP header"] + pub fn header(mut self, key: HeaderName, value: HeaderValue) -> Self { + self.headers.insert(key, value); + self + } + #[doc = "Return human readable values for statistics."] + pub fn human(mut self, human: bool) -> Self { + self.human = Some(human); + self + } + #[doc = "Pretty format the returned JSON response."] + pub fn pretty(mut self, pretty: bool) -> Self { + self.pretty = Some(pretty); + self + } + #[doc = "Sets a request timeout for this API call.\n\nThe timeout is applied from when the request starts connecting until the response body has finished."] + pub fn request_timeout(mut self, timeout: Duration) -> Self { + self.request_timeout = Some(timeout); + self + } + #[doc = "The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests."] + pub fn source(mut self, source: &'b str) -> Self { + self.source = Some(source); + self + } + #[doc = "Creates an asynchronous call to the Rollup Delete Job API that can be awaited"] + pub async fn send(self) -> Result { + let path = self.parts.url(); + let method = Method::Delete; + let headers = self.headers; + let timeout = self.request_timeout; + let query_string = { + #[serde_with::skip_serializing_none] + #[derive(Serialize)] + struct QueryParams<'b> { + error_trace: Option, + #[serde(serialize_with = "crate::client::serialize_coll_qs")] + filter_path: Option<&'b [&'b str]>, + human: Option, + pretty: Option, + source: Option<&'b str>, + } + let query_params = QueryParams { + error_trace: self.error_trace, + filter_path: self.filter_path, + human: self.human, + pretty: self.pretty, + source: self.source, + }; + Some(query_params) + }; + let body = Option::<()>::None; + let response = self + .transport + .send(method, &path, headers, query_string.as_ref(), body, timeout) + .await?; + Ok(response) + } +} +#[cfg(feature = "experimental-apis")] +#[derive(Debug, Clone, PartialEq)] +#[doc = "API parts for the Rollup Get Jobs API"] +pub enum RollupGetJobsParts<'b> { + #[doc = "Id"] + Id(&'b str), + #[doc = "No parts"] + None, +} +#[cfg(feature = "experimental-apis")] +impl<'b> RollupGetJobsParts<'b> { + #[doc = "Builds a relative URL path to the Rollup Get Jobs API"] + pub fn url(self) -> Cow<'static, str> { + match self { + RollupGetJobsParts::Id(ref id) => { + let encoded_id: Cow = percent_encode(id.as_bytes(), PARTS_ENCODED).into(); + let mut p = String::with_capacity(13usize + encoded_id.len()); + p.push_str("/_rollup/job/"); + p.push_str(encoded_id.as_ref()); + p.into() + } + RollupGetJobsParts::None => "/_rollup/job/".into(), + } + } +} +#[doc = "Builder for the [Rollup Get Jobs API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/rollup-get-job.html)\n\nRetrieves the configuration, stats, and status of rollup jobs."] +#[doc = " \n# Optional, experimental\nThis requires the `experimental-apis` feature. Can have breaking changes in future\nversions or might even be removed entirely.\n "] +#[cfg(feature = "experimental-apis")] +#[derive(Clone, Debug)] +pub struct RollupGetJobs<'a, 'b> { + transport: &'a Transport, + parts: RollupGetJobsParts<'b>, + error_trace: Option, + filter_path: Option<&'b [&'b str]>, + headers: HeaderMap, + human: Option, + pretty: Option, + request_timeout: Option, + source: Option<&'b str>, +} +#[cfg(feature = "experimental-apis")] +impl<'a, 'b> RollupGetJobs<'a, 'b> { + #[doc = "Creates a new instance of [RollupGetJobs] with the specified API parts"] + pub fn new(transport: &'a Transport, parts: RollupGetJobsParts<'b>) -> Self { + let headers = HeaderMap::new(); + RollupGetJobs { + transport, + parts, + headers, + error_trace: None, + filter_path: None, + human: None, + pretty: None, + request_timeout: None, + source: None, + } + } + #[doc = "Include the stack trace of returned errors."] + pub fn error_trace(mut self, error_trace: bool) -> Self { + self.error_trace = Some(error_trace); + self + } + #[doc = "A comma-separated list of filters used to reduce the response."] + pub fn filter_path(mut self, filter_path: &'b [&'b str]) -> Self { + self.filter_path = Some(filter_path); + self + } + #[doc = "Adds a HTTP header"] + pub fn header(mut self, key: HeaderName, value: HeaderValue) -> Self { + self.headers.insert(key, value); + self + } + #[doc = "Return human readable values for statistics."] + pub fn human(mut self, human: bool) -> Self { + self.human = Some(human); + self + } + #[doc = "Pretty format the returned JSON response."] + pub fn pretty(mut self, pretty: bool) -> Self { + self.pretty = Some(pretty); + self + } + #[doc = "Sets a request timeout for this API call.\n\nThe timeout is applied from when the request starts connecting until the response body has finished."] + pub fn request_timeout(mut self, timeout: Duration) -> Self { + self.request_timeout = Some(timeout); + self + } + #[doc = "The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests."] + pub fn source(mut self, source: &'b str) -> Self { + self.source = Some(source); + self + } + #[doc = "Creates an asynchronous call to the Rollup Get Jobs API that can be awaited"] + pub async fn send(self) -> Result { + let path = self.parts.url(); + let method = Method::Get; + let headers = self.headers; + let timeout = self.request_timeout; + let query_string = { + #[serde_with::skip_serializing_none] + #[derive(Serialize)] + struct QueryParams<'b> { + error_trace: Option, + #[serde(serialize_with = "crate::client::serialize_coll_qs")] + filter_path: Option<&'b [&'b str]>, + human: Option, + pretty: Option, + source: Option<&'b str>, + } + let query_params = QueryParams { + error_trace: self.error_trace, + filter_path: self.filter_path, + human: self.human, + pretty: self.pretty, + source: self.source, + }; + Some(query_params) + }; + let body = Option::<()>::None; + let response = self + .transport + .send(method, &path, headers, query_string.as_ref(), body, timeout) + .await?; + Ok(response) + } +} +#[cfg(feature = "experimental-apis")] +#[derive(Debug, Clone, PartialEq)] +#[doc = "API parts for the Rollup Get Rollup Caps API"] +pub enum RollupGetRollupCapsParts<'b> { + #[doc = "Id"] + Id(&'b str), + #[doc = "No parts"] + None, +} +#[cfg(feature = "experimental-apis")] +impl<'b> RollupGetRollupCapsParts<'b> { + #[doc = "Builds a relative URL path to the Rollup Get Rollup Caps API"] + pub fn url(self) -> Cow<'static, str> { + match self { + RollupGetRollupCapsParts::Id(ref id) => { + let encoded_id: Cow = percent_encode(id.as_bytes(), PARTS_ENCODED).into(); + let mut p = String::with_capacity(14usize + encoded_id.len()); + p.push_str("/_rollup/data/"); + p.push_str(encoded_id.as_ref()); + p.into() + } + RollupGetRollupCapsParts::None => "/_rollup/data/".into(), + } + } +} +#[doc = "Builder for the [Rollup Get Rollup Caps API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/rollup-get-rollup-caps.html)\n\nReturns the capabilities of any rollup jobs that have been configured for a specific index or index pattern."] +#[doc = " \n# Optional, experimental\nThis requires the `experimental-apis` feature. Can have breaking changes in future\nversions or might even be removed entirely.\n "] +#[cfg(feature = "experimental-apis")] +#[derive(Clone, Debug)] +pub struct RollupGetRollupCaps<'a, 'b> { + transport: &'a Transport, + parts: RollupGetRollupCapsParts<'b>, + error_trace: Option, + filter_path: Option<&'b [&'b str]>, + headers: HeaderMap, + human: Option, + pretty: Option, + request_timeout: Option, + source: Option<&'b str>, +} +#[cfg(feature = "experimental-apis")] +impl<'a, 'b> RollupGetRollupCaps<'a, 'b> { + #[doc = "Creates a new instance of [RollupGetRollupCaps] with the specified API parts"] + pub fn new(transport: &'a Transport, parts: RollupGetRollupCapsParts<'b>) -> Self { + let headers = HeaderMap::new(); + RollupGetRollupCaps { + transport, + parts, + headers, + error_trace: None, + filter_path: None, + human: None, + pretty: None, + request_timeout: None, + source: None, + } + } + #[doc = "Include the stack trace of returned errors."] + pub fn error_trace(mut self, error_trace: bool) -> Self { + self.error_trace = Some(error_trace); + self + } + #[doc = "A comma-separated list of filters used to reduce the response."] + pub fn filter_path(mut self, filter_path: &'b [&'b str]) -> Self { + self.filter_path = Some(filter_path); + self + } + #[doc = "Adds a HTTP header"] + pub fn header(mut self, key: HeaderName, value: HeaderValue) -> Self { + self.headers.insert(key, value); + self + } + #[doc = "Return human readable values for statistics."] + pub fn human(mut self, human: bool) -> Self { + self.human = Some(human); + self + } + #[doc = "Pretty format the returned JSON response."] + pub fn pretty(mut self, pretty: bool) -> Self { + self.pretty = Some(pretty); + self + } + #[doc = "Sets a request timeout for this API call.\n\nThe timeout is applied from when the request starts connecting until the response body has finished."] + pub fn request_timeout(mut self, timeout: Duration) -> Self { + self.request_timeout = Some(timeout); + self + } + #[doc = "The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests."] + pub fn source(mut self, source: &'b str) -> Self { + self.source = Some(source); + self + } + #[doc = "Creates an asynchronous call to the Rollup Get Rollup Caps API that can be awaited"] + pub async fn send(self) -> Result { + let path = self.parts.url(); + let method = Method::Get; + let headers = self.headers; + let timeout = self.request_timeout; + let query_string = { + #[serde_with::skip_serializing_none] + #[derive(Serialize)] + struct QueryParams<'b> { + error_trace: Option, + #[serde(serialize_with = "crate::client::serialize_coll_qs")] + filter_path: Option<&'b [&'b str]>, + human: Option, + pretty: Option, + source: Option<&'b str>, + } + let query_params = QueryParams { + error_trace: self.error_trace, + filter_path: self.filter_path, + human: self.human, + pretty: self.pretty, + source: self.source, + }; + Some(query_params) + }; + let body = Option::<()>::None; + let response = self + .transport + .send(method, &path, headers, query_string.as_ref(), body, timeout) + .await?; + Ok(response) + } +} +#[cfg(feature = "experimental-apis")] +#[derive(Debug, Clone, PartialEq)] +#[doc = "API parts for the Rollup Get Rollup Index Caps API"] +pub enum RollupGetRollupIndexCapsParts<'b> { + #[doc = "Index"] + Index(&'b str), +} +#[cfg(feature = "experimental-apis")] +impl<'b> RollupGetRollupIndexCapsParts<'b> { + #[doc = "Builds a relative URL path to the Rollup Get Rollup Index Caps API"] + pub fn url(self) -> Cow<'static, str> { + match self { + RollupGetRollupIndexCapsParts::Index(ref index) => { + let encoded_index: Cow = + percent_encode(index.as_bytes(), PARTS_ENCODED).into(); + let mut p = String::with_capacity(14usize + encoded_index.len()); + p.push_str("/"); + p.push_str(encoded_index.as_ref()); + p.push_str("/_rollup/data"); + p.into() + } + } + } +} +#[doc = "Builder for the [Rollup Get Rollup Index Caps API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/rollup-get-rollup-index-caps.html)\n\nReturns the rollup capabilities of all jobs inside of a rollup index (e.g. the index where rollup data is stored)."] +#[doc = " \n# Optional, experimental\nThis requires the `experimental-apis` feature. Can have breaking changes in future\nversions or might even be removed entirely.\n "] +#[cfg(feature = "experimental-apis")] +#[derive(Clone, Debug)] +pub struct RollupGetRollupIndexCaps<'a, 'b> { + transport: &'a Transport, + parts: RollupGetRollupIndexCapsParts<'b>, + error_trace: Option, + filter_path: Option<&'b [&'b str]>, + headers: HeaderMap, + human: Option, + pretty: Option, + request_timeout: Option, + source: Option<&'b str>, +} +#[cfg(feature = "experimental-apis")] +impl<'a, 'b> RollupGetRollupIndexCaps<'a, 'b> { + #[doc = "Creates a new instance of [RollupGetRollupIndexCaps] with the specified API parts"] + pub fn new(transport: &'a Transport, parts: RollupGetRollupIndexCapsParts<'b>) -> Self { + let headers = HeaderMap::new(); + RollupGetRollupIndexCaps { + transport, + parts, + headers, + error_trace: None, + filter_path: None, + human: None, + pretty: None, + request_timeout: None, + source: None, + } + } + #[doc = "Include the stack trace of returned errors."] + pub fn error_trace(mut self, error_trace: bool) -> Self { + self.error_trace = Some(error_trace); + self + } + #[doc = "A comma-separated list of filters used to reduce the response."] + pub fn filter_path(mut self, filter_path: &'b [&'b str]) -> Self { + self.filter_path = Some(filter_path); + self + } + #[doc = "Adds a HTTP header"] + pub fn header(mut self, key: HeaderName, value: HeaderValue) -> Self { + self.headers.insert(key, value); + self + } + #[doc = "Return human readable values for statistics."] + pub fn human(mut self, human: bool) -> Self { + self.human = Some(human); + self + } + #[doc = "Pretty format the returned JSON response."] + pub fn pretty(mut self, pretty: bool) -> Self { + self.pretty = Some(pretty); + self + } + #[doc = "Sets a request timeout for this API call.\n\nThe timeout is applied from when the request starts connecting until the response body has finished."] + pub fn request_timeout(mut self, timeout: Duration) -> Self { + self.request_timeout = Some(timeout); + self + } + #[doc = "The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests."] + pub fn source(mut self, source: &'b str) -> Self { + self.source = Some(source); + self + } + #[doc = "Creates an asynchronous call to the Rollup Get Rollup Index Caps API that can be awaited"] + pub async fn send(self) -> Result { + let path = self.parts.url(); + let method = Method::Get; + let headers = self.headers; + let timeout = self.request_timeout; + let query_string = { + #[serde_with::skip_serializing_none] + #[derive(Serialize)] + struct QueryParams<'b> { + error_trace: Option, + #[serde(serialize_with = "crate::client::serialize_coll_qs")] + filter_path: Option<&'b [&'b str]>, + human: Option, + pretty: Option, + source: Option<&'b str>, + } + let query_params = QueryParams { + error_trace: self.error_trace, + filter_path: self.filter_path, + human: self.human, + pretty: self.pretty, + source: self.source, + }; + Some(query_params) + }; + let body = Option::<()>::None; + let response = self + .transport + .send(method, &path, headers, query_string.as_ref(), body, timeout) + .await?; + Ok(response) + } +} +#[cfg(feature = "experimental-apis")] +#[derive(Debug, Clone, PartialEq)] +#[doc = "API parts for the Rollup Put Job API"] +pub enum RollupPutJobParts<'b> { + #[doc = "Id"] + Id(&'b str), +} +#[cfg(feature = "experimental-apis")] +impl<'b> RollupPutJobParts<'b> { + #[doc = "Builds a relative URL path to the Rollup Put Job API"] + pub fn url(self) -> Cow<'static, str> { + match self { + RollupPutJobParts::Id(ref id) => { + let encoded_id: Cow = percent_encode(id.as_bytes(), PARTS_ENCODED).into(); + let mut p = String::with_capacity(13usize + encoded_id.len()); + p.push_str("/_rollup/job/"); + p.push_str(encoded_id.as_ref()); + p.into() + } + } + } +} +#[doc = "Builder for the [Rollup Put Job API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/rollup-put-job.html)\n\nCreates a rollup job."] +#[doc = " \n# Optional, experimental\nThis requires the `experimental-apis` feature. Can have breaking changes in future\nversions or might even be removed entirely.\n "] +#[cfg(feature = "experimental-apis")] +#[derive(Clone, Debug)] +pub struct RollupPutJob<'a, 'b, B> { + transport: &'a Transport, + parts: RollupPutJobParts<'b>, + body: Option, + error_trace: Option, + filter_path: Option<&'b [&'b str]>, + headers: HeaderMap, + human: Option, + pretty: Option, + request_timeout: Option, + source: Option<&'b str>, +} +#[cfg(feature = "experimental-apis")] +impl<'a, 'b, B> RollupPutJob<'a, 'b, B> +where + B: Body, +{ + #[doc = "Creates a new instance of [RollupPutJob] with the specified API parts"] + pub fn new(transport: &'a Transport, parts: RollupPutJobParts<'b>) -> Self { + let headers = HeaderMap::new(); + RollupPutJob { + transport, + parts, + headers, + body: None, + error_trace: None, + filter_path: None, + human: None, + pretty: None, + request_timeout: None, + source: None, + } + } + #[doc = "The body for the API call"] + pub fn body(self, body: T) -> RollupPutJob<'a, 'b, JsonBody> + where + T: Serialize, + { + RollupPutJob { + transport: self.transport, + parts: self.parts, + body: Some(body.into()), + error_trace: self.error_trace, + filter_path: self.filter_path, + headers: self.headers, + human: self.human, + pretty: self.pretty, + request_timeout: self.request_timeout, + source: self.source, + } + } + #[doc = "Include the stack trace of returned errors."] + pub fn error_trace(mut self, error_trace: bool) -> Self { + self.error_trace = Some(error_trace); + self + } + #[doc = "A comma-separated list of filters used to reduce the response."] + pub fn filter_path(mut self, filter_path: &'b [&'b str]) -> Self { + self.filter_path = Some(filter_path); + self + } + #[doc = "Adds a HTTP header"] + pub fn header(mut self, key: HeaderName, value: HeaderValue) -> Self { + self.headers.insert(key, value); + self + } + #[doc = "Return human readable values for statistics."] + pub fn human(mut self, human: bool) -> Self { + self.human = Some(human); + self + } + #[doc = "Pretty format the returned JSON response."] + pub fn pretty(mut self, pretty: bool) -> Self { + self.pretty = Some(pretty); + self + } + #[doc = "Sets a request timeout for this API call.\n\nThe timeout is applied from when the request starts connecting until the response body has finished."] + pub fn request_timeout(mut self, timeout: Duration) -> Self { + self.request_timeout = Some(timeout); + self + } + #[doc = "The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests."] + pub fn source(mut self, source: &'b str) -> Self { + self.source = Some(source); + self + } + #[doc = "Creates an asynchronous call to the Rollup Put Job API that can be awaited"] + pub async fn send(self) -> Result { + let path = self.parts.url(); + let method = Method::Put; + let headers = self.headers; + let timeout = self.request_timeout; + let query_string = { + #[serde_with::skip_serializing_none] + #[derive(Serialize)] + struct QueryParams<'b> { + error_trace: Option, + #[serde(serialize_with = "crate::client::serialize_coll_qs")] + filter_path: Option<&'b [&'b str]>, + human: Option, + pretty: Option, + source: Option<&'b str>, + } + let query_params = QueryParams { + error_trace: self.error_trace, + filter_path: self.filter_path, + human: self.human, + pretty: self.pretty, + source: self.source, + }; + Some(query_params) + }; + let body = self.body; + let response = self + .transport + .send(method, &path, headers, query_string.as_ref(), body, timeout) + .await?; + Ok(response) + } +} +#[derive(Debug, Clone, PartialEq)] +#[doc = "API parts for the Rollup Rollup API"] +pub enum RollupRollupParts<'b> { + #[doc = "Index and RollupIndex"] + IndexRollupIndex(&'b str, &'b str), +} +impl<'b> RollupRollupParts<'b> { + #[doc = "Builds a relative URL path to the Rollup Rollup API"] + pub fn url(self) -> Cow<'static, str> { + match self { + RollupRollupParts::IndexRollupIndex(ref index, ref rollup_index) => { + let encoded_index: Cow = + percent_encode(index.as_bytes(), PARTS_ENCODED).into(); + let encoded_rollup_index: Cow = + percent_encode(rollup_index.as_bytes(), PARTS_ENCODED).into(); + let mut p = String::with_capacity( + 10usize + encoded_index.len() + encoded_rollup_index.len(), + ); + p.push_str("/"); + p.push_str(encoded_index.as_ref()); + p.push_str("/_rollup/"); + p.push_str(encoded_rollup_index.as_ref()); + p.into() + } + } + } +} +#[doc = "Builder for the [Rollup Rollup API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/rollup-api.html)\n\nRollup an index"] +#[derive(Clone, Debug)] +pub struct RollupRollup<'a, 'b, B> { + transport: &'a Transport, + parts: RollupRollupParts<'b>, + body: Option, + error_trace: Option, + filter_path: Option<&'b [&'b str]>, + headers: HeaderMap, + human: Option, + pretty: Option, + request_timeout: Option, + source: Option<&'b str>, +} +impl<'a, 'b, B> RollupRollup<'a, 'b, B> +where + B: Body, +{ + #[doc = "Creates a new instance of [RollupRollup] with the specified API parts"] + pub fn new(transport: &'a Transport, parts: RollupRollupParts<'b>) -> Self { + let headers = HeaderMap::new(); + RollupRollup { + transport, + parts, + headers, + body: None, + error_trace: None, + filter_path: None, + human: None, + pretty: None, + request_timeout: None, + source: None, + } + } + #[doc = "The body for the API call"] + pub fn body(self, body: T) -> RollupRollup<'a, 'b, JsonBody> + where + T: Serialize, + { + RollupRollup { + transport: self.transport, + parts: self.parts, + body: Some(body.into()), + error_trace: self.error_trace, + filter_path: self.filter_path, + headers: self.headers, + human: self.human, + pretty: self.pretty, + request_timeout: self.request_timeout, + source: self.source, + } + } + #[doc = "Include the stack trace of returned errors."] + pub fn error_trace(mut self, error_trace: bool) -> Self { + self.error_trace = Some(error_trace); + self + } + #[doc = "A comma-separated list of filters used to reduce the response."] + pub fn filter_path(mut self, filter_path: &'b [&'b str]) -> Self { + self.filter_path = Some(filter_path); + self + } + #[doc = "Adds a HTTP header"] + pub fn header(mut self, key: HeaderName, value: HeaderValue) -> Self { + self.headers.insert(key, value); + self + } + #[doc = "Return human readable values for statistics."] + pub fn human(mut self, human: bool) -> Self { + self.human = Some(human); + self + } + #[doc = "Pretty format the returned JSON response."] + pub fn pretty(mut self, pretty: bool) -> Self { + self.pretty = Some(pretty); + self + } + #[doc = "Sets a request timeout for this API call.\n\nThe timeout is applied from when the request starts connecting until the response body has finished."] + pub fn request_timeout(mut self, timeout: Duration) -> Self { + self.request_timeout = Some(timeout); + self + } + #[doc = "The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests."] + pub fn source(mut self, source: &'b str) -> Self { + self.source = Some(source); + self + } + #[doc = "Creates an asynchronous call to the Rollup Rollup API that can be awaited"] + pub async fn send(self) -> Result { + let path = self.parts.url(); + let method = Method::Post; + let headers = self.headers; + let timeout = self.request_timeout; + let query_string = { + #[serde_with::skip_serializing_none] + #[derive(Serialize)] + struct QueryParams<'b> { + error_trace: Option, + #[serde(serialize_with = "crate::client::serialize_coll_qs")] + filter_path: Option<&'b [&'b str]>, + human: Option, + pretty: Option, + source: Option<&'b str>, + } + let query_params = QueryParams { + error_trace: self.error_trace, + filter_path: self.filter_path, + human: self.human, + pretty: self.pretty, + source: self.source, + }; + Some(query_params) + }; + let body = self.body; + let response = self + .transport + .send(method, &path, headers, query_string.as_ref(), body, timeout) + .await?; + Ok(response) + } +} +#[cfg(feature = "experimental-apis")] +#[derive(Debug, Clone, PartialEq)] +#[doc = "API parts for the Rollup Rollup Search API"] +pub enum RollupRollupSearchParts<'b> { + #[doc = "Index"] + Index(&'b [&'b str]), + #[doc = "Index and Type"] + IndexType(&'b [&'b str], &'b str), +} +#[cfg(feature = "experimental-apis")] +impl<'b> RollupRollupSearchParts<'b> { + #[doc = "Builds a relative URL path to the Rollup Rollup Search API"] + pub fn url(self) -> Cow<'static, str> { + match self { + RollupRollupSearchParts::Index(ref index) => { + let index_str = index.join(","); + let encoded_index: Cow = + percent_encode(index_str.as_bytes(), PARTS_ENCODED).into(); + let mut p = String::with_capacity(16usize + encoded_index.len()); + p.push_str("/"); + p.push_str(encoded_index.as_ref()); + p.push_str("/_rollup_search"); + p.into() + } + RollupRollupSearchParts::IndexType(ref index, ref ty) => { + let index_str = index.join(","); + let encoded_index: Cow = + percent_encode(index_str.as_bytes(), PARTS_ENCODED).into(); + let encoded_ty: Cow = percent_encode(ty.as_bytes(), PARTS_ENCODED).into(); + let mut p = String::with_capacity(17usize + encoded_index.len() + encoded_ty.len()); + p.push_str("/"); + p.push_str(encoded_index.as_ref()); + p.push_str("/"); + p.push_str(encoded_ty.as_ref()); + p.push_str("/_rollup_search"); + p.into() + } + } + } +} +#[doc = "Builder for the [Rollup Rollup Search API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/rollup-search.html)\n\nEnables searching rolled-up data using the standard query DSL."] +#[doc = " \n# Optional, experimental\nThis requires the `experimental-apis` feature. Can have breaking changes in future\nversions or might even be removed entirely.\n "] +#[cfg(feature = "experimental-apis")] +#[derive(Clone, Debug)] +pub struct RollupRollupSearch<'a, 'b, B> { + transport: &'a Transport, + parts: RollupRollupSearchParts<'b>, + body: Option, + error_trace: Option, + filter_path: Option<&'b [&'b str]>, + headers: HeaderMap, + human: Option, + pretty: Option, + request_timeout: Option, + rest_total_hits_as_int: Option, + source: Option<&'b str>, + typed_keys: Option, +} +#[cfg(feature = "experimental-apis")] +impl<'a, 'b, B> RollupRollupSearch<'a, 'b, B> +where + B: Body, +{ + #[doc = "Creates a new instance of [RollupRollupSearch] with the specified API parts"] + pub fn new(transport: &'a Transport, parts: RollupRollupSearchParts<'b>) -> Self { + let headers = HeaderMap::new(); + RollupRollupSearch { + transport, + parts, + headers, + body: None, + error_trace: None, + filter_path: None, + human: None, + pretty: None, + request_timeout: None, + rest_total_hits_as_int: None, + source: None, + typed_keys: None, + } + } + #[doc = "The body for the API call"] + pub fn body(self, body: T) -> RollupRollupSearch<'a, 'b, JsonBody> + where + T: Serialize, + { + RollupRollupSearch { + transport: self.transport, + parts: self.parts, + body: Some(body.into()), + error_trace: self.error_trace, + filter_path: self.filter_path, + headers: self.headers, + human: self.human, + pretty: self.pretty, + request_timeout: self.request_timeout, + rest_total_hits_as_int: self.rest_total_hits_as_int, + source: self.source, + typed_keys: self.typed_keys, + } + } + #[doc = "Include the stack trace of returned errors."] + pub fn error_trace(mut self, error_trace: bool) -> Self { + self.error_trace = Some(error_trace); + self + } + #[doc = "A comma-separated list of filters used to reduce the response."] + pub fn filter_path(mut self, filter_path: &'b [&'b str]) -> Self { + self.filter_path = Some(filter_path); + self + } + #[doc = "Adds a HTTP header"] + pub fn header(mut self, key: HeaderName, value: HeaderValue) -> Self { + self.headers.insert(key, value); + self + } + #[doc = "Return human readable values for statistics."] + pub fn human(mut self, human: bool) -> Self { + self.human = Some(human); + self + } + #[doc = "Pretty format the returned JSON response."] + pub fn pretty(mut self, pretty: bool) -> Self { + self.pretty = Some(pretty); + self + } + #[doc = "Sets a request timeout for this API call.\n\nThe timeout is applied from when the request starts connecting until the response body has finished."] + pub fn request_timeout(mut self, timeout: Duration) -> Self { + self.request_timeout = Some(timeout); + self + } + #[doc = "Indicates whether hits.total should be rendered as an integer or an object in the rest search response"] + pub fn rest_total_hits_as_int(mut self, rest_total_hits_as_int: bool) -> Self { + self.rest_total_hits_as_int = Some(rest_total_hits_as_int); + self + } + #[doc = "The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests."] + pub fn source(mut self, source: &'b str) -> Self { + self.source = Some(source); + self + } + #[doc = "Specify whether aggregation and suggester names should be prefixed by their respective types in the response"] + pub fn typed_keys(mut self, typed_keys: bool) -> Self { + self.typed_keys = Some(typed_keys); + self + } + #[doc = "Creates an asynchronous call to the Rollup Rollup Search API that can be awaited"] + pub async fn send(self) -> Result { + let path = self.parts.url(); + let method = match self.body { + Some(_) => Method::Post, + None => Method::Get, + }; + let headers = self.headers; + let timeout = self.request_timeout; + let query_string = { + #[serde_with::skip_serializing_none] + #[derive(Serialize)] + struct QueryParams<'b> { + error_trace: Option, + #[serde(serialize_with = "crate::client::serialize_coll_qs")] + filter_path: Option<&'b [&'b str]>, + human: Option, + pretty: Option, + rest_total_hits_as_int: Option, + source: Option<&'b str>, + typed_keys: Option, + } + let query_params = QueryParams { + error_trace: self.error_trace, + filter_path: self.filter_path, + human: self.human, + pretty: self.pretty, + rest_total_hits_as_int: self.rest_total_hits_as_int, + source: self.source, + typed_keys: self.typed_keys, + }; + Some(query_params) + }; + let body = self.body; + let response = self + .transport + .send(method, &path, headers, query_string.as_ref(), body, timeout) + .await?; + Ok(response) + } +} +#[cfg(feature = "experimental-apis")] +#[derive(Debug, Clone, PartialEq)] +#[doc = "API parts for the Rollup Start Job API"] +pub enum RollupStartJobParts<'b> { + #[doc = "Id"] + Id(&'b str), +} +#[cfg(feature = "experimental-apis")] +impl<'b> RollupStartJobParts<'b> { + #[doc = "Builds a relative URL path to the Rollup Start Job API"] + pub fn url(self) -> Cow<'static, str> { + match self { + RollupStartJobParts::Id(ref id) => { + let encoded_id: Cow = percent_encode(id.as_bytes(), PARTS_ENCODED).into(); + let mut p = String::with_capacity(20usize + encoded_id.len()); + p.push_str("/_rollup/job/"); + p.push_str(encoded_id.as_ref()); + p.push_str("/_start"); + p.into() + } + } + } +} +#[doc = "Builder for the [Rollup Start Job API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/rollup-start-job.html)\n\nStarts an existing, stopped rollup job."] +#[doc = " \n# Optional, experimental\nThis requires the `experimental-apis` feature. Can have breaking changes in future\nversions or might even be removed entirely.\n "] +#[cfg(feature = "experimental-apis")] +#[derive(Clone, Debug)] +pub struct RollupStartJob<'a, 'b, B> { + transport: &'a Transport, + parts: RollupStartJobParts<'b>, + body: Option, + error_trace: Option, + filter_path: Option<&'b [&'b str]>, + headers: HeaderMap, + human: Option, + pretty: Option, + request_timeout: Option, + source: Option<&'b str>, +} +#[cfg(feature = "experimental-apis")] +impl<'a, 'b, B> RollupStartJob<'a, 'b, B> +where + B: Body, +{ + #[doc = "Creates a new instance of [RollupStartJob] with the specified API parts"] + pub fn new(transport: &'a Transport, parts: RollupStartJobParts<'b>) -> Self { + let headers = HeaderMap::new(); + RollupStartJob { + transport, + parts, + headers, + body: None, + error_trace: None, + filter_path: None, + human: None, + pretty: None, + request_timeout: None, + source: None, + } + } + #[doc = "The body for the API call"] + pub fn body(self, body: T) -> RollupStartJob<'a, 'b, JsonBody> + where + T: Serialize, + { + RollupStartJob { + transport: self.transport, + parts: self.parts, + body: Some(body.into()), + error_trace: self.error_trace, + filter_path: self.filter_path, + headers: self.headers, + human: self.human, + pretty: self.pretty, + request_timeout: self.request_timeout, + source: self.source, + } + } + #[doc = "Include the stack trace of returned errors."] + pub fn error_trace(mut self, error_trace: bool) -> Self { + self.error_trace = Some(error_trace); + self + } + #[doc = "A comma-separated list of filters used to reduce the response."] + pub fn filter_path(mut self, filter_path: &'b [&'b str]) -> Self { + self.filter_path = Some(filter_path); + self + } + #[doc = "Adds a HTTP header"] + pub fn header(mut self, key: HeaderName, value: HeaderValue) -> Self { + self.headers.insert(key, value); + self + } + #[doc = "Return human readable values for statistics."] + pub fn human(mut self, human: bool) -> Self { + self.human = Some(human); + self + } + #[doc = "Pretty format the returned JSON response."] + pub fn pretty(mut self, pretty: bool) -> Self { + self.pretty = Some(pretty); + self + } + #[doc = "Sets a request timeout for this API call.\n\nThe timeout is applied from when the request starts connecting until the response body has finished."] + pub fn request_timeout(mut self, timeout: Duration) -> Self { + self.request_timeout = Some(timeout); + self + } + #[doc = "The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests."] + pub fn source(mut self, source: &'b str) -> Self { + self.source = Some(source); + self + } + #[doc = "Creates an asynchronous call to the Rollup Start Job API that can be awaited"] + pub async fn send(self) -> Result { + let path = self.parts.url(); + let method = Method::Post; + let headers = self.headers; + let timeout = self.request_timeout; + let query_string = { + #[serde_with::skip_serializing_none] + #[derive(Serialize)] + struct QueryParams<'b> { + error_trace: Option, + #[serde(serialize_with = "crate::client::serialize_coll_qs")] + filter_path: Option<&'b [&'b str]>, + human: Option, + pretty: Option, + source: Option<&'b str>, + } + let query_params = QueryParams { + error_trace: self.error_trace, + filter_path: self.filter_path, + human: self.human, + pretty: self.pretty, + source: self.source, + }; + Some(query_params) + }; + let body = self.body; + let response = self + .transport + .send(method, &path, headers, query_string.as_ref(), body, timeout) + .await?; + Ok(response) + } +} +#[cfg(feature = "experimental-apis")] +#[derive(Debug, Clone, PartialEq)] +#[doc = "API parts for the Rollup Stop Job API"] +pub enum RollupStopJobParts<'b> { + #[doc = "Id"] + Id(&'b str), +} +#[cfg(feature = "experimental-apis")] +impl<'b> RollupStopJobParts<'b> { + #[doc = "Builds a relative URL path to the Rollup Stop Job API"] + pub fn url(self) -> Cow<'static, str> { + match self { + RollupStopJobParts::Id(ref id) => { + let encoded_id: Cow = percent_encode(id.as_bytes(), PARTS_ENCODED).into(); + let mut p = String::with_capacity(19usize + encoded_id.len()); + p.push_str("/_rollup/job/"); + p.push_str(encoded_id.as_ref()); + p.push_str("/_stop"); + p.into() + } + } + } +} +#[doc = "Builder for the [Rollup Stop Job API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/rollup-stop-job.html)\n\nStops an existing, started rollup job."] +#[doc = " \n# Optional, experimental\nThis requires the `experimental-apis` feature. Can have breaking changes in future\nversions or might even be removed entirely.\n "] +#[cfg(feature = "experimental-apis")] +#[derive(Clone, Debug)] +pub struct RollupStopJob<'a, 'b, B> { + transport: &'a Transport, + parts: RollupStopJobParts<'b>, + body: Option, + error_trace: Option, + filter_path: Option<&'b [&'b str]>, + headers: HeaderMap, + human: Option, + pretty: Option, + request_timeout: Option, + source: Option<&'b str>, + timeout: Option<&'b str>, + wait_for_completion: Option, +} +#[cfg(feature = "experimental-apis")] +impl<'a, 'b, B> RollupStopJob<'a, 'b, B> +where + B: Body, +{ + #[doc = "Creates a new instance of [RollupStopJob] with the specified API parts"] + pub fn new(transport: &'a Transport, parts: RollupStopJobParts<'b>) -> Self { + let headers = HeaderMap::new(); + RollupStopJob { + transport, + parts, + headers, + body: None, + error_trace: None, + filter_path: None, + human: None, + pretty: None, + request_timeout: None, + source: None, + timeout: None, + wait_for_completion: None, + } + } + #[doc = "The body for the API call"] + pub fn body(self, body: T) -> RollupStopJob<'a, 'b, JsonBody> + where + T: Serialize, + { + RollupStopJob { + transport: self.transport, + parts: self.parts, + body: Some(body.into()), + error_trace: self.error_trace, + filter_path: self.filter_path, + headers: self.headers, + human: self.human, + pretty: self.pretty, + request_timeout: self.request_timeout, + source: self.source, + timeout: self.timeout, + wait_for_completion: self.wait_for_completion, + } + } + #[doc = "Include the stack trace of returned errors."] + pub fn error_trace(mut self, error_trace: bool) -> Self { + self.error_trace = Some(error_trace); + self + } + #[doc = "A comma-separated list of filters used to reduce the response."] + pub fn filter_path(mut self, filter_path: &'b [&'b str]) -> Self { + self.filter_path = Some(filter_path); + self + } + #[doc = "Adds a HTTP header"] + pub fn header(mut self, key: HeaderName, value: HeaderValue) -> Self { + self.headers.insert(key, value); + self + } + #[doc = "Return human readable values for statistics."] + pub fn human(mut self, human: bool) -> Self { + self.human = Some(human); + self + } + #[doc = "Pretty format the returned JSON response."] + pub fn pretty(mut self, pretty: bool) -> Self { + self.pretty = Some(pretty); + self + } + #[doc = "Sets a request timeout for this API call.\n\nThe timeout is applied from when the request starts connecting until the response body has finished."] + pub fn request_timeout(mut self, timeout: Duration) -> Self { + self.request_timeout = Some(timeout); + self + } + #[doc = "The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests."] + pub fn source(mut self, source: &'b str) -> Self { + self.source = Some(source); + self + } + #[doc = "Block for (at maximum) the specified duration while waiting for the job to stop. Defaults to 30s."] + pub fn timeout(mut self, timeout: &'b str) -> Self { + self.timeout = Some(timeout); + self + } + #[doc = "True if the API should block until the job has fully stopped, false if should be executed async. Defaults to false."] + pub fn wait_for_completion(mut self, wait_for_completion: bool) -> Self { + self.wait_for_completion = Some(wait_for_completion); + self + } + #[doc = "Creates an asynchronous call to the Rollup Stop Job API that can be awaited"] + pub async fn send(self) -> Result { + let path = self.parts.url(); + let method = Method::Post; + let headers = self.headers; + let timeout = self.request_timeout; + let query_string = { + #[serde_with::skip_serializing_none] + #[derive(Serialize)] + struct QueryParams<'b> { + error_trace: Option, + #[serde(serialize_with = "crate::client::serialize_coll_qs")] + filter_path: Option<&'b [&'b str]>, + human: Option, + pretty: Option, + source: Option<&'b str>, + timeout: Option<&'b str>, + wait_for_completion: Option, + } + let query_params = QueryParams { + error_trace: self.error_trace, + filter_path: self.filter_path, + human: self.human, + pretty: self.pretty, + source: self.source, + timeout: self.timeout, + wait_for_completion: self.wait_for_completion, + }; + Some(query_params) + }; + let body = self.body; + let response = self + .transport + .send(method, &path, headers, query_string.as_ref(), body, timeout) + .await?; + Ok(response) + } +} +#[doc = "Namespace client for Rollup APIs"] +pub struct Rollup<'a> { + transport: &'a Transport, +} +impl<'a> Rollup<'a> { + #[doc = "Creates a new instance of [Rollup]"] + pub fn new(transport: &'a Transport) -> Self { + Self { transport } + } + pub fn transport(&self) -> &Transport { + self.transport + } + #[doc = "[Rollup Delete Job API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/rollup-delete-job.html)\n\nDeletes an existing rollup job."] + #[doc = " \n# Optional, experimental\nThis requires the `experimental-apis` feature. Can have breaking changes in future\nversions or might even be removed entirely.\n "] + #[cfg(feature = "experimental-apis")] + pub fn delete_job<'b>(&'a self, parts: RollupDeleteJobParts<'b>) -> RollupDeleteJob<'a, 'b> { + RollupDeleteJob::new(self.transport(), parts) + } + #[doc = "[Rollup Get Jobs API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/rollup-get-job.html)\n\nRetrieves the configuration, stats, and status of rollup jobs."] + #[doc = " \n# Optional, experimental\nThis requires the `experimental-apis` feature. Can have breaking changes in future\nversions or might even be removed entirely.\n "] + #[cfg(feature = "experimental-apis")] + pub fn get_jobs<'b>(&'a self, parts: RollupGetJobsParts<'b>) -> RollupGetJobs<'a, 'b> { + RollupGetJobs::new(self.transport(), parts) + } + #[doc = "[Rollup Get Rollup Caps API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/rollup-get-rollup-caps.html)\n\nReturns the capabilities of any rollup jobs that have been configured for a specific index or index pattern."] + #[doc = " \n# Optional, experimental\nThis requires the `experimental-apis` feature. Can have breaking changes in future\nversions or might even be removed entirely.\n "] + #[cfg(feature = "experimental-apis")] + pub fn get_rollup_caps<'b>( + &'a self, + parts: RollupGetRollupCapsParts<'b>, + ) -> RollupGetRollupCaps<'a, 'b> { + RollupGetRollupCaps::new(self.transport(), parts) + } + #[doc = "[Rollup Get Rollup Index Caps API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/rollup-get-rollup-index-caps.html)\n\nReturns the rollup capabilities of all jobs inside of a rollup index (e.g. the index where rollup data is stored)."] + #[doc = " \n# Optional, experimental\nThis requires the `experimental-apis` feature. Can have breaking changes in future\nversions or might even be removed entirely.\n "] + #[cfg(feature = "experimental-apis")] + pub fn get_rollup_index_caps<'b>( + &'a self, + parts: RollupGetRollupIndexCapsParts<'b>, + ) -> RollupGetRollupIndexCaps<'a, 'b> { + RollupGetRollupIndexCaps::new(self.transport(), parts) + } + #[doc = "[Rollup Put Job API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/rollup-put-job.html)\n\nCreates a rollup job."] + #[doc = " \n# Optional, experimental\nThis requires the `experimental-apis` feature. Can have breaking changes in future\nversions or might even be removed entirely.\n "] + #[cfg(feature = "experimental-apis")] + pub fn put_job<'b>(&'a self, parts: RollupPutJobParts<'b>) -> RollupPutJob<'a, 'b, ()> { + RollupPutJob::new(self.transport(), parts) + } + #[doc = "[Rollup Rollup API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/rollup-api.html)\n\nRollup an index"] + pub fn rollup<'b>(&'a self, parts: RollupRollupParts<'b>) -> RollupRollup<'a, 'b, ()> { + RollupRollup::new(self.transport(), parts) + } + #[doc = "[Rollup Rollup Search API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/rollup-search.html)\n\nEnables searching rolled-up data using the standard query DSL."] + #[doc = " \n# Optional, experimental\nThis requires the `experimental-apis` feature. Can have breaking changes in future\nversions or might even be removed entirely.\n "] + #[cfg(feature = "experimental-apis")] + pub fn rollup_search<'b>( + &'a self, + parts: RollupRollupSearchParts<'b>, + ) -> RollupRollupSearch<'a, 'b, ()> { + RollupRollupSearch::new(self.transport(), parts) + } + #[doc = "[Rollup Start Job API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/rollup-start-job.html)\n\nStarts an existing, stopped rollup job."] + #[doc = " \n# Optional, experimental\nThis requires the `experimental-apis` feature. Can have breaking changes in future\nversions or might even be removed entirely.\n "] + #[cfg(feature = "experimental-apis")] + pub fn start_job<'b>(&'a self, parts: RollupStartJobParts<'b>) -> RollupStartJob<'a, 'b, ()> { + RollupStartJob::new(self.transport(), parts) + } + #[doc = "[Rollup Stop Job API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/rollup-stop-job.html)\n\nStops an existing, started rollup job."] + #[doc = " \n# Optional, experimental\nThis requires the `experimental-apis` feature. Can have breaking changes in future\nversions or might even be removed entirely.\n "] + #[cfg(feature = "experimental-apis")] + pub fn stop_job<'b>(&'a self, parts: RollupStopJobParts<'b>) -> RollupStopJob<'a, 'b, ()> { + RollupStopJob::new(self.transport(), parts) + } +} +impl Elasticsearch { + #[doc = "Creates a namespace client for Rollup APIs"] + pub fn rollup(&self) -> Rollup { + Rollup::new(self.transport()) + } +} diff --git a/elasticsearch/src/root/mod.rs b/elasticsearch/src/root/mod.rs index 0759632d..75bfbd2a 100644 --- a/elasticsearch/src/root/mod.rs +++ b/elasticsearch/src/root/mod.rs @@ -24,7 +24,8 @@ // cargo make generate-api // ----------------------------------------------- -# ! [ allow ( unused_imports ) ]use crate::{ +#![allow(unused_imports)] +use crate::{ client::Elasticsearch, error::Error, http::{ @@ -78,8 +79,8 @@ impl<'b> BulkParts<'b> { } } } +#[doc = "Builder for the [Bulk API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/docs-bulk.html)\n\nAllows to perform multiple index/update/delete operations in a single request."] #[derive(Clone, Debug)] -#[doc = "Builder for the [Bulk API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/docs-bulk.html)\n\nAllows to perform multiple index/update/delete operations in a single request."] pub struct Bulk<'a, 'b, B> { transport: &'a Transport, parts: BulkParts<'b>, @@ -328,8 +329,8 @@ impl<'b> ClearScrollParts<'b> { } } } +#[doc = "Builder for the [Clear Scroll API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/clear-scroll-api.html)\n\nExplicitly clears the search context for a scroll."] #[derive(Clone, Debug)] -#[doc = "Builder for the [Clear Scroll API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/clear-scroll-api.html)\n\nExplicitly clears the search context for a scroll."] pub struct ClearScroll<'a, 'b, B> { transport: &'a Transport, parts: ClearScrollParts<'b>, @@ -450,6 +451,141 @@ where } } #[derive(Debug, Clone, PartialEq)] +#[doc = "API parts for the Close Point In Time API"] +pub enum ClosePointInTimeParts { + #[doc = "No parts"] + None, +} +impl ClosePointInTimeParts { + #[doc = "Builds a relative URL path to the Close Point In Time API"] + pub fn url(self) -> Cow<'static, str> { + match self { + ClosePointInTimeParts::None => "/_pit".into(), + } + } +} +#[doc = "Builder for the [Close Point In Time API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/point-in-time-api.html)\n\nClose a point in time"] +#[derive(Clone, Debug)] +pub struct ClosePointInTime<'a, 'b, B> { + transport: &'a Transport, + parts: ClosePointInTimeParts, + body: Option, + error_trace: Option, + filter_path: Option<&'b [&'b str]>, + headers: HeaderMap, + human: Option, + pretty: Option, + request_timeout: Option, + source: Option<&'b str>, +} +impl<'a, 'b, B> ClosePointInTime<'a, 'b, B> +where + B: Body, +{ + #[doc = "Creates a new instance of [ClosePointInTime]"] + pub fn new(transport: &'a Transport) -> Self { + let headers = HeaderMap::new(); + ClosePointInTime { + transport, + parts: ClosePointInTimeParts::None, + headers, + body: None, + error_trace: None, + filter_path: None, + human: None, + pretty: None, + request_timeout: None, + source: None, + } + } + #[doc = "The body for the API call"] + pub fn body(self, body: T) -> ClosePointInTime<'a, 'b, JsonBody> + where + T: Serialize, + { + ClosePointInTime { + transport: self.transport, + parts: self.parts, + body: Some(body.into()), + error_trace: self.error_trace, + filter_path: self.filter_path, + headers: self.headers, + human: self.human, + pretty: self.pretty, + request_timeout: self.request_timeout, + source: self.source, + } + } + #[doc = "Include the stack trace of returned errors."] + pub fn error_trace(mut self, error_trace: bool) -> Self { + self.error_trace = Some(error_trace); + self + } + #[doc = "A comma-separated list of filters used to reduce the response."] + pub fn filter_path(mut self, filter_path: &'b [&'b str]) -> Self { + self.filter_path = Some(filter_path); + self + } + #[doc = "Adds a HTTP header"] + pub fn header(mut self, key: HeaderName, value: HeaderValue) -> Self { + self.headers.insert(key, value); + self + } + #[doc = "Return human readable values for statistics."] + pub fn human(mut self, human: bool) -> Self { + self.human = Some(human); + self + } + #[doc = "Pretty format the returned JSON response."] + pub fn pretty(mut self, pretty: bool) -> Self { + self.pretty = Some(pretty); + self + } + #[doc = "Sets a request timeout for this API call.\n\nThe timeout is applied from when the request starts connecting until the response body has finished."] + pub fn request_timeout(mut self, timeout: Duration) -> Self { + self.request_timeout = Some(timeout); + self + } + #[doc = "The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests."] + pub fn source(mut self, source: &'b str) -> Self { + self.source = Some(source); + self + } + #[doc = "Creates an asynchronous call to the Close Point In Time API that can be awaited"] + pub async fn send(self) -> Result { + let path = self.parts.url(); + let method = Method::Delete; + let headers = self.headers; + let timeout = self.request_timeout; + let query_string = { + #[serde_with::skip_serializing_none] + #[derive(Serialize)] + struct QueryParams<'b> { + error_trace: Option, + #[serde(serialize_with = "crate::client::serialize_coll_qs")] + filter_path: Option<&'b [&'b str]>, + human: Option, + pretty: Option, + source: Option<&'b str>, + } + let query_params = QueryParams { + error_trace: self.error_trace, + filter_path: self.filter_path, + human: self.human, + pretty: self.pretty, + source: self.source, + }; + Some(query_params) + }; + let body = self.body; + let response = self + .transport + .send(method, &path, headers, query_string.as_ref(), body, timeout) + .await?; + Ok(response) + } +} +#[derive(Debug, Clone, PartialEq)] #[doc = "API parts for the Count API"] pub enum CountParts<'b> { #[doc = "No parts"] @@ -491,8 +627,8 @@ impl<'b> CountParts<'b> { } } } +#[doc = "Builder for the [Count API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/search-count.html)\n\nReturns number of documents matching a query."] #[derive(Clone, Debug)] -#[doc = "Builder for the [Count API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/search-count.html)\n\nReturns number of documents matching a query."] pub struct Count<'a, 'b, B> { transport: &'a Transport, parts: CountParts<'b>, @@ -800,8 +936,8 @@ impl<'b> CreateParts<'b> { } } } +#[doc = "Builder for the [Create API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/docs-index_.html)\n\nCreates a new document in the index.\n\nReturns a 409 response when a document with a same ID already exists in the index."] #[derive(Clone, Debug)] -#[doc = "Builder for the [Create API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/docs-index_.html)\n\nCreates a new document in the index.\n\nReturns a 409 response when a document with a same ID already exists in the index."] pub struct Create<'a, 'b, B> { transport: &'a Transport, parts: CreateParts<'b>, @@ -1033,8 +1169,8 @@ impl<'b> DeleteParts<'b> { } } } +#[doc = "Builder for the [Delete API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/docs-delete.html)\n\nRemoves a document from the index."] #[derive(Clone, Debug)] -#[doc = "Builder for the [Delete API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/docs-delete.html)\n\nRemoves a document from the index."] pub struct Delete<'a, 'b> { transport: &'a Transport, parts: DeleteParts<'b>, @@ -1242,8 +1378,8 @@ impl<'b> DeleteByQueryParts<'b> { } } } +#[doc = "Builder for the [Delete By Query API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/docs-delete-by-query.html)\n\nDeletes documents matching the provided query."] #[derive(Clone, Debug)] -#[doc = "Builder for the [Delete By Query API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/docs-delete-by-query.html)\n\nDeletes documents matching the provided query."] pub struct DeleteByQuery<'a, 'b, B> { transport: &'a Transport, parts: DeleteByQueryParts<'b>, @@ -1722,8 +1858,8 @@ impl<'b> DeleteByQueryRethrottleParts<'b> { } } } +#[doc = "Builder for the [Delete By Query Rethrottle API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/docs-delete-by-query.html)\n\nChanges the number of requests per second for a particular Delete By Query operation."] #[derive(Clone, Debug)] -#[doc = "Builder for the [Delete By Query Rethrottle API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/docs-delete-by-query.html)\n\nChanges the number of requests per second for a particular Delete By Query operation."] pub struct DeleteByQueryRethrottle<'a, 'b, B> { transport: &'a Transport, parts: DeleteByQueryRethrottleParts<'b>, @@ -1873,8 +2009,8 @@ impl<'b> DeleteScriptParts<'b> { } } } +#[doc = "Builder for the [Delete Script API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/modules-scripting.html)\n\nDeletes a script."] #[derive(Clone, Debug)] -#[doc = "Builder for the [Delete Script API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/modules-scripting.html)\n\nDeletes a script."] pub struct DeleteScript<'a, 'b> { transport: &'a Transport, parts: DeleteScriptParts<'b>, @@ -2031,8 +2167,8 @@ impl<'b> ExistsParts<'b> { } } } +#[doc = "Builder for the [Exists API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/docs-get.html)\n\nReturns information about whether a document exists in an index."] #[derive(Clone, Debug)] -#[doc = "Builder for the [Exists API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/docs-get.html)\n\nReturns information about whether a document exists in an index."] pub struct Exists<'a, 'b> { transport: &'a Transport, parts: ExistsParts<'b>, @@ -2266,8 +2402,8 @@ impl<'b> ExistsSourceParts<'b> { } } } +#[doc = "Builder for the [Exists Source API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/docs-get.html)\n\nReturns information about whether a document source exists in an index."] #[derive(Clone, Debug)] -#[doc = "Builder for the [Exists Source API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/docs-get.html)\n\nReturns information about whether a document source exists in an index."] pub struct ExistsSource<'a, 'b> { transport: &'a Transport, parts: ExistsSourceParts<'b>, @@ -2491,8 +2627,8 @@ impl<'b> ExplainParts<'b> { } } } +#[doc = "Builder for the [Explain API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/search-explain.html)\n\nReturns information about why a specific matches (or doesn't match) a query."] #[derive(Clone, Debug)] -#[doc = "Builder for the [Explain API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/search-explain.html)\n\nReturns information about why a specific matches (or doesn't match) a query."] pub struct Explain<'a, 'b, B> { transport: &'a Transport, parts: ExplainParts<'b>, @@ -2765,8 +2901,8 @@ impl<'b> FieldCapsParts<'b> { } } } +#[doc = "Builder for the [Field Caps API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/search-field-caps.html)\n\nReturns the information about the capabilities of fields among multiple indices."] #[derive(Clone, Debug)] -#[doc = "Builder for the [Field Caps API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/search-field-caps.html)\n\nReturns the information about the capabilities of fields among multiple indices."] pub struct FieldCaps<'a, 'b, B> { transport: &'a Transport, parts: FieldCapsParts<'b>, @@ -2983,8 +3119,8 @@ impl<'b> GetParts<'b> { } } } +#[doc = "Builder for the [Get API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/docs-get.html)\n\nReturns a document."] #[derive(Clone, Debug)] -#[doc = "Builder for the [Get API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/docs-get.html)\n\nReturns a document."] pub struct Get<'a, 'b> { transport: &'a Transport, parts: GetParts<'b>, @@ -3195,8 +3331,8 @@ impl<'b> GetScriptParts<'b> { } } } +#[doc = "Builder for the [Get Script API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/modules-scripting.html)\n\nReturns a script."] #[derive(Clone, Debug)] -#[doc = "Builder for the [Get Script API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/modules-scripting.html)\n\nReturns a script."] pub struct GetScript<'a, 'b> { transport: &'a Transport, parts: GetScriptParts<'b>, @@ -3302,111 +3438,54 @@ impl<'a, 'b> GetScript<'a, 'b> { Ok(response) } } +#[cfg(feature = "experimental-apis")] #[derive(Debug, Clone, PartialEq)] -#[doc = "API parts for the Get Source API"] -pub enum GetSourceParts<'b> { - #[doc = "Index and Id"] - IndexId(&'b str, &'b str), - #[doc = "Index, Type and Id"] - IndexTypeId(&'b str, &'b str, &'b str), +#[doc = "API parts for the Get Script Context API"] +pub enum GetScriptContextParts { + #[doc = "No parts"] + None, } -impl<'b> GetSourceParts<'b> { - #[doc = "Builds a relative URL path to the Get Source API"] +#[cfg(feature = "experimental-apis")] +impl GetScriptContextParts { + #[doc = "Builds a relative URL path to the Get Script Context API"] pub fn url(self) -> Cow<'static, str> { match self { - GetSourceParts::IndexId(ref index, ref id) => { - let encoded_index: Cow = - percent_encode(index.as_bytes(), PARTS_ENCODED).into(); - let encoded_id: Cow = percent_encode(id.as_bytes(), PARTS_ENCODED).into(); - let mut p = String::with_capacity(10usize + encoded_index.len() + encoded_id.len()); - p.push_str("/"); - p.push_str(encoded_index.as_ref()); - p.push_str("/_source/"); - p.push_str(encoded_id.as_ref()); - p.into() - } - GetSourceParts::IndexTypeId(ref index, ref ty, ref id) => { - let encoded_index: Cow = - percent_encode(index.as_bytes(), PARTS_ENCODED).into(); - let encoded_ty: Cow = percent_encode(ty.as_bytes(), PARTS_ENCODED).into(); - let encoded_id: Cow = percent_encode(id.as_bytes(), PARTS_ENCODED).into(); - let mut p = String::with_capacity( - 11usize + encoded_index.len() + encoded_ty.len() + encoded_id.len(), - ); - p.push_str("/"); - p.push_str(encoded_index.as_ref()); - p.push_str("/"); - p.push_str(encoded_ty.as_ref()); - p.push_str("/"); - p.push_str(encoded_id.as_ref()); - p.push_str("/_source"); - p.into() - } + GetScriptContextParts::None => "/_script_context".into(), } } } +#[doc = "Builder for the [Get Script Context API](https://www.elastic.co/guide/en/elasticsearch/painless/7.11/painless-contexts.html)\n\nReturns all script contexts."] +#[doc = " \n# Optional, experimental\nThis requires the `experimental-apis` feature. Can have breaking changes in future\nversions or might even be removed entirely.\n "] +#[cfg(feature = "experimental-apis")] #[derive(Clone, Debug)] -#[doc = "Builder for the [Get Source API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/docs-get.html)\n\nReturns the source of a document."] -pub struct GetSource<'a, 'b> { +pub struct GetScriptContext<'a, 'b> { transport: &'a Transport, - parts: GetSourceParts<'b>, - _source: Option<&'b [&'b str]>, - _source_excludes: Option<&'b [&'b str]>, - _source_includes: Option<&'b [&'b str]>, + parts: GetScriptContextParts, error_trace: Option, filter_path: Option<&'b [&'b str]>, headers: HeaderMap, human: Option, - preference: Option<&'b str>, pretty: Option, - realtime: Option, - refresh: Option, request_timeout: Option, - routing: Option<&'b str>, source: Option<&'b str>, - version: Option, - version_type: Option, } -impl<'a, 'b> GetSource<'a, 'b> { - #[doc = "Creates a new instance of [GetSource] with the specified API parts"] - pub fn new(transport: &'a Transport, parts: GetSourceParts<'b>) -> Self { +#[cfg(feature = "experimental-apis")] +impl<'a, 'b> GetScriptContext<'a, 'b> { + #[doc = "Creates a new instance of [GetScriptContext]"] + pub fn new(transport: &'a Transport) -> Self { let headers = HeaderMap::new(); - GetSource { + GetScriptContext { transport, - parts, + parts: GetScriptContextParts::None, headers, - _source: None, - _source_excludes: None, - _source_includes: None, error_trace: None, filter_path: None, human: None, - preference: None, pretty: None, - realtime: None, - refresh: None, request_timeout: None, - routing: None, source: None, - version: None, - version_type: None, } } - #[doc = "True or false to return the _source field or not, or a list of fields to return"] - pub fn _source(mut self, _source: &'b [&'b str]) -> Self { - self._source = Some(_source); - self - } - #[doc = "A list of fields to exclude from the returned _source field"] - pub fn _source_excludes(mut self, _source_excludes: &'b [&'b str]) -> Self { - self._source_excludes = Some(_source_excludes); - self - } - #[doc = "A list of fields to extract and return from the _source field"] - pub fn _source_includes(mut self, _source_includes: &'b [&'b str]) -> Self { - self._source_includes = Some(_source_includes); - self - } #[doc = "Include the stack trace of returned errors."] pub fn error_trace(mut self, error_trace: bool) -> Self { self.error_trace = Some(error_trace); @@ -3427,52 +3506,22 @@ impl<'a, 'b> GetSource<'a, 'b> { self.human = Some(human); self } - #[doc = "Specify the node or shard the operation should be performed on (default: random)"] - pub fn preference(mut self, preference: &'b str) -> Self { - self.preference = Some(preference); - self - } #[doc = "Pretty format the returned JSON response."] pub fn pretty(mut self, pretty: bool) -> Self { self.pretty = Some(pretty); self } - #[doc = "Specify whether to perform the operation in realtime or search mode"] - pub fn realtime(mut self, realtime: bool) -> Self { - self.realtime = Some(realtime); - self - } - #[doc = "Refresh the shard containing the document before performing the operation"] - pub fn refresh(mut self, refresh: bool) -> Self { - self.refresh = Some(refresh); - self - } #[doc = "Sets a request timeout for this API call.\n\nThe timeout is applied from when the request starts connecting until the response body has finished."] pub fn request_timeout(mut self, timeout: Duration) -> Self { self.request_timeout = Some(timeout); self } - #[doc = "Specific routing value"] - pub fn routing(mut self, routing: &'b str) -> Self { - self.routing = Some(routing); - self - } #[doc = "The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests."] pub fn source(mut self, source: &'b str) -> Self { self.source = Some(source); self } - #[doc = "Explicit version number for concurrency control"] - pub fn version(mut self, version: i64) -> Self { - self.version = Some(version); - self - } - #[doc = "Specific version type"] - pub fn version_type(mut self, version_type: VersionType) -> Self { - self.version_type = Some(version_type); - self - } - #[doc = "Creates an asynchronous call to the Get Source API that can be awaited"] + #[doc = "Creates an asynchronous call to the Get Script Context API that can be awaited"] pub async fn send(self) -> Result { let path = self.parts.url(); let method = Method::Get; @@ -3482,40 +3531,19 @@ impl<'a, 'b> GetSource<'a, 'b> { #[serde_with::skip_serializing_none] #[derive(Serialize)] struct QueryParams<'b> { - #[serde(serialize_with = "crate::client::serialize_coll_qs")] - _source: Option<&'b [&'b str]>, - #[serde(serialize_with = "crate::client::serialize_coll_qs")] - _source_excludes: Option<&'b [&'b str]>, - #[serde(serialize_with = "crate::client::serialize_coll_qs")] - _source_includes: Option<&'b [&'b str]>, error_trace: Option, #[serde(serialize_with = "crate::client::serialize_coll_qs")] filter_path: Option<&'b [&'b str]>, human: Option, - preference: Option<&'b str>, pretty: Option, - realtime: Option, - refresh: Option, - routing: Option<&'b str>, source: Option<&'b str>, - version: Option, - version_type: Option, } let query_params = QueryParams { - _source: self._source, - _source_excludes: self._source_excludes, - _source_includes: self._source_includes, error_trace: self.error_trace, filter_path: self.filter_path, human: self.human, - preference: self.preference, pretty: self.pretty, - realtime: self.realtime, - refresh: self.refresh, - routing: self.routing, source: self.source, - version: self.version, - version_type: self.version_type, }; Some(query_params) }; @@ -3527,12 +3555,354 @@ impl<'a, 'b> GetSource<'a, 'b> { Ok(response) } } +#[cfg(feature = "experimental-apis")] #[derive(Debug, Clone, PartialEq)] -#[doc = "API parts for the Index API"] -pub enum IndexParts<'b> { - #[doc = "Index and Id"] - IndexId(&'b str, &'b str), - #[doc = "Index"] +#[doc = "API parts for the Get Script Languages API"] +pub enum GetScriptLanguagesParts { + #[doc = "No parts"] + None, +} +#[cfg(feature = "experimental-apis")] +impl GetScriptLanguagesParts { + #[doc = "Builds a relative URL path to the Get Script Languages API"] + pub fn url(self) -> Cow<'static, str> { + match self { + GetScriptLanguagesParts::None => "/_script_language".into(), + } + } +} +#[doc = "Builder for the [Get Script Languages API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/modules-scripting.html)\n\nReturns available script types, languages and contexts"] +#[doc = " \n# Optional, experimental\nThis requires the `experimental-apis` feature. Can have breaking changes in future\nversions or might even be removed entirely.\n "] +#[cfg(feature = "experimental-apis")] +#[derive(Clone, Debug)] +pub struct GetScriptLanguages<'a, 'b> { + transport: &'a Transport, + parts: GetScriptLanguagesParts, + error_trace: Option, + filter_path: Option<&'b [&'b str]>, + headers: HeaderMap, + human: Option, + pretty: Option, + request_timeout: Option, + source: Option<&'b str>, +} +#[cfg(feature = "experimental-apis")] +impl<'a, 'b> GetScriptLanguages<'a, 'b> { + #[doc = "Creates a new instance of [GetScriptLanguages]"] + pub fn new(transport: &'a Transport) -> Self { + let headers = HeaderMap::new(); + GetScriptLanguages { + transport, + parts: GetScriptLanguagesParts::None, + headers, + error_trace: None, + filter_path: None, + human: None, + pretty: None, + request_timeout: None, + source: None, + } + } + #[doc = "Include the stack trace of returned errors."] + pub fn error_trace(mut self, error_trace: bool) -> Self { + self.error_trace = Some(error_trace); + self + } + #[doc = "A comma-separated list of filters used to reduce the response."] + pub fn filter_path(mut self, filter_path: &'b [&'b str]) -> Self { + self.filter_path = Some(filter_path); + self + } + #[doc = "Adds a HTTP header"] + pub fn header(mut self, key: HeaderName, value: HeaderValue) -> Self { + self.headers.insert(key, value); + self + } + #[doc = "Return human readable values for statistics."] + pub fn human(mut self, human: bool) -> Self { + self.human = Some(human); + self + } + #[doc = "Pretty format the returned JSON response."] + pub fn pretty(mut self, pretty: bool) -> Self { + self.pretty = Some(pretty); + self + } + #[doc = "Sets a request timeout for this API call.\n\nThe timeout is applied from when the request starts connecting until the response body has finished."] + pub fn request_timeout(mut self, timeout: Duration) -> Self { + self.request_timeout = Some(timeout); + self + } + #[doc = "The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests."] + pub fn source(mut self, source: &'b str) -> Self { + self.source = Some(source); + self + } + #[doc = "Creates an asynchronous call to the Get Script Languages API that can be awaited"] + pub async fn send(self) -> Result { + let path = self.parts.url(); + let method = Method::Get; + let headers = self.headers; + let timeout = self.request_timeout; + let query_string = { + #[serde_with::skip_serializing_none] + #[derive(Serialize)] + struct QueryParams<'b> { + error_trace: Option, + #[serde(serialize_with = "crate::client::serialize_coll_qs")] + filter_path: Option<&'b [&'b str]>, + human: Option, + pretty: Option, + source: Option<&'b str>, + } + let query_params = QueryParams { + error_trace: self.error_trace, + filter_path: self.filter_path, + human: self.human, + pretty: self.pretty, + source: self.source, + }; + Some(query_params) + }; + let body = Option::<()>::None; + let response = self + .transport + .send(method, &path, headers, query_string.as_ref(), body, timeout) + .await?; + Ok(response) + } +} +#[derive(Debug, Clone, PartialEq)] +#[doc = "API parts for the Get Source API"] +pub enum GetSourceParts<'b> { + #[doc = "Index and Id"] + IndexId(&'b str, &'b str), + #[doc = "Index, Type and Id"] + IndexTypeId(&'b str, &'b str, &'b str), +} +impl<'b> GetSourceParts<'b> { + #[doc = "Builds a relative URL path to the Get Source API"] + pub fn url(self) -> Cow<'static, str> { + match self { + GetSourceParts::IndexId(ref index, ref id) => { + let encoded_index: Cow = + percent_encode(index.as_bytes(), PARTS_ENCODED).into(); + let encoded_id: Cow = percent_encode(id.as_bytes(), PARTS_ENCODED).into(); + let mut p = String::with_capacity(10usize + encoded_index.len() + encoded_id.len()); + p.push_str("/"); + p.push_str(encoded_index.as_ref()); + p.push_str("/_source/"); + p.push_str(encoded_id.as_ref()); + p.into() + } + GetSourceParts::IndexTypeId(ref index, ref ty, ref id) => { + let encoded_index: Cow = + percent_encode(index.as_bytes(), PARTS_ENCODED).into(); + let encoded_ty: Cow = percent_encode(ty.as_bytes(), PARTS_ENCODED).into(); + let encoded_id: Cow = percent_encode(id.as_bytes(), PARTS_ENCODED).into(); + let mut p = String::with_capacity( + 11usize + encoded_index.len() + encoded_ty.len() + encoded_id.len(), + ); + p.push_str("/"); + p.push_str(encoded_index.as_ref()); + p.push_str("/"); + p.push_str(encoded_ty.as_ref()); + p.push_str("/"); + p.push_str(encoded_id.as_ref()); + p.push_str("/_source"); + p.into() + } + } + } +} +#[doc = "Builder for the [Get Source API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/docs-get.html)\n\nReturns the source of a document."] +#[derive(Clone, Debug)] +pub struct GetSource<'a, 'b> { + transport: &'a Transport, + parts: GetSourceParts<'b>, + _source: Option<&'b [&'b str]>, + _source_excludes: Option<&'b [&'b str]>, + _source_includes: Option<&'b [&'b str]>, + error_trace: Option, + filter_path: Option<&'b [&'b str]>, + headers: HeaderMap, + human: Option, + preference: Option<&'b str>, + pretty: Option, + realtime: Option, + refresh: Option, + request_timeout: Option, + routing: Option<&'b str>, + source: Option<&'b str>, + version: Option, + version_type: Option, +} +impl<'a, 'b> GetSource<'a, 'b> { + #[doc = "Creates a new instance of [GetSource] with the specified API parts"] + pub fn new(transport: &'a Transport, parts: GetSourceParts<'b>) -> Self { + let headers = HeaderMap::new(); + GetSource { + transport, + parts, + headers, + _source: None, + _source_excludes: None, + _source_includes: None, + error_trace: None, + filter_path: None, + human: None, + preference: None, + pretty: None, + realtime: None, + refresh: None, + request_timeout: None, + routing: None, + source: None, + version: None, + version_type: None, + } + } + #[doc = "True or false to return the _source field or not, or a list of fields to return"] + pub fn _source(mut self, _source: &'b [&'b str]) -> Self { + self._source = Some(_source); + self + } + #[doc = "A list of fields to exclude from the returned _source field"] + pub fn _source_excludes(mut self, _source_excludes: &'b [&'b str]) -> Self { + self._source_excludes = Some(_source_excludes); + self + } + #[doc = "A list of fields to extract and return from the _source field"] + pub fn _source_includes(mut self, _source_includes: &'b [&'b str]) -> Self { + self._source_includes = Some(_source_includes); + self + } + #[doc = "Include the stack trace of returned errors."] + pub fn error_trace(mut self, error_trace: bool) -> Self { + self.error_trace = Some(error_trace); + self + } + #[doc = "A comma-separated list of filters used to reduce the response."] + pub fn filter_path(mut self, filter_path: &'b [&'b str]) -> Self { + self.filter_path = Some(filter_path); + self + } + #[doc = "Adds a HTTP header"] + pub fn header(mut self, key: HeaderName, value: HeaderValue) -> Self { + self.headers.insert(key, value); + self + } + #[doc = "Return human readable values for statistics."] + pub fn human(mut self, human: bool) -> Self { + self.human = Some(human); + self + } + #[doc = "Specify the node or shard the operation should be performed on (default: random)"] + pub fn preference(mut self, preference: &'b str) -> Self { + self.preference = Some(preference); + self + } + #[doc = "Pretty format the returned JSON response."] + pub fn pretty(mut self, pretty: bool) -> Self { + self.pretty = Some(pretty); + self + } + #[doc = "Specify whether to perform the operation in realtime or search mode"] + pub fn realtime(mut self, realtime: bool) -> Self { + self.realtime = Some(realtime); + self + } + #[doc = "Refresh the shard containing the document before performing the operation"] + pub fn refresh(mut self, refresh: bool) -> Self { + self.refresh = Some(refresh); + self + } + #[doc = "Sets a request timeout for this API call.\n\nThe timeout is applied from when the request starts connecting until the response body has finished."] + pub fn request_timeout(mut self, timeout: Duration) -> Self { + self.request_timeout = Some(timeout); + self + } + #[doc = "Specific routing value"] + pub fn routing(mut self, routing: &'b str) -> Self { + self.routing = Some(routing); + self + } + #[doc = "The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests."] + pub fn source(mut self, source: &'b str) -> Self { + self.source = Some(source); + self + } + #[doc = "Explicit version number for concurrency control"] + pub fn version(mut self, version: i64) -> Self { + self.version = Some(version); + self + } + #[doc = "Specific version type"] + pub fn version_type(mut self, version_type: VersionType) -> Self { + self.version_type = Some(version_type); + self + } + #[doc = "Creates an asynchronous call to the Get Source API that can be awaited"] + pub async fn send(self) -> Result { + let path = self.parts.url(); + let method = Method::Get; + let headers = self.headers; + let timeout = self.request_timeout; + let query_string = { + #[serde_with::skip_serializing_none] + #[derive(Serialize)] + struct QueryParams<'b> { + #[serde(serialize_with = "crate::client::serialize_coll_qs")] + _source: Option<&'b [&'b str]>, + #[serde(serialize_with = "crate::client::serialize_coll_qs")] + _source_excludes: Option<&'b [&'b str]>, + #[serde(serialize_with = "crate::client::serialize_coll_qs")] + _source_includes: Option<&'b [&'b str]>, + error_trace: Option, + #[serde(serialize_with = "crate::client::serialize_coll_qs")] + filter_path: Option<&'b [&'b str]>, + human: Option, + preference: Option<&'b str>, + pretty: Option, + realtime: Option, + refresh: Option, + routing: Option<&'b str>, + source: Option<&'b str>, + version: Option, + version_type: Option, + } + let query_params = QueryParams { + _source: self._source, + _source_excludes: self._source_excludes, + _source_includes: self._source_includes, + error_trace: self.error_trace, + filter_path: self.filter_path, + human: self.human, + preference: self.preference, + pretty: self.pretty, + realtime: self.realtime, + refresh: self.refresh, + routing: self.routing, + source: self.source, + version: self.version, + version_type: self.version_type, + }; + Some(query_params) + }; + let body = Option::<()>::None; + let response = self + .transport + .send(method, &path, headers, query_string.as_ref(), body, timeout) + .await?; + Ok(response) + } +} +#[derive(Debug, Clone, PartialEq)] +#[doc = "API parts for the Index API"] +pub enum IndexParts<'b> { + #[doc = "Index and Id"] + IndexId(&'b str, &'b str), + #[doc = "Index"] Index(&'b str), #[doc = "Index and Type"] IndexType(&'b str, &'b str), @@ -3593,8 +3963,8 @@ impl<'b> IndexParts<'b> { } } } +#[doc = "Builder for the [Index API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/docs-index_.html)\n\nCreates or updates a document in an index."] #[derive(Clone, Debug)] -#[doc = "Builder for the [Index API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/docs-index_.html)\n\nCreates or updates a document in an index."] pub struct Index<'a, 'b, B> { transport: &'a Transport, parts: IndexParts<'b>, @@ -3838,8 +4208,8 @@ impl InfoParts { } } } +#[doc = "Builder for the [Info API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/index.html)\n\nReturns basic information about the cluster."] #[derive(Clone, Debug)] -#[doc = "Builder for the [Info API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/index.html)\n\nReturns basic information about the cluster."] pub struct Info<'a, 'b> { transport: &'a Transport, parts: InfoParts, @@ -3975,8 +4345,8 @@ impl<'b> MgetParts<'b> { } } } +#[doc = "Builder for the [Mget API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/docs-multi-get.html)\n\nAllows to get multiple documents in one request."] #[derive(Clone, Debug)] -#[doc = "Builder for the [Mget API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/docs-multi-get.html)\n\nAllows to get multiple documents in one request."] pub struct Mget<'a, 'b, B> { transport: &'a Transport, parts: MgetParts<'b>, @@ -4225,8 +4595,8 @@ impl<'b> MsearchParts<'b> { } } } +#[doc = "Builder for the [Msearch API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/search-multi-search.html)\n\nAllows to execute several search operations in one request."] #[derive(Clone, Debug)] -#[doc = "Builder for the [Msearch API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/search-multi-search.html)\n\nAllows to execute several search operations in one request."] pub struct Msearch<'a, 'b, B> { transport: &'a Transport, parts: MsearchParts<'b>, @@ -4461,8 +4831,8 @@ impl<'b> MsearchTemplateParts<'b> { } } } +#[doc = "Builder for the [Msearch Template API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/search-multi-search.html)\n\nAllows to execute several search template operations in one request."] #[derive(Clone, Debug)] -#[doc = "Builder for the [Msearch Template API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/search-multi-search.html)\n\nAllows to execute several search template operations in one request."] pub struct MsearchTemplate<'a, 'b, B> { transport: &'a Transport, parts: MsearchTemplateParts<'b>, @@ -4674,8 +5044,8 @@ impl<'b> MtermvectorsParts<'b> { } } } +#[doc = "Builder for the [Mtermvectors API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/docs-multi-termvectors.html)\n\nReturns multiple termvectors in one request."] #[derive(Clone, Debug)] -#[doc = "Builder for the [Mtermvectors API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/docs-multi-termvectors.html)\n\nReturns multiple termvectors in one request."] pub struct Mtermvectors<'a, 'b, B> { transport: &'a Transport, parts: MtermvectorsParts<'b>, @@ -4792,27 +5162,263 @@ where self.human = Some(human); self } - #[doc = "A comma-separated list of documents ids. You must define ids as parameter or set \"ids\" or \"docs\" in the request body"] - pub fn ids(mut self, ids: &'b [&'b str]) -> Self { - self.ids = Some(ids); - self - } - #[doc = "Specifies if term offsets should be returned. Applies to all returned documents unless otherwise specified in body \"params\" or \"docs\"."] - pub fn offsets(mut self, offsets: bool) -> Self { - self.offsets = Some(offsets); - self - } - #[doc = "Specifies if term payloads should be returned. Applies to all returned documents unless otherwise specified in body \"params\" or \"docs\"."] - pub fn payloads(mut self, payloads: bool) -> Self { - self.payloads = Some(payloads); + #[doc = "A comma-separated list of documents ids. You must define ids as parameter or set \"ids\" or \"docs\" in the request body"] + pub fn ids(mut self, ids: &'b [&'b str]) -> Self { + self.ids = Some(ids); + self + } + #[doc = "Specifies if term offsets should be returned. Applies to all returned documents unless otherwise specified in body \"params\" or \"docs\"."] + pub fn offsets(mut self, offsets: bool) -> Self { + self.offsets = Some(offsets); + self + } + #[doc = "Specifies if term payloads should be returned. Applies to all returned documents unless otherwise specified in body \"params\" or \"docs\"."] + pub fn payloads(mut self, payloads: bool) -> Self { + self.payloads = Some(payloads); + self + } + #[doc = "Specifies if term positions should be returned. Applies to all returned documents unless otherwise specified in body \"params\" or \"docs\"."] + pub fn positions(mut self, positions: bool) -> Self { + self.positions = Some(positions); + self + } + #[doc = "Specify the node or shard the operation should be performed on (default: random) .Applies to all returned documents unless otherwise specified in body \"params\" or \"docs\"."] + pub fn preference(mut self, preference: &'b str) -> Self { + self.preference = Some(preference); + self + } + #[doc = "Pretty format the returned JSON response."] + pub fn pretty(mut self, pretty: bool) -> Self { + self.pretty = Some(pretty); + self + } + #[doc = "Specifies if requests are real-time as opposed to near-real-time (default: true)."] + pub fn realtime(mut self, realtime: bool) -> Self { + self.realtime = Some(realtime); + self + } + #[doc = "Sets a request timeout for this API call.\n\nThe timeout is applied from when the request starts connecting until the response body has finished."] + pub fn request_timeout(mut self, timeout: Duration) -> Self { + self.request_timeout = Some(timeout); + self + } + #[doc = "Specific routing value. Applies to all returned documents unless otherwise specified in body \"params\" or \"docs\"."] + pub fn routing(mut self, routing: &'b str) -> Self { + self.routing = Some(routing); + self + } + #[doc = "The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests."] + pub fn source(mut self, source: &'b str) -> Self { + self.source = Some(source); + self + } + #[doc = "Specifies if total term frequency and document frequency should be returned. Applies to all returned documents unless otherwise specified in body \"params\" or \"docs\"."] + pub fn term_statistics(mut self, term_statistics: bool) -> Self { + self.term_statistics = Some(term_statistics); + self + } + #[doc = "Explicit version number for concurrency control"] + pub fn version(mut self, version: i64) -> Self { + self.version = Some(version); + self + } + #[doc = "Specific version type"] + pub fn version_type(mut self, version_type: VersionType) -> Self { + self.version_type = Some(version_type); + self + } + #[doc = "Creates an asynchronous call to the Mtermvectors API that can be awaited"] + pub async fn send(self) -> Result { + let path = self.parts.url(); + let method = match self.body { + Some(_) => Method::Post, + None => Method::Get, + }; + let headers = self.headers; + let timeout = self.request_timeout; + let query_string = { + #[serde_with::skip_serializing_none] + #[derive(Serialize)] + struct QueryParams<'b> { + error_trace: Option, + field_statistics: Option, + #[serde(serialize_with = "crate::client::serialize_coll_qs")] + fields: Option<&'b [&'b str]>, + #[serde(serialize_with = "crate::client::serialize_coll_qs")] + filter_path: Option<&'b [&'b str]>, + human: Option, + #[serde(serialize_with = "crate::client::serialize_coll_qs")] + ids: Option<&'b [&'b str]>, + offsets: Option, + payloads: Option, + positions: Option, + preference: Option<&'b str>, + pretty: Option, + realtime: Option, + routing: Option<&'b str>, + source: Option<&'b str>, + term_statistics: Option, + version: Option, + version_type: Option, + } + let query_params = QueryParams { + error_trace: self.error_trace, + field_statistics: self.field_statistics, + fields: self.fields, + filter_path: self.filter_path, + human: self.human, + ids: self.ids, + offsets: self.offsets, + payloads: self.payloads, + positions: self.positions, + preference: self.preference, + pretty: self.pretty, + realtime: self.realtime, + routing: self.routing, + source: self.source, + term_statistics: self.term_statistics, + version: self.version, + version_type: self.version_type, + }; + Some(query_params) + }; + let body = self.body; + let response = self + .transport + .send(method, &path, headers, query_string.as_ref(), body, timeout) + .await?; + Ok(response) + } +} +#[derive(Debug, Clone, PartialEq)] +#[doc = "API parts for the Open Point In Time API"] +pub enum OpenPointInTimeParts<'b> { + #[doc = "No parts"] + None, + #[doc = "Index"] + Index(&'b [&'b str]), +} +impl<'b> OpenPointInTimeParts<'b> { + #[doc = "Builds a relative URL path to the Open Point In Time API"] + pub fn url(self) -> Cow<'static, str> { + match self { + OpenPointInTimeParts::None => "/_pit".into(), + OpenPointInTimeParts::Index(ref index) => { + let index_str = index.join(","); + let encoded_index: Cow = + percent_encode(index_str.as_bytes(), PARTS_ENCODED).into(); + let mut p = String::with_capacity(6usize + encoded_index.len()); + p.push_str("/"); + p.push_str(encoded_index.as_ref()); + p.push_str("/_pit"); + p.into() + } + } + } +} +#[doc = "Builder for the [Open Point In Time API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/point-in-time-api.html)\n\nOpen a point in time that can be used in subsequent searches"] +#[derive(Clone, Debug)] +pub struct OpenPointInTime<'a, 'b, B> { + transport: &'a Transport, + parts: OpenPointInTimeParts<'b>, + body: Option, + error_trace: Option, + expand_wildcards: Option<&'b [ExpandWildcards]>, + filter_path: Option<&'b [&'b str]>, + headers: HeaderMap, + human: Option, + ignore_unavailable: Option, + keep_alive: Option<&'b str>, + preference: Option<&'b str>, + pretty: Option, + request_timeout: Option, + routing: Option<&'b str>, + source: Option<&'b str>, +} +impl<'a, 'b, B> OpenPointInTime<'a, 'b, B> +where + B: Body, +{ + #[doc = "Creates a new instance of [OpenPointInTime] with the specified API parts"] + pub fn new(transport: &'a Transport, parts: OpenPointInTimeParts<'b>) -> Self { + let headers = HeaderMap::new(); + OpenPointInTime { + transport, + parts, + headers, + body: None, + error_trace: None, + expand_wildcards: None, + filter_path: None, + human: None, + ignore_unavailable: None, + keep_alive: None, + preference: None, + pretty: None, + request_timeout: None, + routing: None, + source: None, + } + } + #[doc = "The body for the API call"] + pub fn body(self, body: T) -> OpenPointInTime<'a, 'b, JsonBody> + where + T: Serialize, + { + OpenPointInTime { + transport: self.transport, + parts: self.parts, + body: Some(body.into()), + error_trace: self.error_trace, + expand_wildcards: self.expand_wildcards, + filter_path: self.filter_path, + headers: self.headers, + human: self.human, + ignore_unavailable: self.ignore_unavailable, + keep_alive: self.keep_alive, + preference: self.preference, + pretty: self.pretty, + request_timeout: self.request_timeout, + routing: self.routing, + source: self.source, + } + } + #[doc = "Include the stack trace of returned errors."] + pub fn error_trace(mut self, error_trace: bool) -> Self { + self.error_trace = Some(error_trace); + self + } + #[doc = "Whether to expand wildcard expression to concrete indices that are open, closed or both."] + pub fn expand_wildcards(mut self, expand_wildcards: &'b [ExpandWildcards]) -> Self { + self.expand_wildcards = Some(expand_wildcards); + self + } + #[doc = "A comma-separated list of filters used to reduce the response."] + pub fn filter_path(mut self, filter_path: &'b [&'b str]) -> Self { + self.filter_path = Some(filter_path); + self + } + #[doc = "Adds a HTTP header"] + pub fn header(mut self, key: HeaderName, value: HeaderValue) -> Self { + self.headers.insert(key, value); + self + } + #[doc = "Return human readable values for statistics."] + pub fn human(mut self, human: bool) -> Self { + self.human = Some(human); + self + } + #[doc = "Whether specified concrete indices should be ignored when unavailable (missing or closed)"] + pub fn ignore_unavailable(mut self, ignore_unavailable: bool) -> Self { + self.ignore_unavailable = Some(ignore_unavailable); self } - #[doc = "Specifies if term positions should be returned. Applies to all returned documents unless otherwise specified in body \"params\" or \"docs\"."] - pub fn positions(mut self, positions: bool) -> Self { - self.positions = Some(positions); + #[doc = "Specific the time to live for the point in time"] + pub fn keep_alive(mut self, keep_alive: &'b str) -> Self { + self.keep_alive = Some(keep_alive); self } - #[doc = "Specify the node or shard the operation should be performed on (default: random) .Applies to all returned documents unless otherwise specified in body \"params\" or \"docs\"."] + #[doc = "Specify the node or shard the operation should be performed on (default: random)"] pub fn preference(mut self, preference: &'b str) -> Self { self.preference = Some(preference); self @@ -4822,17 +5428,12 @@ where self.pretty = Some(pretty); self } - #[doc = "Specifies if requests are real-time as opposed to near-real-time (default: true)."] - pub fn realtime(mut self, realtime: bool) -> Self { - self.realtime = Some(realtime); - self - } #[doc = "Sets a request timeout for this API call.\n\nThe timeout is applied from when the request starts connecting until the response body has finished."] pub fn request_timeout(mut self, timeout: Duration) -> Self { self.request_timeout = Some(timeout); self } - #[doc = "Specific routing value. Applies to all returned documents unless otherwise specified in body \"params\" or \"docs\"."] + #[doc = "Specific routing value"] pub fn routing(mut self, routing: &'b str) -> Self { self.routing = Some(routing); self @@ -4842,28 +5443,10 @@ where self.source = Some(source); self } - #[doc = "Specifies if total term frequency and document frequency should be returned. Applies to all returned documents unless otherwise specified in body \"params\" or \"docs\"."] - pub fn term_statistics(mut self, term_statistics: bool) -> Self { - self.term_statistics = Some(term_statistics); - self - } - #[doc = "Explicit version number for concurrency control"] - pub fn version(mut self, version: i64) -> Self { - self.version = Some(version); - self - } - #[doc = "Specific version type"] - pub fn version_type(mut self, version_type: VersionType) -> Self { - self.version_type = Some(version_type); - self - } - #[doc = "Creates an asynchronous call to the Mtermvectors API that can be awaited"] + #[doc = "Creates an asynchronous call to the Open Point In Time API that can be awaited"] pub async fn send(self) -> Result { let path = self.parts.url(); - let method = match self.body { - Some(_) => Method::Post, - None => Method::Get, - }; + let method = Method::Post; let headers = self.headers; let timeout = self.request_timeout; let query_string = { @@ -4871,44 +5454,29 @@ where #[derive(Serialize)] struct QueryParams<'b> { error_trace: Option, - field_statistics: Option, #[serde(serialize_with = "crate::client::serialize_coll_qs")] - fields: Option<&'b [&'b str]>, + expand_wildcards: Option<&'b [ExpandWildcards]>, #[serde(serialize_with = "crate::client::serialize_coll_qs")] filter_path: Option<&'b [&'b str]>, human: Option, - #[serde(serialize_with = "crate::client::serialize_coll_qs")] - ids: Option<&'b [&'b str]>, - offsets: Option, - payloads: Option, - positions: Option, + ignore_unavailable: Option, + keep_alive: Option<&'b str>, preference: Option<&'b str>, pretty: Option, - realtime: Option, routing: Option<&'b str>, source: Option<&'b str>, - term_statistics: Option, - version: Option, - version_type: Option, } let query_params = QueryParams { error_trace: self.error_trace, - field_statistics: self.field_statistics, - fields: self.fields, + expand_wildcards: self.expand_wildcards, filter_path: self.filter_path, human: self.human, - ids: self.ids, - offsets: self.offsets, - payloads: self.payloads, - positions: self.positions, + ignore_unavailable: self.ignore_unavailable, + keep_alive: self.keep_alive, preference: self.preference, pretty: self.pretty, - realtime: self.realtime, routing: self.routing, source: self.source, - term_statistics: self.term_statistics, - version: self.version, - version_type: self.version_type, }; Some(query_params) }; @@ -4934,8 +5502,8 @@ impl PingParts { } } } +#[doc = "Builder for the [Ping API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/index.html)\n\nReturns whether the cluster is running."] #[derive(Clone, Debug)] -#[doc = "Builder for the [Ping API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/index.html)\n\nReturns whether the cluster is running."] pub struct Ping<'a, 'b> { transport: &'a Transport, parts: PingParts, @@ -5001,30 +5569,215 @@ impl<'a, 'b> Ping<'a, 'b> { #[doc = "Creates an asynchronous call to the Ping API that can be awaited"] pub async fn send(self) -> Result { let path = self.parts.url(); - let method = Method::Head; + let method = Method::Head; + let headers = self.headers; + let timeout = self.request_timeout; + let query_string = { + #[serde_with::skip_serializing_none] + #[derive(Serialize)] + struct QueryParams<'b> { + error_trace: Option, + #[serde(serialize_with = "crate::client::serialize_coll_qs")] + filter_path: Option<&'b [&'b str]>, + human: Option, + pretty: Option, + source: Option<&'b str>, + } + let query_params = QueryParams { + error_trace: self.error_trace, + filter_path: self.filter_path, + human: self.human, + pretty: self.pretty, + source: self.source, + }; + Some(query_params) + }; + let body = Option::<()>::None; + let response = self + .transport + .send(method, &path, headers, query_string.as_ref(), body, timeout) + .await?; + Ok(response) + } +} +#[derive(Debug, Clone, PartialEq)] +#[doc = "API parts for the Put Script API"] +pub enum PutScriptParts<'b> { + #[doc = "Id"] + Id(&'b str), + #[doc = "Id and Context"] + IdContext(&'b str, &'b str), +} +impl<'b> PutScriptParts<'b> { + #[doc = "Builds a relative URL path to the Put Script API"] + pub fn url(self) -> Cow<'static, str> { + match self { + PutScriptParts::Id(ref id) => { + let encoded_id: Cow = percent_encode(id.as_bytes(), PARTS_ENCODED).into(); + let mut p = String::with_capacity(10usize + encoded_id.len()); + p.push_str("/_scripts/"); + p.push_str(encoded_id.as_ref()); + p.into() + } + PutScriptParts::IdContext(ref id, ref context) => { + let encoded_id: Cow = percent_encode(id.as_bytes(), PARTS_ENCODED).into(); + let encoded_context: Cow = + percent_encode(context.as_bytes(), PARTS_ENCODED).into(); + let mut p = + String::with_capacity(11usize + encoded_id.len() + encoded_context.len()); + p.push_str("/_scripts/"); + p.push_str(encoded_id.as_ref()); + p.push_str("/"); + p.push_str(encoded_context.as_ref()); + p.into() + } + } + } +} +#[doc = "Builder for the [Put Script API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/modules-scripting.html)\n\nCreates or updates a script."] +#[derive(Clone, Debug)] +pub struct PutScript<'a, 'b, B> { + transport: &'a Transport, + parts: PutScriptParts<'b>, + body: Option, + context: Option<&'b str>, + error_trace: Option, + filter_path: Option<&'b [&'b str]>, + headers: HeaderMap, + human: Option, + master_timeout: Option<&'b str>, + pretty: Option, + request_timeout: Option, + source: Option<&'b str>, + timeout: Option<&'b str>, +} +impl<'a, 'b, B> PutScript<'a, 'b, B> +where + B: Body, +{ + #[doc = "Creates a new instance of [PutScript] with the specified API parts"] + pub fn new(transport: &'a Transport, parts: PutScriptParts<'b>) -> Self { + let headers = HeaderMap::new(); + PutScript { + transport, + parts, + headers, + body: None, + context: None, + error_trace: None, + filter_path: None, + human: None, + master_timeout: None, + pretty: None, + request_timeout: None, + source: None, + timeout: None, + } + } + #[doc = "The body for the API call"] + pub fn body(self, body: T) -> PutScript<'a, 'b, JsonBody> + where + T: Serialize, + { + PutScript { + transport: self.transport, + parts: self.parts, + body: Some(body.into()), + context: self.context, + error_trace: self.error_trace, + filter_path: self.filter_path, + headers: self.headers, + human: self.human, + master_timeout: self.master_timeout, + pretty: self.pretty, + request_timeout: self.request_timeout, + source: self.source, + timeout: self.timeout, + } + } + #[doc = "Context name to compile script against"] + pub fn context(mut self, context: &'b str) -> Self { + self.context = Some(context); + self + } + #[doc = "Include the stack trace of returned errors."] + pub fn error_trace(mut self, error_trace: bool) -> Self { + self.error_trace = Some(error_trace); + self + } + #[doc = "A comma-separated list of filters used to reduce the response."] + pub fn filter_path(mut self, filter_path: &'b [&'b str]) -> Self { + self.filter_path = Some(filter_path); + self + } + #[doc = "Adds a HTTP header"] + pub fn header(mut self, key: HeaderName, value: HeaderValue) -> Self { + self.headers.insert(key, value); + self + } + #[doc = "Return human readable values for statistics."] + pub fn human(mut self, human: bool) -> Self { + self.human = Some(human); + self + } + #[doc = "Specify timeout for connection to master"] + pub fn master_timeout(mut self, master_timeout: &'b str) -> Self { + self.master_timeout = Some(master_timeout); + self + } + #[doc = "Pretty format the returned JSON response."] + pub fn pretty(mut self, pretty: bool) -> Self { + self.pretty = Some(pretty); + self + } + #[doc = "Sets a request timeout for this API call.\n\nThe timeout is applied from when the request starts connecting until the response body has finished."] + pub fn request_timeout(mut self, timeout: Duration) -> Self { + self.request_timeout = Some(timeout); + self + } + #[doc = "The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests."] + pub fn source(mut self, source: &'b str) -> Self { + self.source = Some(source); + self + } + #[doc = "Explicit operation timeout"] + pub fn timeout(mut self, timeout: &'b str) -> Self { + self.timeout = Some(timeout); + self + } + #[doc = "Creates an asynchronous call to the Put Script API that can be awaited"] + pub async fn send(self) -> Result { + let path = self.parts.url(); + let method = Method::Put; let headers = self.headers; let timeout = self.request_timeout; let query_string = { #[serde_with::skip_serializing_none] #[derive(Serialize)] struct QueryParams<'b> { + context: Option<&'b str>, error_trace: Option, #[serde(serialize_with = "crate::client::serialize_coll_qs")] filter_path: Option<&'b [&'b str]>, human: Option, + master_timeout: Option<&'b str>, pretty: Option, source: Option<&'b str>, + timeout: Option<&'b str>, } let query_params = QueryParams { + context: self.context, error_trace: self.error_trace, filter_path: self.filter_path, human: self.human, + master_timeout: self.master_timeout, pretty: self.pretty, source: self.source, + timeout: self.timeout, }; Some(query_params) }; - let body = Option::<()>::None; + let body = self.body; let response = self .transport .send(method, &path, headers, query_string.as_ref(), body, timeout) @@ -5032,111 +5785,116 @@ impl<'a, 'b> Ping<'a, 'b> { Ok(response) } } +#[cfg(feature = "experimental-apis")] #[derive(Debug, Clone, PartialEq)] -#[doc = "API parts for the Put Script API"] -pub enum PutScriptParts<'b> { - #[doc = "Id"] - Id(&'b str), - #[doc = "Id and Context"] - IdContext(&'b str, &'b str), +#[doc = "API parts for the Rank Eval API"] +pub enum RankEvalParts<'b> { + #[doc = "No parts"] + None, + #[doc = "Index"] + Index(&'b [&'b str]), } -impl<'b> PutScriptParts<'b> { - #[doc = "Builds a relative URL path to the Put Script API"] +#[cfg(feature = "experimental-apis")] +impl<'b> RankEvalParts<'b> { + #[doc = "Builds a relative URL path to the Rank Eval API"] pub fn url(self) -> Cow<'static, str> { match self { - PutScriptParts::Id(ref id) => { - let encoded_id: Cow = percent_encode(id.as_bytes(), PARTS_ENCODED).into(); - let mut p = String::with_capacity(10usize + encoded_id.len()); - p.push_str("/_scripts/"); - p.push_str(encoded_id.as_ref()); - p.into() - } - PutScriptParts::IdContext(ref id, ref context) => { - let encoded_id: Cow = percent_encode(id.as_bytes(), PARTS_ENCODED).into(); - let encoded_context: Cow = - percent_encode(context.as_bytes(), PARTS_ENCODED).into(); - let mut p = - String::with_capacity(11usize + encoded_id.len() + encoded_context.len()); - p.push_str("/_scripts/"); - p.push_str(encoded_id.as_ref()); + RankEvalParts::None => "/_rank_eval".into(), + RankEvalParts::Index(ref index) => { + let index_str = index.join(","); + let encoded_index: Cow = + percent_encode(index_str.as_bytes(), PARTS_ENCODED).into(); + let mut p = String::with_capacity(12usize + encoded_index.len()); p.push_str("/"); - p.push_str(encoded_context.as_ref()); + p.push_str(encoded_index.as_ref()); + p.push_str("/_rank_eval"); p.into() } } } } +#[doc = "Builder for the [Rank Eval API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/search-rank-eval.html)\n\nAllows to evaluate the quality of ranked search results over a set of typical search queries"] +#[doc = " \n# Optional, experimental\nThis requires the `experimental-apis` feature. Can have breaking changes in future\nversions or might even be removed entirely.\n "] +#[cfg(feature = "experimental-apis")] #[derive(Clone, Debug)] -#[doc = "Builder for the [Put Script API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/modules-scripting.html)\n\nCreates or updates a script."] -pub struct PutScript<'a, 'b, B> { +pub struct RankEval<'a, 'b, B> { transport: &'a Transport, - parts: PutScriptParts<'b>, + parts: RankEvalParts<'b>, + allow_no_indices: Option, body: Option, - context: Option<&'b str>, error_trace: Option, + expand_wildcards: Option<&'b [ExpandWildcards]>, filter_path: Option<&'b [&'b str]>, headers: HeaderMap, human: Option, - master_timeout: Option<&'b str>, + ignore_unavailable: Option, pretty: Option, request_timeout: Option, + search_type: Option, source: Option<&'b str>, - timeout: Option<&'b str>, } -impl<'a, 'b, B> PutScript<'a, 'b, B> +#[cfg(feature = "experimental-apis")] +impl<'a, 'b, B> RankEval<'a, 'b, B> where B: Body, { - #[doc = "Creates a new instance of [PutScript] with the specified API parts"] - pub fn new(transport: &'a Transport, parts: PutScriptParts<'b>) -> Self { + #[doc = "Creates a new instance of [RankEval] with the specified API parts"] + pub fn new(transport: &'a Transport, parts: RankEvalParts<'b>) -> Self { let headers = HeaderMap::new(); - PutScript { + RankEval { transport, parts, headers, + allow_no_indices: None, body: None, - context: None, error_trace: None, + expand_wildcards: None, filter_path: None, human: None, - master_timeout: None, + ignore_unavailable: None, pretty: None, request_timeout: None, + search_type: None, source: None, - timeout: None, } } + #[doc = "Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes `_all` string or when no indices have been specified)"] + pub fn allow_no_indices(mut self, allow_no_indices: bool) -> Self { + self.allow_no_indices = Some(allow_no_indices); + self + } #[doc = "The body for the API call"] - pub fn body(self, body: T) -> PutScript<'a, 'b, JsonBody> + pub fn body(self, body: T) -> RankEval<'a, 'b, JsonBody> where T: Serialize, { - PutScript { + RankEval { transport: self.transport, parts: self.parts, body: Some(body.into()), - context: self.context, + allow_no_indices: self.allow_no_indices, error_trace: self.error_trace, + expand_wildcards: self.expand_wildcards, filter_path: self.filter_path, headers: self.headers, human: self.human, - master_timeout: self.master_timeout, + ignore_unavailable: self.ignore_unavailable, pretty: self.pretty, request_timeout: self.request_timeout, + search_type: self.search_type, source: self.source, - timeout: self.timeout, } } - #[doc = "Context name to compile script against"] - pub fn context(mut self, context: &'b str) -> Self { - self.context = Some(context); - self - } #[doc = "Include the stack trace of returned errors."] pub fn error_trace(mut self, error_trace: bool) -> Self { self.error_trace = Some(error_trace); self } + #[doc = "Whether to expand wildcard expression to concrete indices that are open, closed or both."] + pub fn expand_wildcards(mut self, expand_wildcards: &'b [ExpandWildcards]) -> Self { + self.expand_wildcards = Some(expand_wildcards); + self + } #[doc = "A comma-separated list of filters used to reduce the response."] pub fn filter_path(mut self, filter_path: &'b [&'b str]) -> Self { self.filter_path = Some(filter_path); @@ -5152,9 +5910,9 @@ where self.human = Some(human); self } - #[doc = "Specify timeout for connection to master"] - pub fn master_timeout(mut self, master_timeout: &'b str) -> Self { - self.master_timeout = Some(master_timeout); + #[doc = "Whether specified concrete indices should be ignored when unavailable (missing or closed)"] + pub fn ignore_unavailable(mut self, ignore_unavailable: bool) -> Self { + self.ignore_unavailable = Some(ignore_unavailable); self } #[doc = "Pretty format the returned JSON response."] @@ -5167,45 +5925,51 @@ where self.request_timeout = Some(timeout); self } + #[doc = "Search operation type"] + pub fn search_type(mut self, search_type: SearchType) -> Self { + self.search_type = Some(search_type); + self + } #[doc = "The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests."] pub fn source(mut self, source: &'b str) -> Self { self.source = Some(source); self } - #[doc = "Explicit operation timeout"] - pub fn timeout(mut self, timeout: &'b str) -> Self { - self.timeout = Some(timeout); - self - } - #[doc = "Creates an asynchronous call to the Put Script API that can be awaited"] + #[doc = "Creates an asynchronous call to the Rank Eval API that can be awaited"] pub async fn send(self) -> Result { let path = self.parts.url(); - let method = Method::Put; + let method = match self.body { + Some(_) => Method::Post, + None => Method::Get, + }; let headers = self.headers; let timeout = self.request_timeout; let query_string = { #[serde_with::skip_serializing_none] #[derive(Serialize)] struct QueryParams<'b> { - context: Option<&'b str>, + allow_no_indices: Option, error_trace: Option, #[serde(serialize_with = "crate::client::serialize_coll_qs")] + expand_wildcards: Option<&'b [ExpandWildcards]>, + #[serde(serialize_with = "crate::client::serialize_coll_qs")] filter_path: Option<&'b [&'b str]>, human: Option, - master_timeout: Option<&'b str>, + ignore_unavailable: Option, pretty: Option, + search_type: Option, source: Option<&'b str>, - timeout: Option<&'b str>, } let query_params = QueryParams { - context: self.context, + allow_no_indices: self.allow_no_indices, error_trace: self.error_trace, + expand_wildcards: self.expand_wildcards, filter_path: self.filter_path, human: self.human, - master_timeout: self.master_timeout, + ignore_unavailable: self.ignore_unavailable, pretty: self.pretty, + search_type: self.search_type, source: self.source, - timeout: self.timeout, }; Some(query_params) }; @@ -5231,8 +5995,8 @@ impl ReindexParts { } } } +#[doc = "Builder for the [Reindex API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/docs-reindex.html)\n\nAllows to copy documents from one index to another, optionally filtering the source\ndocuments by a query, changing the destination index settings, or fetching the\ndocuments from a remote cluster."] #[derive(Clone, Debug)] -#[doc = "Builder for the [Reindex API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/docs-reindex.html)\n\nAllows to copy documents from one index to another, optionally filtering the source\ndocuments by a query, changing the destination index settings, or fetching the\ndocuments from a remote cluster."] pub struct Reindex<'a, 'b, B> { transport: &'a Transport, parts: ReindexParts, @@ -5454,8 +6218,8 @@ impl<'b> ReindexRethrottleParts<'b> { } } } +#[doc = "Builder for the [Reindex Rethrottle API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/docs-reindex.html)\n\nChanges the number of requests per second for a particular Reindex operation."] #[derive(Clone, Debug)] -#[doc = "Builder for the [Reindex Rethrottle API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/docs-reindex.html)\n\nChanges the number of requests per second for a particular Reindex operation."] pub struct ReindexRethrottle<'a, 'b, B> { transport: &'a Transport, parts: ReindexRethrottleParts<'b>, @@ -5608,8 +6372,8 @@ impl<'b> RenderSearchTemplateParts<'b> { } } } +#[doc = "Builder for the [Render Search Template API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/search-template.html#_validating_templates)\n\nAllows to use the Mustache language to pre-render a search definition."] #[derive(Clone, Debug)] -#[doc = "Builder for the [Render Search Template API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/search-template.html#_validating_templates)\n\nAllows to use the Mustache language to pre-render a search definition."] pub struct RenderSearchTemplate<'a, 'b, B> { transport: &'a Transport, parts: RenderSearchTemplateParts<'b>, @@ -5732,6 +6496,149 @@ where Ok(response) } } +#[cfg(feature = "experimental-apis")] +#[derive(Debug, Clone, PartialEq)] +#[doc = "API parts for the Scripts Painless Execute API"] +pub enum ScriptsPainlessExecuteParts { + #[doc = "No parts"] + None, +} +#[cfg(feature = "experimental-apis")] +impl ScriptsPainlessExecuteParts { + #[doc = "Builds a relative URL path to the Scripts Painless Execute API"] + pub fn url(self) -> Cow<'static, str> { + match self { + ScriptsPainlessExecuteParts::None => "/_scripts/painless/_execute".into(), + } + } +} +#[doc = "Builder for the [Scripts Painless Execute API](https://www.elastic.co/guide/en/elasticsearch/painless/7.11/painless-execute-api.html)\n\nAllows an arbitrary script to be executed and a result to be returned"] +#[doc = " \n# Optional, experimental\nThis requires the `experimental-apis` feature. Can have breaking changes in future\nversions or might even be removed entirely.\n "] +#[cfg(feature = "experimental-apis")] +#[derive(Clone, Debug)] +pub struct ScriptsPainlessExecute<'a, 'b, B> { + transport: &'a Transport, + parts: ScriptsPainlessExecuteParts, + body: Option, + error_trace: Option, + filter_path: Option<&'b [&'b str]>, + headers: HeaderMap, + human: Option, + pretty: Option, + request_timeout: Option, + source: Option<&'b str>, +} +#[cfg(feature = "experimental-apis")] +impl<'a, 'b, B> ScriptsPainlessExecute<'a, 'b, B> +where + B: Body, +{ + #[doc = "Creates a new instance of [ScriptsPainlessExecute]"] + pub fn new(transport: &'a Transport) -> Self { + let headers = HeaderMap::new(); + ScriptsPainlessExecute { + transport, + parts: ScriptsPainlessExecuteParts::None, + headers, + body: None, + error_trace: None, + filter_path: None, + human: None, + pretty: None, + request_timeout: None, + source: None, + } + } + #[doc = "The body for the API call"] + pub fn body(self, body: T) -> ScriptsPainlessExecute<'a, 'b, JsonBody> + where + T: Serialize, + { + ScriptsPainlessExecute { + transport: self.transport, + parts: self.parts, + body: Some(body.into()), + error_trace: self.error_trace, + filter_path: self.filter_path, + headers: self.headers, + human: self.human, + pretty: self.pretty, + request_timeout: self.request_timeout, + source: self.source, + } + } + #[doc = "Include the stack trace of returned errors."] + pub fn error_trace(mut self, error_trace: bool) -> Self { + self.error_trace = Some(error_trace); + self + } + #[doc = "A comma-separated list of filters used to reduce the response."] + pub fn filter_path(mut self, filter_path: &'b [&'b str]) -> Self { + self.filter_path = Some(filter_path); + self + } + #[doc = "Adds a HTTP header"] + pub fn header(mut self, key: HeaderName, value: HeaderValue) -> Self { + self.headers.insert(key, value); + self + } + #[doc = "Return human readable values for statistics."] + pub fn human(mut self, human: bool) -> Self { + self.human = Some(human); + self + } + #[doc = "Pretty format the returned JSON response."] + pub fn pretty(mut self, pretty: bool) -> Self { + self.pretty = Some(pretty); + self + } + #[doc = "Sets a request timeout for this API call.\n\nThe timeout is applied from when the request starts connecting until the response body has finished."] + pub fn request_timeout(mut self, timeout: Duration) -> Self { + self.request_timeout = Some(timeout); + self + } + #[doc = "The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests."] + pub fn source(mut self, source: &'b str) -> Self { + self.source = Some(source); + self + } + #[doc = "Creates an asynchronous call to the Scripts Painless Execute API that can be awaited"] + pub async fn send(self) -> Result { + let path = self.parts.url(); + let method = match self.body { + Some(_) => Method::Post, + None => Method::Get, + }; + let headers = self.headers; + let timeout = self.request_timeout; + let query_string = { + #[serde_with::skip_serializing_none] + #[derive(Serialize)] + struct QueryParams<'b> { + error_trace: Option, + #[serde(serialize_with = "crate::client::serialize_coll_qs")] + filter_path: Option<&'b [&'b str]>, + human: Option, + pretty: Option, + source: Option<&'b str>, + } + let query_params = QueryParams { + error_trace: self.error_trace, + filter_path: self.filter_path, + human: self.human, + pretty: self.pretty, + source: self.source, + }; + Some(query_params) + }; + let body = self.body; + let response = self + .transport + .send(method, &path, headers, query_string.as_ref(), body, timeout) + .await?; + Ok(response) + } +} #[derive(Debug, Clone, PartialEq)] #[doc = "API parts for the Scroll API"] pub enum ScrollParts<'b> { @@ -5756,8 +6663,8 @@ impl<'b> ScrollParts<'b> { } } } +#[doc = "Builder for the [Scroll API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/search-request-body.html#request-body-search-scroll)\n\nAllows to retrieve a large numbers of results from a single search request."] #[derive(Clone, Debug)] -#[doc = "Builder for the [Scroll API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/search-request-body.html#request-body-search-scroll)\n\nAllows to retrieve a large numbers of results from a single search request."] pub struct Scroll<'a, 'b, B> { transport: &'a Transport, parts: ScrollParts<'b>, @@ -5952,8 +6859,8 @@ impl<'b> SearchParts<'b> { } } } +#[doc = "Builder for the [Search API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/search-search.html)\n\nReturns results matching a query."] #[derive(Clone, Debug)] -#[doc = "Builder for the [Search API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/search-search.html)\n\nReturns results matching a query."] pub struct Search<'a, 'b, B> { transport: &'a Transport, parts: SearchParts<'b>, @@ -5981,6 +6888,7 @@ pub struct Search<'a, 'b, B> { ignore_unavailable: Option, lenient: Option, max_concurrent_shard_requests: Option, + min_compatible_shard_node: Option<&'b str>, pre_filter_shard_size: Option, preference: Option<&'b str>, pretty: Option, @@ -6042,6 +6950,7 @@ where ignore_unavailable: None, lenient: None, max_concurrent_shard_requests: None, + min_compatible_shard_node: None, pre_filter_shard_size: None, preference: None, pretty: None, @@ -6142,6 +7051,7 @@ where ignore_unavailable: self.ignore_unavailable, lenient: self.lenient, max_concurrent_shard_requests: self.max_concurrent_shard_requests, + min_compatible_shard_node: self.min_compatible_shard_node, pre_filter_shard_size: self.pre_filter_shard_size, preference: self.preference, pretty: self.pretty, @@ -6245,6 +7155,11 @@ where self.max_concurrent_shard_requests = Some(max_concurrent_shard_requests); self } + #[doc = "The minimum compatible version that all shards involved in search should have for this request to be successful"] + pub fn min_compatible_shard_node(mut self, min_compatible_shard_node: &'b str) -> Self { + self.min_compatible_shard_node = Some(min_compatible_shard_node); + self + } #[doc = "A threshold that enforces a pre-filter roundtrip to prefilter search shards based on query rewriting if the\u{a0}number of shards the search request expands to exceeds the threshold. This filter roundtrip can limit the number of shards significantly if for instance a shard can not match any documents based on its rewrite method ie. if date filters are mandatory to match but the shard bounds and the query are disjoint."] pub fn pre_filter_shard_size(mut self, pre_filter_shard_size: i64) -> Self { self.pre_filter_shard_size = Some(pre_filter_shard_size); @@ -6416,6 +7331,7 @@ where ignore_unavailable: Option, lenient: Option, max_concurrent_shard_requests: Option, + min_compatible_shard_node: Option<&'b str>, pre_filter_shard_size: Option, preference: Option<&'b str>, pretty: Option, @@ -6469,6 +7385,7 @@ where ignore_unavailable: self.ignore_unavailable, lenient: self.lenient, max_concurrent_shard_requests: self.max_concurrent_shard_requests, + min_compatible_shard_node: self.min_compatible_shard_node, pre_filter_shard_size: self.pre_filter_shard_size, preference: self.preference, pretty: self.pretty, @@ -6531,8 +7448,8 @@ impl<'b> SearchShardsParts<'b> { } } } +#[doc = "Builder for the [Search Shards API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/search-shards.html)\n\nReturns information about the indices and shards that a search request would be executed against."] #[derive(Clone, Debug)] -#[doc = "Builder for the [Search Shards API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/search-shards.html)\n\nReturns information about the indices and shards that a search request would be executed against."] pub struct SearchShards<'a, 'b, B> { transport: &'a Transport, parts: SearchShardsParts<'b>, @@ -6758,8 +7675,8 @@ impl<'b> SearchTemplateParts<'b> { } } } +#[doc = "Builder for the [Search Template API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/search-template.html)\n\nAllows to use the Mustache language to pre-render a search definition."] #[derive(Clone, Debug)] -#[doc = "Builder for the [Search Template API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/search-template.html)\n\nAllows to use the Mustache language to pre-render a search definition."] pub struct SearchTemplate<'a, 'b, B> { transport: &'a Transport, parts: SearchTemplateParts<'b>, @@ -7082,8 +7999,8 @@ impl<'b> TermvectorsParts<'b> { } } } +#[doc = "Builder for the [Termvectors API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/docs-termvectors.html)\n\nReturns information and statistics about terms in the fields of a particular document."] #[derive(Clone, Debug)] -#[doc = "Builder for the [Termvectors API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/docs-termvectors.html)\n\nReturns information and statistics about terms in the fields of a particular document."] pub struct Termvectors<'a, 'b, B> { transport: &'a Transport, parts: TermvectorsParts<'b>, @@ -7360,8 +8277,8 @@ impl<'b> UpdateParts<'b> { } } } +#[doc = "Builder for the [Update API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/docs-update.html)\n\nUpdates a document with a script or partial document."] #[derive(Clone, Debug)] -#[doc = "Builder for the [Update API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/docs-update.html)\n\nUpdates a document with a script or partial document."] pub struct Update<'a, 'b, B> { transport: &'a Transport, parts: UpdateParts<'b>, @@ -7643,8 +8560,8 @@ impl<'b> UpdateByQueryParts<'b> { } } } +#[doc = "Builder for the [Update By Query API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/docs-update-by-query.html)\n\nPerforms an update on every document in the index without changing the source,\nfor example to pick up a mapping change."] #[derive(Clone, Debug)] -#[doc = "Builder for the [Update By Query API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/docs-update-by-query.html)\n\nPerforms an update on every document in the index without changing the source,\nfor example to pick up a mapping change."] pub struct UpdateByQuery<'a, 'b, B> { transport: &'a Transport, parts: UpdateByQueryParts<'b>, @@ -8143,8 +9060,8 @@ impl<'b> UpdateByQueryRethrottleParts<'b> { } } } +#[doc = "Builder for the [Update By Query Rethrottle API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/docs-update-by-query.html)\n\nChanges the number of requests per second for a particular Update By Query operation."] #[derive(Clone, Debug)] -#[doc = "Builder for the [Update By Query Rethrottle API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/docs-update-by-query.html)\n\nChanges the number of requests per second for a particular Update By Query operation."] pub struct UpdateByQueryRethrottle<'a, 'b, B> { transport: &'a Transport, parts: UpdateByQueryRethrottleParts<'b>, @@ -8275,166 +9192,201 @@ where } } impl Elasticsearch { - #[doc = "[Bulk API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/docs-bulk.html)\n\nAllows to perform multiple index/update/delete operations in a single request."] + #[doc = "[Bulk API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/docs-bulk.html)\n\nAllows to perform multiple index/update/delete operations in a single request."] pub fn bulk<'a, 'b>(&'a self, parts: BulkParts<'b>) -> Bulk<'a, 'b, ()> { Bulk::new(self.transport(), parts) } - #[doc = "[Clear Scroll API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/clear-scroll-api.html)\n\nExplicitly clears the search context for a scroll."] + #[doc = "[Clear Scroll API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/clear-scroll-api.html)\n\nExplicitly clears the search context for a scroll."] pub fn clear_scroll<'a, 'b>(&'a self, parts: ClearScrollParts<'b>) -> ClearScroll<'a, 'b, ()> { ClearScroll::new(self.transport(), parts) } - #[doc = "[Count API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/search-count.html)\n\nReturns number of documents matching a query."] + #[doc = "[Close Point In Time API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/point-in-time-api.html)\n\nClose a point in time"] + pub fn close_point_in_time<'a, 'b>(&'a self) -> ClosePointInTime<'a, 'b, ()> { + ClosePointInTime::new(self.transport()) + } + #[doc = "[Count API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/search-count.html)\n\nReturns number of documents matching a query."] pub fn count<'a, 'b>(&'a self, parts: CountParts<'b>) -> Count<'a, 'b, ()> { Count::new(self.transport(), parts) } - #[doc = "[Create API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/docs-index_.html)\n\nCreates a new document in the index.\n\nReturns a 409 response when a document with a same ID already exists in the index."] + #[doc = "[Create API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/docs-index_.html)\n\nCreates a new document in the index.\n\nReturns a 409 response when a document with a same ID already exists in the index."] pub fn create<'a, 'b>(&'a self, parts: CreateParts<'b>) -> Create<'a, 'b, ()> { Create::new(self.transport(), parts) } - #[doc = "[Delete API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/docs-delete.html)\n\nRemoves a document from the index."] + #[doc = "[Delete API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/docs-delete.html)\n\nRemoves a document from the index."] pub fn delete<'a, 'b>(&'a self, parts: DeleteParts<'b>) -> Delete<'a, 'b> { Delete::new(self.transport(), parts) } - #[doc = "[Delete By Query API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/docs-delete-by-query.html)\n\nDeletes documents matching the provided query."] + #[doc = "[Delete By Query API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/docs-delete-by-query.html)\n\nDeletes documents matching the provided query."] pub fn delete_by_query<'a, 'b>( &'a self, parts: DeleteByQueryParts<'b>, ) -> DeleteByQuery<'a, 'b, ()> { DeleteByQuery::new(self.transport(), parts) } - #[doc = "[Delete By Query Rethrottle API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/docs-delete-by-query.html)\n\nChanges the number of requests per second for a particular Delete By Query operation."] + #[doc = "[Delete By Query Rethrottle API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/docs-delete-by-query.html)\n\nChanges the number of requests per second for a particular Delete By Query operation."] pub fn delete_by_query_rethrottle<'a, 'b>( &'a self, parts: DeleteByQueryRethrottleParts<'b>, ) -> DeleteByQueryRethrottle<'a, 'b, ()> { DeleteByQueryRethrottle::new(self.transport(), parts) } - #[doc = "[Delete Script API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/modules-scripting.html)\n\nDeletes a script."] + #[doc = "[Delete Script API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/modules-scripting.html)\n\nDeletes a script."] pub fn delete_script<'a, 'b>(&'a self, parts: DeleteScriptParts<'b>) -> DeleteScript<'a, 'b> { DeleteScript::new(self.transport(), parts) } - #[doc = "[Exists API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/docs-get.html)\n\nReturns information about whether a document exists in an index."] + #[doc = "[Exists API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/docs-get.html)\n\nReturns information about whether a document exists in an index."] pub fn exists<'a, 'b>(&'a self, parts: ExistsParts<'b>) -> Exists<'a, 'b> { Exists::new(self.transport(), parts) } - #[doc = "[Exists Source API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/docs-get.html)\n\nReturns information about whether a document source exists in an index."] + #[doc = "[Exists Source API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/docs-get.html)\n\nReturns information about whether a document source exists in an index."] pub fn exists_source<'a, 'b>(&'a self, parts: ExistsSourceParts<'b>) -> ExistsSource<'a, 'b> { ExistsSource::new(self.transport(), parts) } - #[doc = "[Explain API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/search-explain.html)\n\nReturns information about why a specific matches (or doesn't match) a query."] + #[doc = "[Explain API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/search-explain.html)\n\nReturns information about why a specific matches (or doesn't match) a query."] pub fn explain<'a, 'b>(&'a self, parts: ExplainParts<'b>) -> Explain<'a, 'b, ()> { Explain::new(self.transport(), parts) } - #[doc = "[Field Caps API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/search-field-caps.html)\n\nReturns the information about the capabilities of fields among multiple indices."] + #[doc = "[Field Caps API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/search-field-caps.html)\n\nReturns the information about the capabilities of fields among multiple indices."] pub fn field_caps<'a, 'b>(&'a self, parts: FieldCapsParts<'b>) -> FieldCaps<'a, 'b, ()> { FieldCaps::new(self.transport(), parts) } - #[doc = "[Get API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/docs-get.html)\n\nReturns a document."] + #[doc = "[Get API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/docs-get.html)\n\nReturns a document."] pub fn get<'a, 'b>(&'a self, parts: GetParts<'b>) -> Get<'a, 'b> { Get::new(self.transport(), parts) } - #[doc = "[Get Script API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/modules-scripting.html)\n\nReturns a script."] + #[doc = "[Get Script API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/modules-scripting.html)\n\nReturns a script."] pub fn get_script<'a, 'b>(&'a self, parts: GetScriptParts<'b>) -> GetScript<'a, 'b> { GetScript::new(self.transport(), parts) } - #[doc = "[Get Source API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/docs-get.html)\n\nReturns the source of a document."] + #[doc = "[Get Script Context API](https://www.elastic.co/guide/en/elasticsearch/painless/7.11/painless-contexts.html)\n\nReturns all script contexts."] + #[doc = " \n# Optional, experimental\nThis requires the `experimental-apis` feature. Can have breaking changes in future\nversions or might even be removed entirely.\n "] + #[cfg(feature = "experimental-apis")] + pub fn get_script_context<'a, 'b>(&'a self) -> GetScriptContext<'a, 'b> { + GetScriptContext::new(self.transport()) + } + #[doc = "[Get Script Languages API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/modules-scripting.html)\n\nReturns available script types, languages and contexts"] + #[doc = " \n# Optional, experimental\nThis requires the `experimental-apis` feature. Can have breaking changes in future\nversions or might even be removed entirely.\n "] + #[cfg(feature = "experimental-apis")] + pub fn get_script_languages<'a, 'b>(&'a self) -> GetScriptLanguages<'a, 'b> { + GetScriptLanguages::new(self.transport()) + } + #[doc = "[Get Source API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/docs-get.html)\n\nReturns the source of a document."] pub fn get_source<'a, 'b>(&'a self, parts: GetSourceParts<'b>) -> GetSource<'a, 'b> { GetSource::new(self.transport(), parts) } - #[doc = "[Index API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/docs-index_.html)\n\nCreates or updates a document in an index."] + #[doc = "[Index API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/docs-index_.html)\n\nCreates or updates a document in an index."] pub fn index<'a, 'b>(&'a self, parts: IndexParts<'b>) -> Index<'a, 'b, ()> { Index::new(self.transport(), parts) } - #[doc = "[Info API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/index.html)\n\nReturns basic information about the cluster."] + #[doc = "[Info API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/index.html)\n\nReturns basic information about the cluster."] pub fn info<'a, 'b>(&'a self) -> Info<'a, 'b> { Info::new(self.transport()) } - #[doc = "[Mget API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/docs-multi-get.html)\n\nAllows to get multiple documents in one request."] + #[doc = "[Mget API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/docs-multi-get.html)\n\nAllows to get multiple documents in one request."] pub fn mget<'a, 'b>(&'a self, parts: MgetParts<'b>) -> Mget<'a, 'b, ()> { Mget::new(self.transport(), parts) } - #[doc = "[Msearch API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/search-multi-search.html)\n\nAllows to execute several search operations in one request."] + #[doc = "[Msearch API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/search-multi-search.html)\n\nAllows to execute several search operations in one request."] pub fn msearch<'a, 'b>(&'a self, parts: MsearchParts<'b>) -> Msearch<'a, 'b, ()> { Msearch::new(self.transport(), parts) } - #[doc = "[Msearch Template API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/search-multi-search.html)\n\nAllows to execute several search template operations in one request."] + #[doc = "[Msearch Template API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/search-multi-search.html)\n\nAllows to execute several search template operations in one request."] pub fn msearch_template<'a, 'b>( &'a self, parts: MsearchTemplateParts<'b>, ) -> MsearchTemplate<'a, 'b, ()> { MsearchTemplate::new(self.transport(), parts) } - #[doc = "[Mtermvectors API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/docs-multi-termvectors.html)\n\nReturns multiple termvectors in one request."] + #[doc = "[Mtermvectors API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/docs-multi-termvectors.html)\n\nReturns multiple termvectors in one request."] pub fn mtermvectors<'a, 'b>( &'a self, parts: MtermvectorsParts<'b>, ) -> Mtermvectors<'a, 'b, ()> { Mtermvectors::new(self.transport(), parts) } - #[doc = "[Ping API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/index.html)\n\nReturns whether the cluster is running."] + #[doc = "[Open Point In Time API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/point-in-time-api.html)\n\nOpen a point in time that can be used in subsequent searches"] + pub fn open_point_in_time<'a, 'b>( + &'a self, + parts: OpenPointInTimeParts<'b>, + ) -> OpenPointInTime<'a, 'b, ()> { + OpenPointInTime::new(self.transport(), parts) + } + #[doc = "[Ping API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/index.html)\n\nReturns whether the cluster is running."] pub fn ping<'a, 'b>(&'a self) -> Ping<'a, 'b> { Ping::new(self.transport()) } - #[doc = "[Put Script API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/modules-scripting.html)\n\nCreates or updates a script."] + #[doc = "[Put Script API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/modules-scripting.html)\n\nCreates or updates a script."] pub fn put_script<'a, 'b>(&'a self, parts: PutScriptParts<'b>) -> PutScript<'a, 'b, ()> { PutScript::new(self.transport(), parts) } - #[doc = "[Reindex API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/docs-reindex.html)\n\nAllows to copy documents from one index to another, optionally filtering the source\ndocuments by a query, changing the destination index settings, or fetching the\ndocuments from a remote cluster."] + #[doc = "[Rank Eval API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/search-rank-eval.html)\n\nAllows to evaluate the quality of ranked search results over a set of typical search queries"] + #[doc = " \n# Optional, experimental\nThis requires the `experimental-apis` feature. Can have breaking changes in future\nversions or might even be removed entirely.\n "] + #[cfg(feature = "experimental-apis")] + pub fn rank_eval<'a, 'b>(&'a self, parts: RankEvalParts<'b>) -> RankEval<'a, 'b, ()> { + RankEval::new(self.transport(), parts) + } + #[doc = "[Reindex API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/docs-reindex.html)\n\nAllows to copy documents from one index to another, optionally filtering the source\ndocuments by a query, changing the destination index settings, or fetching the\ndocuments from a remote cluster."] pub fn reindex<'a, 'b>(&'a self) -> Reindex<'a, 'b, ()> { Reindex::new(self.transport()) } - #[doc = "[Reindex Rethrottle API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/docs-reindex.html)\n\nChanges the number of requests per second for a particular Reindex operation."] + #[doc = "[Reindex Rethrottle API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/docs-reindex.html)\n\nChanges the number of requests per second for a particular Reindex operation."] pub fn reindex_rethrottle<'a, 'b>( &'a self, parts: ReindexRethrottleParts<'b>, ) -> ReindexRethrottle<'a, 'b, ()> { ReindexRethrottle::new(self.transport(), parts) } - #[doc = "[Render Search Template API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/search-template.html#_validating_templates)\n\nAllows to use the Mustache language to pre-render a search definition."] + #[doc = "[Render Search Template API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/search-template.html#_validating_templates)\n\nAllows to use the Mustache language to pre-render a search definition."] pub fn render_search_template<'a, 'b>( &'a self, parts: RenderSearchTemplateParts<'b>, ) -> RenderSearchTemplate<'a, 'b, ()> { RenderSearchTemplate::new(self.transport(), parts) } - #[doc = "[Scroll API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/search-request-body.html#request-body-search-scroll)\n\nAllows to retrieve a large numbers of results from a single search request.\n\n# Examples\n\nTo initiate a scroll, make search API call with a specified `scroll` timeout,\nthen fetch the next set of hits using the `_scroll_id` returned in\nthe response. Once no more hits are returned, clear the scroll.\n\n```rust,no_run\n# use elasticsearch::{Elasticsearch, Error, SearchParts, ScrollParts, ClearScrollParts};\n# use serde_json::{json, Value};\n# async fn doc() -> Result<(), Box> {\nlet client = Elasticsearch::default();\n\nfn print_hits(hits: &[Value]) {\n for hit in hits {\n println!(\n \"id: '{}', source: '{}', score: '{}'\",\n hit[\"_id\"].as_str().unwrap(),\n hit[\"_source\"],\n hit[\"_score\"].as_f64().unwrap()\n );\n }\n}\n\nlet scroll = \"1m\";\nlet mut response = client\n .search(SearchParts::Index(&[\"tweets\"]))\n .scroll(scroll)\n .body(json!({\n \"query\": {\n \"match\": {\n \"body\": {\n \"query\": \"Elasticsearch rust\",\n \"operator\": \"AND\"\n }\n }\n }\n }))\n .send()\n .await?;\n\nlet mut response_body = response.json::().await?;\nlet mut scroll_id = response_body[\"_scroll_id\"].as_str().unwrap();\nlet mut hits = response_body[\"hits\"][\"hits\"].as_array().unwrap();\n\nprint_hits(hits);\n\nwhile hits.len() > 0 {\n response = client\n .scroll(ScrollParts::None)\n .body(json!({\n \"scroll\": scroll,\n \"scroll_id\": scroll_id\n }))\n .send()\n .await?;\n\n response_body = response.json::().await?;\n scroll_id = response_body[\"_scroll_id\"].as_str().unwrap();\n hits = response_body[\"hits\"][\"hits\"].as_array().unwrap();\n print_hits(hits);\n}\n\nresponse = client\n .clear_scroll(ClearScrollParts::None)\n .body(json!({\n \"scroll_id\": scroll_id\n }))\n .send()\n .await?;\n \n# Ok(())\n# }\n```"] + #[doc = "[Scripts Painless Execute API](https://www.elastic.co/guide/en/elasticsearch/painless/7.11/painless-execute-api.html)\n\nAllows an arbitrary script to be executed and a result to be returned"] + #[doc = " \n# Optional, experimental\nThis requires the `experimental-apis` feature. Can have breaking changes in future\nversions or might even be removed entirely.\n "] + #[cfg(feature = "experimental-apis")] + pub fn scripts_painless_execute<'a, 'b>(&'a self) -> ScriptsPainlessExecute<'a, 'b, ()> { + ScriptsPainlessExecute::new(self.transport()) + } + #[doc = "[Scroll API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/search-request-body.html#request-body-search-scroll)\n\nAllows to retrieve a large numbers of results from a single search request.\n\n# Examples\n\nTo initiate a scroll, make search API call with a specified `scroll` timeout,\nthen fetch the next set of hits using the `_scroll_id` returned in\nthe response. Once no more hits are returned, clear the scroll.\n\n```rust,no_run\n# use elasticsearch::{Elasticsearch, Error, SearchParts, ScrollParts, ClearScrollParts};\n# use serde_json::{json, Value};\n# async fn doc() -> Result<(), Box> {\nlet client = Elasticsearch::default();\n\nfn print_hits(hits: &[Value]) {\n for hit in hits {\n println!(\n \"id: '{}', source: '{}', score: '{}'\",\n hit[\"_id\"].as_str().unwrap(),\n hit[\"_source\"],\n hit[\"_score\"].as_f64().unwrap()\n );\n }\n}\n\nlet scroll = \"1m\";\nlet mut response = client\n .search(SearchParts::Index(&[\"tweets\"]))\n .scroll(scroll)\n .body(json!({\n \"query\": {\n \"match\": {\n \"body\": {\n \"query\": \"Elasticsearch rust\",\n \"operator\": \"AND\"\n }\n }\n }\n }))\n .send()\n .await?;\n\nlet mut response_body = response.json::().await?;\nlet mut scroll_id = response_body[\"_scroll_id\"].as_str().unwrap();\nlet mut hits = response_body[\"hits\"][\"hits\"].as_array().unwrap();\n\nprint_hits(hits);\n\nwhile hits.len() > 0 {\n response = client\n .scroll(ScrollParts::None)\n .body(json!({\n \"scroll\": scroll,\n \"scroll_id\": scroll_id\n }))\n .send()\n .await?;\n\n response_body = response.json::().await?;\n scroll_id = response_body[\"_scroll_id\"].as_str().unwrap();\n hits = response_body[\"hits\"][\"hits\"].as_array().unwrap();\n print_hits(hits);\n}\n\nresponse = client\n .clear_scroll(ClearScrollParts::None)\n .body(json!({\n \"scroll_id\": scroll_id\n }))\n .send()\n .await?;\n \n# Ok(())\n# }\n```"] pub fn scroll<'a, 'b>(&'a self, parts: ScrollParts<'b>) -> Scroll<'a, 'b, ()> { Scroll::new(self.transport(), parts) } - #[doc = "[Search API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/search-search.html)\n\nReturns results matching a query."] + #[doc = "[Search API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/search-search.html)\n\nReturns results matching a query."] pub fn search<'a, 'b>(&'a self, parts: SearchParts<'b>) -> Search<'a, 'b, ()> { Search::new(self.transport(), parts) } - #[doc = "[Search Shards API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/search-shards.html)\n\nReturns information about the indices and shards that a search request would be executed against."] + #[doc = "[Search Shards API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/search-shards.html)\n\nReturns information about the indices and shards that a search request would be executed against."] pub fn search_shards<'a, 'b>( &'a self, parts: SearchShardsParts<'b>, ) -> SearchShards<'a, 'b, ()> { SearchShards::new(self.transport(), parts) } - #[doc = "[Search Template API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/search-template.html)\n\nAllows to use the Mustache language to pre-render a search definition."] + #[doc = "[Search Template API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/search-template.html)\n\nAllows to use the Mustache language to pre-render a search definition."] pub fn search_template<'a, 'b>( &'a self, parts: SearchTemplateParts<'b>, ) -> SearchTemplate<'a, 'b, ()> { SearchTemplate::new(self.transport(), parts) } - #[doc = "[Termvectors API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/docs-termvectors.html)\n\nReturns information and statistics about terms in the fields of a particular document."] + #[doc = "[Termvectors API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/docs-termvectors.html)\n\nReturns information and statistics about terms in the fields of a particular document."] pub fn termvectors<'a, 'b>(&'a self, parts: TermvectorsParts<'b>) -> Termvectors<'a, 'b, ()> { Termvectors::new(self.transport(), parts) } - #[doc = "[Update API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/docs-update.html)\n\nUpdates a document with a script or partial document."] + #[doc = "[Update API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/docs-update.html)\n\nUpdates a document with a script or partial document."] pub fn update<'a, 'b>(&'a self, parts: UpdateParts<'b>) -> Update<'a, 'b, ()> { Update::new(self.transport(), parts) } - #[doc = "[Update By Query API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/docs-update-by-query.html)\n\nPerforms an update on every document in the index without changing the source,\nfor example to pick up a mapping change."] + #[doc = "[Update By Query API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/docs-update-by-query.html)\n\nPerforms an update on every document in the index without changing the source,\nfor example to pick up a mapping change."] pub fn update_by_query<'a, 'b>( &'a self, parts: UpdateByQueryParts<'b>, ) -> UpdateByQuery<'a, 'b, ()> { UpdateByQuery::new(self.transport(), parts) } - #[doc = "[Update By Query Rethrottle API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/docs-update-by-query.html)\n\nChanges the number of requests per second for a particular Update By Query operation."] + #[doc = "[Update By Query Rethrottle API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/docs-update-by-query.html)\n\nChanges the number of requests per second for a particular Update By Query operation."] pub fn update_by_query_rethrottle<'a, 'b>( &'a self, parts: UpdateByQueryRethrottleParts<'b>, diff --git a/elasticsearch/src/searchable_snapshots.rs b/elasticsearch/src/searchable_snapshots.rs new file mode 100644 index 00000000..951a7577 --- /dev/null +++ b/elasticsearch/src/searchable_snapshots.rs @@ -0,0 +1,754 @@ +/* + * Licensed to Elasticsearch B.V. under one or more contributor + * license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright + * ownership. Elasticsearch B.V. licenses this file to you under + * the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +// ----------------------------------------------- +// This file is generated, Please do not edit it manually. +// Run the following in the root of the repo to regenerate: +// +// cargo make generate-api +// ----------------------------------------------- + +//! Searchable snapshot APIs +//! +//! [Searchable snapshots](https://www.elastic.co/guide/en/elasticsearch/reference/master/searchable-snapshots.html) let +//! you reduce your operating costs by using snapshots for resiliency rather than maintaining replica shards within a +//! cluster. This can result in significant cost savings for less frequently searched data. +//! + +#![cfg(feature = "experimental-apis")] +#![doc = " \n# Optional, experimental\nThis requires the `experimental-apis` feature. Can have breaking changes in future\nversions or might even be removed entirely.\n "] +#![allow(unused_imports)] +use crate::{ + client::Elasticsearch, + error::Error, + http::{ + headers::{HeaderMap, HeaderName, HeaderValue, ACCEPT, CONTENT_TYPE}, + request::{Body, JsonBody, NdBody, PARTS_ENCODED}, + response::Response, + transport::Transport, + Method, + }, + params::*, +}; +use percent_encoding::percent_encode; +use serde::Serialize; +use std::{borrow::Cow, time::Duration}; +#[cfg(feature = "experimental-apis")] +#[derive(Debug, Clone, PartialEq)] +#[doc = "API parts for the Searchable Snapshots Clear Cache API"] +pub enum SearchableSnapshotsClearCacheParts<'b> { + #[doc = "No parts"] + None, + #[doc = "Index"] + Index(&'b [&'b str]), +} +#[cfg(feature = "experimental-apis")] +impl<'b> SearchableSnapshotsClearCacheParts<'b> { + #[doc = "Builds a relative URL path to the Searchable Snapshots Clear Cache API"] + pub fn url(self) -> Cow<'static, str> { + match self { + SearchableSnapshotsClearCacheParts::None => "/_searchable_snapshots/cache/clear".into(), + SearchableSnapshotsClearCacheParts::Index(ref index) => { + let index_str = index.join(","); + let encoded_index: Cow = + percent_encode(index_str.as_bytes(), PARTS_ENCODED).into(); + let mut p = String::with_capacity(35usize + encoded_index.len()); + p.push_str("/"); + p.push_str(encoded_index.as_ref()); + p.push_str("/_searchable_snapshots/cache/clear"); + p.into() + } + } + } +} +#[doc = "Builder for the [Searchable Snapshots Clear Cache API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/searchable-snapshots-apis.html)\n\nClear the cache of searchable snapshots."] +#[doc = " \n# Optional, experimental\nThis requires the `experimental-apis` feature. Can have breaking changes in future\nversions or might even be removed entirely.\n "] +#[cfg(feature = "experimental-apis")] +#[derive(Clone, Debug)] +pub struct SearchableSnapshotsClearCache<'a, 'b, B> { + transport: &'a Transport, + parts: SearchableSnapshotsClearCacheParts<'b>, + allow_no_indices: Option, + body: Option, + error_trace: Option, + expand_wildcards: Option<&'b [ExpandWildcards]>, + filter_path: Option<&'b [&'b str]>, + headers: HeaderMap, + human: Option, + ignore_unavailable: Option, + index: Option<&'b [&'b str]>, + pretty: Option, + request_timeout: Option, + source: Option<&'b str>, +} +#[cfg(feature = "experimental-apis")] +impl<'a, 'b, B> SearchableSnapshotsClearCache<'a, 'b, B> +where + B: Body, +{ + #[doc = "Creates a new instance of [SearchableSnapshotsClearCache] with the specified API parts"] + pub fn new(transport: &'a Transport, parts: SearchableSnapshotsClearCacheParts<'b>) -> Self { + let headers = HeaderMap::new(); + SearchableSnapshotsClearCache { + transport, + parts, + headers, + allow_no_indices: None, + body: None, + error_trace: None, + expand_wildcards: None, + filter_path: None, + human: None, + ignore_unavailable: None, + index: None, + pretty: None, + request_timeout: None, + source: None, + } + } + #[doc = "Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes `_all` string or when no indices have been specified)"] + pub fn allow_no_indices(mut self, allow_no_indices: bool) -> Self { + self.allow_no_indices = Some(allow_no_indices); + self + } + #[doc = "The body for the API call"] + pub fn body(self, body: T) -> SearchableSnapshotsClearCache<'a, 'b, JsonBody> + where + T: Serialize, + { + SearchableSnapshotsClearCache { + transport: self.transport, + parts: self.parts, + body: Some(body.into()), + allow_no_indices: self.allow_no_indices, + error_trace: self.error_trace, + expand_wildcards: self.expand_wildcards, + filter_path: self.filter_path, + headers: self.headers, + human: self.human, + ignore_unavailable: self.ignore_unavailable, + index: self.index, + pretty: self.pretty, + request_timeout: self.request_timeout, + source: self.source, + } + } + #[doc = "Include the stack trace of returned errors."] + pub fn error_trace(mut self, error_trace: bool) -> Self { + self.error_trace = Some(error_trace); + self + } + #[doc = "Whether to expand wildcard expression to concrete indices that are open, closed or both."] + pub fn expand_wildcards(mut self, expand_wildcards: &'b [ExpandWildcards]) -> Self { + self.expand_wildcards = Some(expand_wildcards); + self + } + #[doc = "A comma-separated list of filters used to reduce the response."] + pub fn filter_path(mut self, filter_path: &'b [&'b str]) -> Self { + self.filter_path = Some(filter_path); + self + } + #[doc = "Adds a HTTP header"] + pub fn header(mut self, key: HeaderName, value: HeaderValue) -> Self { + self.headers.insert(key, value); + self + } + #[doc = "Return human readable values for statistics."] + pub fn human(mut self, human: bool) -> Self { + self.human = Some(human); + self + } + #[doc = "Whether specified concrete indices should be ignored when unavailable (missing or closed)"] + pub fn ignore_unavailable(mut self, ignore_unavailable: bool) -> Self { + self.ignore_unavailable = Some(ignore_unavailable); + self + } + #[doc = "A comma-separated list of index name to limit the operation"] + pub fn index(mut self, index: &'b [&'b str]) -> Self { + self.index = Some(index); + self + } + #[doc = "Pretty format the returned JSON response."] + pub fn pretty(mut self, pretty: bool) -> Self { + self.pretty = Some(pretty); + self + } + #[doc = "Sets a request timeout for this API call.\n\nThe timeout is applied from when the request starts connecting until the response body has finished."] + pub fn request_timeout(mut self, timeout: Duration) -> Self { + self.request_timeout = Some(timeout); + self + } + #[doc = "The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests."] + pub fn source(mut self, source: &'b str) -> Self { + self.source = Some(source); + self + } + #[doc = "Creates an asynchronous call to the Searchable Snapshots Clear Cache API that can be awaited"] + pub async fn send(self) -> Result { + let path = self.parts.url(); + let method = Method::Post; + let headers = self.headers; + let timeout = self.request_timeout; + let query_string = { + #[serde_with::skip_serializing_none] + #[derive(Serialize)] + struct QueryParams<'b> { + allow_no_indices: Option, + error_trace: Option, + #[serde(serialize_with = "crate::client::serialize_coll_qs")] + expand_wildcards: Option<&'b [ExpandWildcards]>, + #[serde(serialize_with = "crate::client::serialize_coll_qs")] + filter_path: Option<&'b [&'b str]>, + human: Option, + ignore_unavailable: Option, + #[serde(serialize_with = "crate::client::serialize_coll_qs")] + index: Option<&'b [&'b str]>, + pretty: Option, + source: Option<&'b str>, + } + let query_params = QueryParams { + allow_no_indices: self.allow_no_indices, + error_trace: self.error_trace, + expand_wildcards: self.expand_wildcards, + filter_path: self.filter_path, + human: self.human, + ignore_unavailable: self.ignore_unavailable, + index: self.index, + pretty: self.pretty, + source: self.source, + }; + Some(query_params) + }; + let body = self.body; + let response = self + .transport + .send(method, &path, headers, query_string.as_ref(), body, timeout) + .await?; + Ok(response) + } +} +#[cfg(feature = "experimental-apis")] +#[derive(Debug, Clone, PartialEq)] +#[doc = "API parts for the Searchable Snapshots Mount API"] +pub enum SearchableSnapshotsMountParts<'b> { + #[doc = "Repository and Snapshot"] + RepositorySnapshot(&'b str, &'b str), +} +#[cfg(feature = "experimental-apis")] +impl<'b> SearchableSnapshotsMountParts<'b> { + #[doc = "Builds a relative URL path to the Searchable Snapshots Mount API"] + pub fn url(self) -> Cow<'static, str> { + match self { + SearchableSnapshotsMountParts::RepositorySnapshot(ref repository, ref snapshot) => { + let encoded_repository: Cow = + percent_encode(repository.as_bytes(), PARTS_ENCODED).into(); + let encoded_snapshot: Cow = + percent_encode(snapshot.as_bytes(), PARTS_ENCODED).into(); + let mut p = String::with_capacity( + 19usize + encoded_repository.len() + encoded_snapshot.len(), + ); + p.push_str("/_snapshot/"); + p.push_str(encoded_repository.as_ref()); + p.push_str("/"); + p.push_str(encoded_snapshot.as_ref()); + p.push_str("/_mount"); + p.into() + } + } + } +} +#[doc = "Builder for the [Searchable Snapshots Mount API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/searchable-snapshots-api-mount-snapshot.html)\n\nMount a snapshot as a searchable index."] +#[doc = " \n# Optional, experimental\nThis requires the `experimental-apis` feature. Can have breaking changes in future\nversions or might even be removed entirely.\n "] +#[cfg(feature = "experimental-apis")] +#[derive(Clone, Debug)] +pub struct SearchableSnapshotsMount<'a, 'b, B> { + transport: &'a Transport, + parts: SearchableSnapshotsMountParts<'b>, + body: Option, + error_trace: Option, + filter_path: Option<&'b [&'b str]>, + headers: HeaderMap, + human: Option, + master_timeout: Option<&'b str>, + pretty: Option, + request_timeout: Option, + source: Option<&'b str>, + storage: Option<&'b str>, + wait_for_completion: Option, +} +#[cfg(feature = "experimental-apis")] +impl<'a, 'b, B> SearchableSnapshotsMount<'a, 'b, B> +where + B: Body, +{ + #[doc = "Creates a new instance of [SearchableSnapshotsMount] with the specified API parts"] + pub fn new(transport: &'a Transport, parts: SearchableSnapshotsMountParts<'b>) -> Self { + let headers = HeaderMap::new(); + SearchableSnapshotsMount { + transport, + parts, + headers, + body: None, + error_trace: None, + filter_path: None, + human: None, + master_timeout: None, + pretty: None, + request_timeout: None, + source: None, + storage: None, + wait_for_completion: None, + } + } + #[doc = "The body for the API call"] + pub fn body(self, body: T) -> SearchableSnapshotsMount<'a, 'b, JsonBody> + where + T: Serialize, + { + SearchableSnapshotsMount { + transport: self.transport, + parts: self.parts, + body: Some(body.into()), + error_trace: self.error_trace, + filter_path: self.filter_path, + headers: self.headers, + human: self.human, + master_timeout: self.master_timeout, + pretty: self.pretty, + request_timeout: self.request_timeout, + source: self.source, + storage: self.storage, + wait_for_completion: self.wait_for_completion, + } + } + #[doc = "Include the stack trace of returned errors."] + pub fn error_trace(mut self, error_trace: bool) -> Self { + self.error_trace = Some(error_trace); + self + } + #[doc = "A comma-separated list of filters used to reduce the response."] + pub fn filter_path(mut self, filter_path: &'b [&'b str]) -> Self { + self.filter_path = Some(filter_path); + self + } + #[doc = "Adds a HTTP header"] + pub fn header(mut self, key: HeaderName, value: HeaderValue) -> Self { + self.headers.insert(key, value); + self + } + #[doc = "Return human readable values for statistics."] + pub fn human(mut self, human: bool) -> Self { + self.human = Some(human); + self + } + #[doc = "Explicit operation timeout for connection to master node"] + pub fn master_timeout(mut self, master_timeout: &'b str) -> Self { + self.master_timeout = Some(master_timeout); + self + } + #[doc = "Pretty format the returned JSON response."] + pub fn pretty(mut self, pretty: bool) -> Self { + self.pretty = Some(pretty); + self + } + #[doc = "Sets a request timeout for this API call.\n\nThe timeout is applied from when the request starts connecting until the response body has finished."] + pub fn request_timeout(mut self, timeout: Duration) -> Self { + self.request_timeout = Some(timeout); + self + } + #[doc = "The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests."] + pub fn source(mut self, source: &'b str) -> Self { + self.source = Some(source); + self + } + #[doc = "Selects the kind of local storage used to accelerate searches. Experimental, and defaults to `full_copy`"] + pub fn storage(mut self, storage: &'b str) -> Self { + self.storage = Some(storage); + self + } + #[doc = "Should this request wait until the operation has completed before returning"] + pub fn wait_for_completion(mut self, wait_for_completion: bool) -> Self { + self.wait_for_completion = Some(wait_for_completion); + self + } + #[doc = "Creates an asynchronous call to the Searchable Snapshots Mount API that can be awaited"] + pub async fn send(self) -> Result { + let path = self.parts.url(); + let method = Method::Post; + let headers = self.headers; + let timeout = self.request_timeout; + let query_string = { + #[serde_with::skip_serializing_none] + #[derive(Serialize)] + struct QueryParams<'b> { + error_trace: Option, + #[serde(serialize_with = "crate::client::serialize_coll_qs")] + filter_path: Option<&'b [&'b str]>, + human: Option, + master_timeout: Option<&'b str>, + pretty: Option, + source: Option<&'b str>, + storage: Option<&'b str>, + wait_for_completion: Option, + } + let query_params = QueryParams { + error_trace: self.error_trace, + filter_path: self.filter_path, + human: self.human, + master_timeout: self.master_timeout, + pretty: self.pretty, + source: self.source, + storage: self.storage, + wait_for_completion: self.wait_for_completion, + }; + Some(query_params) + }; + let body = self.body; + let response = self + .transport + .send(method, &path, headers, query_string.as_ref(), body, timeout) + .await?; + Ok(response) + } +} +#[cfg(feature = "experimental-apis")] +#[derive(Debug, Clone, PartialEq)] +#[doc = "API parts for the Searchable Snapshots Repository Stats API"] +pub enum SearchableSnapshotsRepositoryStatsParts<'b> { + #[doc = "Repository"] + Repository(&'b str), +} +#[cfg(feature = "experimental-apis")] +impl<'b> SearchableSnapshotsRepositoryStatsParts<'b> { + #[doc = "Builds a relative URL path to the Searchable Snapshots Repository Stats API"] + pub fn url(self) -> Cow<'static, str> { + match self { + SearchableSnapshotsRepositoryStatsParts::Repository(ref repository) => { + let encoded_repository: Cow = + percent_encode(repository.as_bytes(), PARTS_ENCODED).into(); + let mut p = String::with_capacity(18usize + encoded_repository.len()); + p.push_str("/_snapshot/"); + p.push_str(encoded_repository.as_ref()); + p.push_str("/_stats"); + p.into() + } + } + } +} +#[doc = "Builder for the [Searchable Snapshots Repository Stats API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/searchable-snapshots-apis.html)\n\nDEPRECATED: This API is replaced by the Repositories Metering API."] +#[doc = " \n# Optional, experimental\nThis requires the `experimental-apis` feature. Can have breaking changes in future\nversions or might even be removed entirely.\n "] +#[cfg(feature = "experimental-apis")] +#[derive(Clone, Debug)] +pub struct SearchableSnapshotsRepositoryStats<'a, 'b> { + transport: &'a Transport, + parts: SearchableSnapshotsRepositoryStatsParts<'b>, + error_trace: Option, + filter_path: Option<&'b [&'b str]>, + headers: HeaderMap, + human: Option, + pretty: Option, + request_timeout: Option, + source: Option<&'b str>, +} +#[cfg(feature = "experimental-apis")] +impl<'a, 'b> SearchableSnapshotsRepositoryStats<'a, 'b> { + #[doc = "Creates a new instance of [SearchableSnapshotsRepositoryStats] with the specified API parts"] + pub fn new( + transport: &'a Transport, + parts: SearchableSnapshotsRepositoryStatsParts<'b>, + ) -> Self { + let headers = HeaderMap::new(); + SearchableSnapshotsRepositoryStats { + transport, + parts, + headers, + error_trace: None, + filter_path: None, + human: None, + pretty: None, + request_timeout: None, + source: None, + } + } + #[doc = "Include the stack trace of returned errors."] + pub fn error_trace(mut self, error_trace: bool) -> Self { + self.error_trace = Some(error_trace); + self + } + #[doc = "A comma-separated list of filters used to reduce the response."] + pub fn filter_path(mut self, filter_path: &'b [&'b str]) -> Self { + self.filter_path = Some(filter_path); + self + } + #[doc = "Adds a HTTP header"] + pub fn header(mut self, key: HeaderName, value: HeaderValue) -> Self { + self.headers.insert(key, value); + self + } + #[doc = "Return human readable values for statistics."] + pub fn human(mut self, human: bool) -> Self { + self.human = Some(human); + self + } + #[doc = "Pretty format the returned JSON response."] + pub fn pretty(mut self, pretty: bool) -> Self { + self.pretty = Some(pretty); + self + } + #[doc = "Sets a request timeout for this API call.\n\nThe timeout is applied from when the request starts connecting until the response body has finished."] + pub fn request_timeout(mut self, timeout: Duration) -> Self { + self.request_timeout = Some(timeout); + self + } + #[doc = "The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests."] + pub fn source(mut self, source: &'b str) -> Self { + self.source = Some(source); + self + } + #[doc = "Creates an asynchronous call to the Searchable Snapshots Repository Stats API that can be awaited"] + pub async fn send(self) -> Result { + let path = self.parts.url(); + let method = Method::Get; + let headers = self.headers; + let timeout = self.request_timeout; + let query_string = { + #[serde_with::skip_serializing_none] + #[derive(Serialize)] + struct QueryParams<'b> { + error_trace: Option, + #[serde(serialize_with = "crate::client::serialize_coll_qs")] + filter_path: Option<&'b [&'b str]>, + human: Option, + pretty: Option, + source: Option<&'b str>, + } + let query_params = QueryParams { + error_trace: self.error_trace, + filter_path: self.filter_path, + human: self.human, + pretty: self.pretty, + source: self.source, + }; + Some(query_params) + }; + let body = Option::<()>::None; + let response = self + .transport + .send(method, &path, headers, query_string.as_ref(), body, timeout) + .await?; + Ok(response) + } +} +#[cfg(feature = "experimental-apis")] +#[derive(Debug, Clone, PartialEq)] +#[doc = "API parts for the Searchable Snapshots Stats API"] +pub enum SearchableSnapshotsStatsParts<'b> { + #[doc = "No parts"] + None, + #[doc = "Index"] + Index(&'b [&'b str]), +} +#[cfg(feature = "experimental-apis")] +impl<'b> SearchableSnapshotsStatsParts<'b> { + #[doc = "Builds a relative URL path to the Searchable Snapshots Stats API"] + pub fn url(self) -> Cow<'static, str> { + match self { + SearchableSnapshotsStatsParts::None => "/_searchable_snapshots/stats".into(), + SearchableSnapshotsStatsParts::Index(ref index) => { + let index_str = index.join(","); + let encoded_index: Cow = + percent_encode(index_str.as_bytes(), PARTS_ENCODED).into(); + let mut p = String::with_capacity(29usize + encoded_index.len()); + p.push_str("/"); + p.push_str(encoded_index.as_ref()); + p.push_str("/_searchable_snapshots/stats"); + p.into() + } + } + } +} +#[doc = "Builder for the [Searchable Snapshots Stats API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/searchable-snapshots-apis.html)\n\nRetrieve various statistics about searchable snapshots."] +#[doc = " \n# Optional, experimental\nThis requires the `experimental-apis` feature. Can have breaking changes in future\nversions or might even be removed entirely.\n "] +#[cfg(feature = "experimental-apis")] +#[derive(Clone, Debug)] +pub struct SearchableSnapshotsStats<'a, 'b> { + transport: &'a Transport, + parts: SearchableSnapshotsStatsParts<'b>, + error_trace: Option, + filter_path: Option<&'b [&'b str]>, + headers: HeaderMap, + human: Option, + level: Option, + pretty: Option, + request_timeout: Option, + source: Option<&'b str>, +} +#[cfg(feature = "experimental-apis")] +impl<'a, 'b> SearchableSnapshotsStats<'a, 'b> { + #[doc = "Creates a new instance of [SearchableSnapshotsStats] with the specified API parts"] + pub fn new(transport: &'a Transport, parts: SearchableSnapshotsStatsParts<'b>) -> Self { + let headers = HeaderMap::new(); + SearchableSnapshotsStats { + transport, + parts, + headers, + error_trace: None, + filter_path: None, + human: None, + level: None, + pretty: None, + request_timeout: None, + source: None, + } + } + #[doc = "Include the stack trace of returned errors."] + pub fn error_trace(mut self, error_trace: bool) -> Self { + self.error_trace = Some(error_trace); + self + } + #[doc = "A comma-separated list of filters used to reduce the response."] + pub fn filter_path(mut self, filter_path: &'b [&'b str]) -> Self { + self.filter_path = Some(filter_path); + self + } + #[doc = "Adds a HTTP header"] + pub fn header(mut self, key: HeaderName, value: HeaderValue) -> Self { + self.headers.insert(key, value); + self + } + #[doc = "Return human readable values for statistics."] + pub fn human(mut self, human: bool) -> Self { + self.human = Some(human); + self + } + #[doc = "Return stats aggregated at cluster, index or shard level"] + pub fn level(mut self, level: Level) -> Self { + self.level = Some(level); + self + } + #[doc = "Pretty format the returned JSON response."] + pub fn pretty(mut self, pretty: bool) -> Self { + self.pretty = Some(pretty); + self + } + #[doc = "Sets a request timeout for this API call.\n\nThe timeout is applied from when the request starts connecting until the response body has finished."] + pub fn request_timeout(mut self, timeout: Duration) -> Self { + self.request_timeout = Some(timeout); + self + } + #[doc = "The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests."] + pub fn source(mut self, source: &'b str) -> Self { + self.source = Some(source); + self + } + #[doc = "Creates an asynchronous call to the Searchable Snapshots Stats API that can be awaited"] + pub async fn send(self) -> Result { + let path = self.parts.url(); + let method = Method::Get; + let headers = self.headers; + let timeout = self.request_timeout; + let query_string = { + #[serde_with::skip_serializing_none] + #[derive(Serialize)] + struct QueryParams<'b> { + error_trace: Option, + #[serde(serialize_with = "crate::client::serialize_coll_qs")] + filter_path: Option<&'b [&'b str]>, + human: Option, + level: Option, + pretty: Option, + source: Option<&'b str>, + } + let query_params = QueryParams { + error_trace: self.error_trace, + filter_path: self.filter_path, + human: self.human, + level: self.level, + pretty: self.pretty, + source: self.source, + }; + Some(query_params) + }; + let body = Option::<()>::None; + let response = self + .transport + .send(method, &path, headers, query_string.as_ref(), body, timeout) + .await?; + Ok(response) + } +} +#[doc = "Namespace client for SearchableSnapshots APIs"] +#[doc = " \n# Optional, experimental\nThis requires the `experimental-apis` feature. Can have breaking changes in future\nversions or might even be removed entirely.\n "] +#[cfg(feature = "experimental-apis")] +pub struct SearchableSnapshots<'a> { + transport: &'a Transport, +} +#[cfg(feature = "experimental-apis")] +impl<'a> SearchableSnapshots<'a> { + #[doc = "Creates a new instance of [SearchableSnapshots]"] + pub fn new(transport: &'a Transport) -> Self { + Self { transport } + } + pub fn transport(&self) -> &Transport { + self.transport + } + #[doc = "[Searchable Snapshots Clear Cache API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/searchable-snapshots-apis.html)\n\nClear the cache of searchable snapshots."] + #[doc = " \n# Optional, experimental\nThis requires the `experimental-apis` feature. Can have breaking changes in future\nversions or might even be removed entirely.\n "] + #[cfg(feature = "experimental-apis")] + pub fn clear_cache<'b>( + &'a self, + parts: SearchableSnapshotsClearCacheParts<'b>, + ) -> SearchableSnapshotsClearCache<'a, 'b, ()> { + SearchableSnapshotsClearCache::new(self.transport(), parts) + } + #[doc = "[Searchable Snapshots Mount API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/searchable-snapshots-api-mount-snapshot.html)\n\nMount a snapshot as a searchable index."] + #[doc = " \n# Optional, experimental\nThis requires the `experimental-apis` feature. Can have breaking changes in future\nversions or might even be removed entirely.\n "] + #[cfg(feature = "experimental-apis")] + pub fn mount<'b>( + &'a self, + parts: SearchableSnapshotsMountParts<'b>, + ) -> SearchableSnapshotsMount<'a, 'b, ()> { + SearchableSnapshotsMount::new(self.transport(), parts) + } + #[doc = "[Searchable Snapshots Repository Stats API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/searchable-snapshots-apis.html)\n\nDEPRECATED: This API is replaced by the Repositories Metering API."] + #[doc = " \n# Optional, experimental\nThis requires the `experimental-apis` feature. Can have breaking changes in future\nversions or might even be removed entirely.\n "] + #[cfg(feature = "experimental-apis")] + pub fn repository_stats<'b>( + &'a self, + parts: SearchableSnapshotsRepositoryStatsParts<'b>, + ) -> SearchableSnapshotsRepositoryStats<'a, 'b> { + SearchableSnapshotsRepositoryStats::new(self.transport(), parts) + } + #[doc = "[Searchable Snapshots Stats API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/searchable-snapshots-apis.html)\n\nRetrieve various statistics about searchable snapshots."] + #[doc = " \n# Optional, experimental\nThis requires the `experimental-apis` feature. Can have breaking changes in future\nversions or might even be removed entirely.\n "] + #[cfg(feature = "experimental-apis")] + pub fn stats<'b>( + &'a self, + parts: SearchableSnapshotsStatsParts<'b>, + ) -> SearchableSnapshotsStats<'a, 'b> { + SearchableSnapshotsStats::new(self.transport(), parts) + } +} +#[cfg(feature = "experimental-apis")] +impl Elasticsearch { + #[doc = "Creates a namespace client for SearchableSnapshots APIs"] + pub fn searchable_snapshots(&self) -> SearchableSnapshots { + SearchableSnapshots::new(self.transport()) + } +} diff --git a/elasticsearch/src/security.rs b/elasticsearch/src/security.rs index 4b670cee..02cf9842 100644 --- a/elasticsearch/src/security.rs +++ b/elasticsearch/src/security.rs @@ -37,7 +37,8 @@ //! - Authenticate users against an OpenID Connect or SAML authentication realm when using a //! custom web application other than Kibana -# ! [ allow ( unused_imports ) ]use crate::{ +#![allow(unused_imports)] +use crate::{ client::Elasticsearch, error::Error, http::{ @@ -66,8 +67,8 @@ impl SecurityAuthenticateParts { } } } +#[doc = "Builder for the [Security Authenticate API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/security-api-authenticate.html)\n\nEnables authentication as a user and retrieve information about the authenticated user."] #[derive(Clone, Debug)] -#[doc = "Builder for the [Security Authenticate API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/security-api-authenticate.html)\n\nEnables authentication as a user and retrieve information about the authenticated user."] pub struct SecurityAuthenticate<'a, 'b> { transport: &'a Transport, parts: SecurityAuthenticateParts, @@ -189,8 +190,8 @@ impl<'b> SecurityChangePasswordParts<'b> { } } } +#[doc = "Builder for the [Security Change Password API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/security-api-change-password.html)\n\nChanges the passwords of users in the native realm and built-in users."] #[derive(Clone, Debug)] -#[doc = "Builder for the [Security Change Password API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/security-api-change-password.html)\n\nChanges the passwords of users in the native realm and built-in users."] pub struct SecurityChangePassword<'a, 'b, B> { transport: &'a Transport, parts: SecurityChangePasswordParts<'b>, @@ -321,6 +322,150 @@ where } } #[derive(Debug, Clone, PartialEq)] +#[doc = "API parts for the Security Clear Api Key Cache API"] +pub enum SecurityClearApiKeyCacheParts<'b> { + #[doc = "Ids"] + Ids(&'b [&'b str]), +} +impl<'b> SecurityClearApiKeyCacheParts<'b> { + #[doc = "Builds a relative URL path to the Security Clear Api Key Cache API"] + pub fn url(self) -> Cow<'static, str> { + match self { + SecurityClearApiKeyCacheParts::Ids(ref ids) => { + let ids_str = ids.join(","); + let encoded_ids: Cow = + percent_encode(ids_str.as_bytes(), PARTS_ENCODED).into(); + let mut p = String::with_capacity(32usize + encoded_ids.len()); + p.push_str("/_security/api_key/"); + p.push_str(encoded_ids.as_ref()); + p.push_str("/_clear_cache"); + p.into() + } + } + } +} +#[doc = "Builder for the [Security Clear Api Key Cache API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/security-api-clear-api-key-cache.html)\n\nClear a subset or all entries from the API key cache."] +#[derive(Clone, Debug)] +pub struct SecurityClearApiKeyCache<'a, 'b, B> { + transport: &'a Transport, + parts: SecurityClearApiKeyCacheParts<'b>, + body: Option, + error_trace: Option, + filter_path: Option<&'b [&'b str]>, + headers: HeaderMap, + human: Option, + pretty: Option, + request_timeout: Option, + source: Option<&'b str>, +} +impl<'a, 'b, B> SecurityClearApiKeyCache<'a, 'b, B> +where + B: Body, +{ + #[doc = "Creates a new instance of [SecurityClearApiKeyCache] with the specified API parts"] + pub fn new(transport: &'a Transport, parts: SecurityClearApiKeyCacheParts<'b>) -> Self { + let headers = HeaderMap::new(); + SecurityClearApiKeyCache { + transport, + parts, + headers, + body: None, + error_trace: None, + filter_path: None, + human: None, + pretty: None, + request_timeout: None, + source: None, + } + } + #[doc = "The body for the API call"] + pub fn body(self, body: T) -> SecurityClearApiKeyCache<'a, 'b, JsonBody> + where + T: Serialize, + { + SecurityClearApiKeyCache { + transport: self.transport, + parts: self.parts, + body: Some(body.into()), + error_trace: self.error_trace, + filter_path: self.filter_path, + headers: self.headers, + human: self.human, + pretty: self.pretty, + request_timeout: self.request_timeout, + source: self.source, + } + } + #[doc = "Include the stack trace of returned errors."] + pub fn error_trace(mut self, error_trace: bool) -> Self { + self.error_trace = Some(error_trace); + self + } + #[doc = "A comma-separated list of filters used to reduce the response."] + pub fn filter_path(mut self, filter_path: &'b [&'b str]) -> Self { + self.filter_path = Some(filter_path); + self + } + #[doc = "Adds a HTTP header"] + pub fn header(mut self, key: HeaderName, value: HeaderValue) -> Self { + self.headers.insert(key, value); + self + } + #[doc = "Return human readable values for statistics."] + pub fn human(mut self, human: bool) -> Self { + self.human = Some(human); + self + } + #[doc = "Pretty format the returned JSON response."] + pub fn pretty(mut self, pretty: bool) -> Self { + self.pretty = Some(pretty); + self + } + #[doc = "Sets a request timeout for this API call.\n\nThe timeout is applied from when the request starts connecting until the response body has finished."] + pub fn request_timeout(mut self, timeout: Duration) -> Self { + self.request_timeout = Some(timeout); + self + } + #[doc = "The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests."] + pub fn source(mut self, source: &'b str) -> Self { + self.source = Some(source); + self + } + #[doc = "Creates an asynchronous call to the Security Clear Api Key Cache API that can be awaited"] + pub async fn send(self) -> Result { + let path = self.parts.url(); + let method = Method::Post; + let headers = self.headers; + let timeout = self.request_timeout; + let query_string = { + #[serde_with::skip_serializing_none] + #[derive(Serialize)] + struct QueryParams<'b> { + error_trace: Option, + #[serde(serialize_with = "crate::client::serialize_coll_qs")] + filter_path: Option<&'b [&'b str]>, + human: Option, + pretty: Option, + source: Option<&'b str>, + } + let query_params = QueryParams { + error_trace: self.error_trace, + filter_path: self.filter_path, + human: self.human, + pretty: self.pretty, + source: self.source, + }; + Some(query_params) + }; + let body = self.body; + let response = self + .transport + .send(method, &path, headers, query_string.as_ref(), body, timeout) + .await?; + Ok(response) + } +} +#[derive(Debug, Clone, PartialEq)] #[doc = "API parts for the Security Clear Cached Privileges API"] pub enum SecurityClearCachedPrivilegesParts<'b> { #[doc = "Application"] @@ -343,8 +488,8 @@ impl<'b> SecurityClearCachedPrivilegesParts<'b> { } } } +#[doc = "Builder for the [Security Clear Cached Privileges API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/security-api-clear-privilege-cache.html)\n\nEvicts application privileges from the native application privileges cache."] #[derive(Clone, Debug)] -#[doc = "Builder for the [Security Clear Cached Privileges API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/security-api-clear-privilege-cache.html)\n\nEvicts application privileges from the native application privileges cache."] pub struct SecurityClearCachedPrivileges<'a, 'b, B> { transport: &'a Transport, parts: SecurityClearCachedPrivilegesParts<'b>, @@ -487,8 +632,8 @@ impl<'b> SecurityClearCachedRealmsParts<'b> { } } } +#[doc = "Builder for the [Security Clear Cached Realms API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/security-api-clear-cache.html)\n\nEvicts users from the user cache. Can completely clear the cache or evict specific users."] #[derive(Clone, Debug)] -#[doc = "Builder for the [Security Clear Cached Realms API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/security-api-clear-cache.html)\n\nEvicts users from the user cache. Can completely clear the cache or evict specific users."] pub struct SecurityClearCachedRealms<'a, 'b, B> { transport: &'a Transport, parts: SecurityClearCachedRealmsParts<'b>, @@ -642,8 +787,8 @@ impl<'b> SecurityClearCachedRolesParts<'b> { } } } +#[doc = "Builder for the [Security Clear Cached Roles API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/security-api-clear-role-cache.html)\n\nEvicts roles from the native role cache."] #[derive(Clone, Debug)] -#[doc = "Builder for the [Security Clear Cached Roles API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/security-api-clear-role-cache.html)\n\nEvicts roles from the native role cache."] pub struct SecurityClearCachedRoles<'a, 'b, B> { transport: &'a Transport, parts: SecurityClearCachedRolesParts<'b>, @@ -777,8 +922,8 @@ impl SecurityCreateApiKeyParts { } } } +#[doc = "Builder for the [Security Create Api Key API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/security-api-create-api-key.html)\n\nCreates an API key for access without requiring basic authentication."] #[derive(Clone, Debug)] -#[doc = "Builder for the [Security Create Api Key API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/security-api-create-api-key.html)\n\nCreates an API key for access without requiring basic authentication."] pub struct SecurityCreateApiKey<'a, 'b, B> { transport: &'a Transport, parts: SecurityCreateApiKeyParts, @@ -933,8 +1078,8 @@ impl<'b> SecurityDeletePrivilegesParts<'b> { } } } +#[doc = "Builder for the [Security Delete Privileges API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/security-api-delete-privilege.html)\n\nRemoves application privileges."] #[derive(Clone, Debug)] -#[doc = "Builder for the [Security Delete Privileges API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/security-api-delete-privilege.html)\n\nRemoves application privileges."] pub struct SecurityDeletePrivileges<'a, 'b> { transport: &'a Transport, parts: SecurityDeletePrivilegesParts<'b>, @@ -1060,8 +1205,8 @@ impl<'b> SecurityDeleteRoleParts<'b> { } } } +#[doc = "Builder for the [Security Delete Role API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/security-api-delete-role.html)\n\nRemoves roles in the native realm."] #[derive(Clone, Debug)] -#[doc = "Builder for the [Security Delete Role API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/security-api-delete-role.html)\n\nRemoves roles in the native realm."] pub struct SecurityDeleteRole<'a, 'b> { transport: &'a Transport, parts: SecurityDeleteRoleParts<'b>, @@ -1187,8 +1332,8 @@ impl<'b> SecurityDeleteRoleMappingParts<'b> { } } } +#[doc = "Builder for the [Security Delete Role Mapping API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/security-api-delete-role-mapping.html)\n\nRemoves role mappings."] #[derive(Clone, Debug)] -#[doc = "Builder for the [Security Delete Role Mapping API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/security-api-delete-role-mapping.html)\n\nRemoves role mappings."] pub struct SecurityDeleteRoleMapping<'a, 'b> { transport: &'a Transport, parts: SecurityDeleteRoleMappingParts<'b>, @@ -1315,8 +1460,8 @@ impl<'b> SecurityDeleteUserParts<'b> { } } } +#[doc = "Builder for the [Security Delete User API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/security-api-delete-user.html)\n\nDeletes users from the native realm."] #[derive(Clone, Debug)] -#[doc = "Builder for the [Security Delete User API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/security-api-delete-user.html)\n\nDeletes users from the native realm."] pub struct SecurityDeleteUser<'a, 'b> { transport: &'a Transport, parts: SecurityDeleteUserParts<'b>, @@ -1444,8 +1589,8 @@ impl<'b> SecurityDisableUserParts<'b> { } } } +#[doc = "Builder for the [Security Disable User API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/security-api-disable-user.html)\n\nDisables users in the native realm."] #[derive(Clone, Debug)] -#[doc = "Builder for the [Security Disable User API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/security-api-disable-user.html)\n\nDisables users in the native realm."] pub struct SecurityDisableUser<'a, 'b, B> { transport: &'a Transport, parts: SecurityDisableUserParts<'b>, @@ -1597,8 +1742,8 @@ impl<'b> SecurityEnableUserParts<'b> { } } } +#[doc = "Builder for the [Security Enable User API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/security-api-enable-user.html)\n\nEnables users in the native realm."] #[derive(Clone, Debug)] -#[doc = "Builder for the [Security Enable User API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/security-api-enable-user.html)\n\nEnables users in the native realm."] pub struct SecurityEnableUser<'a, 'b, B> { transport: &'a Transport, parts: SecurityEnableUserParts<'b>, @@ -1742,8 +1887,8 @@ impl SecurityGetApiKeyParts { } } } +#[doc = "Builder for the [Security Get Api Key API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/security-api-get-api-key.html)\n\nRetrieves information for one or more API keys."] #[derive(Clone, Debug)] -#[doc = "Builder for the [Security Get Api Key API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/security-api-get-api-key.html)\n\nRetrieves information for one or more API keys."] pub struct SecurityGetApiKey<'a, 'b> { transport: &'a Transport, parts: SecurityGetApiKeyParts, @@ -1899,8 +2044,8 @@ impl SecurityGetBuiltinPrivilegesParts { } } } +#[doc = "Builder for the [Security Get Builtin Privileges API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/security-api-get-builtin-privileges.html)\n\nRetrieves the list of cluster privileges and index privileges that are available in this version of Elasticsearch."] #[derive(Clone, Debug)] -#[doc = "Builder for the [Security Get Builtin Privileges API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/security-api-get-builtin-privileges.html)\n\nRetrieves the list of cluster privileges and index privileges that are available in this version of Elasticsearch."] pub struct SecurityGetBuiltinPrivileges<'a, 'b> { transport: &'a Transport, parts: SecurityGetBuiltinPrivilegesParts, @@ -2035,8 +2180,8 @@ impl<'b> SecurityGetPrivilegesParts<'b> { } } } +#[doc = "Builder for the [Security Get Privileges API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/security-api-get-privileges.html)\n\nRetrieves application privileges."] #[derive(Clone, Debug)] -#[doc = "Builder for the [Security Get Privileges API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/security-api-get-privileges.html)\n\nRetrieves application privileges."] pub struct SecurityGetPrivileges<'a, 'b> { transport: &'a Transport, parts: SecurityGetPrivilegesParts<'b>, @@ -2137,7 +2282,7 @@ impl<'a, 'b> SecurityGetPrivileges<'a, 'b> { #[doc = "API parts for the Security Get Role API"] pub enum SecurityGetRoleParts<'b> { #[doc = "Name"] - Name(&'b str), + Name(&'b [&'b str]), #[doc = "No parts"] None, } @@ -2146,7 +2291,9 @@ impl<'b> SecurityGetRoleParts<'b> { pub fn url(self) -> Cow<'static, str> { match self { SecurityGetRoleParts::Name(ref name) => { - let encoded_name: Cow = percent_encode(name.as_bytes(), PARTS_ENCODED).into(); + let name_str = name.join(","); + let encoded_name: Cow = + percent_encode(name_str.as_bytes(), PARTS_ENCODED).into(); let mut p = String::with_capacity(16usize + encoded_name.len()); p.push_str("/_security/role/"); p.push_str(encoded_name.as_ref()); @@ -2156,8 +2303,8 @@ impl<'b> SecurityGetRoleParts<'b> { } } } +#[doc = "Builder for the [Security Get Role API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/security-api-get-role.html)\n\nRetrieves roles in the native realm."] #[derive(Clone, Debug)] -#[doc = "Builder for the [Security Get Role API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/security-api-get-role.html)\n\nRetrieves roles in the native realm."] pub struct SecurityGetRole<'a, 'b> { transport: &'a Transport, parts: SecurityGetRoleParts<'b>, @@ -2258,7 +2405,7 @@ impl<'a, 'b> SecurityGetRole<'a, 'b> { #[doc = "API parts for the Security Get Role Mapping API"] pub enum SecurityGetRoleMappingParts<'b> { #[doc = "Name"] - Name(&'b str), + Name(&'b [&'b str]), #[doc = "No parts"] None, } @@ -2267,7 +2414,9 @@ impl<'b> SecurityGetRoleMappingParts<'b> { pub fn url(self) -> Cow<'static, str> { match self { SecurityGetRoleMappingParts::Name(ref name) => { - let encoded_name: Cow = percent_encode(name.as_bytes(), PARTS_ENCODED).into(); + let name_str = name.join(","); + let encoded_name: Cow = + percent_encode(name_str.as_bytes(), PARTS_ENCODED).into(); let mut p = String::with_capacity(24usize + encoded_name.len()); p.push_str("/_security/role_mapping/"); p.push_str(encoded_name.as_ref()); @@ -2277,8 +2426,8 @@ impl<'b> SecurityGetRoleMappingParts<'b> { } } } +#[doc = "Builder for the [Security Get Role Mapping API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/security-api-get-role-mapping.html)\n\nRetrieves role mappings."] #[derive(Clone, Debug)] -#[doc = "Builder for the [Security Get Role Mapping API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/security-api-get-role-mapping.html)\n\nRetrieves role mappings."] pub struct SecurityGetRoleMapping<'a, 'b> { transport: &'a Transport, parts: SecurityGetRoleMappingParts<'b>, @@ -2389,8 +2538,8 @@ impl SecurityGetTokenParts { } } } +#[doc = "Builder for the [Security Get Token API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/security-api-get-token.html)\n\nCreates a bearer token for access without requiring basic authentication."] #[derive(Clone, Debug)] -#[doc = "Builder for the [Security Get Token API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/security-api-get-token.html)\n\nCreates a bearer token for access without requiring basic authentication."] pub struct SecurityGetToken<'a, 'b, B> { transport: &'a Transport, parts: SecurityGetTokenParts, @@ -2535,8 +2684,8 @@ impl<'b> SecurityGetUserParts<'b> { } } } +#[doc = "Builder for the [Security Get User API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/security-api-get-user.html)\n\nRetrieves information about users in the native realm and built-in users."] #[derive(Clone, Debug)] -#[doc = "Builder for the [Security Get User API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/security-api-get-user.html)\n\nRetrieves information about users in the native realm and built-in users."] pub struct SecurityGetUser<'a, 'b> { transport: &'a Transport, parts: SecurityGetUserParts<'b>, @@ -2647,8 +2796,8 @@ impl SecurityGetUserPrivilegesParts { } } } +#[doc = "Builder for the [Security Get User Privileges API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/security-api-get-privileges.html)\n\nRetrieves application privileges."] #[derive(Clone, Debug)] -#[doc = "Builder for the [Security Get User Privileges API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/security-api-get-privileges.html)\n\nRetrieves application privileges."] pub struct SecurityGetUserPrivileges<'a, 'b> { transport: &'a Transport, parts: SecurityGetUserPrivilegesParts, @@ -2746,6 +2895,151 @@ impl<'a, 'b> SecurityGetUserPrivileges<'a, 'b> { } } #[derive(Debug, Clone, PartialEq)] +#[doc = "API parts for the Security Grant Api Key API"] +pub enum SecurityGrantApiKeyParts { + #[doc = "No parts"] + None, +} +impl SecurityGrantApiKeyParts { + #[doc = "Builds a relative URL path to the Security Grant Api Key API"] + pub fn url(self) -> Cow<'static, str> { + match self { + SecurityGrantApiKeyParts::None => "/_security/api_key/grant".into(), + } + } +} +#[doc = "Builder for the [Security Grant Api Key API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/security-api-grant-api-key.html)\n\nCreates an API key on behalf of another user."] +#[derive(Clone, Debug)] +pub struct SecurityGrantApiKey<'a, 'b, B> { + transport: &'a Transport, + parts: SecurityGrantApiKeyParts, + body: Option, + error_trace: Option, + filter_path: Option<&'b [&'b str]>, + headers: HeaderMap, + human: Option, + pretty: Option, + refresh: Option, + request_timeout: Option, + source: Option<&'b str>, +} +impl<'a, 'b, B> SecurityGrantApiKey<'a, 'b, B> +where + B: Body, +{ + #[doc = "Creates a new instance of [SecurityGrantApiKey]"] + pub fn new(transport: &'a Transport) -> Self { + let headers = HeaderMap::new(); + SecurityGrantApiKey { + transport, + parts: SecurityGrantApiKeyParts::None, + headers, + body: None, + error_trace: None, + filter_path: None, + human: None, + pretty: None, + refresh: None, + request_timeout: None, + source: None, + } + } + #[doc = "The body for the API call"] + pub fn body(self, body: T) -> SecurityGrantApiKey<'a, 'b, JsonBody> + where + T: Serialize, + { + SecurityGrantApiKey { + transport: self.transport, + parts: self.parts, + body: Some(body.into()), + error_trace: self.error_trace, + filter_path: self.filter_path, + headers: self.headers, + human: self.human, + pretty: self.pretty, + refresh: self.refresh, + request_timeout: self.request_timeout, + source: self.source, + } + } + #[doc = "Include the stack trace of returned errors."] + pub fn error_trace(mut self, error_trace: bool) -> Self { + self.error_trace = Some(error_trace); + self + } + #[doc = "A comma-separated list of filters used to reduce the response."] + pub fn filter_path(mut self, filter_path: &'b [&'b str]) -> Self { + self.filter_path = Some(filter_path); + self + } + #[doc = "Adds a HTTP header"] + pub fn header(mut self, key: HeaderName, value: HeaderValue) -> Self { + self.headers.insert(key, value); + self + } + #[doc = "Return human readable values for statistics."] + pub fn human(mut self, human: bool) -> Self { + self.human = Some(human); + self + } + #[doc = "Pretty format the returned JSON response."] + pub fn pretty(mut self, pretty: bool) -> Self { + self.pretty = Some(pretty); + self + } + #[doc = "If `true` (the default) then refresh the affected shards to make this operation visible to search, if `wait_for` then wait for a refresh to make this operation visible to search, if `false` then do nothing with refreshes."] + pub fn refresh(mut self, refresh: Refresh) -> Self { + self.refresh = Some(refresh); + self + } + #[doc = "Sets a request timeout for this API call.\n\nThe timeout is applied from when the request starts connecting until the response body has finished."] + pub fn request_timeout(mut self, timeout: Duration) -> Self { + self.request_timeout = Some(timeout); + self + } + #[doc = "The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests."] + pub fn source(mut self, source: &'b str) -> Self { + self.source = Some(source); + self + } + #[doc = "Creates an asynchronous call to the Security Grant Api Key API that can be awaited"] + pub async fn send(self) -> Result { + let path = self.parts.url(); + let method = Method::Post; + let headers = self.headers; + let timeout = self.request_timeout; + let query_string = { + #[serde_with::skip_serializing_none] + #[derive(Serialize)] + struct QueryParams<'b> { + error_trace: Option, + #[serde(serialize_with = "crate::client::serialize_coll_qs")] + filter_path: Option<&'b [&'b str]>, + human: Option, + pretty: Option, + refresh: Option, + source: Option<&'b str>, + } + let query_params = QueryParams { + error_trace: self.error_trace, + filter_path: self.filter_path, + human: self.human, + pretty: self.pretty, + refresh: self.refresh, + source: self.source, + }; + Some(query_params) + }; + let body = self.body; + let response = self + .transport + .send(method, &path, headers, query_string.as_ref(), body, timeout) + .await?; + Ok(response) + } +} +#[derive(Debug, Clone, PartialEq)] #[doc = "API parts for the Security Has Privileges API"] pub enum SecurityHasPrivilegesParts<'b> { #[doc = "No parts"] @@ -2769,8 +3063,8 @@ impl<'b> SecurityHasPrivilegesParts<'b> { } } } +#[doc = "Builder for the [Security Has Privileges API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/security-api-has-privileges.html)\n\nDetermines whether the specified user has a specified list of privileges."] #[derive(Clone, Debug)] -#[doc = "Builder for the [Security Has Privileges API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/security-api-has-privileges.html)\n\nDetermines whether the specified user has a specified list of privileges."] pub struct SecurityHasPrivileges<'a, 'b, B> { transport: &'a Transport, parts: SecurityHasPrivilegesParts<'b>, @@ -2907,8 +3201,8 @@ impl SecurityInvalidateApiKeyParts { } } } +#[doc = "Builder for the [Security Invalidate Api Key API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/security-api-invalidate-api-key.html)\n\nInvalidates one or more API keys."] #[derive(Clone, Debug)] -#[doc = "Builder for the [Security Invalidate Api Key API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/security-api-invalidate-api-key.html)\n\nInvalidates one or more API keys."] pub struct SecurityInvalidateApiKey<'a, 'b, B> { transport: &'a Transport, parts: SecurityInvalidateApiKeyParts, @@ -3042,8 +3336,8 @@ impl SecurityInvalidateTokenParts { } } } +#[doc = "Builder for the [Security Invalidate Token API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/security-api-invalidate-token.html)\n\nInvalidates one or more access tokens or refresh tokens."] #[derive(Clone, Debug)] -#[doc = "Builder for the [Security Invalidate Token API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/security-api-invalidate-token.html)\n\nInvalidates one or more access tokens or refresh tokens."] pub struct SecurityInvalidateToken<'a, 'b, B> { transport: &'a Transport, parts: SecurityInvalidateTokenParts, @@ -3177,8 +3471,8 @@ impl SecurityPutPrivilegesParts { } } } +#[doc = "Builder for the [Security Put Privileges API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/security-api-put-privileges.html)\n\nAdds or updates application privileges."] #[derive(Clone, Debug)] -#[doc = "Builder for the [Security Put Privileges API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/security-api-put-privileges.html)\n\nAdds or updates application privileges."] pub struct SecurityPutPrivileges<'a, 'b, B> { transport: &'a Transport, parts: SecurityPutPrivilegesParts, @@ -3328,8 +3622,8 @@ impl<'b> SecurityPutRoleParts<'b> { } } } +#[doc = "Builder for the [Security Put Role API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/security-api-put-role.html)\n\nAdds and updates roles in the native realm."] #[derive(Clone, Debug)] -#[doc = "Builder for the [Security Put Role API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/security-api-put-role.html)\n\nAdds and updates roles in the native realm."] pub struct SecurityPutRole<'a, 'b, B> { transport: &'a Transport, parts: SecurityPutRoleParts<'b>, @@ -3479,8 +3773,8 @@ impl<'b> SecurityPutRoleMappingParts<'b> { } } } +#[doc = "Builder for the [Security Put Role Mapping API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/security-api-put-role-mapping.html)\n\nCreates and updates role mappings."] #[derive(Clone, Debug)] -#[doc = "Builder for the [Security Put Role Mapping API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/security-api-put-role-mapping.html)\n\nCreates and updates role mappings."] pub struct SecurityPutRoleMapping<'a, 'b, B> { transport: &'a Transport, parts: SecurityPutRoleMappingParts<'b>, @@ -3631,8 +3925,8 @@ impl<'b> SecurityPutUserParts<'b> { } } } +#[doc = "Builder for the [Security Put User API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/security-api-put-user.html)\n\nAdds and updates users in the native realm. These users are commonly referred to as native users."] #[derive(Clone, Debug)] -#[doc = "Builder for the [Security Put User API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/security-api-put-user.html)\n\nAdds and updates users in the native realm. These users are commonly referred to as native users."] pub struct SecurityPutUser<'a, 'b, B> { transport: &'a Transport, parts: SecurityPutUserParts<'b>, @@ -3774,153 +4068,164 @@ impl<'a> Security<'a> { pub fn transport(&self) -> &Transport { self.transport } - #[doc = "[Security Authenticate API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/security-api-authenticate.html)\n\nEnables authentication as a user and retrieve information about the authenticated user."] + #[doc = "[Security Authenticate API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/security-api-authenticate.html)\n\nEnables authentication as a user and retrieve information about the authenticated user."] pub fn authenticate<'b>(&'a self) -> SecurityAuthenticate<'a, 'b> { SecurityAuthenticate::new(self.transport()) } - #[doc = "[Security Change Password API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/security-api-change-password.html)\n\nChanges the passwords of users in the native realm and built-in users."] + #[doc = "[Security Change Password API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/security-api-change-password.html)\n\nChanges the passwords of users in the native realm and built-in users."] pub fn change_password<'b>( &'a self, parts: SecurityChangePasswordParts<'b>, ) -> SecurityChangePassword<'a, 'b, ()> { SecurityChangePassword::new(self.transport(), parts) } - #[doc = "[Security Clear Cached Privileges API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/security-api-clear-privilege-cache.html)\n\nEvicts application privileges from the native application privileges cache."] + #[doc = "[Security Clear Api Key Cache API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/security-api-clear-api-key-cache.html)\n\nClear a subset or all entries from the API key cache."] + pub fn clear_api_key_cache<'b>( + &'a self, + parts: SecurityClearApiKeyCacheParts<'b>, + ) -> SecurityClearApiKeyCache<'a, 'b, ()> { + SecurityClearApiKeyCache::new(self.transport(), parts) + } + #[doc = "[Security Clear Cached Privileges API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/security-api-clear-privilege-cache.html)\n\nEvicts application privileges from the native application privileges cache."] pub fn clear_cached_privileges<'b>( &'a self, parts: SecurityClearCachedPrivilegesParts<'b>, ) -> SecurityClearCachedPrivileges<'a, 'b, ()> { SecurityClearCachedPrivileges::new(self.transport(), parts) } - #[doc = "[Security Clear Cached Realms API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/security-api-clear-cache.html)\n\nEvicts users from the user cache. Can completely clear the cache or evict specific users."] + #[doc = "[Security Clear Cached Realms API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/security-api-clear-cache.html)\n\nEvicts users from the user cache. Can completely clear the cache or evict specific users."] pub fn clear_cached_realms<'b>( &'a self, parts: SecurityClearCachedRealmsParts<'b>, ) -> SecurityClearCachedRealms<'a, 'b, ()> { SecurityClearCachedRealms::new(self.transport(), parts) } - #[doc = "[Security Clear Cached Roles API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/security-api-clear-role-cache.html)\n\nEvicts roles from the native role cache."] + #[doc = "[Security Clear Cached Roles API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/security-api-clear-role-cache.html)\n\nEvicts roles from the native role cache."] pub fn clear_cached_roles<'b>( &'a self, parts: SecurityClearCachedRolesParts<'b>, ) -> SecurityClearCachedRoles<'a, 'b, ()> { SecurityClearCachedRoles::new(self.transport(), parts) } - #[doc = "[Security Create Api Key API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/security-api-create-api-key.html)\n\nCreates an API key for access without requiring basic authentication."] + #[doc = "[Security Create Api Key API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/security-api-create-api-key.html)\n\nCreates an API key for access without requiring basic authentication."] pub fn create_api_key<'b>(&'a self) -> SecurityCreateApiKey<'a, 'b, ()> { SecurityCreateApiKey::new(self.transport()) } - #[doc = "[Security Delete Privileges API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/security-api-delete-privilege.html)\n\nRemoves application privileges."] + #[doc = "[Security Delete Privileges API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/security-api-delete-privilege.html)\n\nRemoves application privileges."] pub fn delete_privileges<'b>( &'a self, parts: SecurityDeletePrivilegesParts<'b>, ) -> SecurityDeletePrivileges<'a, 'b> { SecurityDeletePrivileges::new(self.transport(), parts) } - #[doc = "[Security Delete Role API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/security-api-delete-role.html)\n\nRemoves roles in the native realm."] + #[doc = "[Security Delete Role API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/security-api-delete-role.html)\n\nRemoves roles in the native realm."] pub fn delete_role<'b>( &'a self, parts: SecurityDeleteRoleParts<'b>, ) -> SecurityDeleteRole<'a, 'b> { SecurityDeleteRole::new(self.transport(), parts) } - #[doc = "[Security Delete Role Mapping API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/security-api-delete-role-mapping.html)\n\nRemoves role mappings."] + #[doc = "[Security Delete Role Mapping API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/security-api-delete-role-mapping.html)\n\nRemoves role mappings."] pub fn delete_role_mapping<'b>( &'a self, parts: SecurityDeleteRoleMappingParts<'b>, ) -> SecurityDeleteRoleMapping<'a, 'b> { SecurityDeleteRoleMapping::new(self.transport(), parts) } - #[doc = "[Security Delete User API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/security-api-delete-user.html)\n\nDeletes users from the native realm."] + #[doc = "[Security Delete User API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/security-api-delete-user.html)\n\nDeletes users from the native realm."] pub fn delete_user<'b>( &'a self, parts: SecurityDeleteUserParts<'b>, ) -> SecurityDeleteUser<'a, 'b> { SecurityDeleteUser::new(self.transport(), parts) } - #[doc = "[Security Disable User API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/security-api-disable-user.html)\n\nDisables users in the native realm."] + #[doc = "[Security Disable User API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/security-api-disable-user.html)\n\nDisables users in the native realm."] pub fn disable_user<'b>( &'a self, parts: SecurityDisableUserParts<'b>, ) -> SecurityDisableUser<'a, 'b, ()> { SecurityDisableUser::new(self.transport(), parts) } - #[doc = "[Security Enable User API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/security-api-enable-user.html)\n\nEnables users in the native realm."] + #[doc = "[Security Enable User API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/security-api-enable-user.html)\n\nEnables users in the native realm."] pub fn enable_user<'b>( &'a self, parts: SecurityEnableUserParts<'b>, ) -> SecurityEnableUser<'a, 'b, ()> { SecurityEnableUser::new(self.transport(), parts) } - #[doc = "[Security Get Api Key API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/security-api-get-api-key.html)\n\nRetrieves information for one or more API keys."] + #[doc = "[Security Get Api Key API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/security-api-get-api-key.html)\n\nRetrieves information for one or more API keys."] pub fn get_api_key<'b>(&'a self) -> SecurityGetApiKey<'a, 'b> { SecurityGetApiKey::new(self.transport()) } - #[doc = "[Security Get Builtin Privileges API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/security-api-get-builtin-privileges.html)\n\nRetrieves the list of cluster privileges and index privileges that are available in this version of Elasticsearch."] + #[doc = "[Security Get Builtin Privileges API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/security-api-get-builtin-privileges.html)\n\nRetrieves the list of cluster privileges and index privileges that are available in this version of Elasticsearch."] pub fn get_builtin_privileges<'b>(&'a self) -> SecurityGetBuiltinPrivileges<'a, 'b> { SecurityGetBuiltinPrivileges::new(self.transport()) } - #[doc = "[Security Get Privileges API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/security-api-get-privileges.html)\n\nRetrieves application privileges."] + #[doc = "[Security Get Privileges API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/security-api-get-privileges.html)\n\nRetrieves application privileges."] pub fn get_privileges<'b>( &'a self, parts: SecurityGetPrivilegesParts<'b>, ) -> SecurityGetPrivileges<'a, 'b> { SecurityGetPrivileges::new(self.transport(), parts) } - #[doc = "[Security Get Role API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/security-api-get-role.html)\n\nRetrieves roles in the native realm."] + #[doc = "[Security Get Role API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/security-api-get-role.html)\n\nRetrieves roles in the native realm."] pub fn get_role<'b>(&'a self, parts: SecurityGetRoleParts<'b>) -> SecurityGetRole<'a, 'b> { SecurityGetRole::new(self.transport(), parts) } - #[doc = "[Security Get Role Mapping API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/security-api-get-role-mapping.html)\n\nRetrieves role mappings."] + #[doc = "[Security Get Role Mapping API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/security-api-get-role-mapping.html)\n\nRetrieves role mappings."] pub fn get_role_mapping<'b>( &'a self, parts: SecurityGetRoleMappingParts<'b>, ) -> SecurityGetRoleMapping<'a, 'b> { SecurityGetRoleMapping::new(self.transport(), parts) } - #[doc = "[Security Get Token API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/security-api-get-token.html)\n\nCreates a bearer token for access without requiring basic authentication."] + #[doc = "[Security Get Token API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/security-api-get-token.html)\n\nCreates a bearer token for access without requiring basic authentication."] pub fn get_token<'b>(&'a self) -> SecurityGetToken<'a, 'b, ()> { SecurityGetToken::new(self.transport()) } - #[doc = "[Security Get User API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/security-api-get-user.html)\n\nRetrieves information about users in the native realm and built-in users."] + #[doc = "[Security Get User API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/security-api-get-user.html)\n\nRetrieves information about users in the native realm and built-in users."] pub fn get_user<'b>(&'a self, parts: SecurityGetUserParts<'b>) -> SecurityGetUser<'a, 'b> { SecurityGetUser::new(self.transport(), parts) } - #[doc = "[Security Get User Privileges API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/security-api-get-privileges.html)\n\nRetrieves application privileges."] + #[doc = "[Security Get User Privileges API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/security-api-get-privileges.html)\n\nRetrieves application privileges."] pub fn get_user_privileges<'b>(&'a self) -> SecurityGetUserPrivileges<'a, 'b> { SecurityGetUserPrivileges::new(self.transport()) } - #[doc = "[Security Has Privileges API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/security-api-has-privileges.html)\n\nDetermines whether the specified user has a specified list of privileges."] + #[doc = "[Security Grant Api Key API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/security-api-grant-api-key.html)\n\nCreates an API key on behalf of another user."] + pub fn grant_api_key<'b>(&'a self) -> SecurityGrantApiKey<'a, 'b, ()> { + SecurityGrantApiKey::new(self.transport()) + } + #[doc = "[Security Has Privileges API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/security-api-has-privileges.html)\n\nDetermines whether the specified user has a specified list of privileges."] pub fn has_privileges<'b>( &'a self, parts: SecurityHasPrivilegesParts<'b>, ) -> SecurityHasPrivileges<'a, 'b, ()> { SecurityHasPrivileges::new(self.transport(), parts) } - #[doc = "[Security Invalidate Api Key API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/security-api-invalidate-api-key.html)\n\nInvalidates one or more API keys."] + #[doc = "[Security Invalidate Api Key API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/security-api-invalidate-api-key.html)\n\nInvalidates one or more API keys."] pub fn invalidate_api_key<'b>(&'a self) -> SecurityInvalidateApiKey<'a, 'b, ()> { SecurityInvalidateApiKey::new(self.transport()) } - #[doc = "[Security Invalidate Token API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/security-api-invalidate-token.html)\n\nInvalidates one or more access tokens or refresh tokens."] + #[doc = "[Security Invalidate Token API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/security-api-invalidate-token.html)\n\nInvalidates one or more access tokens or refresh tokens."] pub fn invalidate_token<'b>(&'a self) -> SecurityInvalidateToken<'a, 'b, ()> { SecurityInvalidateToken::new(self.transport()) } - #[doc = "[Security Put Privileges API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/security-api-put-privileges.html)\n\nAdds or updates application privileges."] + #[doc = "[Security Put Privileges API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/security-api-put-privileges.html)\n\nAdds or updates application privileges."] pub fn put_privileges<'b>(&'a self) -> SecurityPutPrivileges<'a, 'b, ()> { SecurityPutPrivileges::new(self.transport()) } - #[doc = "[Security Put Role API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/security-api-put-role.html)\n\nAdds and updates roles in the native realm."] + #[doc = "[Security Put Role API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/security-api-put-role.html)\n\nAdds and updates roles in the native realm."] pub fn put_role<'b>(&'a self, parts: SecurityPutRoleParts<'b>) -> SecurityPutRole<'a, 'b, ()> { SecurityPutRole::new(self.transport(), parts) } - #[doc = "[Security Put Role Mapping API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/security-api-put-role-mapping.html)\n\nCreates and updates role mappings."] + #[doc = "[Security Put Role Mapping API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/security-api-put-role-mapping.html)\n\nCreates and updates role mappings."] pub fn put_role_mapping<'b>( &'a self, parts: SecurityPutRoleMappingParts<'b>, ) -> SecurityPutRoleMapping<'a, 'b, ()> { SecurityPutRoleMapping::new(self.transport(), parts) } - #[doc = "[Security Put User API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/security-api-put-user.html)\n\nAdds and updates users in the native realm. These users are commonly referred to as native users."] + #[doc = "[Security Put User API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/security-api-put-user.html)\n\nAdds and updates users in the native realm. These users are commonly referred to as native users."] pub fn put_user<'b>(&'a self, parts: SecurityPutUserParts<'b>) -> SecurityPutUser<'a, 'b, ()> { SecurityPutUser::new(self.transport(), parts) } diff --git a/elasticsearch/src/slm.rs b/elasticsearch/src/slm.rs index 9193dea7..c8d4e6f3 100644 --- a/elasticsearch/src/slm.rs +++ b/elasticsearch/src/slm.rs @@ -33,7 +33,8 @@ //! indices. Snapshot Lifecycle Management can also perform deletion of older snapshots based on a //! configurable retention policy. -# ! [ allow ( unused_imports ) ]use crate::{ +#![allow(unused_imports)] +use crate::{ client::Elasticsearch, error::Error, http::{ @@ -69,8 +70,8 @@ impl<'b> SlmDeleteLifecycleParts<'b> { } } } +#[doc = "Builder for the [Slm Delete Lifecycle API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/slm-api-delete-policy.html)\n\nDeletes an existing snapshot lifecycle policy."] #[derive(Clone, Debug)] -#[doc = "Builder for the [Slm Delete Lifecycle API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/slm-api-delete-policy.html)\n\nDeletes an existing snapshot lifecycle policy."] pub struct SlmDeleteLifecycle<'a, 'b> { transport: &'a Transport, parts: SlmDeleteLifecycleParts<'b>, @@ -189,8 +190,8 @@ impl<'b> SlmExecuteLifecycleParts<'b> { } } } +#[doc = "Builder for the [Slm Execute Lifecycle API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/slm-api-execute-lifecycle.html)\n\nImmediately creates a snapshot according to the lifecycle policy, without waiting for the scheduled time."] #[derive(Clone, Debug)] -#[doc = "Builder for the [Slm Execute Lifecycle API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/slm-api-execute-lifecycle.html)\n\nImmediately creates a snapshot according to the lifecycle policy, without waiting for the scheduled time."] pub struct SlmExecuteLifecycle<'a, 'b, B> { transport: &'a Transport, parts: SlmExecuteLifecycleParts<'b>, @@ -324,8 +325,8 @@ impl SlmExecuteRetentionParts { } } } +#[doc = "Builder for the [Slm Execute Retention API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/slm-api-execute-retention.html)\n\nDeletes any snapshots that are expired according to the policy's retention rules."] #[derive(Clone, Debug)] -#[doc = "Builder for the [Slm Execute Retention API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/slm-api-execute-retention.html)\n\nDeletes any snapshots that are expired according to the policy's retention rules."] pub struct SlmExecuteRetention<'a, 'b, B> { transport: &'a Transport, parts: SlmExecuteRetentionParts, @@ -470,8 +471,8 @@ impl<'b> SlmGetLifecycleParts<'b> { } } } +#[doc = "Builder for the [Slm Get Lifecycle API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/slm-api-get-policy.html)\n\nRetrieves one or more snapshot lifecycle policy definitions and information about the latest snapshot attempts."] #[derive(Clone, Debug)] -#[doc = "Builder for the [Slm Get Lifecycle API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/slm-api-get-policy.html)\n\nRetrieves one or more snapshot lifecycle policy definitions and information about the latest snapshot attempts."] pub struct SlmGetLifecycle<'a, 'b> { transport: &'a Transport, parts: SlmGetLifecycleParts<'b>, @@ -582,8 +583,8 @@ impl SlmGetStatsParts { } } } +#[doc = "Builder for the [Slm Get Stats API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/slm-api-get-stats.html)\n\nReturns global and policy-level statistics about actions taken by snapshot lifecycle management."] #[derive(Clone, Debug)] -#[doc = "Builder for the [Slm Get Stats API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/slm-api-get-stats.html)\n\nReturns global and policy-level statistics about actions taken by snapshot lifecycle management."] pub struct SlmGetStats<'a, 'b> { transport: &'a Transport, parts: SlmGetStatsParts, @@ -694,8 +695,8 @@ impl SlmGetStatusParts { } } } +#[doc = "Builder for the [Slm Get Status API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/slm-api-get-status.html)\n\nRetrieves the status of snapshot lifecycle management (SLM)."] #[derive(Clone, Debug)] -#[doc = "Builder for the [Slm Get Status API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/slm-api-get-status.html)\n\nRetrieves the status of snapshot lifecycle management (SLM)."] pub struct SlmGetStatus<'a, 'b> { transport: &'a Transport, parts: SlmGetStatusParts, @@ -813,8 +814,8 @@ impl<'b> SlmPutLifecycleParts<'b> { } } } +#[doc = "Builder for the [Slm Put Lifecycle API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/slm-api-put-policy.html)\n\nCreates or updates a snapshot lifecycle policy."] #[derive(Clone, Debug)] -#[doc = "Builder for the [Slm Put Lifecycle API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/slm-api-put-policy.html)\n\nCreates or updates a snapshot lifecycle policy."] pub struct SlmPutLifecycle<'a, 'b, B> { transport: &'a Transport, parts: SlmPutLifecycleParts<'b>, @@ -948,8 +949,8 @@ impl SlmStartParts { } } } +#[doc = "Builder for the [Slm Start API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/slm-api-start.html)\n\nTurns on snapshot lifecycle management (SLM)."] #[derive(Clone, Debug)] -#[doc = "Builder for the [Slm Start API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/slm-api-start.html)\n\nTurns on snapshot lifecycle management (SLM)."] pub struct SlmStart<'a, 'b, B> { transport: &'a Transport, parts: SlmStartParts, @@ -1083,8 +1084,8 @@ impl SlmStopParts { } } } +#[doc = "Builder for the [Slm Stop API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/slm-api-stop.html)\n\nTurns off snapshot lifecycle management (SLM)."] #[derive(Clone, Debug)] -#[doc = "Builder for the [Slm Stop API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/slm-api-stop.html)\n\nTurns off snapshot lifecycle management (SLM)."] pub struct SlmStop<'a, 'b, B> { transport: &'a Transport, parts: SlmStopParts, @@ -1216,48 +1217,48 @@ impl<'a> Slm<'a> { pub fn transport(&self) -> &Transport { self.transport } - #[doc = "[Slm Delete Lifecycle API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/slm-api-delete-policy.html)\n\nDeletes an existing snapshot lifecycle policy."] + #[doc = "[Slm Delete Lifecycle API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/slm-api-delete-policy.html)\n\nDeletes an existing snapshot lifecycle policy."] pub fn delete_lifecycle<'b>( &'a self, parts: SlmDeleteLifecycleParts<'b>, ) -> SlmDeleteLifecycle<'a, 'b> { SlmDeleteLifecycle::new(self.transport(), parts) } - #[doc = "[Slm Execute Lifecycle API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/slm-api-execute-lifecycle.html)\n\nImmediately creates a snapshot according to the lifecycle policy, without waiting for the scheduled time."] + #[doc = "[Slm Execute Lifecycle API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/slm-api-execute-lifecycle.html)\n\nImmediately creates a snapshot according to the lifecycle policy, without waiting for the scheduled time."] pub fn execute_lifecycle<'b>( &'a self, parts: SlmExecuteLifecycleParts<'b>, ) -> SlmExecuteLifecycle<'a, 'b, ()> { SlmExecuteLifecycle::new(self.transport(), parts) } - #[doc = "[Slm Execute Retention API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/slm-api-execute-retention.html)\n\nDeletes any snapshots that are expired according to the policy's retention rules."] + #[doc = "[Slm Execute Retention API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/slm-api-execute-retention.html)\n\nDeletes any snapshots that are expired according to the policy's retention rules."] pub fn execute_retention<'b>(&'a self) -> SlmExecuteRetention<'a, 'b, ()> { SlmExecuteRetention::new(self.transport()) } - #[doc = "[Slm Get Lifecycle API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/slm-api-get-policy.html)\n\nRetrieves one or more snapshot lifecycle policy definitions and information about the latest snapshot attempts."] + #[doc = "[Slm Get Lifecycle API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/slm-api-get-policy.html)\n\nRetrieves one or more snapshot lifecycle policy definitions and information about the latest snapshot attempts."] pub fn get_lifecycle<'b>(&'a self, parts: SlmGetLifecycleParts<'b>) -> SlmGetLifecycle<'a, 'b> { SlmGetLifecycle::new(self.transport(), parts) } - #[doc = "[Slm Get Stats API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/slm-api-get-stats.html)\n\nReturns global and policy-level statistics about actions taken by snapshot lifecycle management."] + #[doc = "[Slm Get Stats API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/slm-api-get-stats.html)\n\nReturns global and policy-level statistics about actions taken by snapshot lifecycle management."] pub fn get_stats<'b>(&'a self) -> SlmGetStats<'a, 'b> { SlmGetStats::new(self.transport()) } - #[doc = "[Slm Get Status API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/slm-api-get-status.html)\n\nRetrieves the status of snapshot lifecycle management (SLM)."] + #[doc = "[Slm Get Status API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/slm-api-get-status.html)\n\nRetrieves the status of snapshot lifecycle management (SLM)."] pub fn get_status<'b>(&'a self) -> SlmGetStatus<'a, 'b> { SlmGetStatus::new(self.transport()) } - #[doc = "[Slm Put Lifecycle API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/slm-api-put-policy.html)\n\nCreates or updates a snapshot lifecycle policy."] + #[doc = "[Slm Put Lifecycle API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/slm-api-put-policy.html)\n\nCreates or updates a snapshot lifecycle policy."] pub fn put_lifecycle<'b>( &'a self, parts: SlmPutLifecycleParts<'b>, ) -> SlmPutLifecycle<'a, 'b, ()> { SlmPutLifecycle::new(self.transport(), parts) } - #[doc = "[Slm Start API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/slm-api-start.html)\n\nTurns on snapshot lifecycle management (SLM)."] + #[doc = "[Slm Start API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/slm-api-start.html)\n\nTurns on snapshot lifecycle management (SLM)."] pub fn start<'b>(&'a self) -> SlmStart<'a, 'b, ()> { SlmStart::new(self.transport()) } - #[doc = "[Slm Stop API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/slm-api-stop.html)\n\nTurns off snapshot lifecycle management (SLM)."] + #[doc = "[Slm Stop API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/slm-api-stop.html)\n\nTurns off snapshot lifecycle management (SLM)."] pub fn stop<'b>(&'a self) -> SlmStop<'a, 'b, ()> { SlmStop::new(self.transport()) } diff --git a/elasticsearch/src/snapshot.rs b/elasticsearch/src/snapshot.rs index a0318596..19fda9a9 100644 --- a/elasticsearch/src/snapshot.rs +++ b/elasticsearch/src/snapshot.rs @@ -31,7 +31,8 @@ //! indices or the entire cluster, stored in a repository on a shared filesystem or a remote repository //! on S3, HDFS, Azure, Google Cloud storage, and more. -# ! [ allow ( unused_imports ) ]use crate::{ +#![allow(unused_imports)] +use crate::{ client::Elasticsearch, error::Error, http::{ @@ -68,8 +69,8 @@ impl<'b> SnapshotCleanupRepositoryParts<'b> { } } } +#[doc = "Builder for the [Snapshot Cleanup Repository API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/clean-up-snapshot-repo-api.html)\n\nRemoves stale data from repository."] #[derive(Clone, Debug)] -#[doc = "Builder for the [Snapshot Cleanup Repository API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/clean-up-snapshot-repo-api.html)\n\nRemoves stale data from repository."] pub struct SnapshotCleanupRepository<'a, 'b, B> { transport: &'a Transport, parts: SnapshotCleanupRepositoryParts<'b>, @@ -210,6 +211,175 @@ where } } #[derive(Debug, Clone, PartialEq)] +#[doc = "API parts for the Snapshot Clone API"] +pub enum SnapshotCloneParts<'b> { + #[doc = "Repository, Snapshot and TargetSnapshot"] + RepositorySnapshotTargetSnapshot(&'b str, &'b str, &'b str), +} +impl<'b> SnapshotCloneParts<'b> { + #[doc = "Builds a relative URL path to the Snapshot Clone API"] + pub fn url(self) -> Cow<'static, str> { + match self { + SnapshotCloneParts::RepositorySnapshotTargetSnapshot( + ref repository, + ref snapshot, + ref target_snapshot, + ) => { + let encoded_repository: Cow = + percent_encode(repository.as_bytes(), PARTS_ENCODED).into(); + let encoded_snapshot: Cow = + percent_encode(snapshot.as_bytes(), PARTS_ENCODED).into(); + let encoded_target_snapshot: Cow = + percent_encode(target_snapshot.as_bytes(), PARTS_ENCODED).into(); + let mut p = String::with_capacity( + 20usize + + encoded_repository.len() + + encoded_snapshot.len() + + encoded_target_snapshot.len(), + ); + p.push_str("/_snapshot/"); + p.push_str(encoded_repository.as_ref()); + p.push_str("/"); + p.push_str(encoded_snapshot.as_ref()); + p.push_str("/_clone/"); + p.push_str(encoded_target_snapshot.as_ref()); + p.into() + } + } + } +} +#[doc = "Builder for the [Snapshot Clone API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/modules-snapshots.html)\n\nClones indices from one snapshot into another snapshot in the same repository."] +#[derive(Clone, Debug)] +pub struct SnapshotClone<'a, 'b, B> { + transport: &'a Transport, + parts: SnapshotCloneParts<'b>, + body: Option, + error_trace: Option, + filter_path: Option<&'b [&'b str]>, + headers: HeaderMap, + human: Option, + master_timeout: Option<&'b str>, + pretty: Option, + request_timeout: Option, + source: Option<&'b str>, +} +impl<'a, 'b, B> SnapshotClone<'a, 'b, B> +where + B: Body, +{ + #[doc = "Creates a new instance of [SnapshotClone] with the specified API parts"] + pub fn new(transport: &'a Transport, parts: SnapshotCloneParts<'b>) -> Self { + let headers = HeaderMap::new(); + SnapshotClone { + transport, + parts, + headers, + body: None, + error_trace: None, + filter_path: None, + human: None, + master_timeout: None, + pretty: None, + request_timeout: None, + source: None, + } + } + #[doc = "The body for the API call"] + pub fn body(self, body: T) -> SnapshotClone<'a, 'b, JsonBody> + where + T: Serialize, + { + SnapshotClone { + transport: self.transport, + parts: self.parts, + body: Some(body.into()), + error_trace: self.error_trace, + filter_path: self.filter_path, + headers: self.headers, + human: self.human, + master_timeout: self.master_timeout, + pretty: self.pretty, + request_timeout: self.request_timeout, + source: self.source, + } + } + #[doc = "Include the stack trace of returned errors."] + pub fn error_trace(mut self, error_trace: bool) -> Self { + self.error_trace = Some(error_trace); + self + } + #[doc = "A comma-separated list of filters used to reduce the response."] + pub fn filter_path(mut self, filter_path: &'b [&'b str]) -> Self { + self.filter_path = Some(filter_path); + self + } + #[doc = "Adds a HTTP header"] + pub fn header(mut self, key: HeaderName, value: HeaderValue) -> Self { + self.headers.insert(key, value); + self + } + #[doc = "Return human readable values for statistics."] + pub fn human(mut self, human: bool) -> Self { + self.human = Some(human); + self + } + #[doc = "Explicit operation timeout for connection to master node"] + pub fn master_timeout(mut self, master_timeout: &'b str) -> Self { + self.master_timeout = Some(master_timeout); + self + } + #[doc = "Pretty format the returned JSON response."] + pub fn pretty(mut self, pretty: bool) -> Self { + self.pretty = Some(pretty); + self + } + #[doc = "Sets a request timeout for this API call.\n\nThe timeout is applied from when the request starts connecting until the response body has finished."] + pub fn request_timeout(mut self, timeout: Duration) -> Self { + self.request_timeout = Some(timeout); + self + } + #[doc = "The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests."] + pub fn source(mut self, source: &'b str) -> Self { + self.source = Some(source); + self + } + #[doc = "Creates an asynchronous call to the Snapshot Clone API that can be awaited"] + pub async fn send(self) -> Result { + let path = self.parts.url(); + let method = Method::Put; + let headers = self.headers; + let timeout = self.request_timeout; + let query_string = { + #[serde_with::skip_serializing_none] + #[derive(Serialize)] + struct QueryParams<'b> { + error_trace: Option, + #[serde(serialize_with = "crate::client::serialize_coll_qs")] + filter_path: Option<&'b [&'b str]>, + human: Option, + master_timeout: Option<&'b str>, + pretty: Option, + source: Option<&'b str>, + } + let query_params = QueryParams { + error_trace: self.error_trace, + filter_path: self.filter_path, + human: self.human, + master_timeout: self.master_timeout, + pretty: self.pretty, + source: self.source, + }; + Some(query_params) + }; + let body = self.body; + let response = self + .transport + .send(method, &path, headers, query_string.as_ref(), body, timeout) + .await?; + Ok(response) + } +} +#[derive(Debug, Clone, PartialEq)] #[doc = "API parts for the Snapshot Create API"] pub enum SnapshotCreateParts<'b> { #[doc = "Repository and Snapshot"] @@ -236,8 +406,8 @@ impl<'b> SnapshotCreateParts<'b> { } } } +#[doc = "Builder for the [Snapshot Create API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/modules-snapshots.html)\n\nCreates a snapshot in a repository."] #[derive(Clone, Debug)] -#[doc = "Builder for the [Snapshot Create API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/modules-snapshots.html)\n\nCreates a snapshot in a repository."] pub struct SnapshotCreate<'a, 'b, B> { transport: &'a Transport, parts: SnapshotCreateParts<'b>, @@ -398,8 +568,8 @@ impl<'b> SnapshotCreateRepositoryParts<'b> { } } } +#[doc = "Builder for the [Snapshot Create Repository API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/modules-snapshots.html)\n\nCreates a repository."] #[derive(Clone, Debug)] -#[doc = "Builder for the [Snapshot Create Repository API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/modules-snapshots.html)\n\nCreates a repository."] pub struct SnapshotCreateRepository<'a, 'b, B> { transport: &'a Transport, parts: SnapshotCreateRepositoryParts<'b>, @@ -576,8 +746,8 @@ impl<'b> SnapshotDeleteParts<'b> { } } } +#[doc = "Builder for the [Snapshot Delete API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/modules-snapshots.html)\n\nDeletes a snapshot."] #[derive(Clone, Debug)] -#[doc = "Builder for the [Snapshot Delete API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/modules-snapshots.html)\n\nDeletes a snapshot."] pub struct SnapshotDelete<'a, 'b> { transport: &'a Transport, parts: SnapshotDeleteParts<'b>, @@ -705,8 +875,8 @@ impl<'b> SnapshotDeleteRepositoryParts<'b> { } } } +#[doc = "Builder for the [Snapshot Delete Repository API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/modules-snapshots.html)\n\nDeletes a repository."] #[derive(Clone, Debug)] -#[doc = "Builder for the [Snapshot Delete Repository API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/modules-snapshots.html)\n\nDeletes a repository."] pub struct SnapshotDeleteRepository<'a, 'b> { transport: &'a Transport, parts: SnapshotDeleteRepositoryParts<'b>, @@ -849,8 +1019,8 @@ impl<'b> SnapshotGetParts<'b> { } } } +#[doc = "Builder for the [Snapshot Get API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/modules-snapshots.html)\n\nReturns information about a snapshot."] #[derive(Clone, Debug)] -#[doc = "Builder for the [Snapshot Get API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/modules-snapshots.html)\n\nReturns information about a snapshot."] pub struct SnapshotGet<'a, 'b> { transport: &'a Transport, parts: SnapshotGetParts<'b>, @@ -975,6 +1145,127 @@ impl<'a, 'b> SnapshotGet<'a, 'b> { } } #[derive(Debug, Clone, PartialEq)] +#[doc = "API parts for the Snapshot Get Features API"] +pub enum SnapshotGetFeaturesParts { + #[doc = "No parts"] + None, +} +impl SnapshotGetFeaturesParts { + #[doc = "Builds a relative URL path to the Snapshot Get Features API"] + pub fn url(self) -> Cow<'static, str> { + match self { + SnapshotGetFeaturesParts::None => "/_snapshottable_features".into(), + } + } +} +#[doc = "Builder for the [Snapshot Get Features API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/modules-snapshots.html)\n\nReturns a list of features which can be snapshotted in this cluster."] +#[derive(Clone, Debug)] +pub struct SnapshotGetFeatures<'a, 'b> { + transport: &'a Transport, + parts: SnapshotGetFeaturesParts, + error_trace: Option, + filter_path: Option<&'b [&'b str]>, + headers: HeaderMap, + human: Option, + master_timeout: Option<&'b str>, + pretty: Option, + request_timeout: Option, + source: Option<&'b str>, +} +impl<'a, 'b> SnapshotGetFeatures<'a, 'b> { + #[doc = "Creates a new instance of [SnapshotGetFeatures]"] + pub fn new(transport: &'a Transport) -> Self { + let headers = HeaderMap::new(); + SnapshotGetFeatures { + transport, + parts: SnapshotGetFeaturesParts::None, + headers, + error_trace: None, + filter_path: None, + human: None, + master_timeout: None, + pretty: None, + request_timeout: None, + source: None, + } + } + #[doc = "Include the stack trace of returned errors."] + pub fn error_trace(mut self, error_trace: bool) -> Self { + self.error_trace = Some(error_trace); + self + } + #[doc = "A comma-separated list of filters used to reduce the response."] + pub fn filter_path(mut self, filter_path: &'b [&'b str]) -> Self { + self.filter_path = Some(filter_path); + self + } + #[doc = "Adds a HTTP header"] + pub fn header(mut self, key: HeaderName, value: HeaderValue) -> Self { + self.headers.insert(key, value); + self + } + #[doc = "Return human readable values for statistics."] + pub fn human(mut self, human: bool) -> Self { + self.human = Some(human); + self + } + #[doc = "Explicit operation timeout for connection to master node"] + pub fn master_timeout(mut self, master_timeout: &'b str) -> Self { + self.master_timeout = Some(master_timeout); + self + } + #[doc = "Pretty format the returned JSON response."] + pub fn pretty(mut self, pretty: bool) -> Self { + self.pretty = Some(pretty); + self + } + #[doc = "Sets a request timeout for this API call.\n\nThe timeout is applied from when the request starts connecting until the response body has finished."] + pub fn request_timeout(mut self, timeout: Duration) -> Self { + self.request_timeout = Some(timeout); + self + } + #[doc = "The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests."] + pub fn source(mut self, source: &'b str) -> Self { + self.source = Some(source); + self + } + #[doc = "Creates an asynchronous call to the Snapshot Get Features API that can be awaited"] + pub async fn send(self) -> Result { + let path = self.parts.url(); + let method = Method::Get; + let headers = self.headers; + let timeout = self.request_timeout; + let query_string = { + #[serde_with::skip_serializing_none] + #[derive(Serialize)] + struct QueryParams<'b> { + error_trace: Option, + #[serde(serialize_with = "crate::client::serialize_coll_qs")] + filter_path: Option<&'b [&'b str]>, + human: Option, + master_timeout: Option<&'b str>, + pretty: Option, + source: Option<&'b str>, + } + let query_params = QueryParams { + error_trace: self.error_trace, + filter_path: self.filter_path, + human: self.human, + master_timeout: self.master_timeout, + pretty: self.pretty, + source: self.source, + }; + Some(query_params) + }; + let body = Option::<()>::None; + let response = self + .transport + .send(method, &path, headers, query_string.as_ref(), body, timeout) + .await?; + Ok(response) + } +} +#[derive(Debug, Clone, PartialEq)] #[doc = "API parts for the Snapshot Get Repository API"] pub enum SnapshotGetRepositoryParts<'b> { #[doc = "No parts"] @@ -999,8 +1290,8 @@ impl<'b> SnapshotGetRepositoryParts<'b> { } } } +#[doc = "Builder for the [Snapshot Get Repository API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/modules-snapshots.html)\n\nReturns information about a repository."] #[derive(Clone, Debug)] -#[doc = "Builder for the [Snapshot Get Repository API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/modules-snapshots.html)\n\nReturns information about a repository."] pub struct SnapshotGetRepository<'a, 'b> { transport: &'a Transport, parts: SnapshotGetRepositoryParts<'b>, @@ -1143,8 +1434,8 @@ impl<'b> SnapshotRestoreParts<'b> { } } } +#[doc = "Builder for the [Snapshot Restore API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/modules-snapshots.html)\n\nRestores a snapshot."] #[derive(Clone, Debug)] -#[doc = "Builder for the [Snapshot Restore API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/modules-snapshots.html)\n\nRestores a snapshot."] pub struct SnapshotRestore<'a, 'b, B> { transport: &'a Transport, parts: SnapshotRestoreParts<'b>, @@ -1327,8 +1618,8 @@ impl<'b> SnapshotStatusParts<'b> { } } } +#[doc = "Builder for the [Snapshot Status API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/modules-snapshots.html)\n\nReturns information about the status of a snapshot."] #[derive(Clone, Debug)] -#[doc = "Builder for the [Snapshot Status API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/modules-snapshots.html)\n\nReturns information about the status of a snapshot."] pub struct SnapshotStatus<'a, 'b> { transport: &'a Transport, parts: SnapshotStatusParts<'b>, @@ -1465,8 +1756,8 @@ impl<'b> SnapshotVerifyRepositoryParts<'b> { } } } +#[doc = "Builder for the [Snapshot Verify Repository API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/modules-snapshots.html)\n\nVerifies a repository."] #[derive(Clone, Debug)] -#[doc = "Builder for the [Snapshot Verify Repository API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/modules-snapshots.html)\n\nVerifies a repository."] pub struct SnapshotVerifyRepository<'a, 'b, B> { transport: &'a Transport, parts: SnapshotVerifyRepositoryParts<'b>, @@ -1618,55 +1909,63 @@ impl<'a> Snapshot<'a> { pub fn transport(&self) -> &Transport { self.transport } - #[doc = "[Snapshot Cleanup Repository API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/clean-up-snapshot-repo-api.html)\n\nRemoves stale data from repository."] + #[doc = "[Snapshot Cleanup Repository API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/clean-up-snapshot-repo-api.html)\n\nRemoves stale data from repository."] pub fn cleanup_repository<'b>( &'a self, parts: SnapshotCleanupRepositoryParts<'b>, ) -> SnapshotCleanupRepository<'a, 'b, ()> { SnapshotCleanupRepository::new(self.transport(), parts) } - #[doc = "[Snapshot Create API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/modules-snapshots.html)\n\nCreates a snapshot in a repository."] + #[doc = "[Snapshot Clone API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/modules-snapshots.html)\n\nClones indices from one snapshot into another snapshot in the same repository."] + pub fn clone<'b>(&'a self, parts: SnapshotCloneParts<'b>) -> SnapshotClone<'a, 'b, ()> { + SnapshotClone::new(self.transport(), parts) + } + #[doc = "[Snapshot Create API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/modules-snapshots.html)\n\nCreates a snapshot in a repository."] pub fn create<'b>(&'a self, parts: SnapshotCreateParts<'b>) -> SnapshotCreate<'a, 'b, ()> { SnapshotCreate::new(self.transport(), parts) } - #[doc = "[Snapshot Create Repository API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/modules-snapshots.html)\n\nCreates a repository."] + #[doc = "[Snapshot Create Repository API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/modules-snapshots.html)\n\nCreates a repository."] pub fn create_repository<'b>( &'a self, parts: SnapshotCreateRepositoryParts<'b>, ) -> SnapshotCreateRepository<'a, 'b, ()> { SnapshotCreateRepository::new(self.transport(), parts) } - #[doc = "[Snapshot Delete API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/modules-snapshots.html)\n\nDeletes a snapshot."] + #[doc = "[Snapshot Delete API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/modules-snapshots.html)\n\nDeletes a snapshot."] pub fn delete<'b>(&'a self, parts: SnapshotDeleteParts<'b>) -> SnapshotDelete<'a, 'b> { SnapshotDelete::new(self.transport(), parts) } - #[doc = "[Snapshot Delete Repository API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/modules-snapshots.html)\n\nDeletes a repository."] + #[doc = "[Snapshot Delete Repository API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/modules-snapshots.html)\n\nDeletes a repository."] pub fn delete_repository<'b>( &'a self, parts: SnapshotDeleteRepositoryParts<'b>, ) -> SnapshotDeleteRepository<'a, 'b> { SnapshotDeleteRepository::new(self.transport(), parts) } - #[doc = "[Snapshot Get API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/modules-snapshots.html)\n\nReturns information about a snapshot."] + #[doc = "[Snapshot Get API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/modules-snapshots.html)\n\nReturns information about a snapshot."] pub fn get<'b>(&'a self, parts: SnapshotGetParts<'b>) -> SnapshotGet<'a, 'b> { SnapshotGet::new(self.transport(), parts) } - #[doc = "[Snapshot Get Repository API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/modules-snapshots.html)\n\nReturns information about a repository."] + #[doc = "[Snapshot Get Features API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/modules-snapshots.html)\n\nReturns a list of features which can be snapshotted in this cluster."] + pub fn get_features<'b>(&'a self) -> SnapshotGetFeatures<'a, 'b> { + SnapshotGetFeatures::new(self.transport()) + } + #[doc = "[Snapshot Get Repository API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/modules-snapshots.html)\n\nReturns information about a repository."] pub fn get_repository<'b>( &'a self, parts: SnapshotGetRepositoryParts<'b>, ) -> SnapshotGetRepository<'a, 'b> { SnapshotGetRepository::new(self.transport(), parts) } - #[doc = "[Snapshot Restore API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/modules-snapshots.html)\n\nRestores a snapshot."] + #[doc = "[Snapshot Restore API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/modules-snapshots.html)\n\nRestores a snapshot."] pub fn restore<'b>(&'a self, parts: SnapshotRestoreParts<'b>) -> SnapshotRestore<'a, 'b, ()> { SnapshotRestore::new(self.transport(), parts) } - #[doc = "[Snapshot Status API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/modules-snapshots.html)\n\nReturns information about the status of a snapshot."] + #[doc = "[Snapshot Status API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/modules-snapshots.html)\n\nReturns information about the status of a snapshot."] pub fn status<'b>(&'a self, parts: SnapshotStatusParts<'b>) -> SnapshotStatus<'a, 'b> { SnapshotStatus::new(self.transport(), parts) } - #[doc = "[Snapshot Verify Repository API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/modules-snapshots.html)\n\nVerifies a repository."] + #[doc = "[Snapshot Verify Repository API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/modules-snapshots.html)\n\nVerifies a repository."] pub fn verify_repository<'b>( &'a self, parts: SnapshotVerifyRepositoryParts<'b>, diff --git a/elasticsearch/src/sql.rs b/elasticsearch/src/sql.rs index 2fbc1e48..8b5bf8d6 100644 --- a/elasticsearch/src/sql.rs +++ b/elasticsearch/src/sql.rs @@ -28,7 +28,8 @@ //! //! [Execute SQL queries against Elasticsearch indices and return results in tabular format](https://www.elastic.co/guide/en/elasticsearch/reference/master/xpack-sql.html). -# ! [ allow ( unused_imports ) ]use crate::{ +#![allow(unused_imports)] +use crate::{ client::Elasticsearch, error::Error, http::{ @@ -57,8 +58,8 @@ impl SqlClearCursorParts { } } } +#[doc = "Builder for the [Sql Clear Cursor API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/sql-pagination.html)\n\nClears the SQL cursor"] #[derive(Clone, Debug)] -#[doc = "Builder for the [Sql Clear Cursor API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/sql-pagination.html)\n\nClears the SQL cursor"] pub struct SqlClearCursor<'a, 'b, B> { transport: &'a Transport, parts: SqlClearCursorParts, @@ -192,8 +193,8 @@ impl SqlQueryParts { } } } +#[doc = "Builder for the [Sql Query API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/sql-rest-overview.html)\n\nExecutes a SQL request"] #[derive(Clone, Debug)] -#[doc = "Builder for the [Sql Query API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/sql-rest-overview.html)\n\nExecutes a SQL request"] pub struct SqlQuery<'a, 'b, B> { transport: &'a Transport, parts: SqlQueryParts, @@ -340,8 +341,8 @@ impl SqlTranslateParts { } } } +#[doc = "Builder for the [Sql Translate API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/sql-translate.html)\n\nTranslates SQL into Elasticsearch queries"] #[derive(Clone, Debug)] -#[doc = "Builder for the [Sql Translate API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/sql-translate.html)\n\nTranslates SQL into Elasticsearch queries"] pub struct SqlTranslate<'a, 'b, B> { transport: &'a Transport, parts: SqlTranslateParts, @@ -476,15 +477,15 @@ impl<'a> Sql<'a> { pub fn transport(&self) -> &Transport { self.transport } - #[doc = "[Sql Clear Cursor API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/sql-pagination.html)\n\nClears the SQL cursor"] + #[doc = "[Sql Clear Cursor API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/sql-pagination.html)\n\nClears the SQL cursor"] pub fn clear_cursor<'b>(&'a self) -> SqlClearCursor<'a, 'b, ()> { SqlClearCursor::new(self.transport()) } - #[doc = "[Sql Query API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/sql-rest-overview.html)\n\nExecutes a SQL request"] + #[doc = "[Sql Query API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/sql-rest-overview.html)\n\nExecutes a SQL request"] pub fn query<'b>(&'a self) -> SqlQuery<'a, 'b, ()> { SqlQuery::new(self.transport()) } - #[doc = "[Sql Translate API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/sql-translate.html)\n\nTranslates SQL into Elasticsearch queries"] + #[doc = "[Sql Translate API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/sql-translate.html)\n\nTranslates SQL into Elasticsearch queries"] pub fn translate<'b>(&'a self) -> SqlTranslate<'a, 'b, ()> { SqlTranslate::new(self.transport()) } diff --git a/elasticsearch/src/ssl.rs b/elasticsearch/src/ssl.rs index 94c04875..1000de2a 100644 --- a/elasticsearch/src/ssl.rs +++ b/elasticsearch/src/ssl.rs @@ -28,7 +28,8 @@ //! //! [Retrieve information about the X.509 certificates used to encrypt communications in the cluster](https://www.elastic.co/guide/en/elasticsearch/reference/master/security-api-ssl.html). -# ! [ allow ( unused_imports ) ]use crate::{ +#![allow(unused_imports)] +use crate::{ client::Elasticsearch, error::Error, http::{ @@ -57,8 +58,8 @@ impl SslCertificatesParts { } } } +#[doc = "Builder for the [Ssl Certificates API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/security-api-ssl.html)\n\nRetrieves information about the X.509 certificates used to encrypt communications in the cluster."] #[derive(Clone, Debug)] -#[doc = "Builder for the [Ssl Certificates API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/security-api-ssl.html)\n\nRetrieves information about the X.509 certificates used to encrypt communications in the cluster."] pub struct SslCertificates<'a, 'b> { transport: &'a Transport, parts: SslCertificatesParts, @@ -167,7 +168,7 @@ impl<'a> Ssl<'a> { pub fn transport(&self) -> &Transport { self.transport } - #[doc = "[Ssl Certificates API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/security-api-ssl.html)\n\nRetrieves information about the X.509 certificates used to encrypt communications in the cluster."] + #[doc = "[Ssl Certificates API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/security-api-ssl.html)\n\nRetrieves information about the X.509 certificates used to encrypt communications in the cluster."] pub fn certificates<'b>(&'a self) -> SslCertificates<'a, 'b> { SslCertificates::new(self.transport()) } diff --git a/elasticsearch/src/tasks.rs b/elasticsearch/src/tasks.rs index e89fd443..701d8902 100644 --- a/elasticsearch/src/tasks.rs +++ b/elasticsearch/src/tasks.rs @@ -28,7 +28,10 @@ //! //! [Manage tasks currently executing on one or more nodes in the cluster](https://www.elastic.co/guide/en/elasticsearch/reference/master/tasks.html). -# ! [ allow ( unused_imports ) ]use crate::{ +#![cfg(feature = "experimental-apis")] +#![doc = " \n# Optional, experimental\nThis requires the `experimental-apis` feature. Can have breaking changes in future\nversions or might even be removed entirely.\n "] +#![allow(unused_imports)] +use crate::{ client::Elasticsearch, error::Error, http::{ @@ -43,6 +46,7 @@ use percent_encoding::percent_encode; use serde::Serialize; use std::{borrow::Cow, time::Duration}; +#[cfg(feature = "experimental-apis")] #[derive(Debug, Clone, PartialEq)] #[doc = "API parts for the Tasks Cancel API"] pub enum TasksCancelParts<'b> { @@ -51,6 +55,7 @@ pub enum TasksCancelParts<'b> { #[doc = "TaskId"] TaskId(&'b str), } +#[cfg(feature = "experimental-apis")] impl<'b> TasksCancelParts<'b> { #[doc = "Builds a relative URL path to the Tasks Cancel API"] pub fn url(self) -> Cow<'static, str> { @@ -68,8 +73,10 @@ impl<'b> TasksCancelParts<'b> { } } } +#[doc = "Builder for the [Tasks Cancel API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/tasks.html)\n\nCancels a task, if it can be cancelled through an API."] +#[doc = " \n# Optional, experimental\nThis requires the `experimental-apis` feature. Can have breaking changes in future\nversions or might even be removed entirely.\n "] +#[cfg(feature = "experimental-apis")] #[derive(Clone, Debug)] -#[doc = "Builder for the [Tasks Cancel API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/tasks.html)\n\nCancels a task, if it can be cancelled through an API."] pub struct TasksCancel<'a, 'b, B> { transport: &'a Transport, parts: TasksCancelParts<'b>, @@ -86,6 +93,7 @@ pub struct TasksCancel<'a, 'b, B> { source: Option<&'b str>, wait_for_completion: Option, } +#[cfg(feature = "experimental-apis")] impl<'a, 'b, B> TasksCancel<'a, 'b, B> where B: Body, @@ -231,12 +239,14 @@ where Ok(response) } } +#[cfg(feature = "experimental-apis")] #[derive(Debug, Clone, PartialEq)] #[doc = "API parts for the Tasks Get API"] pub enum TasksGetParts<'b> { #[doc = "TaskId"] TaskId(&'b str), } +#[cfg(feature = "experimental-apis")] impl<'b> TasksGetParts<'b> { #[doc = "Builds a relative URL path to the Tasks Get API"] pub fn url(self) -> Cow<'static, str> { @@ -252,8 +262,10 @@ impl<'b> TasksGetParts<'b> { } } } +#[doc = "Builder for the [Tasks Get API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/tasks.html)\n\nReturns information about a task."] +#[doc = " \n# Optional, experimental\nThis requires the `experimental-apis` feature. Can have breaking changes in future\nversions or might even be removed entirely.\n "] +#[cfg(feature = "experimental-apis")] #[derive(Clone, Debug)] -#[doc = "Builder for the [Tasks Get API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/tasks.html)\n\nReturns information about a task."] pub struct TasksGet<'a, 'b> { transport: &'a Transport, parts: TasksGetParts<'b>, @@ -267,6 +279,7 @@ pub struct TasksGet<'a, 'b> { timeout: Option<&'b str>, wait_for_completion: Option, } +#[cfg(feature = "experimental-apis")] impl<'a, 'b> TasksGet<'a, 'b> { #[doc = "Creates a new instance of [TasksGet] with the specified API parts"] pub fn new(transport: &'a Transport, parts: TasksGetParts<'b>) -> Self { @@ -368,12 +381,14 @@ impl<'a, 'b> TasksGet<'a, 'b> { Ok(response) } } +#[cfg(feature = "experimental-apis")] #[derive(Debug, Clone, PartialEq)] #[doc = "API parts for the Tasks List API"] pub enum TasksListParts { #[doc = "No parts"] None, } +#[cfg(feature = "experimental-apis")] impl TasksListParts { #[doc = "Builds a relative URL path to the Tasks List API"] pub fn url(self) -> Cow<'static, str> { @@ -382,8 +397,10 @@ impl TasksListParts { } } } +#[doc = "Builder for the [Tasks List API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/tasks.html)\n\nReturns a list of tasks."] +#[doc = " \n# Optional, experimental\nThis requires the `experimental-apis` feature. Can have breaking changes in future\nversions or might even be removed entirely.\n "] +#[cfg(feature = "experimental-apis")] #[derive(Clone, Debug)] -#[doc = "Builder for the [Tasks List API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/tasks.html)\n\nReturns a list of tasks."] pub struct TasksList<'a, 'b> { transport: &'a Transport, parts: TasksListParts, @@ -402,6 +419,7 @@ pub struct TasksList<'a, 'b> { timeout: Option<&'b str>, wait_for_completion: Option, } +#[cfg(feature = "experimental-apis")] impl<'a, 'b> TasksList<'a, 'b> { #[doc = "Creates a new instance of [TasksList]"] pub fn new(transport: &'a Transport) -> Self { @@ -546,9 +564,12 @@ impl<'a, 'b> TasksList<'a, 'b> { } } #[doc = "Namespace client for Tasks APIs"] +#[doc = " \n# Optional, experimental\nThis requires the `experimental-apis` feature. Can have breaking changes in future\nversions or might even be removed entirely.\n "] +#[cfg(feature = "experimental-apis")] pub struct Tasks<'a> { transport: &'a Transport, } +#[cfg(feature = "experimental-apis")] impl<'a> Tasks<'a> { #[doc = "Creates a new instance of [Tasks]"] pub fn new(transport: &'a Transport) -> Self { @@ -557,19 +578,26 @@ impl<'a> Tasks<'a> { pub fn transport(&self) -> &Transport { self.transport } - #[doc = "[Tasks Cancel API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/tasks.html)\n\nCancels a task, if it can be cancelled through an API."] + #[doc = "[Tasks Cancel API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/tasks.html)\n\nCancels a task, if it can be cancelled through an API."] + #[doc = " \n# Optional, experimental\nThis requires the `experimental-apis` feature. Can have breaking changes in future\nversions or might even be removed entirely.\n "] + #[cfg(feature = "experimental-apis")] pub fn cancel<'b>(&'a self, parts: TasksCancelParts<'b>) -> TasksCancel<'a, 'b, ()> { TasksCancel::new(self.transport(), parts) } - #[doc = "[Tasks Get API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/tasks.html)\n\nReturns information about a task."] + #[doc = "[Tasks Get API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/tasks.html)\n\nReturns information about a task."] + #[doc = " \n# Optional, experimental\nThis requires the `experimental-apis` feature. Can have breaking changes in future\nversions or might even be removed entirely.\n "] + #[cfg(feature = "experimental-apis")] pub fn get<'b>(&'a self, parts: TasksGetParts<'b>) -> TasksGet<'a, 'b> { TasksGet::new(self.transport(), parts) } - #[doc = "[Tasks List API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/tasks.html)\n\nReturns a list of tasks."] + #[doc = "[Tasks List API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/tasks.html)\n\nReturns a list of tasks."] + #[doc = " \n# Optional, experimental\nThis requires the `experimental-apis` feature. Can have breaking changes in future\nversions or might even be removed entirely.\n "] + #[cfg(feature = "experimental-apis")] pub fn list<'b>(&'a self) -> TasksList<'a, 'b> { TasksList::new(self.transport()) } } +#[cfg(feature = "experimental-apis")] impl Elasticsearch { #[doc = "Creates a namespace client for Tasks APIs"] pub fn tasks(&self) -> Tasks { diff --git a/elasticsearch/src/text_structure.rs b/elasticsearch/src/text_structure.rs new file mode 100644 index 00000000..ee83d5eb --- /dev/null +++ b/elasticsearch/src/text_structure.rs @@ -0,0 +1,359 @@ +/* + * Licensed to Elasticsearch B.V. under one or more contributor + * license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright + * ownership. Elasticsearch B.V. licenses this file to you under + * the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +// ----------------------------------------------- +// This file is generated, Please do not edit it manually. +// Run the following in the root of the repo to regenerate: +// +// cargo make generate-api +// ----------------------------------------------- + +//! Text structure APIs +//! +//! Determines the structure of text and other information that will be useful to import its contents to an Elasticsearch +//! index. + +#![cfg(feature = "experimental-apis")] +#![doc = " \n# Optional, experimental\nThis requires the `experimental-apis` feature. Can have breaking changes in future\nversions or might even be removed entirely.\n "] +#![allow(unused_imports)] +use crate::{ + client::Elasticsearch, + error::Error, + http::{ + headers::{HeaderMap, HeaderName, HeaderValue, ACCEPT, CONTENT_TYPE}, + request::{Body, JsonBody, NdBody, PARTS_ENCODED}, + response::Response, + transport::Transport, + Method, + }, + params::*, +}; +use percent_encoding::percent_encode; +use serde::Serialize; +use std::{borrow::Cow, time::Duration}; +#[cfg(feature = "experimental-apis")] +#[derive(Debug, Clone, PartialEq)] +#[doc = "API parts for the Text Structure Find Structure API"] +pub enum TextStructureFindStructureParts { + #[doc = "No parts"] + None, +} +#[cfg(feature = "experimental-apis")] +impl TextStructureFindStructureParts { + #[doc = "Builds a relative URL path to the Text Structure Find Structure API"] + pub fn url(self) -> Cow<'static, str> { + match self { + TextStructureFindStructureParts::None => "/_text_structure/find_structure".into(), + } + } +} +#[doc = "Builder for the [Text Structure Find Structure API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/find-structure.html)\n\nFinds the structure of a text file. The text file must contain data that is suitable to be ingested into Elasticsearch."] +#[doc = " \n# Optional, experimental\nThis requires the `experimental-apis` feature. Can have breaking changes in future\nversions or might even be removed entirely.\n "] +#[cfg(feature = "experimental-apis")] +#[derive(Clone, Debug)] +pub struct TextStructureFindStructure<'a, 'b, B> { + transport: &'a Transport, + parts: TextStructureFindStructureParts, + body: Option, + charset: Option<&'b str>, + column_names: Option<&'b [&'b str]>, + delimiter: Option<&'b str>, + error_trace: Option, + explain: Option, + filter_path: Option<&'b [&'b str]>, + format: Option, + grok_pattern: Option<&'b str>, + has_header_row: Option, + headers: HeaderMap, + human: Option, + line_merge_size_limit: Option, + lines_to_sample: Option, + pretty: Option, + quote: Option<&'b str>, + request_timeout: Option, + should_trim_fields: Option, + source: Option<&'b str>, + timeout: Option<&'b str>, + timestamp_field: Option<&'b str>, + timestamp_format: Option<&'b str>, +} +#[cfg(feature = "experimental-apis")] +impl<'a, 'b, B> TextStructureFindStructure<'a, 'b, B> +where + B: Body, +{ + #[doc = "Creates a new instance of [TextStructureFindStructure]"] + pub fn new(transport: &'a Transport) -> Self { + let headers = HeaderMap::new(); + TextStructureFindStructure { + transport, + parts: TextStructureFindStructureParts::None, + headers, + body: None, + charset: None, + column_names: None, + delimiter: None, + error_trace: None, + explain: None, + filter_path: None, + format: None, + grok_pattern: None, + has_header_row: None, + human: None, + line_merge_size_limit: None, + lines_to_sample: None, + pretty: None, + quote: None, + request_timeout: None, + should_trim_fields: None, + source: None, + timeout: None, + timestamp_field: None, + timestamp_format: None, + } + } + #[doc = "The body for the API call"] + pub fn body(self, body: Vec) -> TextStructureFindStructure<'a, 'b, NdBody> + where + T: Body, + { + TextStructureFindStructure { + transport: self.transport, + parts: self.parts, + body: Some(NdBody(body)), + charset: self.charset, + column_names: self.column_names, + delimiter: self.delimiter, + error_trace: self.error_trace, + explain: self.explain, + filter_path: self.filter_path, + format: self.format, + grok_pattern: self.grok_pattern, + has_header_row: self.has_header_row, + headers: self.headers, + human: self.human, + line_merge_size_limit: self.line_merge_size_limit, + lines_to_sample: self.lines_to_sample, + pretty: self.pretty, + quote: self.quote, + request_timeout: self.request_timeout, + should_trim_fields: self.should_trim_fields, + source: self.source, + timeout: self.timeout, + timestamp_field: self.timestamp_field, + timestamp_format: self.timestamp_format, + } + } + #[doc = "Optional parameter to specify the character set of the file"] + pub fn charset(mut self, charset: &'b str) -> Self { + self.charset = Some(charset); + self + } + #[doc = "Optional parameter containing a comma separated list of the column names for a delimited file"] + pub fn column_names(mut self, column_names: &'b [&'b str]) -> Self { + self.column_names = Some(column_names); + self + } + #[doc = "Optional parameter to specify the delimiter character for a delimited file - must be a single character"] + pub fn delimiter(mut self, delimiter: &'b str) -> Self { + self.delimiter = Some(delimiter); + self + } + #[doc = "Include the stack trace of returned errors."] + pub fn error_trace(mut self, error_trace: bool) -> Self { + self.error_trace = Some(error_trace); + self + } + #[doc = "Whether to include a commentary on how the structure was derived"] + pub fn explain(mut self, explain: bool) -> Self { + self.explain = Some(explain); + self + } + #[doc = "A comma-separated list of filters used to reduce the response."] + pub fn filter_path(mut self, filter_path: &'b [&'b str]) -> Self { + self.filter_path = Some(filter_path); + self + } + #[doc = "Optional parameter to specify the high level file format"] + pub fn format(mut self, format: Format) -> Self { + self.format = Some(format); + self + } + #[doc = "Optional parameter to specify the Grok pattern that should be used to extract fields from messages in a semi-structured text file"] + pub fn grok_pattern(mut self, grok_pattern: &'b str) -> Self { + self.grok_pattern = Some(grok_pattern); + self + } + #[doc = "Optional parameter to specify whether a delimited file includes the column names in its first row"] + pub fn has_header_row(mut self, has_header_row: bool) -> Self { + self.has_header_row = Some(has_header_row); + self + } + #[doc = "Adds a HTTP header"] + pub fn header(mut self, key: HeaderName, value: HeaderValue) -> Self { + self.headers.insert(key, value); + self + } + #[doc = "Return human readable values for statistics."] + pub fn human(mut self, human: bool) -> Self { + self.human = Some(human); + self + } + #[doc = "Maximum number of characters permitted in a single message when lines are merged to create messages."] + pub fn line_merge_size_limit(mut self, line_merge_size_limit: i32) -> Self { + self.line_merge_size_limit = Some(line_merge_size_limit); + self + } + #[doc = "How many lines of the file should be included in the analysis"] + pub fn lines_to_sample(mut self, lines_to_sample: i32) -> Self { + self.lines_to_sample = Some(lines_to_sample); + self + } + #[doc = "Pretty format the returned JSON response."] + pub fn pretty(mut self, pretty: bool) -> Self { + self.pretty = Some(pretty); + self + } + #[doc = "Optional parameter to specify the quote character for a delimited file - must be a single character"] + pub fn quote(mut self, quote: &'b str) -> Self { + self.quote = Some(quote); + self + } + #[doc = "Sets a request timeout for this API call.\n\nThe timeout is applied from when the request starts connecting until the response body has finished."] + pub fn request_timeout(mut self, timeout: Duration) -> Self { + self.request_timeout = Some(timeout); + self + } + #[doc = "Optional parameter to specify whether the values between delimiters in a delimited file should have whitespace trimmed from them"] + pub fn should_trim_fields(mut self, should_trim_fields: bool) -> Self { + self.should_trim_fields = Some(should_trim_fields); + self + } + #[doc = "The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests."] + pub fn source(mut self, source: &'b str) -> Self { + self.source = Some(source); + self + } + #[doc = "Timeout after which the analysis will be aborted"] + pub fn timeout(mut self, timeout: &'b str) -> Self { + self.timeout = Some(timeout); + self + } + #[doc = "Optional parameter to specify the timestamp field in the file"] + pub fn timestamp_field(mut self, timestamp_field: &'b str) -> Self { + self.timestamp_field = Some(timestamp_field); + self + } + #[doc = "Optional parameter to specify the timestamp format in the file - may be either a Joda or Java time format"] + pub fn timestamp_format(mut self, timestamp_format: &'b str) -> Self { + self.timestamp_format = Some(timestamp_format); + self + } + #[doc = "Creates an asynchronous call to the Text Structure Find Structure API that can be awaited"] + pub async fn send(self) -> Result { + let path = self.parts.url(); + let method = Method::Post; + let headers = self.headers; + let timeout = self.request_timeout; + let query_string = { + #[serde_with::skip_serializing_none] + #[derive(Serialize)] + struct QueryParams<'b> { + charset: Option<&'b str>, + #[serde(serialize_with = "crate::client::serialize_coll_qs")] + column_names: Option<&'b [&'b str]>, + delimiter: Option<&'b str>, + error_trace: Option, + explain: Option, + #[serde(serialize_with = "crate::client::serialize_coll_qs")] + filter_path: Option<&'b [&'b str]>, + format: Option, + grok_pattern: Option<&'b str>, + has_header_row: Option, + human: Option, + line_merge_size_limit: Option, + lines_to_sample: Option, + pretty: Option, + quote: Option<&'b str>, + should_trim_fields: Option, + source: Option<&'b str>, + timeout: Option<&'b str>, + timestamp_field: Option<&'b str>, + timestamp_format: Option<&'b str>, + } + let query_params = QueryParams { + charset: self.charset, + column_names: self.column_names, + delimiter: self.delimiter, + error_trace: self.error_trace, + explain: self.explain, + filter_path: self.filter_path, + format: self.format, + grok_pattern: self.grok_pattern, + has_header_row: self.has_header_row, + human: self.human, + line_merge_size_limit: self.line_merge_size_limit, + lines_to_sample: self.lines_to_sample, + pretty: self.pretty, + quote: self.quote, + should_trim_fields: self.should_trim_fields, + source: self.source, + timeout: self.timeout, + timestamp_field: self.timestamp_field, + timestamp_format: self.timestamp_format, + }; + Some(query_params) + }; + let body = self.body; + let response = self + .transport + .send(method, &path, headers, query_string.as_ref(), body, timeout) + .await?; + Ok(response) + } +} +#[doc = "Namespace client for TextStructure APIs"] +#[doc = " \n# Optional, experimental\nThis requires the `experimental-apis` feature. Can have breaking changes in future\nversions or might even be removed entirely.\n "] +#[cfg(feature = "experimental-apis")] +pub struct TextStructure<'a> { + transport: &'a Transport, +} +#[cfg(feature = "experimental-apis")] +impl<'a> TextStructure<'a> { + #[doc = "Creates a new instance of [TextStructure]"] + pub fn new(transport: &'a Transport) -> Self { + Self { transport } + } + pub fn transport(&self) -> &Transport { + self.transport + } + #[doc = "[Text Structure Find Structure API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/find-structure.html)\n\nFinds the structure of a text file. The text file must contain data that is suitable to be ingested into Elasticsearch."] + #[doc = " \n# Optional, experimental\nThis requires the `experimental-apis` feature. Can have breaking changes in future\nversions or might even be removed entirely.\n "] + #[cfg(feature = "experimental-apis")] + pub fn find_structure<'b>(&'a self) -> TextStructureFindStructure<'a, 'b, ()> { + TextStructureFindStructure::new(self.transport()) + } +} +#[cfg(feature = "experimental-apis")] +impl Elasticsearch { + #[doc = "Creates a namespace client for TextStructure APIs"] + pub fn text_structure(&self) -> TextStructure { + TextStructure::new(self.transport()) + } +} diff --git a/elasticsearch/src/transform.rs b/elasticsearch/src/transform.rs index 09efd41a..55d54fde 100644 --- a/elasticsearch/src/transform.rs +++ b/elasticsearch/src/transform.rs @@ -30,7 +30,8 @@ //! can be used to copy data from source indices, transforms it, and persists it into an //! entity-centric destination index. -# ! [ allow ( unused_imports ) ]use crate::{ +#![allow(unused_imports)] +use crate::{ client::Elasticsearch, error::Error, http::{ @@ -66,8 +67,8 @@ impl<'b> TransformDeleteTransformParts<'b> { } } } +#[doc = "Builder for the [Transform Delete Transform API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/delete-transform.html)\n\nDeletes an existing transform."] #[derive(Clone, Debug)] -#[doc = "Builder for the [Transform Delete Transform API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/delete-transform.html)\n\nDeletes an existing transform."] pub struct TransformDeleteTransform<'a, 'b> { transport: &'a Transport, parts: TransformDeleteTransformParts<'b>, @@ -197,13 +198,14 @@ impl<'b> TransformGetTransformParts<'b> { } } } +#[doc = "Builder for the [Transform Get Transform API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/get-transform.html)\n\nRetrieves configuration information for transforms."] #[derive(Clone, Debug)] -#[doc = "Builder for the [Transform Get Transform API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/get-transform.html)\n\nRetrieves configuration information for transforms."] pub struct TransformGetTransform<'a, 'b> { transport: &'a Transport, parts: TransformGetTransformParts<'b>, allow_no_match: Option, error_trace: Option, + exclude_generated: Option, filter_path: Option<&'b [&'b str]>, from: Option, headers: HeaderMap, @@ -223,6 +225,7 @@ impl<'a, 'b> TransformGetTransform<'a, 'b> { headers, allow_no_match: None, error_trace: None, + exclude_generated: None, filter_path: None, from: None, human: None, @@ -242,6 +245,11 @@ impl<'a, 'b> TransformGetTransform<'a, 'b> { self.error_trace = Some(error_trace); self } + #[doc = "Omits fields that are illegal to set on transform PUT"] + pub fn exclude_generated(mut self, exclude_generated: bool) -> Self { + self.exclude_generated = Some(exclude_generated); + self + } #[doc = "A comma-separated list of filters used to reduce the response."] pub fn filter_path(mut self, filter_path: &'b [&'b str]) -> Self { self.filter_path = Some(filter_path); @@ -294,6 +302,7 @@ impl<'a, 'b> TransformGetTransform<'a, 'b> { struct QueryParams<'b> { allow_no_match: Option, error_trace: Option, + exclude_generated: Option, #[serde(serialize_with = "crate::client::serialize_coll_qs")] filter_path: Option<&'b [&'b str]>, from: Option, @@ -305,6 +314,7 @@ impl<'a, 'b> TransformGetTransform<'a, 'b> { let query_params = QueryParams { allow_no_match: self.allow_no_match, error_trace: self.error_trace, + exclude_generated: self.exclude_generated, filter_path: self.filter_path, from: self.from, human: self.human, @@ -344,8 +354,8 @@ impl<'b> TransformGetTransformStatsParts<'b> { } } } +#[doc = "Builder for the [Transform Get Transform Stats API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/get-transform-stats.html)\n\nRetrieves usage information for transforms."] #[derive(Clone, Debug)] -#[doc = "Builder for the [Transform Get Transform Stats API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/get-transform-stats.html)\n\nRetrieves usage information for transforms."] pub struct TransformGetTransformStats<'a, 'b> { transport: &'a Transport, parts: TransformGetTransformStatsParts<'b>, @@ -483,8 +493,8 @@ impl TransformPreviewTransformParts { } } } +#[doc = "Builder for the [Transform Preview Transform API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/preview-transform.html)\n\nPreviews a transform."] #[derive(Clone, Debug)] -#[doc = "Builder for the [Transform Preview Transform API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/preview-transform.html)\n\nPreviews a transform."] pub struct TransformPreviewTransform<'a, 'b, B> { transport: &'a Transport, parts: TransformPreviewTransformParts, @@ -625,8 +635,8 @@ impl<'b> TransformPutTransformParts<'b> { } } } +#[doc = "Builder for the [Transform Put Transform API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/put-transform.html)\n\nInstantiates a transform."] #[derive(Clone, Debug)] -#[doc = "Builder for the [Transform Put Transform API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/put-transform.html)\n\nInstantiates a transform."] pub struct TransformPutTransform<'a, 'b, B> { transport: &'a Transport, parts: TransformPutTransformParts<'b>, @@ -778,8 +788,8 @@ impl<'b> TransformStartTransformParts<'b> { } } } +#[doc = "Builder for the [Transform Start Transform API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/start-transform.html)\n\nStarts one or more transforms."] #[derive(Clone, Debug)] -#[doc = "Builder for the [Transform Start Transform API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/start-transform.html)\n\nStarts one or more transforms."] pub struct TransformStartTransform<'a, 'b, B> { transport: &'a Transport, parts: TransformStartTransformParts<'b>, @@ -931,8 +941,8 @@ impl<'b> TransformStopTransformParts<'b> { } } } +#[doc = "Builder for the [Transform Stop Transform API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/stop-transform.html)\n\nStops one or more transforms."] #[derive(Clone, Debug)] -#[doc = "Builder for the [Transform Stop Transform API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/stop-transform.html)\n\nStops one or more transforms."] pub struct TransformStopTransform<'a, 'b, B> { transport: &'a Transport, parts: TransformStopTransformParts<'b>, @@ -1124,8 +1134,8 @@ impl<'b> TransformUpdateTransformParts<'b> { } } } +#[doc = "Builder for the [Transform Update Transform API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/update-transform.html)\n\nUpdates certain properties of a transform."] #[derive(Clone, Debug)] -#[doc = "Builder for the [Transform Update Transform API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/update-transform.html)\n\nUpdates certain properties of a transform."] pub struct TransformUpdateTransform<'a, 'b, B> { transport: &'a Transport, parts: TransformUpdateTransformParts<'b>, @@ -1267,53 +1277,53 @@ impl<'a> Transform<'a> { pub fn transport(&self) -> &Transport { self.transport } - #[doc = "[Transform Delete Transform API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/delete-transform.html)\n\nDeletes an existing transform."] + #[doc = "[Transform Delete Transform API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/delete-transform.html)\n\nDeletes an existing transform."] pub fn delete_transform<'b>( &'a self, parts: TransformDeleteTransformParts<'b>, ) -> TransformDeleteTransform<'a, 'b> { TransformDeleteTransform::new(self.transport(), parts) } - #[doc = "[Transform Get Transform API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/get-transform.html)\n\nRetrieves configuration information for transforms."] + #[doc = "[Transform Get Transform API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/get-transform.html)\n\nRetrieves configuration information for transforms."] pub fn get_transform<'b>( &'a self, parts: TransformGetTransformParts<'b>, ) -> TransformGetTransform<'a, 'b> { TransformGetTransform::new(self.transport(), parts) } - #[doc = "[Transform Get Transform Stats API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/get-transform-stats.html)\n\nRetrieves usage information for transforms."] + #[doc = "[Transform Get Transform Stats API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/get-transform-stats.html)\n\nRetrieves usage information for transforms."] pub fn get_transform_stats<'b>( &'a self, parts: TransformGetTransformStatsParts<'b>, ) -> TransformGetTransformStats<'a, 'b> { TransformGetTransformStats::new(self.transport(), parts) } - #[doc = "[Transform Preview Transform API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/preview-transform.html)\n\nPreviews a transform."] + #[doc = "[Transform Preview Transform API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/preview-transform.html)\n\nPreviews a transform."] pub fn preview_transform<'b>(&'a self) -> TransformPreviewTransform<'a, 'b, ()> { TransformPreviewTransform::new(self.transport()) } - #[doc = "[Transform Put Transform API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/put-transform.html)\n\nInstantiates a transform."] + #[doc = "[Transform Put Transform API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/put-transform.html)\n\nInstantiates a transform."] pub fn put_transform<'b>( &'a self, parts: TransformPutTransformParts<'b>, ) -> TransformPutTransform<'a, 'b, ()> { TransformPutTransform::new(self.transport(), parts) } - #[doc = "[Transform Start Transform API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/start-transform.html)\n\nStarts one or more transforms."] + #[doc = "[Transform Start Transform API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/start-transform.html)\n\nStarts one or more transforms."] pub fn start_transform<'b>( &'a self, parts: TransformStartTransformParts<'b>, ) -> TransformStartTransform<'a, 'b, ()> { TransformStartTransform::new(self.transport(), parts) } - #[doc = "[Transform Stop Transform API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/stop-transform.html)\n\nStops one or more transforms."] + #[doc = "[Transform Stop Transform API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/stop-transform.html)\n\nStops one or more transforms."] pub fn stop_transform<'b>( &'a self, parts: TransformStopTransformParts<'b>, ) -> TransformStopTransform<'a, 'b, ()> { TransformStopTransform::new(self.transport(), parts) } - #[doc = "[Transform Update Transform API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/update-transform.html)\n\nUpdates certain properties of a transform."] + #[doc = "[Transform Update Transform API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/update-transform.html)\n\nUpdates certain properties of a transform."] pub fn update_transform<'b>( &'a self, parts: TransformUpdateTransformParts<'b>, diff --git a/elasticsearch/src/watcher.rs b/elasticsearch/src/watcher.rs index 3590ddd6..d25d5ede 100644 --- a/elasticsearch/src/watcher.rs +++ b/elasticsearch/src/watcher.rs @@ -29,7 +29,8 @@ //! Enable [watching for changes or anomalies in data and perform the necessary actions in response](https://www.elastic.co/guide/en/elasticsearch/reference/master/xpack-alerting.html), //! by creating and managing watches that take action based on a met condition. -# ! [ allow ( unused_imports ) ]use crate::{ +#![allow(unused_imports)] +use crate::{ client::Elasticsearch, error::Error, http::{ @@ -83,8 +84,8 @@ impl<'b> WatcherAckWatchParts<'b> { } } } +#[doc = "Builder for the [Watcher Ack Watch API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/watcher-api-ack-watch.html)\n\nAcknowledges a watch, manually throttling the execution of the watch's actions."] #[derive(Clone, Debug)] -#[doc = "Builder for the [Watcher Ack Watch API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/watcher-api-ack-watch.html)\n\nAcknowledges a watch, manually throttling the execution of the watch's actions."] pub struct WatcherAckWatch<'a, 'b, B> { transport: &'a Transport, parts: WatcherAckWatchParts<'b>, @@ -226,8 +227,8 @@ impl<'b> WatcherActivateWatchParts<'b> { } } } +#[doc = "Builder for the [Watcher Activate Watch API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/watcher-api-activate-watch.html)\n\nActivates a currently inactive watch."] #[derive(Clone, Debug)] -#[doc = "Builder for the [Watcher Activate Watch API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/watcher-api-activate-watch.html)\n\nActivates a currently inactive watch."] pub struct WatcherActivateWatch<'a, 'b, B> { transport: &'a Transport, parts: WatcherActivateWatchParts<'b>, @@ -369,8 +370,8 @@ impl<'b> WatcherDeactivateWatchParts<'b> { } } } +#[doc = "Builder for the [Watcher Deactivate Watch API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/watcher-api-deactivate-watch.html)\n\nDeactivates a currently active watch."] #[derive(Clone, Debug)] -#[doc = "Builder for the [Watcher Deactivate Watch API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/watcher-api-deactivate-watch.html)\n\nDeactivates a currently active watch."] pub struct WatcherDeactivateWatch<'a, 'b, B> { transport: &'a Transport, parts: WatcherDeactivateWatchParts<'b>, @@ -510,8 +511,8 @@ impl<'b> WatcherDeleteWatchParts<'b> { } } } +#[doc = "Builder for the [Watcher Delete Watch API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/watcher-api-delete-watch.html)\n\nRemoves a watch from Watcher."] #[derive(Clone, Debug)] -#[doc = "Builder for the [Watcher Delete Watch API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/watcher-api-delete-watch.html)\n\nRemoves a watch from Watcher."] pub struct WatcherDeleteWatch<'a, 'b> { transport: &'a Transport, parts: WatcherDeleteWatchParts<'b>, @@ -632,8 +633,8 @@ impl<'b> WatcherExecuteWatchParts<'b> { } } } +#[doc = "Builder for the [Watcher Execute Watch API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/watcher-api-execute-watch.html)\n\nForces the execution of a stored watch."] #[derive(Clone, Debug)] -#[doc = "Builder for the [Watcher Execute Watch API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/watcher-api-execute-watch.html)\n\nForces the execution of a stored watch."] pub struct WatcherExecuteWatch<'a, 'b, B> { transport: &'a Transport, parts: WatcherExecuteWatchParts<'b>, @@ -783,8 +784,8 @@ impl<'b> WatcherGetWatchParts<'b> { } } } +#[doc = "Builder for the [Watcher Get Watch API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/watcher-api-get-watch.html)\n\nRetrieves a watch by its ID."] #[derive(Clone, Debug)] -#[doc = "Builder for the [Watcher Get Watch API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/watcher-api-get-watch.html)\n\nRetrieves a watch by its ID."] pub struct WatcherGetWatch<'a, 'b> { transport: &'a Transport, parts: WatcherGetWatchParts<'b>, @@ -901,8 +902,8 @@ impl<'b> WatcherPutWatchParts<'b> { } } } +#[doc = "Builder for the [Watcher Put Watch API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/watcher-api-put-watch.html)\n\nCreates a new watch, or updates an existing one."] #[derive(Clone, Debug)] -#[doc = "Builder for the [Watcher Put Watch API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/watcher-api-put-watch.html)\n\nCreates a new watch, or updates an existing one."] pub struct WatcherPutWatch<'a, 'b, B> { transport: &'a Transport, parts: WatcherPutWatchParts<'b>, @@ -1063,6 +1064,144 @@ where } } #[derive(Debug, Clone, PartialEq)] +#[doc = "API parts for the Watcher Query Watches API"] +pub enum WatcherQueryWatchesParts { + #[doc = "No parts"] + None, +} +impl WatcherQueryWatchesParts { + #[doc = "Builds a relative URL path to the Watcher Query Watches API"] + pub fn url(self) -> Cow<'static, str> { + match self { + WatcherQueryWatchesParts::None => "/_watcher/_query/watches".into(), + } + } +} +#[doc = "Builder for the [Watcher Query Watches API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/watcher-api-query-watches.html)\n\nRetrieves stored watches."] +#[derive(Clone, Debug)] +pub struct WatcherQueryWatches<'a, 'b, B> { + transport: &'a Transport, + parts: WatcherQueryWatchesParts, + body: Option, + error_trace: Option, + filter_path: Option<&'b [&'b str]>, + headers: HeaderMap, + human: Option, + pretty: Option, + request_timeout: Option, + source: Option<&'b str>, +} +impl<'a, 'b, B> WatcherQueryWatches<'a, 'b, B> +where + B: Body, +{ + #[doc = "Creates a new instance of [WatcherQueryWatches]"] + pub fn new(transport: &'a Transport) -> Self { + let headers = HeaderMap::new(); + WatcherQueryWatches { + transport, + parts: WatcherQueryWatchesParts::None, + headers, + body: None, + error_trace: None, + filter_path: None, + human: None, + pretty: None, + request_timeout: None, + source: None, + } + } + #[doc = "The body for the API call"] + pub fn body(self, body: T) -> WatcherQueryWatches<'a, 'b, JsonBody> + where + T: Serialize, + { + WatcherQueryWatches { + transport: self.transport, + parts: self.parts, + body: Some(body.into()), + error_trace: self.error_trace, + filter_path: self.filter_path, + headers: self.headers, + human: self.human, + pretty: self.pretty, + request_timeout: self.request_timeout, + source: self.source, + } + } + #[doc = "Include the stack trace of returned errors."] + pub fn error_trace(mut self, error_trace: bool) -> Self { + self.error_trace = Some(error_trace); + self + } + #[doc = "A comma-separated list of filters used to reduce the response."] + pub fn filter_path(mut self, filter_path: &'b [&'b str]) -> Self { + self.filter_path = Some(filter_path); + self + } + #[doc = "Adds a HTTP header"] + pub fn header(mut self, key: HeaderName, value: HeaderValue) -> Self { + self.headers.insert(key, value); + self + } + #[doc = "Return human readable values for statistics."] + pub fn human(mut self, human: bool) -> Self { + self.human = Some(human); + self + } + #[doc = "Pretty format the returned JSON response."] + pub fn pretty(mut self, pretty: bool) -> Self { + self.pretty = Some(pretty); + self + } + #[doc = "Sets a request timeout for this API call.\n\nThe timeout is applied from when the request starts connecting until the response body has finished."] + pub fn request_timeout(mut self, timeout: Duration) -> Self { + self.request_timeout = Some(timeout); + self + } + #[doc = "The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests."] + pub fn source(mut self, source: &'b str) -> Self { + self.source = Some(source); + self + } + #[doc = "Creates an asynchronous call to the Watcher Query Watches API that can be awaited"] + pub async fn send(self) -> Result { + let path = self.parts.url(); + let method = match self.body { + Some(_) => Method::Post, + None => Method::Get, + }; + let headers = self.headers; + let timeout = self.request_timeout; + let query_string = { + #[serde_with::skip_serializing_none] + #[derive(Serialize)] + struct QueryParams<'b> { + error_trace: Option, + #[serde(serialize_with = "crate::client::serialize_coll_qs")] + filter_path: Option<&'b [&'b str]>, + human: Option, + pretty: Option, + source: Option<&'b str>, + } + let query_params = QueryParams { + error_trace: self.error_trace, + filter_path: self.filter_path, + human: self.human, + pretty: self.pretty, + source: self.source, + }; + Some(query_params) + }; + let body = self.body; + let response = self + .transport + .send(method, &path, headers, query_string.as_ref(), body, timeout) + .await?; + Ok(response) + } +} +#[derive(Debug, Clone, PartialEq)] #[doc = "API parts for the Watcher Start API"] pub enum WatcherStartParts { #[doc = "No parts"] @@ -1076,8 +1215,8 @@ impl WatcherStartParts { } } } +#[doc = "Builder for the [Watcher Start API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/watcher-api-start.html)\n\nStarts Watcher if it is not already running."] #[derive(Clone, Debug)] -#[doc = "Builder for the [Watcher Start API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/watcher-api-start.html)\n\nStarts Watcher if it is not already running."] pub struct WatcherStart<'a, 'b, B> { transport: &'a Transport, parts: WatcherStartParts, @@ -1222,8 +1361,8 @@ impl<'b> WatcherStatsParts<'b> { } } } +#[doc = "Builder for the [Watcher Stats API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/watcher-api-stats.html)\n\nRetrieves the current Watcher metrics."] #[derive(Clone, Debug)] -#[doc = "Builder for the [Watcher Stats API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/watcher-api-stats.html)\n\nRetrieves the current Watcher metrics."] pub struct WatcherStats<'a, 'b> { transport: &'a Transport, parts: WatcherStatsParts<'b>, @@ -1353,8 +1492,8 @@ impl WatcherStopParts { } } } +#[doc = "Builder for the [Watcher Stop API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/watcher-api-stop.html)\n\nStops Watcher if it is running."] #[derive(Clone, Debug)] -#[doc = "Builder for the [Watcher Stop API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/watcher-api-stop.html)\n\nStops Watcher if it is running."] pub struct WatcherStop<'a, 'b, B> { transport: &'a Transport, parts: WatcherStopParts, @@ -1486,55 +1625,59 @@ impl<'a> Watcher<'a> { pub fn transport(&self) -> &Transport { self.transport } - #[doc = "[Watcher Ack Watch API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/watcher-api-ack-watch.html)\n\nAcknowledges a watch, manually throttling the execution of the watch's actions."] + #[doc = "[Watcher Ack Watch API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/watcher-api-ack-watch.html)\n\nAcknowledges a watch, manually throttling the execution of the watch's actions."] pub fn ack_watch<'b>(&'a self, parts: WatcherAckWatchParts<'b>) -> WatcherAckWatch<'a, 'b, ()> { WatcherAckWatch::new(self.transport(), parts) } - #[doc = "[Watcher Activate Watch API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/watcher-api-activate-watch.html)\n\nActivates a currently inactive watch."] + #[doc = "[Watcher Activate Watch API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/watcher-api-activate-watch.html)\n\nActivates a currently inactive watch."] pub fn activate_watch<'b>( &'a self, parts: WatcherActivateWatchParts<'b>, ) -> WatcherActivateWatch<'a, 'b, ()> { WatcherActivateWatch::new(self.transport(), parts) } - #[doc = "[Watcher Deactivate Watch API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/watcher-api-deactivate-watch.html)\n\nDeactivates a currently active watch."] + #[doc = "[Watcher Deactivate Watch API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/watcher-api-deactivate-watch.html)\n\nDeactivates a currently active watch."] pub fn deactivate_watch<'b>( &'a self, parts: WatcherDeactivateWatchParts<'b>, ) -> WatcherDeactivateWatch<'a, 'b, ()> { WatcherDeactivateWatch::new(self.transport(), parts) } - #[doc = "[Watcher Delete Watch API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/watcher-api-delete-watch.html)\n\nRemoves a watch from Watcher."] + #[doc = "[Watcher Delete Watch API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/watcher-api-delete-watch.html)\n\nRemoves a watch from Watcher."] pub fn delete_watch<'b>( &'a self, parts: WatcherDeleteWatchParts<'b>, ) -> WatcherDeleteWatch<'a, 'b> { WatcherDeleteWatch::new(self.transport(), parts) } - #[doc = "[Watcher Execute Watch API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/watcher-api-execute-watch.html)\n\nForces the execution of a stored watch."] + #[doc = "[Watcher Execute Watch API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/watcher-api-execute-watch.html)\n\nForces the execution of a stored watch."] pub fn execute_watch<'b>( &'a self, parts: WatcherExecuteWatchParts<'b>, ) -> WatcherExecuteWatch<'a, 'b, ()> { WatcherExecuteWatch::new(self.transport(), parts) } - #[doc = "[Watcher Get Watch API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/watcher-api-get-watch.html)\n\nRetrieves a watch by its ID."] + #[doc = "[Watcher Get Watch API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/watcher-api-get-watch.html)\n\nRetrieves a watch by its ID."] pub fn get_watch<'b>(&'a self, parts: WatcherGetWatchParts<'b>) -> WatcherGetWatch<'a, 'b> { WatcherGetWatch::new(self.transport(), parts) } - #[doc = "[Watcher Put Watch API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/watcher-api-put-watch.html)\n\nCreates a new watch, or updates an existing one."] + #[doc = "[Watcher Put Watch API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/watcher-api-put-watch.html)\n\nCreates a new watch, or updates an existing one."] pub fn put_watch<'b>(&'a self, parts: WatcherPutWatchParts<'b>) -> WatcherPutWatch<'a, 'b, ()> { WatcherPutWatch::new(self.transport(), parts) } - #[doc = "[Watcher Start API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/watcher-api-start.html)\n\nStarts Watcher if it is not already running."] + #[doc = "[Watcher Query Watches API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/watcher-api-query-watches.html)\n\nRetrieves stored watches."] + pub fn query_watches<'b>(&'a self) -> WatcherQueryWatches<'a, 'b, ()> { + WatcherQueryWatches::new(self.transport()) + } + #[doc = "[Watcher Start API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/watcher-api-start.html)\n\nStarts Watcher if it is not already running."] pub fn start<'b>(&'a self) -> WatcherStart<'a, 'b, ()> { WatcherStart::new(self.transport()) } - #[doc = "[Watcher Stats API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/watcher-api-stats.html)\n\nRetrieves the current Watcher metrics."] + #[doc = "[Watcher Stats API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/watcher-api-stats.html)\n\nRetrieves the current Watcher metrics."] pub fn stats<'b>(&'a self, parts: WatcherStatsParts<'b>) -> WatcherStats<'a, 'b> { WatcherStats::new(self.transport(), parts) } - #[doc = "[Watcher Stop API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/watcher-api-stop.html)\n\nStops Watcher if it is running."] + #[doc = "[Watcher Stop API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/watcher-api-stop.html)\n\nStops Watcher if it is running."] pub fn stop<'b>(&'a self) -> WatcherStop<'a, 'b, ()> { WatcherStop::new(self.transport()) } diff --git a/elasticsearch/src/xpack.rs b/elasticsearch/src/xpack.rs index b071a18f..c62da358 100644 --- a/elasticsearch/src/xpack.rs +++ b/elasticsearch/src/xpack.rs @@ -28,7 +28,8 @@ //! //! Provide general information about the installed X-Pack features and their usage. -# ! [ allow ( unused_imports ) ]use crate::{ +#![allow(unused_imports)] +use crate::{ client::Elasticsearch, error::Error, http::{ @@ -57,8 +58,8 @@ impl XpackInfoParts { } } } +#[doc = "Builder for the [Xpack Info API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/info-api.html)\n\nRetrieves information about the installed X-Pack features."] #[derive(Clone, Debug)] -#[doc = "Builder for the [Xpack Info API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/info-api.html)\n\nRetrieves information about the installed X-Pack features."] pub struct XpackInfo<'a, 'b> { transport: &'a Transport, parts: XpackInfoParts, @@ -188,8 +189,8 @@ impl XpackUsageParts { } } } +#[doc = "Builder for the [Xpack Usage API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/usage-api.html)\n\nRetrieves usage information about the installed X-Pack features."] #[derive(Clone, Debug)] -#[doc = "Builder for the [Xpack Usage API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/usage-api.html)\n\nRetrieves usage information about the installed X-Pack features."] pub struct XpackUsage<'a, 'b> { transport: &'a Transport, parts: XpackUsageParts, @@ -307,11 +308,11 @@ impl<'a> Xpack<'a> { pub fn transport(&self) -> &Transport { self.transport } - #[doc = "[Xpack Info API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/info-api.html)\n\nRetrieves information about the installed X-Pack features."] + #[doc = "[Xpack Info API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/info-api.html)\n\nRetrieves information about the installed X-Pack features."] pub fn info<'b>(&'a self) -> XpackInfo<'a, 'b> { XpackInfo::new(self.transport()) } - #[doc = "[Xpack Usage API](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/usage-api.html)\n\nRetrieves usage information about the installed X-Pack features."] + #[doc = "[Xpack Usage API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/usage-api.html)\n\nRetrieves usage information about the installed X-Pack features."] pub fn usage<'b>(&'a self) -> XpackUsage<'a, 'b> { XpackUsage::new(self.transport()) } diff --git a/yaml_test_runner/skip.yml b/yaml_test_runner/skip.yml index e52b9ef1..9cac7379 100644 --- a/yaml_test_runner/skip.yml +++ b/yaml_test_runner/skip.yml @@ -11,18 +11,20 @@ features: # tests to skip generating and compiling a test for tests: - xpack/ssl/10_basic.yml: - # this test returns the CA cert before the cert, so always fails - - "Test get SSL certificates" - xpack/transform/transforms_stats_continuous.yml: - # this test always returns "exponential_avg_checkpoint_duration_ms": 0.0 . seems like it might be missing data in - # the setup, fires quicker than any documents are processed, or the delay of 1m is too high? - - "Test get continuous transform stats" + xpack/api_key/10_basic.yml: + # Regex contains variable substitutions that the test harness doesn't support yet + - "Test invalidate api keys" + + xpack/data_stream/40_supported_apis.yml: + # uses number as a key into object. serde_json::Value expects a string key + - "Verify shard stores api" - xpack/ml/jobs_get_result_overall_buckets.yml: - # this test always returns 3 buckets where 1 is expected - - "Test overall buckets given overall_score filter" + xpack/data_stream/80_resolve_index_data_streams.yml: + # Regex not properly interpreted by the test harness + - "Resolve index with hidden and closed indices" + # expected value json["indices"][0]["name"] to match String("test_index1") but was String(".security-7") + - "Resolve index with indices, aliases, and data streams" xpack/ml/filter_crud.yml: # Warning "this request accesses system indices..." to match is wrong on all tests @@ -35,10 +37,15 @@ tests: xpack/runtime_fields/20_long.yml: # expected value ... to match Number(40.0) but was Number(40) - "terms agg" + - + xpack/ssl/10_basic.yml: + # this test returns the CA cert before the cert, so always fails + - "Test get SSL certificates" - xpack/snapshot/10_basic.yml: - # this test fails because it can't access snapshot to restore it - - "Create a source only snapshot and then restore it" + xpack/transform/transforms_stats_continuous.yml: + # this test always returns "exponential_avg_checkpoint_duration_ms": 0.0 . seems like it might be missing data in + # the setup, fires quicker than any documents are processed, or the delay of 1m is too high? + - "Test get continuous transform stats" # Test generator currently doesn't handle unsigned long values. # We skip all tests as even the setup code will fail to compile. @@ -55,32 +62,42 @@ tests: xpack/unsigned_long/60_collapse.yml: - "*" - oss/cat.aliases/10_basic.yml: + free/cat.aliases/10_basic.yml: # this test fails as the regex needs a \n before the ending $ - "Multiple alias names" - oss/cat.indices/10_basic.yml: + free/cat.indices/10_basic.yml: # this test fails as the regex needs a \n before the ending $ - "Test cat indices using health status" - oss/indices.shard_stores/10_basic.yml: - # uses number as a key into object. serde_json::Value expects a string key - - "basic index test" - - "multiple indices test" + free/cat.templates/10_basic.yml: + # Regex do not account for hidden templates returned by the request + - "Multiple template" + - "No templates" + - "Sort templates" - oss/indices.flush/10_basic.yml: + free/indices.flush/10_basic.yml: # uses number as a key into object. serde_json::Value expects a string key - "Index synced flush rest test" - oss/indices.segments/10_basic.yml: + free/indices.segments/10_basic.yml: # uses number as a key into object. serde_json::Value expects a string key - "basic segments test" - oss/indices.stats/12_level.yml: + free/indices.shard_stores/10_basic.yml: + # uses number as a key into object. serde_json::Value expects a string key + - "basic index test" + - "multiple indices test" + + free/indices.stats/12_level.yml: # uses number as a key into object. serde_json::Value expects a string key - "Level - shards" - oss/search.aggregation/250_moving_fn.yml: + free/nodes.info/10_basic.yml: + # node has a lot more roles than those checked in the test (expects "ingest", finds "data_cold") + - "node_info role test" + + free/search.aggregation/250_moving_fn.yml: # The use of an invalid window interval results in a 400 response which looks like # it suppresses the sending of deprecation headers - "Bad window deprecated interval" diff --git a/yaml_test_runner/src/generator.rs b/yaml_test_runner/src/generator.rs index 28b6101a..276f42c3 100644 --- a/yaml_test_runner/src/generator.rs +++ b/yaml_test_runner/src/generator.rs @@ -413,11 +413,7 @@ pub fn generate_tests_from_yaml( }; if &test_suite != suite { - info!( - "skipping {}. compiling tests for {:?}", - relative_path.to_slash_lossy(), - suite - ); + // Belongs to another test suite continue; } diff --git a/yaml_test_runner/src/step/mod.rs b/yaml_test_runner/src/step/mod.rs index 1fa93bd3..b8c452a0 100644 --- a/yaml_test_runner/src/step/mod.rs +++ b/yaml_test_runner/src/step/mod.rs @@ -162,6 +162,9 @@ impl Expr { // which should be removed. if Self::is_string_body(values[0].as_ref()) { values.remove(0); + } else if values[0] == "" { + // some tests start the json path with a dot, leading to an empty first element + values.remove(0); } let mut expr = String::new(); diff --git a/yaml_test_runner/tests/common/client.rs b/yaml_test_runner/tests/common/client.rs index 8c09797a..744c2d54 100644 --- a/yaml_test_runner/tests/common/client.rs +++ b/yaml_test_runner/tests/common/client.rs @@ -18,7 +18,7 @@ */ use elasticsearch::{ auth::Credentials, - cat::{CatSnapshotsParts, CatTemplatesParts}, + cat::CatTemplatesParts, cert::CertificateValidation, cluster::ClusterHealthParts, http::{ @@ -27,7 +27,10 @@ use elasticsearch::{ Method, StatusCode, }, ilm::IlmRemovePolicyParts, - indices::{IndicesDeleteParts, IndicesDeleteTemplateParts, IndicesRefreshParts}, + indices::{ + IndicesDeleteIndexTemplateParts, IndicesDeleteParts, IndicesDeleteTemplateParts, + IndicesRefreshParts, + }, ml::{ MlCloseJobParts, MlDeleteDatafeedParts, MlDeleteJobParts, MlGetDatafeedsParts, MlGetJobsParts, MlStopDatafeedParts, @@ -138,41 +141,48 @@ pub async fn read_response( /// general setup step for an OSS yaml test pub async fn general_oss_setup() -> Result<(), Error> { let client = get(); + delete_data_streams(client).await?; delete_indices(client).await?; delete_templates(client).await?; + delete_snapshots(client).await?; + + Ok(()) +} - let cat_snapshot_response = client +pub async fn delete_snapshots(client: &Elasticsearch) -> Result<(), Error> { + let cat_repo_response = client .cat() - .snapshots(CatSnapshotsParts::None) - .h(&["id", "repository"]) + .repositories() + .h(&["id"]) .send() + .await? + .error_for_status_code()? + .text() .await?; - if cat_snapshot_response.status_code().is_success() { - let cat_snapshot_text = cat_snapshot_response.text().await?; + if cat_repo_response.len() > 0 { + let repositories: Vec<&str> = cat_repo_response.split_terminator('\n').collect(); - let all_snapshots: Vec<(&str, &str)> = cat_snapshot_text - .split('\n') - .map(|s| s.split(' ').collect::>()) - .filter(|s| s.len() == 2) - .map(|s| (s[0].trim(), s[1].trim())) - .filter(|(id, repo)| !id.is_empty() && !repo.is_empty()) - .collect(); - - for (id, repo) in all_snapshots { - let _snapshot_response = client + // Delete snapshots in each repository + for repo in repositories { + let delete_snapshots_response = client .snapshot() - .delete(SnapshotDeleteParts::RepositorySnapshot(&repo, &id)) + .delete(SnapshotDeleteParts::RepositorySnapshot(repo, "*")) .send() .await?; + + assert_response_success!(delete_snapshots_response); } - } - let _delete_repo_response = client - .snapshot() - .delete_repository(SnapshotDeleteRepositoryParts::Repository(&["*"])) - .send() - .await?; + // Delete all snapshot repositories + let delete_repo_response = client + .snapshot() + .delete_repository(SnapshotDeleteRepositoryParts::Repository(&["*"])) + .send() + .await?; + + assert_response_success!(delete_repo_response); + } Ok(()) } @@ -180,7 +190,6 @@ pub async fn general_oss_setup() -> Result<(), Error> { /// general setup step for an xpack yaml test pub async fn general_xpack_setup() -> Result<(), Error> { let client = get(); - delete_templates(client).await?; let _delete_watch_response = client .watcher() @@ -193,12 +202,14 @@ pub async fn general_xpack_setup() -> Result<(), Error> { delete_privileges(client).await?; stop_and_delete_datafeeds(client).await?; - let _ = client + let response = client .ilm() .remove_policy(IlmRemovePolicyParts::Index("_all")) .send() .await?; + assert_response_success!(response); + close_and_delete_jobs(client).await?; // TODO: stop and delete rollup jobs once implemented in the client @@ -206,9 +217,11 @@ pub async fn general_xpack_setup() -> Result<(), Error> { cancel_tasks(client).await?; stop_and_delete_transforms(client).await?; wait_for_yellow_status(client).await?; + delete_data_streams(client).await?; delete_indices(client).await?; + delete_templates(client).await?; - let _ = client + let response = client .security() .put_user(SecurityPutUserParts::Username("x_pack_rest_user")) .body(json!({ @@ -218,7 +231,9 @@ pub async fn general_xpack_setup() -> Result<(), Error> { .send() .await?; - let _ = client + assert_response_success!(response); + + let response = client .indices() .refresh(IndicesRefreshParts::Index(&["_all"])) .expand_wildcards(&[ @@ -229,6 +244,8 @@ pub async fn general_xpack_setup() -> Result<(), Error> { .send() .await?; + assert_response_success!(response); + wait_for_yellow_status(client).await?; Ok(()) @@ -246,7 +263,7 @@ async fn wait_for_yellow_status(client: &Elasticsearch) -> Result<(), Error> { Ok(()) } -async fn delete_indices(client: &Elasticsearch) -> Result<(), Error> { +async fn delete_data_streams(client: &Elasticsearch) -> Result<(), Error> { // Hand-crafted request as the indices.delete_data_stream spec doesn't yet have the // "expand_wildcards" parameter that is needed to delete ILM data streams // @@ -276,6 +293,10 @@ async fn delete_indices(client: &Elasticsearch) -> Result<(), Error> { assert_response_success!(delete_response); + Ok(()) +} + +async fn delete_indices(client: &Elasticsearch) -> Result<(), Error> { let delete_response = client .indices() .delete(IndicesDeleteParts::Index(&["*"])) @@ -302,17 +323,21 @@ async fn stop_and_delete_transforms(client: &Elasticsearch) -> Result<(), Error> for transform in transforms_response["transforms"].as_array().unwrap() { let id = transform["id"].as_str().unwrap(); - let _ = client + let response = client .transform() .stop_transform(TransformStopTransformParts::TransformId(id)) .send() .await?; - let _ = client + assert_response_success!(response); + + let response = client .transform() .delete_transform(TransformDeleteTransformParts::TransformId(id)) .send() .await?; + + assert_response_success!(response); } Ok(()) @@ -325,11 +350,13 @@ async fn cancel_tasks(client: &Elasticsearch) -> Result<(), Error> { for (task_id, task) in nodes["tasks"].as_object().unwrap() { if let Some(b) = task["cancellable"].as_bool() { if b { - let _ = client + let response = client .tasks() .cancel(TasksCancelParts::TaskId(task_id)) .send() .await?; + + assert_response_success!(response); } } } @@ -339,6 +366,8 @@ async fn cancel_tasks(client: &Elasticsearch) -> Result<(), Error> { } async fn delete_templates(client: &Elasticsearch) -> Result<(), Error> { + // There are "legacy templates and "new templates" + let cat_template_response = client .cat() .templates(CatTemplatesParts::Name("*")) @@ -349,16 +378,32 @@ async fn delete_templates(client: &Elasticsearch) -> Result<(), Error> { .await?; let all_templates: Vec<&str> = cat_template_response - .split('\n') - .filter(|s| !s.is_empty() && !s.starts_with('.') && s != &"security-audit-log") + .split_terminator('\n') + .filter(|s| !s.starts_with('.') && s != &"security-audit-log") .collect(); for template in all_templates { - let _delete_template_response = client + if template == "ilm-history" { + // We may need to extend this to mimic ESRestTestCase.isXPackTemplate() from the ES + // test harness + continue; + } + + let mut delete_template_response = client .indices() - .delete_template(IndicesDeleteTemplateParts::Name(&template)) + .delete_index_template(IndicesDeleteIndexTemplateParts::Name(&template)) .send() .await?; + + if delete_template_response.status_code().as_u16() == 404 { + // Certainly an old-style template + delete_template_response = client + .indices() + .delete_template(IndicesDeleteTemplateParts::Name(&template)) + .send() + .await?; + } + assert_response_success!(delete_template_response); } Ok(()) @@ -376,11 +421,13 @@ async fn delete_users(client: &Elasticsearch) -> Result<(), Error> { for (k, v) in users_response.as_object().unwrap() { if let Some(b) = v["metadata"]["_reserved"].as_bool() { if !b { - let _ = client + let response = client .security() .delete_user(SecurityDeleteUserParts::Username(k)) .send() .await?; + + assert_response_success!(response); } } } @@ -400,11 +447,13 @@ async fn delete_roles(client: &Elasticsearch) -> Result<(), Error> { for (k, v) in roles_response.as_object().unwrap() { if let Some(b) = v["metadata"]["_reserved"].as_bool() { if !b { - let _ = client + let response = client .security() .delete_role(SecurityDeleteRoleParts::Name(k)) .send() .await?; + + assert_response_success!(response); } } } @@ -424,11 +473,13 @@ async fn delete_privileges(client: &Elasticsearch) -> Result<(), Error> { for (k, v) in privileges_response.as_object().unwrap() { if let Some(b) = v["metadata"]["_reserved"].as_bool() { if !b { - let _ = client + let response = client .security() .delete_privileges(SecurityDeletePrivilegesParts::ApplicationName(k, "_all")) .send() .await?; + + assert_response_success!(response); } } } @@ -437,12 +488,14 @@ async fn delete_privileges(client: &Elasticsearch) -> Result<(), Error> { } async fn stop_and_delete_datafeeds(client: &Elasticsearch) -> Result<(), Error> { - let _stop_data_feed_response = client + let stop_data_feed_response = client .ml() .stop_datafeed(MlStopDatafeedParts::DatafeedId("_all")) .send() .await?; + assert_response_success!(stop_data_feed_response); + let get_data_feeds_response = client .ml() .get_datafeeds(MlGetDatafeedsParts::None) @@ -464,12 +517,14 @@ async fn stop_and_delete_datafeeds(client: &Elasticsearch) -> Result<(), Error> } async fn close_and_delete_jobs(client: &Elasticsearch) -> Result<(), Error> { - let _ = client + let response = client .ml() .close_job(MlCloseJobParts::JobId("_all")) .send() .await?; + assert_response_success!(response); + let get_jobs_response = client .ml() .get_jobs(MlGetJobsParts::JobId("_all")) @@ -480,11 +535,13 @@ async fn close_and_delete_jobs(client: &Elasticsearch) -> Result<(), Error> { for job in get_jobs_response["jobs"].as_array().unwrap() { let id = job["job_id"].as_str().unwrap(); - let _ = client + let response = client .ml() .delete_job(MlDeleteJobParts::JobId(id)) .send() .await?; + + assert_response_success!(response); } Ok(())