diff --git a/.buildkite/pipeline.yml b/.buildkite/pipeline.yml index d087788f2..89888a2b4 100644 --- a/.buildkite/pipeline.yml +++ b/.buildkite/pipeline.yml @@ -7,13 +7,14 @@ steps: env: PHP_VERSION: "{{ matrix.php }}" TEST_SUITE: "{{ matrix.suite }}" - STACK_VERSION: 8.14.0-SNAPSHOT + STACK_VERSION: 8.18.0-SNAPSHOT matrix: setup: suite: - "free" - "platinum" php: + - "8.4-cli" - "8.3-cli" - "8.2-cli" - "8.1-cli" diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 822de1841..65e954c6c 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -9,9 +9,9 @@ jobs: strategy: matrix: - php-version: [7.4, 8.0, 8.1, 8.2, 8.3] + php-version: [7.4, 8.0, 8.1, 8.2, 8.3, 8.4] os: [ubuntu-latest] - es-version: [8.14-SNAPSHOT] + es-version: [8.18-SNAPSHOT] steps: - name: Checkout diff --git a/.gitignore b/.gitignore index 61b321f53..87a81043a 100755 --- a/.gitignore +++ b/.gitignore @@ -35,6 +35,7 @@ util/doctum.phar # PHPUnit /phpunit.xml .phpunit.result.cache +.phpunit.cache/ # Code coverage build diff --git a/composer.json b/composer.json index 1a71c3be8..56f8afc47 100644 --- a/composer.json +++ b/composer.json @@ -21,14 +21,13 @@ "ext-yaml": "*", "ext-zip": "*", "mockery/mockery": "^1.5", - "phpstan/phpstan": "^1.4", + "phpstan/phpstan": "^2.1", "phpunit/phpunit": "^9.5", "symfony/finder": "~4.0", "nyholm/psr7": "^1.5", "php-http/mock-client": "^1.5", "symfony/http-client": "^5.0|^6.0|^7.0", - "psr/http-factory" : "^1.0", - "php-http/message-factory" : "^1.0" + "psr/http-factory" : "^1.0" }, "autoload": { "psr-4": { @@ -52,7 +51,7 @@ "vendor/bin/phpunit --testdox -c phpunit-integration-cloud-tests.xml" ], "phpstan": [ - "phpstan analyse src --level 2 --no-progress --memory-limit 256M" + "phpstan analyse --no-progress --memory-limit 256M" ] }, "config": { diff --git a/phpstan.neon b/phpstan.neon index 8e7aa19ae..14d48a18d 100644 --- a/phpstan.neon +++ b/phpstan.neon @@ -1,3 +1,8 @@ parameters: + level: 5 + paths: + - src + reportUnmatchedIgnoredErrors: false ignoreErrors: - - '#PHPDoc tag @param has invalid value#' + - '#Offset ''body'' on array\{\}\|array\{#' + - '#Access to an undefined property Elastic\\Elasticsearch\\Client::\$client.#' diff --git a/src/Client.php b/src/Client.php index 64d2608dc..b8f2d8d47 100644 --- a/src/Client.php +++ b/src/Client.php @@ -28,7 +28,7 @@ final class Client implements ClientInterface { const CLIENT_NAME = 'es'; - const VERSION = '8.15.0'; + const VERSION = '8.18.0'; const API_COMPATIBILITY_HEADER = '%s/vnd.elasticsearch+%s; compatible-with=8'; const SEARCH_ENDPOINTS = [ diff --git a/src/ClientBuilder.php b/src/ClientBuilder.php index 0d05e1bdf..8a1b72e50 100644 --- a/src/ClientBuilder.php +++ b/src/ClientBuilder.php @@ -226,7 +226,7 @@ public function setHosts(array $hosts): ClientBuilder * * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-create-api-key.html */ - public function setApiKey(string $apiKey, string $id = null): ClientBuilder + public function setApiKey(string $apiKey, ?string $id = null): ClientBuilder { if (empty($id)) { $this->apiKey = $apiKey; @@ -272,7 +272,7 @@ public function setRetries(int $retries): ClientBuilder * @param string $cert The name of a file containing a PEM formatted certificate * @param string $password if the certificate requires a password */ - public function setSSLCert(string $cert, string $password = null): ClientBuilder + public function setSSLCert(string $cert, ?string $password = null): ClientBuilder { $this->sslCert = [$cert, $password]; return $this; @@ -295,7 +295,7 @@ public function setCABundle(string $cert): ClientBuilder * @param string $key The name of a file containing a private SSL key * @param string $password if the private key requires a password */ - public function setSSLKey(string $key, string $password = null): ClientBuilder + public function setSSLKey(string $key, ?string $password = null): ClientBuilder { $this->sslKey = [$key, $password]; return $this; diff --git a/src/Endpoints/AsyncSearch.php b/src/Endpoints/AsyncSearch.php index a1a0cee41..12a1a90c6 100644 --- a/src/Endpoints/AsyncSearch.php +++ b/src/Endpoints/AsyncSearch.php @@ -35,11 +35,11 @@ class AsyncSearch extends AbstractEndpoint * * @param array{ * id: string, // (REQUIRED) The async search ID - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. * } $params * * @throws MissingParameterException if a required parameter is missing @@ -49,8 +49,9 @@ class AsyncSearch extends AbstractEndpoint * * @return Elasticsearch|Promise */ - public function delete(array $params = []) + public function delete(?array $params = null) { + $params = $params ?? []; $this->checkRequiredParameters(['id'], $params); $url = '/_async_search/' . $this->encode($params['id']); $method = 'DELETE'; @@ -72,14 +73,14 @@ public function delete(array $params = []) * * @param array{ * id: string, // (REQUIRED) The async search ID - * wait_for_completion_timeout: time, // Specify the time that the request should block waiting for the final response - * keep_alive: time, // Specify the time interval in which the results (partial or final) for this search will be available - * typed_keys: boolean, // Specify whether aggregation and suggester names should be prefixed by their respective types in the response - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. + * wait_for_completion_timeout?: int|string, // Specify the time that the request should block waiting for the final response + * keep_alive?: int|string, // Specify the time interval in which the results (partial or final) for this search will be available + * typed_keys?: bool, // Specify whether aggregation and suggester names should be prefixed by their respective types in the response + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. * } $params * * @throws MissingParameterException if a required parameter is missing @@ -89,8 +90,9 @@ public function delete(array $params = []) * * @return Elasticsearch|Promise */ - public function get(array $params = []) + public function get(?array $params = null) { + $params = $params ?? []; $this->checkRequiredParameters(['id'], $params); $url = '/_async_search/' . $this->encode($params['id']); $method = 'GET'; @@ -112,12 +114,12 @@ public function get(array $params = []) * * @param array{ * id: string, // (REQUIRED) The async search ID - * keep_alive: time, // Specify the time interval in which the results (partial or final) for this search will be available - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. + * keep_alive?: int|string, // Specify the time interval in which the results (partial or final) for this search will be available + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. * } $params * * @throws MissingParameterException if a required parameter is missing @@ -127,8 +129,9 @@ public function get(array $params = []) * * @return Elasticsearch|Promise */ - public function status(array $params = []) + public function status(?array $params = null) { + $params = $params ?? []; $this->checkRequiredParameters(['id'], $params); $url = '/_async_search/status/' . $this->encode($params['id']); $method = 'GET'; @@ -149,54 +152,56 @@ public function status(array $params = []) * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/async-search.html * * @param array{ - * index: list, // A comma-separated list of index names to search; use `_all` or empty string to perform the operation on all indices - * wait_for_completion_timeout: time, // Specify the time that the request should block waiting for the final response - * keep_on_completion: boolean, // Control whether the response should be stored in the cluster if it completed within the provided [wait_for_completion] time (default: false) - * keep_alive: time, // Update the time interval in which the results (partial or final) for this search will be available - * batched_reduce_size: number, // The number of shard results that should be reduced at once on the coordinating node. This value should be used as the granularity at which progress results will be made available. - * request_cache: boolean, // Specify if request cache should be used for this request or not, defaults to true - * analyzer: string, // The analyzer to use for the query string - * analyze_wildcard: boolean, // Specify whether wildcard and prefix queries should be analyzed (default: false) - * default_operator: enum, // The default operator for query string query (AND or OR) - * df: string, // The field to use as default where no field prefix is given in the query string - * explain: boolean, // Specify whether to return detailed information about score computation as part of a hit - * stored_fields: list, // A comma-separated list of stored fields to return as part of a hit - * docvalue_fields: list, // A comma-separated list of fields to return as the docvalue representation of a field for each hit - * from: number, // Starting offset (default: 0) - * ignore_unavailable: boolean, // Whether specified concrete indices should be ignored when unavailable (missing or closed) - * ignore_throttled: boolean, // Whether specified concrete, expanded or aliased indices should be ignored when throttled - * allow_no_indices: boolean, // Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes `_all` string or when no indices have been specified) - * expand_wildcards: enum, // Whether to expand wildcard expression to concrete indices that are open, closed or both. - * lenient: boolean, // Specify whether format-based query failures (such as providing text to a numeric field) should be ignored - * preference: string, // Specify the node or shard the operation should be performed on (default: random) - * q: string, // Query in the Lucene query string syntax - * routing: list, // A comma-separated list of specific routing values - * search_type: enum, // Search operation type - * size: number, // Number of hits to return (default: 10) - * sort: list, // A comma-separated list of : pairs - * _source: list, // True or false to return the _source field or not, or a list of fields to return - * _source_excludes: list, // A list of fields to exclude from the returned _source field - * _source_includes: list, // A list of fields to extract and return from the _source field - * terminate_after: number, // The maximum number of documents to collect for each shard, upon reaching which the query execution will terminate early. - * stats: list, // Specific 'tag' of the request for logging and statistical purposes - * suggest_field: string, // Specify which field to use for suggestions - * suggest_mode: enum, // Specify suggest mode - * suggest_size: number, // How many suggestions to return in response - * suggest_text: string, // The source text for which the suggestions should be returned - * timeout: time, // Explicit operation timeout - * track_scores: boolean, // Whether to calculate and return scores even if they are not used for sorting - * track_total_hits: boolean|long, // Indicate if the number of documents that match the query should be tracked. A number can also be specified, to accurately track the total hit count up to the number. - * allow_partial_search_results: boolean, // Indicate if an error should be returned if there is a partial search failure or timeout - * typed_keys: boolean, // Specify whether aggregation and suggester names should be prefixed by their respective types in the response - * version: boolean, // Specify whether to return document version as part of a hit - * seq_no_primary_term: boolean, // Specify whether to return sequence number and primary term of the last modification of each hit - * max_concurrent_shard_requests: number, // The number of concurrent shard requests per node this search executes concurrently. This value should be used to limit the impact of the search on the cluster in order to limit the number of concurrent shard requests - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. - * body: array, // The search definition using the Query DSL + * index?: string|array, // A comma-separated list of index names to search; use `_all` or empty string to perform the operation on all indices + * wait_for_completion_timeout?: int|string, // Specify the time that the request should block waiting for the final response + * keep_on_completion?: bool, // Control whether the response should be stored in the cluster if it completed within the provided [wait_for_completion] time (default: false) + * keep_alive?: int|string, // Update the time interval in which the results (partial or final) for this search will be available + * batched_reduce_size?: int, // The number of shard results that should be reduced at once on the coordinating node. This value should be used as the granularity at which progress results will be made available. + * request_cache?: bool, // Specify if request cache should be used for this request or not, defaults to true + * analyzer?: string, // The analyzer to use for the query string + * analyze_wildcard?: bool, // Specify whether wildcard and prefix queries should be analyzed (default: false) + * ccs_minimize_roundtrips?: bool, // When doing a cross-cluster search, setting it to true may improve overall search latency, particularly when searching clusters with a large number of shards. However, when set to true, the progress of searches on the remote clusters will not be received until the search finishes on all clusters. + * default_operator?: string, // The default operator for query string query (AND or OR) + * df?: string, // The field to use as default where no field prefix is given in the query string + * explain?: bool, // Specify whether to return detailed information about score computation as part of a hit + * stored_fields?: string|array, // A comma-separated list of stored fields to return as part of a hit + * docvalue_fields?: string|array, // A comma-separated list of fields to return as the docvalue representation of a field for each hit + * from?: int, // Starting offset (default: 0) + * ignore_unavailable?: bool, // Whether specified concrete indices should be ignored when unavailable (missing or closed) + * ignore_throttled?: bool, // Whether specified concrete, expanded or aliased indices should be ignored when throttled + * allow_no_indices?: bool, // Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes `_all` string or when no indices have been specified) + * expand_wildcards?: string, // Whether to expand wildcard expression to concrete indices that are open, closed or both. + * lenient?: bool, // Specify whether format-based query failures (such as providing text to a numeric field) should be ignored + * preference?: string, // Specify the node or shard the operation should be performed on (default: random) + * rest_total_hits_as_int?: bool, // Indicates whether hits.total should be rendered as an integer or an object in the rest search response + * q?: string, // Query in the Lucene query string syntax + * routing?: string|array, // A comma-separated list of specific routing values + * search_type?: string, // Search operation type + * size?: int, // Number of hits to return (default: 10) + * sort?: string|array, // A comma-separated list of : pairs + * _source?: string|array, // True or false to return the _source field or not, or a list of fields to return + * _source_excludes?: string|array, // A list of fields to exclude from the returned _source field + * _source_includes?: string|array, // A list of fields to extract and return from the _source field + * terminate_after?: int, // The maximum number of documents to collect for each shard, upon reaching which the query execution will terminate early. + * stats?: string|array, // Specific 'tag' of the request for logging and statistical purposes + * suggest_field?: string, // Specify which field to use for suggestions + * suggest_mode?: string, // Specify suggest mode + * suggest_size?: int, // How many suggestions to return in response + * suggest_text?: string, // The source text for which the suggestions should be returned + * timeout?: int|string, // Explicit operation timeout + * track_scores?: bool, // Whether to calculate and return scores even if they are not used for sorting + * track_total_hits?: bool|int, // Indicate if the number of documents that match the query should be tracked. A number can also be specified, to accurately track the total hit count up to the number. + * allow_partial_search_results?: bool, // Indicate if an error should be returned if there is a partial search failure or timeout + * typed_keys?: bool, // Specify whether aggregation and suggester names should be prefixed by their respective types in the response + * version?: bool, // Specify whether to return document version as part of a hit + * seq_no_primary_term?: bool, // Specify whether to return sequence number and primary term of the last modification of each hit + * max_concurrent_shard_requests?: int, // The number of concurrent shard requests per node this search executes concurrently. This value should be used to limit the impact of the search on the cluster in order to limit the number of concurrent shard requests + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. + * body?: string|array, // The search definition using the Query DSL. If body is a string must be a valid JSON. * } $params * * @throws NoNodeAvailableException if all the hosts are offline @@ -205,16 +210,17 @@ public function status(array $params = []) * * @return Elasticsearch|Promise */ - public function submit(array $params = []) + public function submit(?array $params = null) { + $params = $params ?? []; if (isset($params['index'])) { - $url = '/' . $this->encode($params['index']) . '/_async_search'; + $url = '/' . $this->encode($this->convertValue($params['index'])) . '/_async_search'; $method = 'POST'; } else { $url = '/_async_search'; $method = 'POST'; } - $url = $this->addQueryString($url, $params, ['wait_for_completion_timeout','keep_on_completion','keep_alive','batched_reduce_size','request_cache','analyzer','analyze_wildcard','default_operator','df','explain','stored_fields','docvalue_fields','from','ignore_unavailable','ignore_throttled','allow_no_indices','expand_wildcards','lenient','preference','q','routing','search_type','size','sort','_source','_source_excludes','_source_includes','terminate_after','stats','suggest_field','suggest_mode','suggest_size','suggest_text','timeout','track_scores','track_total_hits','allow_partial_search_results','typed_keys','version','seq_no_primary_term','max_concurrent_shard_requests','pretty','human','error_trace','source','filter_path']); + $url = $this->addQueryString($url, $params, ['wait_for_completion_timeout','keep_on_completion','keep_alive','batched_reduce_size','request_cache','analyzer','analyze_wildcard','ccs_minimize_roundtrips','default_operator','df','explain','stored_fields','docvalue_fields','from','ignore_unavailable','ignore_throttled','allow_no_indices','expand_wildcards','lenient','preference','rest_total_hits_as_int','q','routing','search_type','size','sort','_source','_source_excludes','_source_includes','terminate_after','stats','suggest_field','suggest_mode','suggest_size','suggest_text','timeout','track_scores','track_total_hits','allow_partial_search_results','typed_keys','version','seq_no_primary_term','max_concurrent_shard_requests','pretty','human','error_trace','source','filter_path']); $headers = [ 'Accept' => 'application/json', 'Content-Type' => 'application/json', diff --git a/src/Endpoints/Autoscaling.php b/src/Endpoints/Autoscaling.php index 75481fc88..4843972f3 100644 --- a/src/Endpoints/Autoscaling.php +++ b/src/Endpoints/Autoscaling.php @@ -35,13 +35,13 @@ class Autoscaling extends AbstractEndpoint * * @param array{ * name: string, // (REQUIRED) the name of the autoscaling policy - * master_timeout: time, // Timeout for processing on master node - * timeout: time, // Timeout for acknowledgement of update from all nodes in cluster - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. + * master_timeout?: int|string, // Timeout for processing on master node + * timeout?: int|string, // Timeout for acknowledgement of update from all nodes in cluster + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. * } $params * * @throws MissingParameterException if a required parameter is missing @@ -51,8 +51,9 @@ class Autoscaling extends AbstractEndpoint * * @return Elasticsearch|Promise */ - public function deleteAutoscalingPolicy(array $params = []) + public function deleteAutoscalingPolicy(?array $params = null) { + $params = $params ?? []; $this->checkRequiredParameters(['name'], $params); $url = '/_autoscaling/policy/' . $this->encode($params['name']); $method = 'DELETE'; @@ -73,12 +74,12 @@ public function deleteAutoscalingPolicy(array $params = []) * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/autoscaling-get-autoscaling-capacity.html * * @param array{ - * master_timeout: time, // Timeout for processing on master node - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. + * master_timeout?: int|string, // Timeout for processing on master node + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. * } $params * * @throws NoNodeAvailableException if all the hosts are offline @@ -87,8 +88,9 @@ public function deleteAutoscalingPolicy(array $params = []) * * @return Elasticsearch|Promise */ - public function getAutoscalingCapacity(array $params = []) + public function getAutoscalingCapacity(?array $params = null) { + $params = $params ?? []; $url = '/_autoscaling/capacity'; $method = 'GET'; @@ -109,12 +111,12 @@ public function getAutoscalingCapacity(array $params = []) * * @param array{ * name: string, // (REQUIRED) the name of the autoscaling policy - * master_timeout: time, // Timeout for processing on master node - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. + * master_timeout?: int|string, // Timeout for processing on master node + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. * } $params * * @throws MissingParameterException if a required parameter is missing @@ -124,8 +126,9 @@ public function getAutoscalingCapacity(array $params = []) * * @return Elasticsearch|Promise */ - public function getAutoscalingPolicy(array $params = []) + public function getAutoscalingPolicy(?array $params = null) { + $params = $params ?? []; $this->checkRequiredParameters(['name'], $params); $url = '/_autoscaling/policy/' . $this->encode($params['name']); $method = 'GET'; @@ -147,14 +150,14 @@ public function getAutoscalingPolicy(array $params = []) * * @param array{ * name: string, // (REQUIRED) the name of the autoscaling policy - * master_timeout: time, // Timeout for processing on master node - * timeout: time, // Timeout for acknowledgement of update from all nodes in cluster - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. - * body: array, // (REQUIRED) the specification of the autoscaling policy + * master_timeout?: int|string, // Timeout for processing on master node + * timeout?: int|string, // Timeout for acknowledgement of update from all nodes in cluster + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. + * body: string|array, // (REQUIRED) the specification of the autoscaling policy. If body is a string must be a valid JSON. * } $params * * @throws MissingParameterException if a required parameter is missing @@ -164,8 +167,9 @@ public function getAutoscalingPolicy(array $params = []) * * @return Elasticsearch|Promise */ - public function putAutoscalingPolicy(array $params = []) + public function putAutoscalingPolicy(?array $params = null) { + $params = $params ?? []; $this->checkRequiredParameters(['name','body'], $params); $url = '/_autoscaling/policy/' . $this->encode($params['name']); $method = 'PUT'; diff --git a/src/Endpoints/Cat.php b/src/Endpoints/Cat.php index 026f7ba32..d2d7a4278 100644 --- a/src/Endpoints/Cat.php +++ b/src/Endpoints/Cat.php @@ -34,19 +34,19 @@ class Cat extends AbstractEndpoint * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/cat-alias.html * * @param array{ - * name: list, // A comma-separated list of alias names to return - * format: string, // a short version of the Accept header, e.g. json, yaml - * local: boolean, // Return local information, do not retrieve the state from master node (default: false) - * h: list, // Comma-separated list of column names to display - * help: boolean, // Return help information - * s: list, // Comma-separated list of column names or column aliases to sort by - * v: boolean, // Verbose mode. Display column headers - * expand_wildcards: enum, // Whether to expand wildcard expression to concrete indices that are open, closed or both. - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. + * name?: string|array, // A comma-separated list of alias names to return + * format?: string, // a short version of the Accept header, e.g. json, yaml + * local?: bool, // Return local information, do not retrieve the state from master node (default: false) + * h?: string|array, // Comma-separated list of column names to display + * help?: bool, // Return help information + * s?: string|array, // Comma-separated list of column names or column aliases to sort by + * v?: bool, // Verbose mode. Display column headers + * expand_wildcards?: string, // Whether to expand wildcard expression to concrete indices that are open, closed or both. + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. * } $params * * @throws NoNodeAvailableException if all the hosts are offline @@ -55,10 +55,11 @@ class Cat extends AbstractEndpoint * * @return Elasticsearch|Promise */ - public function aliases(array $params = []) + public function aliases(?array $params = null) { + $params = $params ?? []; if (isset($params['name'])) { - $url = '/_cat/aliases/' . $this->encode($params['name']); + $url = '/_cat/aliases/' . $this->encode($this->convertValue($params['name'])); $method = 'GET'; } else { $url = '/_cat/aliases'; @@ -80,20 +81,20 @@ public function aliases(array $params = []) * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/cat-allocation.html * * @param array{ - * node_id: list, // A comma-separated list of node IDs or names to limit the returned information - * format: string, // a short version of the Accept header, e.g. json, yaml - * bytes: enum, // The unit in which to display byte values - * local: boolean, // Return local information, do not retrieve the state from master node (default: false) - * master_timeout: time, // Explicit operation timeout for connection to master node - * h: list, // Comma-separated list of column names to display - * help: boolean, // Return help information - * s: list, // Comma-separated list of column names or column aliases to sort by - * v: boolean, // Verbose mode. Display column headers - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. + * node_id?: string|array, // A comma-separated list of node IDs or names to limit the returned information + * format?: string, // a short version of the Accept header, e.g. json, yaml + * bytes?: string, // The unit in which to display byte values + * local?: bool, // Return local information, do not retrieve the state from master node (default: false) + * master_timeout?: int|string, // Explicit operation timeout for connection to master node + * h?: string|array, // Comma-separated list of column names to display + * help?: bool, // Return help information + * s?: string|array, // Comma-separated list of column names or column aliases to sort by + * v?: bool, // Verbose mode. Display column headers + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. * } $params * * @throws NoNodeAvailableException if all the hosts are offline @@ -102,10 +103,11 @@ public function aliases(array $params = []) * * @return Elasticsearch|Promise */ - public function allocation(array $params = []) + public function allocation(?array $params = null) { + $params = $params ?? []; if (isset($params['node_id'])) { - $url = '/_cat/allocation/' . $this->encode($params['node_id']); + $url = '/_cat/allocation/' . $this->encode($this->convertValue($params['node_id'])); $method = 'GET'; } else { $url = '/_cat/allocation'; @@ -127,19 +129,19 @@ public function allocation(array $params = []) * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/cat-component-templates.html * * @param array{ - * name: string, // A pattern that returned component template names must match - * format: string, // a short version of the Accept header, e.g. json, yaml - * local: boolean, // Return local information, do not retrieve the state from master node (default: false) - * master_timeout: time, // Explicit operation timeout for connection to master node - * h: list, // Comma-separated list of column names to display - * help: boolean, // Return help information - * s: list, // Comma-separated list of column names or column aliases to sort by - * v: boolean, // Verbose mode. Display column headers - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. + * name?: string, // A pattern that returned component template names must match + * format?: string, // a short version of the Accept header, e.g. json, yaml + * local?: bool, // Return local information, do not retrieve the state from master node (default: false) + * master_timeout?: int|string, // Explicit operation timeout for connection to master node + * h?: string|array, // Comma-separated list of column names to display + * help?: bool, // Return help information + * s?: string|array, // Comma-separated list of column names or column aliases to sort by + * v?: bool, // Verbose mode. Display column headers + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. * } $params * * @throws NoNodeAvailableException if all the hosts are offline @@ -148,8 +150,9 @@ public function allocation(array $params = []) * * @return Elasticsearch|Promise */ - public function componentTemplates(array $params = []) + public function componentTemplates(?array $params = null) { + $params = $params ?? []; if (isset($params['name'])) { $url = '/_cat/component_templates/' . $this->encode($params['name']); $method = 'GET'; @@ -173,17 +176,17 @@ public function componentTemplates(array $params = []) * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/cat-count.html * * @param array{ - * index: list, // A comma-separated list of index names to limit the returned information - * format: string, // a short version of the Accept header, e.g. json, yaml - * h: list, // Comma-separated list of column names to display - * help: boolean, // Return help information - * s: list, // Comma-separated list of column names or column aliases to sort by - * v: boolean, // Verbose mode. Display column headers - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. + * index?: string|array, // A comma-separated list of index names to limit the returned information + * format?: string, // a short version of the Accept header, e.g. json, yaml + * h?: string|array, // Comma-separated list of column names to display + * help?: bool, // Return help information + * s?: string|array, // Comma-separated list of column names or column aliases to sort by + * v?: bool, // Verbose mode. Display column headers + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. * } $params * * @throws NoNodeAvailableException if all the hosts are offline @@ -192,10 +195,11 @@ public function componentTemplates(array $params = []) * * @return Elasticsearch|Promise */ - public function count(array $params = []) + public function count(?array $params = null) { + $params = $params ?? []; if (isset($params['index'])) { - $url = '/_cat/count/' . $this->encode($params['index']); + $url = '/_cat/count/' . $this->encode($this->convertValue($params['index'])); $method = 'GET'; } else { $url = '/_cat/count'; @@ -217,18 +221,18 @@ public function count(array $params = []) * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/cat-fielddata.html * * @param array{ - * fields: list, // A comma-separated list of fields to return the fielddata size - * format: string, // a short version of the Accept header, e.g. json, yaml - * bytes: enum, // The unit in which to display byte values - * h: list, // Comma-separated list of column names to display - * help: boolean, // Return help information - * s: list, // Comma-separated list of column names or column aliases to sort by - * v: boolean, // Verbose mode. Display column headers - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. + * fields?: string|array, // A comma-separated list of fields to return the fielddata size + * format?: string, // a short version of the Accept header, e.g. json, yaml + * bytes?: string, // The unit in which to display byte values + * h?: string|array, // Comma-separated list of column names to display + * help?: bool, // Return help information + * s?: string|array, // Comma-separated list of column names or column aliases to sort by + * v?: bool, // Verbose mode. Display column headers + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. * } $params * * @throws NoNodeAvailableException if all the hosts are offline @@ -237,10 +241,11 @@ public function count(array $params = []) * * @return Elasticsearch|Promise */ - public function fielddata(array $params = []) + public function fielddata(?array $params = null) { + $params = $params ?? []; if (isset($params['fields'])) { - $url = '/_cat/fielddata/' . $this->encode($params['fields']); + $url = '/_cat/fielddata/' . $this->encode($this->convertValue($params['fields'])); $method = 'GET'; } else { $url = '/_cat/fielddata'; @@ -262,18 +267,18 @@ public function fielddata(array $params = []) * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/cat-health.html * * @param array{ - * format: string, // a short version of the Accept header, e.g. json, yaml - * h: list, // Comma-separated list of column names to display - * help: boolean, // Return help information - * s: list, // Comma-separated list of column names or column aliases to sort by - * time: enum, // The unit in which to display time values - * ts: boolean, // Set to false to disable timestamping - * v: boolean, // Verbose mode. Display column headers - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. + * format?: string, // a short version of the Accept header, e.g. json, yaml + * h?: string|array, // Comma-separated list of column names to display + * help?: bool, // Return help information + * s?: string|array, // Comma-separated list of column names or column aliases to sort by + * time?: string, // The unit in which to display time values + * ts?: bool, // Set to false to disable timestamping + * v?: bool, // Verbose mode. Display column headers + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. * } $params * * @throws NoNodeAvailableException if all the hosts are offline @@ -282,8 +287,9 @@ public function fielddata(array $params = []) * * @return Elasticsearch|Promise */ - public function health(array $params = []) + public function health(?array $params = null) { + $params = $params ?? []; $url = '/_cat/health'; $method = 'GET'; @@ -303,13 +309,11 @@ public function health(array $params = []) * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/cat.html * * @param array{ - * help: boolean, // Return help information - * s: list, // Comma-separated list of column names or column aliases to sort by - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. * } $params * * @throws NoNodeAvailableException if all the hosts are offline @@ -318,12 +322,13 @@ public function health(array $params = []) * * @return Elasticsearch|Promise */ - public function help(array $params = []) + public function help(?array $params = null) { + $params = $params ?? []; $url = '/_cat'; $method = 'GET'; - $url = $this->addQueryString($url, $params, ['help','s','pretty','human','error_trace','source','filter_path']); + $url = $this->addQueryString($url, $params, ['pretty','human','error_trace','source','filter_path']); $headers = [ 'Accept' => 'text/plain', ]; @@ -339,24 +344,24 @@ public function help(array $params = []) * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/cat-indices.html * * @param array{ - * index: list, // A comma-separated list of index names to limit the returned information - * format: string, // a short version of the Accept header, e.g. json, yaml - * bytes: enum, // The unit in which to display byte values - * master_timeout: time, // Explicit operation timeout for connection to master node - * h: list, // Comma-separated list of column names to display - * health: enum, // A health status ("green", "yellow", or "red" to filter only indices matching the specified health status - * help: boolean, // Return help information - * pri: boolean, // Set to true to return stats only for primary shards - * s: list, // Comma-separated list of column names or column aliases to sort by - * time: enum, // The unit in which to display time values - * v: boolean, // Verbose mode. Display column headers - * include_unloaded_segments: boolean, // If set to true segment stats will include stats for segments that are not currently loaded into memory - * expand_wildcards: enum, // Whether to expand wildcard expression to concrete indices that are open, closed or both. - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. + * index?: string|array, // A comma-separated list of index names to limit the returned information + * format?: string, // a short version of the Accept header, e.g. json, yaml + * bytes?: string, // The unit in which to display byte values + * master_timeout?: int|string, // Explicit operation timeout for connection to master node + * h?: string|array, // Comma-separated list of column names to display + * health?: string, // A health status ("green", "yellow", or "red" to filter only indices matching the specified health status + * help?: bool, // Return help information + * pri?: bool, // Set to true to return stats only for primary shards + * s?: string|array, // Comma-separated list of column names or column aliases to sort by + * time?: string, // The unit in which to display time values + * v?: bool, // Verbose mode. Display column headers + * include_unloaded_segments?: bool, // If set to true segment stats will include stats for segments that are not currently loaded into memory + * expand_wildcards?: string, // Whether to expand wildcard expression to concrete indices that are open, closed or both. + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. * } $params * * @throws NoNodeAvailableException if all the hosts are offline @@ -365,10 +370,11 @@ public function help(array $params = []) * * @return Elasticsearch|Promise */ - public function indices(array $params = []) + public function indices(?array $params = null) { + $params = $params ?? []; if (isset($params['index'])) { - $url = '/_cat/indices/' . $this->encode($params['index']); + $url = '/_cat/indices/' . $this->encode($this->convertValue($params['index'])); $method = 'GET'; } else { $url = '/_cat/indices'; @@ -390,18 +396,18 @@ public function indices(array $params = []) * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/cat-master.html * * @param array{ - * format: string, // a short version of the Accept header, e.g. json, yaml - * local: boolean, // Return local information, do not retrieve the state from master node (default: false) - * master_timeout: time, // Explicit operation timeout for connection to master node - * h: list, // Comma-separated list of column names to display - * help: boolean, // Return help information - * s: list, // Comma-separated list of column names or column aliases to sort by - * v: boolean, // Verbose mode. Display column headers - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. + * format?: string, // a short version of the Accept header, e.g. json, yaml + * local?: bool, // Return local information, do not retrieve the state from master node (default: false) + * master_timeout?: int|string, // Explicit operation timeout for connection to master node + * h?: string|array, // Comma-separated list of column names to display + * help?: bool, // Return help information + * s?: string|array, // Comma-separated list of column names or column aliases to sort by + * v?: bool, // Verbose mode. Display column headers + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. * } $params * * @throws NoNodeAvailableException if all the hosts are offline @@ -410,8 +416,9 @@ public function indices(array $params = []) * * @return Elasticsearch|Promise */ - public function master(array $params = []) + public function master(?array $params = null) { + $params = $params ?? []; $url = '/_cat/master'; $method = 'GET'; @@ -431,20 +438,20 @@ public function master(array $params = []) * @see http://www.elastic.co/guide/en/elasticsearch/reference/current/cat-dfanalytics.html * * @param array{ - * id: string, // The ID of the data frame analytics to fetch - * allow_no_match: boolean, // Whether to ignore if a wildcard expression matches no configs. (This includes `_all` string or when no configs have been specified) - * bytes: enum, // The unit in which to display byte values - * format: string, // a short version of the Accept header, e.g. json, yaml - * h: list, // Comma-separated list of column names to display - * help: boolean, // Return help information - * s: list, // Comma-separated list of column names or column aliases to sort by - * time: enum, // The unit in which to display time values - * v: boolean, // Verbose mode. Display column headers - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. + * id?: string, // The ID of the data frame analytics to fetch + * allow_no_match?: bool, // Whether to ignore if a wildcard expression matches no configs. (This includes `_all` string or when no configs have been specified) + * bytes?: string, // The unit in which to display byte values + * format?: string, // a short version of the Accept header, e.g. json, yaml + * h?: string|array, // Comma-separated list of column names to display + * help?: bool, // Return help information + * s?: string|array, // Comma-separated list of column names or column aliases to sort by + * time?: string, // The unit in which to display time values + * v?: bool, // Verbose mode. Display column headers + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. * } $params * * @throws NoNodeAvailableException if all the hosts are offline @@ -453,8 +460,9 @@ public function master(array $params = []) * * @return Elasticsearch|Promise */ - public function mlDataFrameAnalytics(array $params = []) + public function mlDataFrameAnalytics(?array $params = null) { + $params = $params ?? []; if (isset($params['id'])) { $url = '/_cat/ml/data_frame/analytics/' . $this->encode($params['id']); $method = 'GET'; @@ -478,19 +486,19 @@ public function mlDataFrameAnalytics(array $params = []) * @see http://www.elastic.co/guide/en/elasticsearch/reference/current/cat-datafeeds.html * * @param array{ - * datafeed_id: string, // The ID of the datafeeds stats to fetch - * allow_no_match: boolean, // Whether to ignore if a wildcard expression matches no datafeeds. (This includes `_all` string or when no datafeeds have been specified) - * format: string, // a short version of the Accept header, e.g. json, yaml - * h: list, // Comma-separated list of column names to display - * help: boolean, // Return help information - * s: list, // Comma-separated list of column names or column aliases to sort by - * time: enum, // The unit in which to display time values - * v: boolean, // Verbose mode. Display column headers - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. + * datafeed_id?: string, // The ID of the datafeeds stats to fetch + * allow_no_match?: bool, // Whether to ignore if a wildcard expression matches no datafeeds. (This includes `_all` string or when no datafeeds have been specified) + * format?: string, // a short version of the Accept header, e.g. json, yaml + * h?: string|array, // Comma-separated list of column names to display + * help?: bool, // Return help information + * s?: string|array, // Comma-separated list of column names or column aliases to sort by + * time?: string, // The unit in which to display time values + * v?: bool, // Verbose mode. Display column headers + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. * } $params * * @throws NoNodeAvailableException if all the hosts are offline @@ -499,8 +507,9 @@ public function mlDataFrameAnalytics(array $params = []) * * @return Elasticsearch|Promise */ - public function mlDatafeeds(array $params = []) + public function mlDatafeeds(?array $params = null) { + $params = $params ?? []; if (isset($params['datafeed_id'])) { $url = '/_cat/ml/datafeeds/' . $this->encode($params['datafeed_id']); $method = 'GET'; @@ -524,20 +533,20 @@ public function mlDatafeeds(array $params = []) * @see http://www.elastic.co/guide/en/elasticsearch/reference/current/cat-anomaly-detectors.html * * @param array{ - * job_id: string, // The ID of the jobs stats to fetch - * allow_no_match: boolean, // Whether to ignore if a wildcard expression matches no jobs. (This includes `_all` string or when no jobs have been specified) - * bytes: enum, // The unit in which to display byte values - * format: string, // a short version of the Accept header, e.g. json, yaml - * h: list, // Comma-separated list of column names to display - * help: boolean, // Return help information - * s: list, // Comma-separated list of column names or column aliases to sort by - * time: enum, // The unit in which to display time values - * v: boolean, // Verbose mode. Display column headers - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. + * job_id?: string, // The ID of the jobs stats to fetch + * allow_no_match?: bool, // Whether to ignore if a wildcard expression matches no jobs. (This includes `_all` string or when no jobs have been specified) + * bytes?: string, // The unit in which to display byte values + * format?: string, // a short version of the Accept header, e.g. json, yaml + * h?: string|array, // Comma-separated list of column names to display + * help?: bool, // Return help information + * s?: string|array, // Comma-separated list of column names or column aliases to sort by + * time?: string, // The unit in which to display time values + * v?: bool, // Verbose mode. Display column headers + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. * } $params * * @throws NoNodeAvailableException if all the hosts are offline @@ -546,8 +555,9 @@ public function mlDatafeeds(array $params = []) * * @return Elasticsearch|Promise */ - public function mlJobs(array $params = []) + public function mlJobs(?array $params = null) { + $params = $params ?? []; if (isset($params['job_id'])) { $url = '/_cat/ml/anomaly_detectors/' . $this->encode($params['job_id']); $method = 'GET'; @@ -571,22 +581,22 @@ public function mlJobs(array $params = []) * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/cat-trained-model.html * * @param array{ - * model_id: string, // The ID of the trained models stats to fetch - * allow_no_match: boolean, // Whether to ignore if a wildcard expression matches no trained models. (This includes `_all` string or when no trained models have been specified) - * from: int, // skips a number of trained models - * size: int, // specifies a max number of trained models to get - * bytes: enum, // The unit in which to display byte values - * format: string, // a short version of the Accept header, e.g. json, yaml - * h: list, // Comma-separated list of column names to display - * help: boolean, // Return help information - * s: list, // Comma-separated list of column names or column aliases to sort by - * time: enum, // The unit in which to display time values - * v: boolean, // Verbose mode. Display column headers - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. + * model_id?: string, // The ID of the trained models stats to fetch + * allow_no_match?: bool, // Whether to ignore if a wildcard expression matches no trained models. (This includes `_all` string or when no trained models have been specified) + * from?: int, // skips a number of trained models + * size?: int, // specifies a max number of trained models to get + * bytes?: string, // The unit in which to display byte values + * format?: string, // a short version of the Accept header, e.g. json, yaml + * h?: string|array, // Comma-separated list of column names to display + * help?: bool, // Return help information + * s?: string|array, // Comma-separated list of column names or column aliases to sort by + * time?: string, // The unit in which to display time values + * v?: bool, // Verbose mode. Display column headers + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. * } $params * * @throws NoNodeAvailableException if all the hosts are offline @@ -595,8 +605,9 @@ public function mlJobs(array $params = []) * * @return Elasticsearch|Promise */ - public function mlTrainedModels(array $params = []) + public function mlTrainedModels(?array $params = null) { + $params = $params ?? []; if (isset($params['model_id'])) { $url = '/_cat/ml/trained_models/' . $this->encode($params['model_id']); $method = 'GET'; @@ -620,18 +631,18 @@ public function mlTrainedModels(array $params = []) * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/cat-nodeattrs.html * * @param array{ - * format: string, // a short version of the Accept header, e.g. json, yaml - * local: boolean, // Return local information, do not retrieve the state from master node (default: false) - * master_timeout: time, // Explicit operation timeout for connection to master node - * h: list, // Comma-separated list of column names to display - * help: boolean, // Return help information - * s: list, // Comma-separated list of column names or column aliases to sort by - * v: boolean, // Verbose mode. Display column headers - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. + * format?: string, // a short version of the Accept header, e.g. json, yaml + * local?: bool, // Return local information, do not retrieve the state from master node (default: false) + * master_timeout?: int|string, // Explicit operation timeout for connection to master node + * h?: string|array, // Comma-separated list of column names to display + * help?: bool, // Return help information + * s?: string|array, // Comma-separated list of column names or column aliases to sort by + * v?: bool, // Verbose mode. Display column headers + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. * } $params * * @throws NoNodeAvailableException if all the hosts are offline @@ -640,8 +651,9 @@ public function mlTrainedModels(array $params = []) * * @return Elasticsearch|Promise */ - public function nodeattrs(array $params = []) + public function nodeattrs(?array $params = null) { + $params = $params ?? []; $url = '/_cat/nodeattrs'; $method = 'GET'; @@ -661,21 +673,21 @@ public function nodeattrs(array $params = []) * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/cat-nodes.html * * @param array{ - * bytes: enum, // The unit in which to display byte values - * format: string, // a short version of the Accept header, e.g. json, yaml - * full_id: boolean, // Return the full node ID instead of the shortened version (default: false) - * master_timeout: time, // Explicit operation timeout for connection to master node - * h: list, // Comma-separated list of column names to display - * help: boolean, // Return help information - * s: list, // Comma-separated list of column names or column aliases to sort by - * time: enum, // The unit in which to display time values - * v: boolean, // Verbose mode. Display column headers - * include_unloaded_segments: boolean, // If set to true segment stats will include stats for segments that are not currently loaded into memory - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. + * bytes?: string, // The unit in which to display byte values + * format?: string, // a short version of the Accept header, e.g. json, yaml + * full_id?: bool, // Return the full node ID instead of the shortened version (default: false) + * master_timeout?: int|string, // Explicit operation timeout for connection to master node + * h?: string|array, // Comma-separated list of column names to display + * help?: bool, // Return help information + * s?: string|array, // Comma-separated list of column names or column aliases to sort by + * time?: string, // The unit in which to display time values + * v?: bool, // Verbose mode. Display column headers + * include_unloaded_segments?: bool, // If set to true segment stats will include stats for segments that are not currently loaded into memory + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. * } $params * * @throws NoNodeAvailableException if all the hosts are offline @@ -684,8 +696,9 @@ public function nodeattrs(array $params = []) * * @return Elasticsearch|Promise */ - public function nodes(array $params = []) + public function nodes(?array $params = null) { + $params = $params ?? []; $url = '/_cat/nodes'; $method = 'GET'; @@ -705,19 +718,19 @@ public function nodes(array $params = []) * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/cat-pending-tasks.html * * @param array{ - * format: string, // a short version of the Accept header, e.g. json, yaml - * local: boolean, // Return local information, do not retrieve the state from master node (default: false) - * master_timeout: time, // Explicit operation timeout for connection to master node - * h: list, // Comma-separated list of column names to display - * help: boolean, // Return help information - * s: list, // Comma-separated list of column names or column aliases to sort by - * time: enum, // The unit in which to display time values - * v: boolean, // Verbose mode. Display column headers - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. + * format?: string, // a short version of the Accept header, e.g. json, yaml + * local?: bool, // Return local information, do not retrieve the state from master node (default: false) + * master_timeout?: int|string, // Explicit operation timeout for connection to master node + * h?: string|array, // Comma-separated list of column names to display + * help?: bool, // Return help information + * s?: string|array, // Comma-separated list of column names or column aliases to sort by + * time?: string, // The unit in which to display time values + * v?: bool, // Verbose mode. Display column headers + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. * } $params * * @throws NoNodeAvailableException if all the hosts are offline @@ -726,8 +739,9 @@ public function nodes(array $params = []) * * @return Elasticsearch|Promise */ - public function pendingTasks(array $params = []) + public function pendingTasks(?array $params = null) { + $params = $params ?? []; $url = '/_cat/pending_tasks'; $method = 'GET'; @@ -747,19 +761,19 @@ public function pendingTasks(array $params = []) * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/cat-plugins.html * * @param array{ - * format: string, // a short version of the Accept header, e.g. json, yaml - * local: boolean, // Return local information, do not retrieve the state from master node (default: false) - * master_timeout: time, // Explicit operation timeout for connection to master node - * h: list, // Comma-separated list of column names to display - * help: boolean, // Return help information - * include_bootstrap: boolean, // Include bootstrap plugins in the response - * s: list, // Comma-separated list of column names or column aliases to sort by - * v: boolean, // Verbose mode. Display column headers - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. + * format?: string, // a short version of the Accept header, e.g. json, yaml + * local?: bool, // Return local information, do not retrieve the state from master node (default: false) + * master_timeout?: int|string, // Explicit operation timeout for connection to master node + * h?: string|array, // Comma-separated list of column names to display + * help?: bool, // Return help information + * include_bootstrap?: bool, // Include bootstrap plugins in the response + * s?: string|array, // Comma-separated list of column names or column aliases to sort by + * v?: bool, // Verbose mode. Display column headers + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. * } $params * * @throws NoNodeAvailableException if all the hosts are offline @@ -768,8 +782,9 @@ public function pendingTasks(array $params = []) * * @return Elasticsearch|Promise */ - public function plugins(array $params = []) + public function plugins(?array $params = null) { + $params = $params ?? []; $url = '/_cat/plugins'; $method = 'GET'; @@ -789,21 +804,21 @@ public function plugins(array $params = []) * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/cat-recovery.html * * @param array{ - * index: list, // Comma-separated list or wildcard expression of index names to limit the returned information - * format: string, // a short version of the Accept header, e.g. json, yaml - * active_only: boolean, // If `true`, the response only includes ongoing shard recoveries - * bytes: enum, // The unit in which to display byte values - * detailed: boolean, // If `true`, the response includes detailed information about shard recoveries - * h: list, // Comma-separated list of column names to display - * help: boolean, // Return help information - * s: list, // Comma-separated list of column names or column aliases to sort by - * time: enum, // The unit in which to display time values - * v: boolean, // Verbose mode. Display column headers - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. + * index?: string|array, // Comma-separated list or wildcard expression of index names to limit the returned information + * format?: string, // a short version of the Accept header, e.g. json, yaml + * active_only?: bool, // If `true`, the response only includes ongoing shard recoveries + * bytes?: string, // The unit in which to display byte values + * detailed?: bool, // If `true`, the response includes detailed information about shard recoveries + * h?: string|array, // Comma-separated list of column names to display + * help?: bool, // Return help information + * s?: string|array, // Comma-separated list of column names or column aliases to sort by + * time?: string, // The unit in which to display time values + * v?: bool, // Verbose mode. Display column headers + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. * } $params * * @throws NoNodeAvailableException if all the hosts are offline @@ -812,10 +827,11 @@ public function plugins(array $params = []) * * @return Elasticsearch|Promise */ - public function recovery(array $params = []) + public function recovery(?array $params = null) { + $params = $params ?? []; if (isset($params['index'])) { - $url = '/_cat/recovery/' . $this->encode($params['index']); + $url = '/_cat/recovery/' . $this->encode($this->convertValue($params['index'])); $method = 'GET'; } else { $url = '/_cat/recovery'; @@ -837,18 +853,18 @@ public function recovery(array $params = []) * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/cat-repositories.html * * @param array{ - * format: string, // a short version of the Accept header, e.g. json, yaml - * local: boolean, // Return local information, do not retrieve the state from master node - * master_timeout: time, // Explicit operation timeout for connection to master node - * h: list, // Comma-separated list of column names to display - * help: boolean, // Return help information - * s: list, // Comma-separated list of column names or column aliases to sort by - * v: boolean, // Verbose mode. Display column headers - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. + * format?: string, // a short version of the Accept header, e.g. json, yaml + * local?: bool, // Return local information, do not retrieve the state from master node + * master_timeout?: int|string, // Explicit operation timeout for connection to master node + * h?: string|array, // Comma-separated list of column names to display + * help?: bool, // Return help information + * s?: string|array, // Comma-separated list of column names or column aliases to sort by + * v?: bool, // Verbose mode. Display column headers + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. * } $params * * @throws NoNodeAvailableException if all the hosts are offline @@ -857,8 +873,9 @@ public function recovery(array $params = []) * * @return Elasticsearch|Promise */ - public function repositories(array $params = []) + public function repositories(?array $params = null) { + $params = $params ?? []; $url = '/_cat/repositories'; $method = 'GET'; @@ -878,18 +895,20 @@ public function repositories(array $params = []) * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/cat-segments.html * * @param array{ - * index: list, // A comma-separated list of index names to limit the returned information - * format: string, // a short version of the Accept header, e.g. json, yaml - * bytes: enum, // The unit in which to display byte values - * h: list, // Comma-separated list of column names to display - * help: boolean, // Return help information - * s: list, // Comma-separated list of column names or column aliases to sort by - * v: boolean, // Verbose mode. Display column headers - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. + * index?: string|array, // A comma-separated list of index names to limit the returned information + * format?: string, // a short version of the Accept header, e.g. json, yaml + * local?: bool, // Return local information, do not retrieve the state from master node (default: false) + * master_timeout?: int|string, // Explicit operation timeout for connection to master node + * bytes?: string, // The unit in which to display byte values + * h?: string|array, // Comma-separated list of column names to display + * help?: bool, // Return help information + * s?: string|array, // Comma-separated list of column names or column aliases to sort by + * v?: bool, // Verbose mode. Display column headers + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. * } $params * * @throws NoNodeAvailableException if all the hosts are offline @@ -898,16 +917,17 @@ public function repositories(array $params = []) * * @return Elasticsearch|Promise */ - public function segments(array $params = []) + public function segments(?array $params = null) { + $params = $params ?? []; if (isset($params['index'])) { - $url = '/_cat/segments/' . $this->encode($params['index']); + $url = '/_cat/segments/' . $this->encode($this->convertValue($params['index'])); $method = 'GET'; } else { $url = '/_cat/segments'; $method = 'GET'; } - $url = $this->addQueryString($url, $params, ['format','bytes','h','help','s','v','pretty','human','error_trace','source','filter_path']); + $url = $this->addQueryString($url, $params, ['format','local','master_timeout','bytes','h','help','s','v','pretty','human','error_trace','source','filter_path']); $headers = [ 'Accept' => 'text/plain,application/json', ]; @@ -923,20 +943,20 @@ public function segments(array $params = []) * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/cat-shards.html * * @param array{ - * index: list, // A comma-separated list of index names to limit the returned information - * format: string, // a short version of the Accept header, e.g. json, yaml - * bytes: enum, // The unit in which to display byte values - * master_timeout: time, // Explicit operation timeout for connection to master node - * h: list, // Comma-separated list of column names to display - * help: boolean, // Return help information - * s: list, // Comma-separated list of column names or column aliases to sort by - * time: enum, // The unit in which to display time values - * v: boolean, // Verbose mode. Display column headers - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. + * index?: string|array, // A comma-separated list of index names to limit the returned information + * format?: string, // a short version of the Accept header, e.g. json, yaml + * bytes?: string, // The unit in which to display byte values + * master_timeout?: int|string, // Explicit operation timeout for connection to master node + * h?: string|array, // Comma-separated list of column names to display + * help?: bool, // Return help information + * s?: string|array, // Comma-separated list of column names or column aliases to sort by + * time?: string, // The unit in which to display time values + * v?: bool, // Verbose mode. Display column headers + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. * } $params * * @throws NoNodeAvailableException if all the hosts are offline @@ -945,10 +965,11 @@ public function segments(array $params = []) * * @return Elasticsearch|Promise */ - public function shards(array $params = []) + public function shards(?array $params = null) { + $params = $params ?? []; if (isset($params['index'])) { - $url = '/_cat/shards/' . $this->encode($params['index']); + $url = '/_cat/shards/' . $this->encode($this->convertValue($params['index'])); $method = 'GET'; } else { $url = '/_cat/shards'; @@ -970,20 +991,20 @@ public function shards(array $params = []) * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/cat-snapshots.html * * @param array{ - * repository: list, // Name of repository from which to fetch the snapshot information - * format: string, // a short version of the Accept header, e.g. json, yaml - * ignore_unavailable: boolean, // Set to true to ignore unavailable snapshots - * master_timeout: time, // Explicit operation timeout for connection to master node - * h: list, // Comma-separated list of column names to display - * help: boolean, // Return help information - * s: list, // Comma-separated list of column names or column aliases to sort by - * time: enum, // The unit in which to display time values - * v: boolean, // Verbose mode. Display column headers - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. + * repository?: string|array, // Name of repository from which to fetch the snapshot information + * format?: string, // a short version of the Accept header, e.g. json, yaml + * ignore_unavailable?: bool, // Set to true to ignore unavailable snapshots + * master_timeout?: int|string, // Explicit operation timeout for connection to master node + * h?: string|array, // Comma-separated list of column names to display + * help?: bool, // Return help information + * s?: string|array, // Comma-separated list of column names or column aliases to sort by + * time?: string, // The unit in which to display time values + * v?: bool, // Verbose mode. Display column headers + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. * } $params * * @throws NoNodeAvailableException if all the hosts are offline @@ -992,10 +1013,11 @@ public function shards(array $params = []) * * @return Elasticsearch|Promise */ - public function snapshots(array $params = []) + public function snapshots(?array $params = null) { + $params = $params ?? []; if (isset($params['repository'])) { - $url = '/_cat/snapshots/' . $this->encode($params['repository']); + $url = '/_cat/snapshots/' . $this->encode($this->convertValue($params['repository'])); $method = 'GET'; } else { $url = '/_cat/snapshots'; @@ -1018,21 +1040,23 @@ public function snapshots(array $params = []) * @internal This API is EXPERIMENTAL and may be changed or removed completely in a future release * * @param array{ - * format: string, // a short version of the Accept header, e.g. json, yaml - * nodes: list, // 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 - * actions: list, // A comma-separated list of actions that should be returned. Leave empty to return all. - * detailed: boolean, // Return detailed task information (default: false) - * parent_task_id: string, // Return tasks with specified parent task id (node_id:task_number). Set to -1 to return all. - * h: list, // Comma-separated list of column names to display - * help: boolean, // Return help information - * s: list, // Comma-separated list of column names or column aliases to sort by - * time: enum, // The unit in which to display time values - * v: boolean, // Verbose mode. Display column headers - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. + * format?: string, // a short version of the Accept header, e.g. json, yaml + * nodes?: string|array, // 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 + * actions?: string|array, // A comma-separated list of actions that should be returned. Leave empty to return all. + * detailed?: bool, // Return detailed task information (default: false) + * parent_task_id?: string, // Return tasks with specified parent task id (node_id:task_number). Set to -1 to return all. + * h?: string|array, // Comma-separated list of column names to display + * help?: bool, // Return help information + * s?: string|array, // Comma-separated list of column names or column aliases to sort by + * time?: string, // The unit in which to display time values + * v?: bool, // Verbose mode. Display column headers + * timeout?: int|string, // Period to wait for a response. If no response is received before the timeout expires, the request fails and returns an error. + * wait_for_completion?: bool, // If `true`, the request blocks until the task has completed. + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. * } $params * * @throws NoNodeAvailableException if all the hosts are offline @@ -1041,12 +1065,13 @@ public function snapshots(array $params = []) * * @return Elasticsearch|Promise */ - public function tasks(array $params = []) + public function tasks(?array $params = null) { + $params = $params ?? []; $url = '/_cat/tasks'; $method = 'GET'; - $url = $this->addQueryString($url, $params, ['format','nodes','actions','detailed','parent_task_id','h','help','s','time','v','pretty','human','error_trace','source','filter_path']); + $url = $this->addQueryString($url, $params, ['format','nodes','actions','detailed','parent_task_id','h','help','s','time','v','timeout','wait_for_completion','pretty','human','error_trace','source','filter_path']); $headers = [ 'Accept' => 'text/plain,application/json', ]; @@ -1062,19 +1087,19 @@ public function tasks(array $params = []) * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/cat-templates.html * * @param array{ - * name: string, // A pattern that returned template names must match - * format: string, // a short version of the Accept header, e.g. json, yaml - * local: boolean, // Return local information, do not retrieve the state from master node (default: false) - * master_timeout: time, // Explicit operation timeout for connection to master node - * h: list, // Comma-separated list of column names to display - * help: boolean, // Return help information - * s: list, // Comma-separated list of column names or column aliases to sort by - * v: boolean, // Verbose mode. Display column headers - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. + * name?: string, // A pattern that returned template names must match + * format?: string, // a short version of the Accept header, e.g. json, yaml + * local?: bool, // Return local information, do not retrieve the state from master node (default: false) + * master_timeout?: int|string, // Explicit operation timeout for connection to master node + * h?: string|array, // Comma-separated list of column names to display + * help?: bool, // Return help information + * s?: string|array, // Comma-separated list of column names or column aliases to sort by + * v?: bool, // Verbose mode. Display column headers + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. * } $params * * @throws NoNodeAvailableException if all the hosts are offline @@ -1083,8 +1108,9 @@ public function tasks(array $params = []) * * @return Elasticsearch|Promise */ - public function templates(array $params = []) + public function templates(?array $params = null) { + $params = $params ?? []; if (isset($params['name'])) { $url = '/_cat/templates/' . $this->encode($params['name']); $method = 'GET'; @@ -1109,20 +1135,20 @@ public function templates(array $params = []) * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/cat-thread-pool.html * * @param array{ - * thread_pool_patterns: list, // A comma-separated list of regular-expressions to filter the thread pools in the output - * format: string, // a short version of the Accept header, e.g. json, yaml - * time: enum, // The unit in which to display time values - * local: boolean, // Return local information, do not retrieve the state from master node (default: false) - * master_timeout: time, // Explicit operation timeout for connection to master node - * h: list, // Comma-separated list of column names to display - * help: boolean, // Return help information - * s: list, // Comma-separated list of column names or column aliases to sort by - * v: boolean, // Verbose mode. Display column headers - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. + * thread_pool_patterns?: string|array, // A comma-separated list of regular-expressions to filter the thread pools in the output + * format?: string, // a short version of the Accept header, e.g. json, yaml + * time?: string, // The unit in which to display time values + * local?: bool, // Return local information, do not retrieve the state from master node (default: false) + * master_timeout?: int|string, // Explicit operation timeout for connection to master node + * h?: string|array, // Comma-separated list of column names to display + * help?: bool, // Return help information + * s?: string|array, // Comma-separated list of column names or column aliases to sort by + * v?: bool, // Verbose mode. Display column headers + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. * } $params * * @throws NoNodeAvailableException if all the hosts are offline @@ -1131,10 +1157,11 @@ public function templates(array $params = []) * * @return Elasticsearch|Promise */ - public function threadPool(array $params = []) + public function threadPool(?array $params = null) { + $params = $params ?? []; if (isset($params['thread_pool_patterns'])) { - $url = '/_cat/thread_pool/' . $this->encode($params['thread_pool_patterns']); + $url = '/_cat/thread_pool/' . $this->encode($this->convertValue($params['thread_pool_patterns'])); $method = 'GET'; } else { $url = '/_cat/thread_pool'; @@ -1156,21 +1183,21 @@ public function threadPool(array $params = []) * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/cat-transforms.html * * @param array{ - * transform_id: string, // The id of the transform for which to get stats. '_all' or '*' implies all transforms - * from: int, // skips a number of transform configs, defaults to 0 - * size: int, // specifies a max number of transforms to get, defaults to 100 - * allow_no_match: boolean, // Whether to ignore if a wildcard expression matches no transforms. (This includes `_all` string or when no transforms have been specified) - * format: string, // a short version of the Accept header, e.g. json, yaml - * h: list, // Comma-separated list of column names to display - * help: boolean, // Return help information - * s: list, // Comma-separated list of column names or column aliases to sort by - * time: enum, // The unit in which to display time values - * v: boolean, // Verbose mode. Display column headers - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. + * transform_id?: string, // The id of the transform for which to get stats. '_all' or '*' implies all transforms + * from?: int, // skips a number of transform configs, defaults to 0 + * size?: int, // specifies a max number of transforms to get, defaults to 100 + * allow_no_match?: bool, // Whether to ignore if a wildcard expression matches no transforms. (This includes `_all` string or when no transforms have been specified) + * format?: string, // a short version of the Accept header, e.g. json, yaml + * h?: string|array, // Comma-separated list of column names to display + * help?: bool, // Return help information + * s?: string|array, // Comma-separated list of column names or column aliases to sort by + * time?: string, // The unit in which to display time values + * v?: bool, // Verbose mode. Display column headers + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. * } $params * * @throws NoNodeAvailableException if all the hosts are offline @@ -1179,8 +1206,9 @@ public function threadPool(array $params = []) * * @return Elasticsearch|Promise */ - public function transforms(array $params = []) + public function transforms(?array $params = null) { + $params = $params ?? []; if (isset($params['transform_id'])) { $url = '/_cat/transforms/' . $this->encode($params['transform_id']); $method = 'GET'; diff --git a/src/Endpoints/Ccr.php b/src/Endpoints/Ccr.php index 9a14314c4..58cb593ac 100644 --- a/src/Endpoints/Ccr.php +++ b/src/Endpoints/Ccr.php @@ -35,12 +35,12 @@ class Ccr extends AbstractEndpoint * * @param array{ * name: string, // (REQUIRED) The name of the auto follow pattern. - * master_timeout: time, // Explicit operation timeout for connection to master node - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. + * master_timeout?: int|string, // Explicit operation timeout for connection to master node + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. * } $params * * @throws MissingParameterException if a required parameter is missing @@ -50,8 +50,9 @@ class Ccr extends AbstractEndpoint * * @return Elasticsearch|Promise */ - public function deleteAutoFollowPattern(array $params = []) + public function deleteAutoFollowPattern(?array $params = null) { + $params = $params ?? []; $this->checkRequiredParameters(['name'], $params); $url = '/_ccr/auto_follow/' . $this->encode($params['name']); $method = 'DELETE'; @@ -73,14 +74,14 @@ public function deleteAutoFollowPattern(array $params = []) * * @param array{ * index: string, // (REQUIRED) The name of the follower index - * wait_for_active_shards: string, // Sets the number of shard copies that must be active before returning. Defaults to 0. Set to `all` for all shard copies, otherwise set to any non-negative value less than or equal to the total number of copies for the shard (number of replicas + 1) - * master_timeout: time, // Explicit operation timeout for connection to master node - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. - * body: array, // (REQUIRED) The name of the leader index and other optional ccr related parameters + * wait_for_active_shards?: string, // Sets the number of shard copies that must be active before returning. Defaults to 0. Set to `all` for all shard copies, otherwise set to any non-negative value less than or equal to the total number of copies for the shard (number of replicas + 1) + * master_timeout?: int|string, // Explicit operation timeout for connection to master node + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. + * body: string|array, // (REQUIRED) The name of the leader index and other optional ccr related parameters. If body is a string must be a valid JSON. * } $params * * @throws MissingParameterException if a required parameter is missing @@ -90,8 +91,9 @@ public function deleteAutoFollowPattern(array $params = []) * * @return Elasticsearch|Promise */ - public function follow(array $params = []) + public function follow(?array $params = null) { + $params = $params ?? []; $this->checkRequiredParameters(['index','body'], $params); $url = '/' . $this->encode($params['index']) . '/_ccr/follow'; $method = 'PUT'; @@ -113,13 +115,13 @@ public function follow(array $params = []) * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/ccr-get-follow-info.html * * @param array{ - * index: list, // (REQUIRED) A comma-separated list of index patterns; use `_all` to perform the operation on all indices - * master_timeout: time, // Explicit operation timeout for connection to master node - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. + * index: string|array, // (REQUIRED) A comma-separated list of index patterns; use `_all` to perform the operation on all indices + * master_timeout?: int|string, // Explicit operation timeout for connection to master node + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. * } $params * * @throws MissingParameterException if a required parameter is missing @@ -129,10 +131,11 @@ public function follow(array $params = []) * * @return Elasticsearch|Promise */ - public function followInfo(array $params = []) + public function followInfo(?array $params = null) { + $params = $params ?? []; $this->checkRequiredParameters(['index'], $params); - $url = '/' . $this->encode($params['index']) . '/_ccr/info'; + $url = '/' . $this->encode($this->convertValue($params['index'])) . '/_ccr/info'; $method = 'GET'; $url = $this->addQueryString($url, $params, ['master_timeout','pretty','human','error_trace','source','filter_path']); @@ -151,13 +154,13 @@ public function followInfo(array $params = []) * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/ccr-get-follow-stats.html * * @param array{ - * index: list, // (REQUIRED) A comma-separated list of index patterns; use `_all` to perform the operation on all indices - * timeout: time, // Explicit operation timeout - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. + * index: string|array, // (REQUIRED) A comma-separated list of index patterns; use `_all` to perform the operation on all indices + * timeout?: int|string, // Explicit operation timeout + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. * } $params * * @throws MissingParameterException if a required parameter is missing @@ -167,10 +170,11 @@ public function followInfo(array $params = []) * * @return Elasticsearch|Promise */ - public function followStats(array $params = []) + public function followStats(?array $params = null) { + $params = $params ?? []; $this->checkRequiredParameters(['index'], $params); - $url = '/' . $this->encode($params['index']) . '/_ccr/stats'; + $url = '/' . $this->encode($this->convertValue($params['index'])) . '/_ccr/stats'; $method = 'GET'; $url = $this->addQueryString($url, $params, ['timeout','pretty','human','error_trace','source','filter_path']); @@ -190,13 +194,13 @@ public function followStats(array $params = []) * * @param array{ * index: string, // (REQUIRED) the name of the leader index for which specified follower retention leases should be removed - * timeout: time, // Explicit operation timeout - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. - * body: array, // (REQUIRED) the name and UUID of the follower index, the name of the cluster containing the follower index, and the alias from the perspective of that cluster for the remote cluster containing the leader index + * timeout?: int|string, // Explicit operation timeout + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. + * body: string|array, // (REQUIRED) the name and UUID of the follower index, the name of the cluster containing the follower index, and the alias from the perspective of that cluster for the remote cluster containing the leader index. If body is a string must be a valid JSON. * } $params * * @throws MissingParameterException if a required parameter is missing @@ -206,8 +210,9 @@ public function followStats(array $params = []) * * @return Elasticsearch|Promise */ - public function forgetFollower(array $params = []) + public function forgetFollower(?array $params = null) { + $params = $params ?? []; $this->checkRequiredParameters(['index','body'], $params); $url = '/' . $this->encode($params['index']) . '/_ccr/forget_follower'; $method = 'POST'; @@ -229,13 +234,13 @@ public function forgetFollower(array $params = []) * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/ccr-get-auto-follow-pattern.html * * @param array{ - * name: string, // The name of the auto follow pattern. - * master_timeout: time, // Explicit operation timeout for connection to master node - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. + * name?: string, // The name of the auto follow pattern. + * master_timeout?: int|string, // Explicit operation timeout for connection to master node + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. * } $params * * @throws NoNodeAvailableException if all the hosts are offline @@ -244,8 +249,9 @@ public function forgetFollower(array $params = []) * * @return Elasticsearch|Promise */ - public function getAutoFollowPattern(array $params = []) + public function getAutoFollowPattern(?array $params = null) { + $params = $params ?? []; if (isset($params['name'])) { $url = '/_ccr/auto_follow/' . $this->encode($params['name']); $method = 'GET'; @@ -270,12 +276,12 @@ public function getAutoFollowPattern(array $params = []) * * @param array{ * name: string, // (REQUIRED) The name of the auto follow pattern that should pause discovering new indices to follow. - * master_timeout: time, // Explicit operation timeout for connection to master node - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. + * master_timeout?: int|string, // Explicit operation timeout for connection to master node + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. * } $params * * @throws MissingParameterException if a required parameter is missing @@ -285,8 +291,9 @@ public function getAutoFollowPattern(array $params = []) * * @return Elasticsearch|Promise */ - public function pauseAutoFollowPattern(array $params = []) + public function pauseAutoFollowPattern(?array $params = null) { + $params = $params ?? []; $this->checkRequiredParameters(['name'], $params); $url = '/_ccr/auto_follow/' . $this->encode($params['name']) . '/pause'; $method = 'POST'; @@ -308,12 +315,12 @@ public function pauseAutoFollowPattern(array $params = []) * * @param array{ * index: string, // (REQUIRED) The name of the follower index that should pause following its leader index. - * master_timeout: time, // Explicit operation timeout for connection to master node - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. + * master_timeout?: int|string, // Explicit operation timeout for connection to master node + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. * } $params * * @throws MissingParameterException if a required parameter is missing @@ -323,8 +330,9 @@ public function pauseAutoFollowPattern(array $params = []) * * @return Elasticsearch|Promise */ - public function pauseFollow(array $params = []) + public function pauseFollow(?array $params = null) { + $params = $params ?? []; $this->checkRequiredParameters(['index'], $params); $url = '/' . $this->encode($params['index']) . '/_ccr/pause_follow'; $method = 'POST'; @@ -346,13 +354,13 @@ public function pauseFollow(array $params = []) * * @param array{ * name: string, // (REQUIRED) The name of the auto follow pattern. - * master_timeout: time, // Explicit operation timeout for connection to master node - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. - * body: array, // (REQUIRED) The specification of the auto follow pattern + * master_timeout?: int|string, // Explicit operation timeout for connection to master node + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. + * body: string|array, // (REQUIRED) The specification of the auto follow pattern. If body is a string must be a valid JSON. * } $params * * @throws MissingParameterException if a required parameter is missing @@ -362,8 +370,9 @@ public function pauseFollow(array $params = []) * * @return Elasticsearch|Promise */ - public function putAutoFollowPattern(array $params = []) + public function putAutoFollowPattern(?array $params = null) { + $params = $params ?? []; $this->checkRequiredParameters(['name','body'], $params); $url = '/_ccr/auto_follow/' . $this->encode($params['name']); $method = 'PUT'; @@ -386,12 +395,12 @@ public function putAutoFollowPattern(array $params = []) * * @param array{ * name: string, // (REQUIRED) The name of the auto follow pattern to resume discovering new indices to follow. - * master_timeout: time, // Explicit operation timeout for connection to master node - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. + * master_timeout?: int|string, // Explicit operation timeout for connection to master node + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. * } $params * * @throws MissingParameterException if a required parameter is missing @@ -401,8 +410,9 @@ public function putAutoFollowPattern(array $params = []) * * @return Elasticsearch|Promise */ - public function resumeAutoFollowPattern(array $params = []) + public function resumeAutoFollowPattern(?array $params = null) { + $params = $params ?? []; $this->checkRequiredParameters(['name'], $params); $url = '/_ccr/auto_follow/' . $this->encode($params['name']) . '/resume'; $method = 'POST'; @@ -424,13 +434,13 @@ public function resumeAutoFollowPattern(array $params = []) * * @param array{ * index: string, // (REQUIRED) The name of the follow index to resume following. - * master_timeout: time, // Explicit operation timeout for connection to master node - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. - * body: array, // The name of the leader index and other optional ccr related parameters + * master_timeout?: int|string, // Explicit operation timeout for connection to master node + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. + * body?: string|array, // The name of the leader index and other optional ccr related parameters. If body is a string must be a valid JSON. * } $params * * @throws MissingParameterException if a required parameter is missing @@ -440,8 +450,9 @@ public function resumeAutoFollowPattern(array $params = []) * * @return Elasticsearch|Promise */ - public function resumeFollow(array $params = []) + public function resumeFollow(?array $params = null) { + $params = $params ?? []; $this->checkRequiredParameters(['index'], $params); $url = '/' . $this->encode($params['index']) . '/_ccr/resume_follow'; $method = 'POST'; @@ -463,13 +474,13 @@ public function resumeFollow(array $params = []) * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/ccr-get-stats.html * * @param array{ - * timeout: time, // Explicit operation timeout - * master_timeout: time, // Explicit operation timeout for connection to master node - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. + * timeout?: int|string, // Explicit operation timeout + * master_timeout?: int|string, // Explicit operation timeout for connection to master node + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. * } $params * * @throws NoNodeAvailableException if all the hosts are offline @@ -478,8 +489,9 @@ public function resumeFollow(array $params = []) * * @return Elasticsearch|Promise */ - public function stats(array $params = []) + public function stats(?array $params = null) { + $params = $params ?? []; $url = '/_ccr/stats'; $method = 'GET'; @@ -500,12 +512,12 @@ public function stats(array $params = []) * * @param array{ * index: string, // (REQUIRED) The name of the follower index that should be turned into a regular index. - * master_timeout: time, // Explicit operation timeout for connection to master node - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. + * master_timeout?: int|string, // Explicit operation timeout for connection to master node + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. * } $params * * @throws MissingParameterException if a required parameter is missing @@ -515,8 +527,9 @@ public function stats(array $params = []) * * @return Elasticsearch|Promise */ - public function unfollow(array $params = []) + public function unfollow(?array $params = null) { + $params = $params ?? []; $this->checkRequiredParameters(['index'], $params); $url = '/' . $this->encode($params['index']) . '/_ccr/unfollow'; $method = 'POST'; diff --git a/src/Endpoints/Cluster.php b/src/Endpoints/Cluster.php index 203fcaf5b..f362f10e9 100644 --- a/src/Endpoints/Cluster.php +++ b/src/Endpoints/Cluster.php @@ -34,15 +34,15 @@ class Cluster extends AbstractEndpoint * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/cluster-allocation-explain.html * * @param array{ - * master_timeout: time, // Timeout for connection to master node - * include_yes_decisions: boolean, // Return 'YES' decisions in explanation (default: false) - * include_disk_info: boolean, // Return information about disk usage and shard sizes (default: false) - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. - * body: array, // The index, shard, and primary flag to explain. Empty means 'explain a randomly-chosen unassigned shard' + * master_timeout?: int|string, // Timeout for connection to master node + * include_yes_decisions?: bool, // Return 'YES' decisions in explanation (default: false) + * include_disk_info?: bool, // Return information about disk usage and shard sizes (default: false) + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. + * body?: string|array, // The index, shard, and primary flag to explain. Empty means 'explain a randomly-chosen unassigned shard'. If body is a string must be a valid JSON. * } $params * * @throws NoNodeAvailableException if all the hosts are offline @@ -51,8 +51,9 @@ class Cluster extends AbstractEndpoint * * @return Elasticsearch|Promise */ - public function allocationExplain(array $params = []) + public function allocationExplain(?array $params = null) { + $params = $params ?? []; $url = '/_cluster/allocation/explain'; $method = empty($params['body']) ? 'GET' : 'POST'; @@ -74,13 +75,13 @@ public function allocationExplain(array $params = []) * * @param array{ * name: string, // (REQUIRED) The name of the template - * timeout: time, // Explicit operation timeout - * master_timeout: time, // Specify timeout for connection to master - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. + * timeout?: int|string, // Explicit operation timeout + * master_timeout?: int|string, // Specify timeout for connection to master + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. * } $params * * @throws MissingParameterException if a required parameter is missing @@ -90,8 +91,9 @@ public function allocationExplain(array $params = []) * * @return Elasticsearch|Promise */ - public function deleteComponentTemplate(array $params = []) + public function deleteComponentTemplate(?array $params = null) { + $params = $params ?? []; $this->checkRequiredParameters(['name'], $params); $url = '/_component_template/' . $this->encode($params['name']); $method = 'DELETE'; @@ -112,13 +114,13 @@ public function deleteComponentTemplate(array $params = []) * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/voting-config-exclusions.html * * @param array{ - * wait_for_removal: boolean, // Specifies whether to wait for all excluded nodes to be removed from the cluster before clearing the voting configuration exclusions list. - * master_timeout: time, // Timeout for submitting request to master - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. + * wait_for_removal?: bool, // Specifies whether to wait for all excluded nodes to be removed from the cluster before clearing the voting configuration exclusions list. + * master_timeout?: int|string, // Timeout for submitting request to master + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. * } $params * * @throws NoNodeAvailableException if all the hosts are offline @@ -127,8 +129,9 @@ public function deleteComponentTemplate(array $params = []) * * @return Elasticsearch|Promise */ - public function deleteVotingConfigExclusions(array $params = []) + public function deleteVotingConfigExclusions(?array $params = null) { + $params = $params ?? []; $url = '/_cluster/voting_config_exclusions'; $method = 'DELETE'; @@ -149,13 +152,13 @@ public function deleteVotingConfigExclusions(array $params = []) * * @param array{ * name: string, // (REQUIRED) The name of the template - * master_timeout: time, // Explicit operation timeout for connection to master node - * local: boolean, // Return local information, do not retrieve the state from master node (default: false) - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. + * master_timeout?: int|string, // Explicit operation timeout for connection to master node + * local?: bool, // Return local information, do not retrieve the state from master node (default: false) + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. * } $params * * @throws MissingParameterException if a required parameter is missing @@ -165,8 +168,9 @@ public function deleteVotingConfigExclusions(array $params = []) * * @return Elasticsearch|Promise */ - public function existsComponentTemplate(array $params = []) + public function existsComponentTemplate(?array $params = null) { + $params = $params ?? []; $this->checkRequiredParameters(['name'], $params); $url = '/_component_template/' . $this->encode($params['name']); $method = 'HEAD'; @@ -187,15 +191,15 @@ public function existsComponentTemplate(array $params = []) * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-component-template.html * * @param array{ - * name: list, // The comma separated names of the component templates - * master_timeout: time, // Explicit operation timeout for connection to master node - * local: boolean, // Return local information, do not retrieve the state from master node (default: false) - * include_defaults: boolean, // Return all default configurations for the component template (default: false) - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. + * name?: string|array, // The comma separated names of the component templates + * master_timeout?: int|string, // Explicit operation timeout for connection to master node + * local?: bool, // Return local information, do not retrieve the state from master node (default: false) + * include_defaults?: bool, // Return all default configurations for the component template (default: false) + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. * } $params * * @throws NoNodeAvailableException if all the hosts are offline @@ -204,10 +208,11 @@ public function existsComponentTemplate(array $params = []) * * @return Elasticsearch|Promise */ - public function getComponentTemplate(array $params = []) + public function getComponentTemplate(?array $params = null) { + $params = $params ?? []; if (isset($params['name'])) { - $url = '/_component_template/' . $this->encode($params['name']); + $url = '/_component_template/' . $this->encode($this->convertValue($params['name'])); $method = 'GET'; } else { $url = '/_component_template'; @@ -229,15 +234,15 @@ public function getComponentTemplate(array $params = []) * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/cluster-get-settings.html * * @param array{ - * flat_settings: boolean, // Return settings in flat format (default: false) - * master_timeout: time, // Explicit operation timeout for connection to master node - * timeout: time, // Explicit operation timeout - * include_defaults: boolean, // Whether to return all default clusters setting. - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. + * flat_settings?: bool, // Return settings in flat format (default: false) + * master_timeout?: int|string, // Explicit operation timeout for connection to master node + * timeout?: int|string, // Explicit operation timeout + * include_defaults?: bool, // Whether to return all default clusters setting. + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. * } $params * * @throws NoNodeAvailableException if all the hosts are offline @@ -246,8 +251,9 @@ public function getComponentTemplate(array $params = []) * * @return Elasticsearch|Promise */ - public function getSettings(array $params = []) + public function getSettings(?array $params = null) { + $params = $params ?? []; $url = '/_cluster/settings'; $method = 'GET'; @@ -267,23 +273,23 @@ public function getSettings(array $params = []) * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/cluster-health.html * * @param array{ - * index: list, // Limit the information returned to a specific index - * expand_wildcards: enum, // Whether to expand wildcard expression to concrete indices that are open, closed or both. - * level: enum, // Specify the level of detail for returned information - * local: boolean, // Return local information, do not retrieve the state from master node (default: false) - * master_timeout: time, // Explicit operation timeout for connection to master node - * timeout: time, // Explicit operation timeout - * wait_for_active_shards: string, // Wait until the specified number of shards is active - * wait_for_nodes: string, // Wait until the specified number of nodes is available - * wait_for_events: enum, // Wait until all currently queued events with the given priority are processed - * wait_for_no_relocating_shards: boolean, // Whether to wait until there are no relocating shards in the cluster - * wait_for_no_initializing_shards: boolean, // Whether to wait until there are no initializing shards in the cluster - * wait_for_status: enum, // Wait until cluster is in a specific state - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. + * index?: string|array, // Limit the information returned to a specific index + * expand_wildcards?: string, // Whether to expand wildcard expression to concrete indices that are open, closed or both. + * level?: string, // Specify the level of detail for returned information + * local?: bool, // Return local information, do not retrieve the state from master node (default: false) + * master_timeout?: int|string, // Explicit operation timeout for connection to master node + * timeout?: int|string, // Explicit operation timeout + * wait_for_active_shards?: string, // Wait until the specified number of shards is active + * wait_for_nodes?: string, // Wait until the specified number of nodes is available + * wait_for_events?: string, // Wait until all currently queued events with the given priority are processed + * wait_for_no_relocating_shards?: bool, // Whether to wait until there are no relocating shards in the cluster + * wait_for_no_initializing_shards?: bool, // Whether to wait until there are no initializing shards in the cluster + * wait_for_status?: string, // Wait until cluster is in a specific state + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. * } $params * * @throws NoNodeAvailableException if all the hosts are offline @@ -292,10 +298,11 @@ public function getSettings(array $params = []) * * @return Elasticsearch|Promise */ - public function health(array $params = []) + public function health(?array $params = null) { + $params = $params ?? []; if (isset($params['index'])) { - $url = '/_cluster/health/' . $this->encode($params['index']); + $url = '/_cluster/health/' . $this->encode($this->convertValue($params['index'])); $method = 'GET'; } else { $url = '/_cluster/health'; @@ -317,12 +324,12 @@ public function health(array $params = []) * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/cluster-info.html * * @param array{ - * target: list, // (REQUIRED) Limit the information returned to the specified target. - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. + * target: string|array, // (REQUIRED) Limit the information returned to the specified target. + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. * } $params * * @throws MissingParameterException if a required parameter is missing @@ -332,10 +339,11 @@ public function health(array $params = []) * * @return Elasticsearch|Promise */ - public function info(array $params = []) + public function info(?array $params = null) { + $params = $params ?? []; $this->checkRequiredParameters(['target'], $params); - $url = '/_info/' . $this->encode($params['target']); + $url = '/_info/' . $this->encode($this->convertValue($params['target'])); $method = 'GET'; $url = $this->addQueryString($url, $params, ['pretty','human','error_trace','source','filter_path']); @@ -355,13 +363,13 @@ public function info(array $params = []) * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/cluster-pending.html * * @param array{ - * local: boolean, // Return local information, do not retrieve the state from master node (default: false) - * master_timeout: time, // Specify timeout for connection to master - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. + * local?: bool, // Return local information, do not retrieve the state from master node (default: false) + * master_timeout?: int|string, // Specify timeout for connection to master + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. * } $params * * @throws NoNodeAvailableException if all the hosts are offline @@ -370,8 +378,9 @@ public function info(array $params = []) * * @return Elasticsearch|Promise */ - public function pendingTasks(array $params = []) + public function pendingTasks(?array $params = null) { + $params = $params ?? []; $url = '/_cluster/pending_tasks'; $method = 'GET'; @@ -391,15 +400,15 @@ public function pendingTasks(array $params = []) * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/voting-config-exclusions.html * * @param array{ - * node_ids: string, // A comma-separated list of the persistent ids of the nodes to exclude from the voting configuration. If specified, you may not also specify ?node_names. - * node_names: string, // A comma-separated list of the names of the nodes to exclude from the voting configuration. If specified, you may not also specify ?node_ids. - * timeout: time, // Explicit operation timeout - * master_timeout: time, // Timeout for submitting request to master - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. + * node_ids?: string, // A comma-separated list of the persistent ids of the nodes to exclude from the voting configuration. If specified, you may not also specify ?node_names. + * node_names?: string, // A comma-separated list of the names of the nodes to exclude from the voting configuration. If specified, you may not also specify ?node_ids. + * timeout?: int|string, // Explicit operation timeout + * master_timeout?: int|string, // Timeout for submitting request to master + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. * } $params * * @throws NoNodeAvailableException if all the hosts are offline @@ -408,8 +417,9 @@ public function pendingTasks(array $params = []) * * @return Elasticsearch|Promise */ - public function postVotingConfigExclusions(array $params = []) + public function postVotingConfigExclusions(?array $params = null) { + $params = $params ?? []; $url = '/_cluster/voting_config_exclusions'; $method = 'POST'; @@ -430,15 +440,15 @@ public function postVotingConfigExclusions(array $params = []) * * @param array{ * name: string, // (REQUIRED) The name of the template - * create: boolean, // Whether the index template should only be added if new or can also replace an existing one - * timeout: time, // Explicit operation timeout - * master_timeout: time, // Specify timeout for connection to master - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. - * body: array, // (REQUIRED) The template definition + * create?: bool, // Whether the index template should only be added if new or can also replace an existing one + * timeout?: int|string, // Explicit operation timeout + * master_timeout?: int|string, // Specify timeout for connection to master + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. + * body: string|array, // (REQUIRED) The template definition. If body is a string must be a valid JSON. * } $params * * @throws MissingParameterException if a required parameter is missing @@ -448,8 +458,9 @@ public function postVotingConfigExclusions(array $params = []) * * @return Elasticsearch|Promise */ - public function putComponentTemplate(array $params = []) + public function putComponentTemplate(?array $params = null) { + $params = $params ?? []; $this->checkRequiredParameters(['name','body'], $params); $url = '/_component_template/' . $this->encode($params['name']); $method = 'PUT'; @@ -471,15 +482,15 @@ public function putComponentTemplate(array $params = []) * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/cluster-update-settings.html * * @param array{ - * flat_settings: boolean, // Return settings in flat format (default: false) - * master_timeout: time, // Explicit operation timeout for connection to master node - * timeout: time, // Explicit operation timeout - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. - * body: array, // (REQUIRED) The settings to be updated. Can be either `transient` or `persistent` (survives cluster restart). + * flat_settings?: bool, // Return settings in flat format (default: false) + * master_timeout?: int|string, // Explicit operation timeout for connection to master node + * timeout?: int|string, // Explicit operation timeout + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. + * body: string|array, // (REQUIRED) The settings to be updated. Can be either `transient` or `persistent` (survives cluster restart).. If body is a string must be a valid JSON. * } $params * * @throws NoNodeAvailableException if all the hosts are offline @@ -488,8 +499,9 @@ public function putComponentTemplate(array $params = []) * * @return Elasticsearch|Promise */ - public function putSettings(array $params = []) + public function putSettings(?array $params = null) { + $params = $params ?? []; $this->checkRequiredParameters(['body'], $params); $url = '/_cluster/settings'; $method = 'PUT'; @@ -511,11 +523,11 @@ public function putSettings(array $params = []) * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/cluster-remote-info.html * * @param array{ - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. * } $params * * @throws NoNodeAvailableException if all the hosts are offline @@ -524,8 +536,9 @@ public function putSettings(array $params = []) * * @return Elasticsearch|Promise */ - public function remoteInfo(array $params = []) + public function remoteInfo(?array $params = null) { + $params = $params ?? []; $url = '/_remote/info'; $method = 'GET'; @@ -545,18 +558,18 @@ public function remoteInfo(array $params = []) * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/cluster-reroute.html * * @param array{ - * dry_run: boolean, // Simulate the operation only and return the resulting state - * explain: boolean, // Return an explanation of why the commands can or cannot be executed - * retry_failed: boolean, // Retries allocation of shards that are blocked due to too many subsequent allocation failures - * metric: list, // Limit the information returned to the specified metrics. Defaults to all but metadata - * master_timeout: time, // Explicit operation timeout for connection to master node - * timeout: time, // Explicit operation timeout - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. - * body: array, // The definition of `commands` to perform (`move`, `cancel`, `allocate`) + * dry_run?: bool, // Simulate the operation only and return the resulting state + * explain?: bool, // Return an explanation of why the commands can or cannot be executed + * retry_failed?: bool, // Retries allocation of shards that are blocked due to too many subsequent allocation failures + * metric?: string|array, // Limit the information returned to the specified metrics. Defaults to all but metadata + * master_timeout?: int|string, // Explicit operation timeout for connection to master node + * timeout?: int|string, // Explicit operation timeout + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. + * body?: string|array, // The definition of `commands` to perform (`move`, `cancel`, `allocate`). If body is a string must be a valid JSON. * } $params * * @throws NoNodeAvailableException if all the hosts are offline @@ -565,8 +578,9 @@ public function remoteInfo(array $params = []) * * @return Elasticsearch|Promise */ - public function reroute(array $params = []) + public function reroute(?array $params = null) { + $params = $params ?? []; $url = '/_cluster/reroute'; $method = 'POST'; @@ -587,21 +601,21 @@ public function reroute(array $params = []) * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/cluster-state.html * * @param array{ - * metric: list, // Limit the information returned to the specified metrics - * index: list, // A comma-separated list of index names; use `_all` or empty string to perform the operation on all indices - * local: boolean, // Return local information, do not retrieve the state from master node (default: false) - * master_timeout: time, // Specify timeout for connection to master - * flat_settings: boolean, // Return settings in flat format (default: false) - * wait_for_metadata_version: number, // Wait for the metadata version to be equal or greater than the specified metadata version - * wait_for_timeout: time, // The maximum time to wait for wait_for_metadata_version before timing out - * ignore_unavailable: boolean, // Whether specified concrete indices should be ignored when unavailable (missing or closed) - * allow_no_indices: boolean, // Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes `_all` string or when no indices have been specified) - * expand_wildcards: enum, // Whether to expand wildcard expression to concrete indices that are open, closed or both. - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. + * metric?: string|array, // Limit the information returned to the specified metrics + * index?: string|array, // A comma-separated list of index names; use `_all` or empty string to perform the operation on all indices + * local?: bool, // Return local information, do not retrieve the state from master node (default: false) + * master_timeout?: int|string, // Specify timeout for connection to master + * flat_settings?: bool, // Return settings in flat format (default: false) + * wait_for_metadata_version?: int, // Wait for the metadata version to be equal or greater than the specified metadata version + * wait_for_timeout?: int|string, // The maximum time to wait for wait_for_metadata_version before timing out + * ignore_unavailable?: bool, // Whether specified concrete indices should be ignored when unavailable (missing or closed) + * allow_no_indices?: bool, // Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes `_all` string or when no indices have been specified) + * expand_wildcards?: string, // Whether to expand wildcard expression to concrete indices that are open, closed or both. + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. * } $params * * @throws NoNodeAvailableException if all the hosts are offline @@ -610,13 +624,14 @@ public function reroute(array $params = []) * * @return Elasticsearch|Promise */ - public function state(array $params = []) + public function state(?array $params = null) { + $params = $params ?? []; if (isset($params['index']) && isset($params['metric'])) { - $url = '/_cluster/state/' . $this->encode($params['metric']) . '/' . $this->encode($params['index']); + $url = '/_cluster/state/' . $this->encode($this->convertValue($params['metric'])) . '/' . $this->encode($this->convertValue($params['index'])); $method = 'GET'; } elseif (isset($params['metric'])) { - $url = '/_cluster/state/' . $this->encode($params['metric']); + $url = '/_cluster/state/' . $this->encode($this->convertValue($params['metric'])); $method = 'GET'; } else { $url = '/_cluster/state'; @@ -638,14 +653,14 @@ public function state(array $params = []) * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/cluster-stats.html * * @param array{ - * node_id: list, // 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 - * flat_settings: boolean, // Return settings in flat format (default: false) - * timeout: time, // Explicit operation timeout - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. + * node_id?: string|array, // 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 + * include_remotes?: bool, // Include remote cluster data into the response (default: false) + * timeout?: int|string, // Explicit operation timeout + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. * } $params * * @throws NoNodeAvailableException if all the hosts are offline @@ -654,16 +669,17 @@ public function state(array $params = []) * * @return Elasticsearch|Promise */ - public function stats(array $params = []) + public function stats(?array $params = null) { + $params = $params ?? []; if (isset($params['node_id'])) { - $url = '/_cluster/stats/nodes/' . $this->encode($params['node_id']); + $url = '/_cluster/stats/nodes/' . $this->encode($this->convertValue($params['node_id'])); $method = 'GET'; } else { $url = '/_cluster/stats'; $method = 'GET'; } - $url = $this->addQueryString($url, $params, ['flat_settings','timeout','pretty','human','error_trace','source','filter_path']); + $url = $this->addQueryString($url, $params, ['include_remotes','timeout','pretty','human','error_trace','source','filter_path']); $headers = [ 'Accept' => 'application/json', ]; diff --git a/src/Endpoints/Connector.php b/src/Endpoints/Connector.php index 98ab0ec59..9f02f3eb1 100644 --- a/src/Endpoints/Connector.php +++ b/src/Endpoints/Connector.php @@ -36,11 +36,11 @@ class Connector extends AbstractEndpoint * * @param array{ * connector_id: string, // (REQUIRED) The unique identifier of the connector to be updated. - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. * } $params * * @throws MissingParameterException if a required parameter is missing @@ -50,8 +50,9 @@ class Connector extends AbstractEndpoint * * @return Elasticsearch|Promise */ - public function checkIn(array $params = []) + public function checkIn(?array $params = null) { + $params = $params ?? []; $this->checkRequiredParameters(['connector_id'], $params); $url = '/_connector/' . $this->encode($params['connector_id']) . '/_check_in'; $method = 'PUT'; @@ -74,12 +75,12 @@ public function checkIn(array $params = []) * * @param array{ * connector_id: string, // (REQUIRED) The unique identifier of the connector to be deleted. - * delete_sync_jobs: boolean, // Determines whether associated sync jobs are also deleted. - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. + * delete_sync_jobs?: bool, // Determines whether associated sync jobs are also deleted. + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. * } $params * * @throws MissingParameterException if a required parameter is missing @@ -89,8 +90,9 @@ public function checkIn(array $params = []) * * @return Elasticsearch|Promise */ - public function delete(array $params = []) + public function delete(?array $params = null) { + $params = $params ?? []; $this->checkRequiredParameters(['connector_id'], $params); $url = '/_connector/' . $this->encode($params['connector_id']); $method = 'DELETE'; @@ -113,11 +115,11 @@ public function delete(array $params = []) * * @param array{ * connector_id: string, // (REQUIRED) The unique identifier of the connector to be returned. - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. * } $params * * @throws MissingParameterException if a required parameter is missing @@ -127,8 +129,9 @@ public function delete(array $params = []) * * @return Elasticsearch|Promise */ - public function get(array $params = []) + public function get(?array $params = null) { + $params = $params ?? []; $this->checkRequiredParameters(['connector_id'], $params); $url = '/_connector/' . $this->encode($params['connector_id']); $method = 'GET'; @@ -151,12 +154,12 @@ public function get(array $params = []) * * @param array{ * connector_id: string, // (REQUIRED) The unique identifier of the connector to be updated. - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. - * body: array, // (REQUIRED) Object with stats related to the last connector sync run. + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. + * body: string|array, // (REQUIRED) Object with stats related to the last connector sync run.. If body is a string must be a valid JSON. * } $params * * @throws MissingParameterException if a required parameter is missing @@ -166,8 +169,9 @@ public function get(array $params = []) * * @return Elasticsearch|Promise */ - public function lastSync(array $params = []) + public function lastSync(?array $params = null) { + $params = $params ?? []; $this->checkRequiredParameters(['connector_id','body'], $params); $url = '/_connector/' . $this->encode($params['connector_id']) . '/_last_sync'; $method = 'PUT'; @@ -190,17 +194,17 @@ public function lastSync(array $params = []) * @internal This API is EXPERIMENTAL and may be changed or removed completely in a future release * * @param array{ - * from: int, // Starting offset (default: 0) - * size: int, // Specifies a max number of results to get (default: 100) - * index_name: list, // A comma-separated list of connector index names to fetch connector documents for - * connector_name: list, // A comma-separated list of connector names to fetch connector documents for - * service_type: list, // A comma-separated list of connector service types to fetch connector documents for - * query: string, // A search string for querying connectors, filtering results by matching against connector names, descriptions, and index names - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. + * from?: int, // Starting offset (default: 0) + * size?: int, // Specifies a max number of results to get (default: 100) + * index_name?: string|array, // A comma-separated list of connector index names to fetch connector documents for + * connector_name?: string|array, // A comma-separated list of connector names to fetch connector documents for + * service_type?: string|array, // A comma-separated list of connector service types to fetch connector documents for + * query?: string, // A search string for querying connectors, filtering results by matching against connector names, descriptions, and index names + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. * } $params * * @throws NoNodeAvailableException if all the hosts are offline @@ -209,8 +213,9 @@ public function lastSync(array $params = []) * * @return Elasticsearch|Promise */ - public function list(array $params = []) + public function list(?array $params = null) { + $params = $params ?? []; $url = '/_connector'; $method = 'GET'; @@ -231,12 +236,12 @@ public function list(array $params = []) * @internal This API is EXPERIMENTAL and may be changed or removed completely in a future release * * @param array{ - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. - * body: array, // The connector configuration. + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. + * body?: string|array, // The connector configuration.. If body is a string must be a valid JSON. * } $params * * @throws NoNodeAvailableException if all the hosts are offline @@ -245,8 +250,9 @@ public function list(array $params = []) * * @return Elasticsearch|Promise */ - public function post(array $params = []) + public function post(?array $params = null) { + $params = $params ?? []; $url = '/_connector'; $method = 'POST'; @@ -268,13 +274,13 @@ public function post(array $params = []) * @internal This API is EXPERIMENTAL and may be changed or removed completely in a future release * * @param array{ - * connector_id: string, // The unique identifier of the connector to be created or updated. - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. - * body: array, // The connector configuration. + * connector_id?: string, // The unique identifier of the connector to be created or updated. + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. + * body?: string|array, // The connector configuration.. If body is a string must be a valid JSON. * } $params * * @throws NoNodeAvailableException if all the hosts are offline @@ -283,8 +289,9 @@ public function post(array $params = []) * * @return Elasticsearch|Promise */ - public function put(array $params = []) + public function put(?array $params = null) { + $params = $params ?? []; if (isset($params['connector_id'])) { $url = '/_connector/' . $this->encode($params['connector_id']); $method = 'PUT'; @@ -311,11 +318,11 @@ public function put(array $params = []) * * @param array{ * connector_sync_job_id: string, // (REQUIRED) The unique identifier of the connector sync job to be canceled - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. * } $params * * @throws MissingParameterException if a required parameter is missing @@ -325,8 +332,9 @@ public function put(array $params = []) * * @return Elasticsearch|Promise */ - public function syncJobCancel(array $params = []) + public function syncJobCancel(?array $params = null) { + $params = $params ?? []; $this->checkRequiredParameters(['connector_sync_job_id'], $params); $url = '/_connector/_sync_job/' . $this->encode($params['connector_sync_job_id']) . '/_cancel'; $method = 'PUT'; @@ -349,11 +357,11 @@ public function syncJobCancel(array $params = []) * * @param array{ * connector_sync_job_id: string, // (REQUIRED) The unique identifier of the connector sync job to be checked in - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. * } $params * * @throws MissingParameterException if a required parameter is missing @@ -363,8 +371,9 @@ public function syncJobCancel(array $params = []) * * @return Elasticsearch|Promise */ - public function syncJobCheckIn(array $params = []) + public function syncJobCheckIn(?array $params = null) { + $params = $params ?? []; $this->checkRequiredParameters(['connector_sync_job_id'], $params); $url = '/_connector/_sync_job/' . $this->encode($params['connector_sync_job_id']) . '/_check_in'; $method = 'PUT'; @@ -387,12 +396,12 @@ public function syncJobCheckIn(array $params = []) * * @param array{ * connector_sync_job_id: string, // (REQUIRED) The unique identifier of the connector sync job to be claimed. - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. - * body: array, // (REQUIRED) Data to claim a sync job. + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. + * body: string|array, // (REQUIRED) Data to claim a sync job.. If body is a string must be a valid JSON. * } $params * * @throws MissingParameterException if a required parameter is missing @@ -402,8 +411,9 @@ public function syncJobCheckIn(array $params = []) * * @return Elasticsearch|Promise */ - public function syncJobClaim(array $params = []) + public function syncJobClaim(?array $params = null) { + $params = $params ?? []; $this->checkRequiredParameters(['connector_sync_job_id','body'], $params); $url = '/_connector/_sync_job/' . $this->encode($params['connector_sync_job_id']) . '/_claim'; $method = 'PUT'; @@ -427,11 +437,11 @@ public function syncJobClaim(array $params = []) * * @param array{ * connector_sync_job_id: string, // (REQUIRED) The unique identifier of the connector sync job to be deleted. - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. * } $params * * @throws MissingParameterException if a required parameter is missing @@ -441,8 +451,9 @@ public function syncJobClaim(array $params = []) * * @return Elasticsearch|Promise */ - public function syncJobDelete(array $params = []) + public function syncJobDelete(?array $params = null) { + $params = $params ?? []; $this->checkRequiredParameters(['connector_sync_job_id'], $params); $url = '/_connector/_sync_job/' . $this->encode($params['connector_sync_job_id']); $method = 'DELETE'; @@ -465,12 +476,12 @@ public function syncJobDelete(array $params = []) * * @param array{ * connector_sync_job_id: string, // (REQUIRED) The unique identifier of the connector sync job to set an error for. - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. - * body: array, // (REQUIRED) The error to set in the connector sync job. + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. + * body: string|array, // (REQUIRED) The error to set in the connector sync job.. If body is a string must be a valid JSON. * } $params * * @throws MissingParameterException if a required parameter is missing @@ -480,8 +491,9 @@ public function syncJobDelete(array $params = []) * * @return Elasticsearch|Promise */ - public function syncJobError(array $params = []) + public function syncJobError(?array $params = null) { + $params = $params ?? []; $this->checkRequiredParameters(['connector_sync_job_id','body'], $params); $url = '/_connector/_sync_job/' . $this->encode($params['connector_sync_job_id']) . '/_error'; $method = 'PUT'; @@ -505,11 +517,11 @@ public function syncJobError(array $params = []) * * @param array{ * connector_sync_job_id: string, // (REQUIRED) The unique identifier of the connector sync job to be returned. - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. * } $params * * @throws MissingParameterException if a required parameter is missing @@ -519,8 +531,9 @@ public function syncJobError(array $params = []) * * @return Elasticsearch|Promise */ - public function syncJobGet(array $params = []) + public function syncJobGet(?array $params = null) { + $params = $params ?? []; $this->checkRequiredParameters(['connector_sync_job_id'], $params); $url = '/_connector/_sync_job/' . $this->encode($params['connector_sync_job_id']); $method = 'GET'; @@ -542,16 +555,16 @@ public function syncJobGet(array $params = []) * @internal This API is EXPERIMENTAL and may be changed or removed completely in a future release * * @param array{ - * from: int, // Starting offset (default: 0) - * size: int, // specifies a max number of results to get (default: 100) - * status: string, // Sync job status, which sync jobs are fetched for - * connector_id: string, // Id of the connector to fetch the sync jobs for - * job_type: list, // A comma-separated list of job types - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. + * from?: int, // Starting offset (default: 0) + * size?: int, // specifies a max number of results to get (default: 100) + * status?: string, // Sync job status, which sync jobs are fetched for + * connector_id?: string, // Id of the connector to fetch the sync jobs for + * job_type?: string|array, // A comma-separated list of job types + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. * } $params * * @throws NoNodeAvailableException if all the hosts are offline @@ -560,8 +573,9 @@ public function syncJobGet(array $params = []) * * @return Elasticsearch|Promise */ - public function syncJobList(array $params = []) + public function syncJobList(?array $params = null) { + $params = $params ?? []; $url = '/_connector/_sync_job'; $method = 'GET'; @@ -582,12 +596,12 @@ public function syncJobList(array $params = []) * @internal This API is EXPERIMENTAL and may be changed or removed completely in a future release * * @param array{ - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. - * body: array, // (REQUIRED) The connector sync job data. + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. + * body: string|array, // (REQUIRED) The connector sync job data.. If body is a string must be a valid JSON. * } $params * * @throws NoNodeAvailableException if all the hosts are offline @@ -596,8 +610,9 @@ public function syncJobList(array $params = []) * * @return Elasticsearch|Promise */ - public function syncJobPost(array $params = []) + public function syncJobPost(?array $params = null) { + $params = $params ?? []; $this->checkRequiredParameters(['body'], $params); $url = '/_connector/_sync_job'; $method = 'POST'; @@ -621,12 +636,12 @@ public function syncJobPost(array $params = []) * * @param array{ * connector_sync_job_id: string, // (REQUIRED) The unique identifier of the connector sync job to be updated. - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. - * body: array, // (REQUIRED) The stats to update for the connector sync job. + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. + * body: string|array, // (REQUIRED) The stats to update for the connector sync job.. If body is a string must be a valid JSON. * } $params * * @throws MissingParameterException if a required parameter is missing @@ -636,8 +651,9 @@ public function syncJobPost(array $params = []) * * @return Elasticsearch|Promise */ - public function syncJobUpdateStats(array $params = []) + public function syncJobUpdateStats(?array $params = null) { + $params = $params ?? []; $this->checkRequiredParameters(['connector_sync_job_id','body'], $params); $url = '/_connector/_sync_job/' . $this->encode($params['connector_sync_job_id']) . '/_stats'; $method = 'PUT'; @@ -661,11 +677,11 @@ public function syncJobUpdateStats(array $params = []) * * @param array{ * connector_id: string, // (REQUIRED) The unique identifier of the connector to be updated. - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. * } $params * * @throws MissingParameterException if a required parameter is missing @@ -675,8 +691,9 @@ public function syncJobUpdateStats(array $params = []) * * @return Elasticsearch|Promise */ - public function updateActiveFiltering(array $params = []) + public function updateActiveFiltering(?array $params = null) { + $params = $params ?? []; $this->checkRequiredParameters(['connector_id'], $params); $url = '/_connector/' . $this->encode($params['connector_id']) . '/_filtering/_activate'; $method = 'PUT'; @@ -700,12 +717,12 @@ public function updateActiveFiltering(array $params = []) * * @param array{ * connector_id: string, // (REQUIRED) The unique identifier of the connector to be updated. - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. - * body: array, // (REQUIRED) An object containing the connector's API key id and/or Connector Secret document id for that API key. + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. + * body: string|array, // (REQUIRED) An object containing the connector's API key id and/or Connector Secret document id for that API key.. If body is a string must be a valid JSON. * } $params * * @throws MissingParameterException if a required parameter is missing @@ -715,8 +732,9 @@ public function updateActiveFiltering(array $params = []) * * @return Elasticsearch|Promise */ - public function updateApiKeyId(array $params = []) + public function updateApiKeyId(?array $params = null) { + $params = $params ?? []; $this->checkRequiredParameters(['connector_id','body'], $params); $url = '/_connector/' . $this->encode($params['connector_id']) . '/_api_key_id'; $method = 'PUT'; @@ -740,12 +758,12 @@ public function updateApiKeyId(array $params = []) * * @param array{ * connector_id: string, // (REQUIRED) The unique identifier of the connector to be updated. - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. - * body: array, // (REQUIRED) Mapping between field names to configuration. + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. + * body: string|array, // (REQUIRED) Mapping between field names to configuration.. If body is a string must be a valid JSON. * } $params * * @throws MissingParameterException if a required parameter is missing @@ -755,8 +773,9 @@ public function updateApiKeyId(array $params = []) * * @return Elasticsearch|Promise */ - public function updateConfiguration(array $params = []) + public function updateConfiguration(?array $params = null) { + $params = $params ?? []; $this->checkRequiredParameters(['connector_id','body'], $params); $url = '/_connector/' . $this->encode($params['connector_id']) . '/_configuration'; $method = 'PUT'; @@ -780,12 +799,12 @@ public function updateConfiguration(array $params = []) * * @param array{ * connector_id: string, // (REQUIRED) The unique identifier of the connector to be updated. - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. - * body: array, // (REQUIRED) An object containing the connector's error. + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. + * body: string|array, // (REQUIRED) An object containing the connector's error.. If body is a string must be a valid JSON. * } $params * * @throws MissingParameterException if a required parameter is missing @@ -795,8 +814,9 @@ public function updateConfiguration(array $params = []) * * @return Elasticsearch|Promise */ - public function updateError(array $params = []) + public function updateError(?array $params = null) { + $params = $params ?? []; $this->checkRequiredParameters(['connector_id','body'], $params); $url = '/_connector/' . $this->encode($params['connector_id']) . '/_error'; $method = 'PUT'; @@ -820,12 +840,12 @@ public function updateError(array $params = []) * * @param array{ * connector_id: string, // (REQUIRED) The unique identifier of the connector to be updated. - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. - * body: array, // (REQUIRED) An object containing the connector's features definition. + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. + * body: string|array, // (REQUIRED) An object containing the connector's features definition.. If body is a string must be a valid JSON. * } $params * * @throws MissingParameterException if a required parameter is missing @@ -835,8 +855,9 @@ public function updateError(array $params = []) * * @return Elasticsearch|Promise */ - public function updateFeatures(array $params = []) + public function updateFeatures(?array $params = null) { + $params = $params ?? []; $this->checkRequiredParameters(['connector_id','body'], $params); $url = '/_connector/' . $this->encode($params['connector_id']) . '/_features'; $method = 'PUT'; @@ -860,12 +881,12 @@ public function updateFeatures(array $params = []) * * @param array{ * connector_id: string, // (REQUIRED) The unique identifier of the connector to be updated. - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. - * body: array, // (REQUIRED) A list of connector filtering configurations. + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. + * body: string|array, // (REQUIRED) A list of connector filtering configurations.. If body is a string must be a valid JSON. * } $params * * @throws MissingParameterException if a required parameter is missing @@ -875,8 +896,9 @@ public function updateFeatures(array $params = []) * * @return Elasticsearch|Promise */ - public function updateFiltering(array $params = []) + public function updateFiltering(?array $params = null) { + $params = $params ?? []; $this->checkRequiredParameters(['connector_id','body'], $params); $url = '/_connector/' . $this->encode($params['connector_id']) . '/_filtering'; $method = 'PUT'; @@ -900,12 +922,12 @@ public function updateFiltering(array $params = []) * * @param array{ * connector_id: string, // (REQUIRED) The unique identifier of the connector to be updated. - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. - * body: array, // (REQUIRED) Validation info for the draft filtering rules + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. + * body: string|array, // (REQUIRED) Validation info for the draft filtering rules. If body is a string must be a valid JSON. * } $params * * @throws MissingParameterException if a required parameter is missing @@ -915,8 +937,9 @@ public function updateFiltering(array $params = []) * * @return Elasticsearch|Promise */ - public function updateFilteringValidation(array $params = []) + public function updateFilteringValidation(?array $params = null) { + $params = $params ?? []; $this->checkRequiredParameters(['connector_id','body'], $params); $url = '/_connector/' . $this->encode($params['connector_id']) . '/_filtering/_validation'; $method = 'PUT'; @@ -940,12 +963,12 @@ public function updateFilteringValidation(array $params = []) * * @param array{ * connector_id: string, // (REQUIRED) The unique identifier of the connector to be updated. - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. - * body: array, // (REQUIRED) An object containing the connector's index name. + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. + * body: string|array, // (REQUIRED) An object containing the connector's index name.. If body is a string must be a valid JSON. * } $params * * @throws MissingParameterException if a required parameter is missing @@ -955,8 +978,9 @@ public function updateFilteringValidation(array $params = []) * * @return Elasticsearch|Promise */ - public function updateIndexName(array $params = []) + public function updateIndexName(?array $params = null) { + $params = $params ?? []; $this->checkRequiredParameters(['connector_id','body'], $params); $url = '/_connector/' . $this->encode($params['connector_id']) . '/_index_name'; $method = 'PUT'; @@ -980,12 +1004,12 @@ public function updateIndexName(array $params = []) * * @param array{ * connector_id: string, // (REQUIRED) The unique identifier of the connector to be updated. - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. - * body: array, // (REQUIRED) An object containing the connector's name and/or description. + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. + * body: string|array, // (REQUIRED) An object containing the connector's name and/or description.. If body is a string must be a valid JSON. * } $params * * @throws MissingParameterException if a required parameter is missing @@ -995,8 +1019,9 @@ public function updateIndexName(array $params = []) * * @return Elasticsearch|Promise */ - public function updateName(array $params = []) + public function updateName(?array $params = null) { + $params = $params ?? []; $this->checkRequiredParameters(['connector_id','body'], $params); $url = '/_connector/' . $this->encode($params['connector_id']) . '/_name'; $method = 'PUT'; @@ -1020,12 +1045,12 @@ public function updateName(array $params = []) * * @param array{ * connector_id: string, // (REQUIRED) The unique identifier of the connector to be updated. - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. - * body: array, // (REQUIRED) An object containing the connector's is_native flag + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. + * body: string|array, // (REQUIRED) An object containing the connector's is_native flag. If body is a string must be a valid JSON. * } $params * * @throws MissingParameterException if a required parameter is missing @@ -1035,8 +1060,9 @@ public function updateName(array $params = []) * * @return Elasticsearch|Promise */ - public function updateNative(array $params = []) + public function updateNative(?array $params = null) { + $params = $params ?? []; $this->checkRequiredParameters(['connector_id','body'], $params); $url = '/_connector/' . $this->encode($params['connector_id']) . '/_native'; $method = 'PUT'; @@ -1060,12 +1086,12 @@ public function updateNative(array $params = []) * * @param array{ * connector_id: string, // (REQUIRED) The unique identifier of the connector to be updated. - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. - * body: array, // (REQUIRED) An object with connector ingest pipeline configuration. + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. + * body: string|array, // (REQUIRED) An object with connector ingest pipeline configuration.. If body is a string must be a valid JSON. * } $params * * @throws MissingParameterException if a required parameter is missing @@ -1075,8 +1101,9 @@ public function updateNative(array $params = []) * * @return Elasticsearch|Promise */ - public function updatePipeline(array $params = []) + public function updatePipeline(?array $params = null) { + $params = $params ?? []; $this->checkRequiredParameters(['connector_id','body'], $params); $url = '/_connector/' . $this->encode($params['connector_id']) . '/_pipeline'; $method = 'PUT'; @@ -1100,12 +1127,12 @@ public function updatePipeline(array $params = []) * * @param array{ * connector_id: string, // (REQUIRED) The unique identifier of the connector to be updated. - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. - * body: array, // (REQUIRED) An object containing the connector's scheduling configuration. + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. + * body: string|array, // (REQUIRED) An object containing the connector's scheduling configuration.. If body is a string must be a valid JSON. * } $params * * @throws MissingParameterException if a required parameter is missing @@ -1115,8 +1142,9 @@ public function updatePipeline(array $params = []) * * @return Elasticsearch|Promise */ - public function updateScheduling(array $params = []) + public function updateScheduling(?array $params = null) { + $params = $params ?? []; $this->checkRequiredParameters(['connector_id','body'], $params); $url = '/_connector/' . $this->encode($params['connector_id']) . '/_scheduling'; $method = 'PUT'; @@ -1140,12 +1168,12 @@ public function updateScheduling(array $params = []) * * @param array{ * connector_id: string, // (REQUIRED) The unique identifier of the connector to be updated. - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. - * body: array, // (REQUIRED) An object containing the connector's service type. + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. + * body: string|array, // (REQUIRED) An object containing the connector's service type.. If body is a string must be a valid JSON. * } $params * * @throws MissingParameterException if a required parameter is missing @@ -1155,8 +1183,9 @@ public function updateScheduling(array $params = []) * * @return Elasticsearch|Promise */ - public function updateServiceType(array $params = []) + public function updateServiceType(?array $params = null) { + $params = $params ?? []; $this->checkRequiredParameters(['connector_id','body'], $params); $url = '/_connector/' . $this->encode($params['connector_id']) . '/_service_type'; $method = 'PUT'; @@ -1180,12 +1209,12 @@ public function updateServiceType(array $params = []) * * @param array{ * connector_id: string, // (REQUIRED) The unique identifier of the connector to be updated. - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. - * body: array, // (REQUIRED) An object containing the connector's status. + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. + * body: string|array, // (REQUIRED) An object containing the connector's status.. If body is a string must be a valid JSON. * } $params * * @throws MissingParameterException if a required parameter is missing @@ -1195,8 +1224,9 @@ public function updateServiceType(array $params = []) * * @return Elasticsearch|Promise */ - public function updateStatus(array $params = []) + public function updateStatus(?array $params = null) { + $params = $params ?? []; $this->checkRequiredParameters(['connector_id','body'], $params); $url = '/_connector/' . $this->encode($params['connector_id']) . '/_status'; $method = 'PUT'; diff --git a/src/Endpoints/DanglingIndices.php b/src/Endpoints/DanglingIndices.php index b75c77635..bcb03ee14 100644 --- a/src/Endpoints/DanglingIndices.php +++ b/src/Endpoints/DanglingIndices.php @@ -35,14 +35,14 @@ class DanglingIndices extends AbstractEndpoint * * @param array{ * index_uuid: string, // (REQUIRED) The UUID of the dangling index - * accept_data_loss: boolean, // Must be set to true in order to delete the dangling index - * timeout: time, // Explicit operation timeout - * master_timeout: time, // Specify timeout for connection to master - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. + * accept_data_loss?: bool, // Must be set to true in order to delete the dangling index + * timeout?: int|string, // Explicit operation timeout + * master_timeout?: int|string, // Specify timeout for connection to master + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. * } $params * * @throws MissingParameterException if a required parameter is missing @@ -52,8 +52,9 @@ class DanglingIndices extends AbstractEndpoint * * @return Elasticsearch|Promise */ - public function deleteDanglingIndex(array $params = []) + public function deleteDanglingIndex(?array $params = null) { + $params = $params ?? []; $this->checkRequiredParameters(['index_uuid'], $params); $url = '/_dangling/' . $this->encode($params['index_uuid']); $method = 'DELETE'; @@ -75,14 +76,14 @@ public function deleteDanglingIndex(array $params = []) * * @param array{ * index_uuid: string, // (REQUIRED) The UUID of the dangling index - * accept_data_loss: boolean, // Must be set to true in order to import the dangling index - * timeout: time, // Explicit operation timeout - * master_timeout: time, // Specify timeout for connection to master - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. + * accept_data_loss?: bool, // Must be set to true in order to import the dangling index + * timeout?: int|string, // Explicit operation timeout + * master_timeout?: int|string, // Specify timeout for connection to master + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. * } $params * * @throws MissingParameterException if a required parameter is missing @@ -92,8 +93,9 @@ public function deleteDanglingIndex(array $params = []) * * @return Elasticsearch|Promise */ - public function importDanglingIndex(array $params = []) + public function importDanglingIndex(?array $params = null) { + $params = $params ?? []; $this->checkRequiredParameters(['index_uuid'], $params); $url = '/_dangling/' . $this->encode($params['index_uuid']); $method = 'POST'; @@ -114,11 +116,11 @@ public function importDanglingIndex(array $params = []) * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/modules-gateway-dangling-indices.html * * @param array{ - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. * } $params * * @throws NoNodeAvailableException if all the hosts are offline @@ -127,8 +129,9 @@ public function importDanglingIndex(array $params = []) * * @return Elasticsearch|Promise */ - public function listDanglingIndices(array $params = []) + public function listDanglingIndices(?array $params = null) { + $params = $params ?? []; $url = '/_dangling'; $method = 'GET'; diff --git a/src/Endpoints/Enrich.php b/src/Endpoints/Enrich.php index b2f893962..d0624ef91 100644 --- a/src/Endpoints/Enrich.php +++ b/src/Endpoints/Enrich.php @@ -35,12 +35,12 @@ class Enrich extends AbstractEndpoint * * @param array{ * name: string, // (REQUIRED) The name of the enrich policy - * master_timeout: time, // Timeout for processing on master node - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. + * master_timeout?: int|string, // Timeout for processing on master node + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. * } $params * * @throws MissingParameterException if a required parameter is missing @@ -50,8 +50,9 @@ class Enrich extends AbstractEndpoint * * @return Elasticsearch|Promise */ - public function deletePolicy(array $params = []) + public function deletePolicy(?array $params = null) { + $params = $params ?? []; $this->checkRequiredParameters(['name'], $params); $url = '/_enrich/policy/' . $this->encode($params['name']); $method = 'DELETE'; @@ -73,13 +74,13 @@ public function deletePolicy(array $params = []) * * @param array{ * name: string, // (REQUIRED) The name of the enrich policy - * wait_for_completion: boolean, // Should the request should block until the execution is complete. - * master_timeout: time, // Timeout for processing on master node - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. + * wait_for_completion?: bool, // Should the request should block until the execution is complete. + * master_timeout?: int|string, // Timeout for processing on master node + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. * } $params * * @throws MissingParameterException if a required parameter is missing @@ -89,8 +90,9 @@ public function deletePolicy(array $params = []) * * @return Elasticsearch|Promise */ - public function executePolicy(array $params = []) + public function executePolicy(?array $params = null) { + $params = $params ?? []; $this->checkRequiredParameters(['name'], $params); $url = '/_enrich/policy/' . $this->encode($params['name']) . '/_execute'; $method = 'PUT'; @@ -111,13 +113,13 @@ public function executePolicy(array $params = []) * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/get-enrich-policy-api.html * * @param array{ - * name: list, // A comma-separated list of enrich policy names - * master_timeout: time, // Timeout for processing on master node - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. + * name?: string|array, // A comma-separated list of enrich policy names + * master_timeout?: int|string, // Timeout for processing on master node + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. * } $params * * @throws NoNodeAvailableException if all the hosts are offline @@ -126,10 +128,11 @@ public function executePolicy(array $params = []) * * @return Elasticsearch|Promise */ - public function getPolicy(array $params = []) + public function getPolicy(?array $params = null) { + $params = $params ?? []; if (isset($params['name'])) { - $url = '/_enrich/policy/' . $this->encode($params['name']); + $url = '/_enrich/policy/' . $this->encode($this->convertValue($params['name'])); $method = 'GET'; } else { $url = '/_enrich/policy'; @@ -152,13 +155,13 @@ public function getPolicy(array $params = []) * * @param array{ * name: string, // (REQUIRED) The name of the enrich policy - * master_timeout: time, // Timeout for processing on master node - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. - * body: array, // (REQUIRED) The enrich policy to register + * master_timeout?: int|string, // Timeout for processing on master node + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. + * body: string|array, // (REQUIRED) The enrich policy to register. If body is a string must be a valid JSON. * } $params * * @throws MissingParameterException if a required parameter is missing @@ -168,8 +171,9 @@ public function getPolicy(array $params = []) * * @return Elasticsearch|Promise */ - public function putPolicy(array $params = []) + public function putPolicy(?array $params = null) { + $params = $params ?? []; $this->checkRequiredParameters(['name','body'], $params); $url = '/_enrich/policy/' . $this->encode($params['name']); $method = 'PUT'; @@ -191,12 +195,12 @@ public function putPolicy(array $params = []) * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/enrich-stats-api.html * * @param array{ - * master_timeout: time, // Timeout for processing on master node - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. + * master_timeout?: int|string, // Timeout for processing on master node + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. * } $params * * @throws NoNodeAvailableException if all the hosts are offline @@ -205,8 +209,9 @@ public function putPolicy(array $params = []) * * @return Elasticsearch|Promise */ - public function stats(array $params = []) + public function stats(?array $params = null) { + $params = $params ?? []; $url = '/_enrich/_stats'; $method = 'GET'; diff --git a/src/Endpoints/Eql.php b/src/Endpoints/Eql.php index 4a10691c4..4b4a8f21a 100644 --- a/src/Endpoints/Eql.php +++ b/src/Endpoints/Eql.php @@ -35,11 +35,11 @@ class Eql extends AbstractEndpoint * * @param array{ * id: string, // (REQUIRED) The async search ID - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. * } $params * * @throws MissingParameterException if a required parameter is missing @@ -49,8 +49,9 @@ class Eql extends AbstractEndpoint * * @return Elasticsearch|Promise */ - public function delete(array $params = []) + public function delete(?array $params = null) { + $params = $params ?? []; $this->checkRequiredParameters(['id'], $params); $url = '/_eql/search/' . $this->encode($params['id']); $method = 'DELETE'; @@ -72,13 +73,13 @@ public function delete(array $params = []) * * @param array{ * id: string, // (REQUIRED) The async search ID - * wait_for_completion_timeout: time, // Specify the time that the request should block waiting for the final response - * keep_alive: time, // Update the time interval in which the results (partial or final) for this search will be available - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. + * wait_for_completion_timeout?: int|string, // Specify the time that the request should block waiting for the final response + * keep_alive?: int|string, // Update the time interval in which the results (partial or final) for this search will be available + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. * } $params * * @throws MissingParameterException if a required parameter is missing @@ -88,8 +89,9 @@ public function delete(array $params = []) * * @return Elasticsearch|Promise */ - public function get(array $params = []) + public function get(?array $params = null) { + $params = $params ?? []; $this->checkRequiredParameters(['id'], $params); $url = '/_eql/search/' . $this->encode($params['id']); $method = 'GET'; @@ -111,11 +113,11 @@ public function get(array $params = []) * * @param array{ * id: string, // (REQUIRED) The async search ID - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. * } $params * * @throws MissingParameterException if a required parameter is missing @@ -125,8 +127,9 @@ public function get(array $params = []) * * @return Elasticsearch|Promise */ - public function getStatus(array $params = []) + public function getStatus(?array $params = null) { + $params = $params ?? []; $this->checkRequiredParameters(['id'], $params); $url = '/_eql/search/status/' . $this->encode($params['id']); $method = 'GET'; @@ -148,15 +151,17 @@ public function getStatus(array $params = []) * * @param array{ * index: string, // (REQUIRED) The name of the index to scope the operation - * wait_for_completion_timeout: time, // Specify the time that the request should block waiting for the final response - * keep_on_completion: boolean, // Control whether the response should be stored in the cluster if it completed within the provided [wait_for_completion] time (default: false) - * keep_alive: time, // Update the time interval in which the results (partial or final) for this search will be available - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. - * body: array, // (REQUIRED) Eql request body. Use the `query` to limit the query scope. + * wait_for_completion_timeout?: int|string, // Specify the time that the request should block waiting for the final response + * keep_on_completion?: bool, // Control whether the response should be stored in the cluster if it completed within the provided [wait_for_completion] time (default: false) + * keep_alive?: int|string, // Update the time interval in which the results (partial or final) for this search will be available + * allow_partial_search_results?: bool, // Control whether the query should keep running in case of shard failures, and return partial results + * allow_partial_sequence_results?: bool, // Control whether a sequence query should return partial results or no results at all in case of shard failures. This option has effect only if [allow_partial_search_results] is true. + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. + * body: string|array, // (REQUIRED) Eql request body. Use the `query` to limit the query scope.. If body is a string must be a valid JSON. * } $params * * @throws MissingParameterException if a required parameter is missing @@ -166,13 +171,14 @@ public function getStatus(array $params = []) * * @return Elasticsearch|Promise */ - public function search(array $params = []) + public function search(?array $params = null) { + $params = $params ?? []; $this->checkRequiredParameters(['index','body'], $params); $url = '/' . $this->encode($params['index']) . '/_eql/search'; $method = empty($params['body']) ? 'GET' : 'POST'; - $url = $this->addQueryString($url, $params, ['wait_for_completion_timeout','keep_on_completion','keep_alive','pretty','human','error_trace','source','filter_path']); + $url = $this->addQueryString($url, $params, ['wait_for_completion_timeout','keep_on_completion','keep_alive','allow_partial_search_results','allow_partial_sequence_results','pretty','human','error_trace','source','filter_path']); $headers = [ 'Accept' => 'application/json', 'Content-Type' => 'application/json', diff --git a/src/Endpoints/Esql.php b/src/Endpoints/Esql.php index 0e7388fa0..6aa367702 100644 --- a/src/Endpoints/Esql.php +++ b/src/Endpoints/Esql.php @@ -34,15 +34,15 @@ class Esql extends AbstractEndpoint * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/esql-async-query-api.html * * @param array{ - * format: string, // a short version of the Accept header, e.g. json, yaml - * delimiter: string, // The character to use between values within a CSV row. Only valid for the csv format. - * drop_null_columns: boolean, // Should entirely null columns be removed from the results? Their name and type will be returning in a new `all_columns` section. - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. - * body: array, // (REQUIRED) Use the `query` element to start a query. Use `columnar` to format the answer. + * format?: string, // a short version of the Accept header, e.g. json, yaml + * delimiter?: string, // The character to use between values within a CSV row. Only valid for the csv format. + * drop_null_columns?: bool, // Should entirely null columns be removed from the results? Their name and type will be returning in a new `all_columns` section. + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. + * body: string|array, // (REQUIRED) Use the `query` element to start a query. Use `columnar` to format the answer.. If body is a string must be a valid JSON. * } $params * * @throws NoNodeAvailableException if all the hosts are offline @@ -51,8 +51,9 @@ class Esql extends AbstractEndpoint * * @return Elasticsearch|Promise */ - public function asyncQuery(array $params = []) + public function asyncQuery(?array $params = null) { + $params = $params ?? []; $this->checkRequiredParameters(['body'], $params); $url = '/_query/async'; $method = 'POST'; @@ -68,6 +69,44 @@ public function asyncQuery(array $params = []) } + /** + * Delete an async query request given its ID. + * + * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/esql-async-query-delete-api.html + * + * @param array{ + * id: string, // (REQUIRED) The async query ID + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. + * } $params + * + * @throws MissingParameterException if a required parameter is missing + * @throws NoNodeAvailableException if all the hosts are offline + * @throws ClientResponseException if the status code of response is 4xx + * @throws ServerResponseException if the status code of response is 5xx + * + * @return Elasticsearch|Promise + */ + public function asyncQueryDelete(?array $params = null) + { + $params = $params ?? []; + $this->checkRequiredParameters(['id'], $params); + $url = '/_query/async/' . $this->encode($params['id']); + $method = 'DELETE'; + + $url = $this->addQueryString($url, $params, ['pretty','human','error_trace','source','filter_path']); + $headers = [ + 'Accept' => 'application/json', + ]; + $request = $this->createRequest($method, $url, $headers, $params['body'] ?? null); + $request = $this->addOtelAttributes($params, ['id'], $request, 'esql.async_query_delete'); + return $this->client->sendRequest($request); + } + + /** * Retrieves the results of a previously submitted async query request given its ID. * @@ -75,14 +114,14 @@ public function asyncQuery(array $params = []) * * @param array{ * id: string, // (REQUIRED) The async query ID - * wait_for_completion_timeout: time, // Specify the time that the request should block waiting for the final response - * keep_alive: time, // Specify the time interval in which the results (partial or final) for this search will be available - * drop_null_columns: boolean, // Should entirely null columns be removed from the results? Their name and type will be returning in a new `all_columns` section. - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. + * wait_for_completion_timeout?: int|string, // Specify the time that the request should block waiting for the final response + * keep_alive?: int|string, // Specify the time interval in which the results (partial or final) for this search will be available + * drop_null_columns?: bool, // Should entirely null columns be removed from the results? Their name and type will be returning in a new `all_columns` section. + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. * } $params * * @throws MissingParameterException if a required parameter is missing @@ -92,8 +131,9 @@ public function asyncQuery(array $params = []) * * @return Elasticsearch|Promise */ - public function asyncQueryGet(array $params = []) + public function asyncQueryGet(?array $params = null) { + $params = $params ?? []; $this->checkRequiredParameters(['id'], $params); $url = '/_query/async/' . $this->encode($params['id']); $method = 'GET'; @@ -108,21 +148,59 @@ public function asyncQueryGet(array $params = []) } + /** + * Stops a previously submitted async query request given its ID and collects the results. + * + * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/esql-async-query-stop-api.html + * + * @param array{ + * id: string, // (REQUIRED) The async query ID + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. + * } $params + * + * @throws MissingParameterException if a required parameter is missing + * @throws NoNodeAvailableException if all the hosts are offline + * @throws ClientResponseException if the status code of response is 4xx + * @throws ServerResponseException if the status code of response is 5xx + * + * @return Elasticsearch|Promise + */ + public function asyncQueryStop(?array $params = null) + { + $params = $params ?? []; + $this->checkRequiredParameters(['id'], $params); + $url = '/_query/async/' . $this->encode($params['id']) . '/stop'; + $method = 'POST'; + + $url = $this->addQueryString($url, $params, ['pretty','human','error_trace','source','filter_path']); + $headers = [ + 'Accept' => 'application/json', + ]; + $request = $this->createRequest($method, $url, $headers, $params['body'] ?? null); + $request = $this->addOtelAttributes($params, ['id'], $request, 'esql.async_query_stop'); + return $this->client->sendRequest($request); + } + + /** * Executes an ESQL request * * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/esql-query-api.html * * @param array{ - * format: string, // a short version of the Accept header, e.g. json, yaml - * delimiter: string, // The character to use between values within a CSV row. Only valid for the csv format. - * drop_null_columns: boolean, // Should entirely null columns be removed from the results? Their name and type will be returning in a new `all_columns` section. - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. - * body: array, // (REQUIRED) Use the `query` element to start a query. Use `columnar` to format the answer. + * format?: string, // a short version of the Accept header, e.g. json, yaml + * delimiter?: string, // The character to use between values within a CSV row. Only valid for the csv format. + * drop_null_columns?: bool, // Should entirely null columns be removed from the results? Their name and type will be returning in a new `all_columns` section. + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. + * body: string|array, // (REQUIRED) Use the `query` element to start a query. Use `columnar` to format the answer.. If body is a string must be a valid JSON. * } $params * * @throws NoNodeAvailableException if all the hosts are offline @@ -131,8 +209,9 @@ public function asyncQueryGet(array $params = []) * * @return Elasticsearch|Promise */ - public function query(array $params = []) + public function query(?array $params = null) { + $params = $params ?? []; $this->checkRequiredParameters(['body'], $params); $url = '/_query'; $method = 'POST'; diff --git a/src/Endpoints/Features.php b/src/Endpoints/Features.php index 2cb21fa0e..3ebe9bfc7 100644 --- a/src/Endpoints/Features.php +++ b/src/Endpoints/Features.php @@ -34,12 +34,12 @@ class Features extends AbstractEndpoint * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/get-features-api.html * * @param array{ - * master_timeout: time, // Explicit operation timeout for connection to master node - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. + * master_timeout?: int|string, // Explicit operation timeout for connection to master node + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. * } $params * * @throws NoNodeAvailableException if all the hosts are offline @@ -48,8 +48,9 @@ class Features extends AbstractEndpoint * * @return Elasticsearch|Promise */ - public function getFeatures(array $params = []) + public function getFeatures(?array $params = null) { + $params = $params ?? []; $url = '/_features'; $method = 'GET'; @@ -70,12 +71,12 @@ public function getFeatures(array $params = []) * @internal This API is EXPERIMENTAL and may be changed or removed completely in a future release * * @param array{ - * master_timeout: time, // Explicit operation timeout for connection to master node - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. + * master_timeout?: int|string, // Explicit operation timeout for connection to master node + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. * } $params * * @throws NoNodeAvailableException if all the hosts are offline @@ -84,8 +85,9 @@ public function getFeatures(array $params = []) * * @return Elasticsearch|Promise */ - public function resetFeatures(array $params = []) + public function resetFeatures(?array $params = null) { + $params = $params ?? []; $url = '/_features/_reset'; $method = 'POST'; diff --git a/src/Endpoints/Fleet.php b/src/Endpoints/Fleet.php index bb0e9e209..de0a4a85a 100644 --- a/src/Endpoints/Fleet.php +++ b/src/Endpoints/Fleet.php @@ -35,15 +35,15 @@ class Fleet extends AbstractEndpoint * * @param array{ * index: string, // (REQUIRED) The name of the index. - * wait_for_advance: boolean, // Whether to wait for the global checkpoint to advance past the specified current checkpoints - * wait_for_index: boolean, // Whether to wait for the target index to exist and all primary shards be active - * checkpoints: list, // Comma separated list of checkpoints - * timeout: time, // Timeout to wait for global checkpoint to advance - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. + * wait_for_advance?: bool, // Whether to wait for the global checkpoint to advance past the specified current checkpoints + * wait_for_index?: bool, // Whether to wait for the target index to exist and all primary shards be active + * checkpoints?: string|array, // Comma separated list of checkpoints + * timeout?: int|string, // Timeout to wait for global checkpoint to advance + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. * } $params * * @throws MissingParameterException if a required parameter is missing @@ -53,8 +53,9 @@ class Fleet extends AbstractEndpoint * * @return Elasticsearch|Promise */ - public function globalCheckpoints(array $params = []) + public function globalCheckpoints(?array $params = null) { + $params = $params ?? []; $this->checkRequiredParameters(['index'], $params); $url = '/' . $this->encode($params['index']) . '/_fleet/global_checkpoints'; $method = 'GET'; @@ -76,13 +77,13 @@ public function globalCheckpoints(array $params = []) * @internal This API is EXPERIMENTAL and may be changed or removed completely in a future release * * @param array{ - * index: string, // The index name to use as the default - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. - * body: array, // (REQUIRED) The request definitions (metadata-fleet search request definition pairs), separated by newlines + * index?: string, // The index name to use as the default + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. + * body: string|array, // (REQUIRED) The request definitions (metadata-fleet search request definition pairs), separated by newlines. If body is a string must be a valid JSON. * } $params * * @throws NoNodeAvailableException if all the hosts are offline @@ -91,8 +92,9 @@ public function globalCheckpoints(array $params = []) * * @return Elasticsearch|Promise */ - public function msearch(array $params = []) + public function msearch(?array $params = null) { + $params = $params ?? []; $this->checkRequiredParameters(['body'], $params); if (isset($params['index'])) { $url = '/' . $this->encode($params['index']) . '/_fleet/_fleet_msearch'; @@ -119,15 +121,15 @@ public function msearch(array $params = []) * * @param array{ * index: string, // (REQUIRED) The index name to search. - * wait_for_checkpoints: list, // Comma separated list of checkpoints, one per shard - * wait_for_checkpoints_timeout: time, // Explicit wait_for_checkpoints timeout - * allow_partial_search_results: boolean, // Indicate if an error should be returned if there is a partial search failure or timeout - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. - * body: array, // The search definition using the Query DSL + * wait_for_checkpoints?: string|array, // Comma separated list of checkpoints, one per shard + * wait_for_checkpoints_timeout?: int|string, // Explicit wait_for_checkpoints timeout + * allow_partial_search_results?: bool, // Indicate if an error should be returned if there is a partial search failure or timeout + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. + * body?: string|array, // The search definition using the Query DSL. If body is a string must be a valid JSON. * } $params * * @throws MissingParameterException if a required parameter is missing @@ -137,8 +139,9 @@ public function msearch(array $params = []) * * @return Elasticsearch|Promise */ - public function search(array $params = []) + public function search(?array $params = null) { + $params = $params ?? []; $this->checkRequiredParameters(['index'], $params); $url = '/' . $this->encode($params['index']) . '/_fleet/_fleet_search'; $method = empty($params['body']) ? 'GET' : 'POST'; diff --git a/src/Endpoints/Graph.php b/src/Endpoints/Graph.php index 416585654..f05eb5925 100644 --- a/src/Endpoints/Graph.php +++ b/src/Endpoints/Graph.php @@ -34,15 +34,15 @@ class Graph extends AbstractEndpoint * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/graph-explore-api.html * * @param array{ - * index: list, // (REQUIRED) A comma-separated list of index names to search; use `_all` or empty string to perform the operation on all indices - * routing: string, // Specific routing value - * timeout: time, // Explicit operation timeout - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. - * body: array, // Graph Query DSL + * index: string|array, // (REQUIRED) A comma-separated list of index names to search; use `_all` or empty string to perform the operation on all indices + * routing?: string, // Specific routing value + * timeout?: int|string, // Explicit operation timeout + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. + * body?: string|array, // Graph Query DSL. If body is a string must be a valid JSON. * } $params * * @throws MissingParameterException if a required parameter is missing @@ -52,10 +52,11 @@ class Graph extends AbstractEndpoint * * @return Elasticsearch|Promise */ - public function explore(array $params = []) + public function explore(?array $params = null) { + $params = $params ?? []; $this->checkRequiredParameters(['index'], $params); - $url = '/' . $this->encode($params['index']) . '/_graph/explore'; + $url = '/' . $this->encode($this->convertValue($params['index'])) . '/_graph/explore'; $method = empty($params['body']) ? 'GET' : 'POST'; $url = $this->addQueryString($url, $params, ['routing','timeout','pretty','human','error_trace','source','filter_path']); diff --git a/src/Endpoints/Ilm.php b/src/Endpoints/Ilm.php index 1fce30391..5882271dc 100644 --- a/src/Endpoints/Ilm.php +++ b/src/Endpoints/Ilm.php @@ -35,11 +35,11 @@ class Ilm extends AbstractEndpoint * * @param array{ * policy: string, // (REQUIRED) The name of the index lifecycle policy - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. * } $params * * @throws MissingParameterException if a required parameter is missing @@ -49,8 +49,9 @@ class Ilm extends AbstractEndpoint * * @return Elasticsearch|Promise */ - public function deleteLifecycle(array $params = []) + public function deleteLifecycle(?array $params = null) { + $params = $params ?? []; $this->checkRequiredParameters(['policy'], $params); $url = '/_ilm/policy/' . $this->encode($params['policy']); $method = 'DELETE'; @@ -72,13 +73,13 @@ public function deleteLifecycle(array $params = []) * * @param array{ * index: string, // (REQUIRED) The name of the index to explain - * only_managed: boolean, // filters the indices included in the response to ones managed by ILM - * only_errors: boolean, // filters the indices included in the response to ones in an ILM error state, implies only_managed - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. + * only_managed?: bool, // filters the indices included in the response to ones managed by ILM + * only_errors?: bool, // filters the indices included in the response to ones in an ILM error state, implies only_managed + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. * } $params * * @throws MissingParameterException if a required parameter is missing @@ -88,8 +89,9 @@ public function deleteLifecycle(array $params = []) * * @return Elasticsearch|Promise */ - public function explainLifecycle(array $params = []) + public function explainLifecycle(?array $params = null) { + $params = $params ?? []; $this->checkRequiredParameters(['index'], $params); $url = '/' . $this->encode($params['index']) . '/_ilm/explain'; $method = 'GET'; @@ -110,12 +112,12 @@ public function explainLifecycle(array $params = []) * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/ilm-get-lifecycle.html * * @param array{ - * policy: string, // The name of the index lifecycle policy - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. + * policy?: string, // The name of the index lifecycle policy + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. * } $params * * @throws NoNodeAvailableException if all the hosts are offline @@ -124,8 +126,9 @@ public function explainLifecycle(array $params = []) * * @return Elasticsearch|Promise */ - public function getLifecycle(array $params = []) + public function getLifecycle(?array $params = null) { + $params = $params ?? []; if (isset($params['policy'])) { $url = '/_ilm/policy/' . $this->encode($params['policy']); $method = 'GET'; @@ -149,11 +152,11 @@ public function getLifecycle(array $params = []) * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/ilm-get-status.html * * @param array{ - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. * } $params * * @throws NoNodeAvailableException if all the hosts are offline @@ -162,8 +165,9 @@ public function getLifecycle(array $params = []) * * @return Elasticsearch|Promise */ - public function getStatus(array $params = []) + public function getStatus(?array $params = null) { + $params = $params ?? []; $url = '/_ilm/status'; $method = 'GET'; @@ -183,13 +187,13 @@ public function getStatus(array $params = []) * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/ilm-migrate-to-data-tiers.html * * @param array{ - * dry_run: boolean, // If set to true it will simulate the migration, providing a way to retrieve the ILM policies and indices that need to be migrated. The default is false - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. - * body: array, // Optionally specify a legacy index template name to delete and optionally specify a node attribute name used for index shard routing (defaults to "data") + * dry_run?: bool, // If set to true it will simulate the migration, providing a way to retrieve the ILM policies and indices that need to be migrated. The default is false + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. + * body?: string|array, // Optionally specify a legacy index template name to delete and optionally specify a node attribute name used for index shard routing (defaults to "data"). If body is a string must be a valid JSON. * } $params * * @throws NoNodeAvailableException if all the hosts are offline @@ -198,8 +202,9 @@ public function getStatus(array $params = []) * * @return Elasticsearch|Promise */ - public function migrateToDataTiers(array $params = []) + public function migrateToDataTiers(?array $params = null) { + $params = $params ?? []; $url = '/_ilm/migrate_to_data_tiers'; $method = 'POST'; @@ -221,12 +226,12 @@ public function migrateToDataTiers(array $params = []) * * @param array{ * index: string, // (REQUIRED) The name of the index whose lifecycle step is to change - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. - * body: array, // The new lifecycle step to move to + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. + * body?: string|array, // The new lifecycle step to move to. If body is a string must be a valid JSON. * } $params * * @throws MissingParameterException if a required parameter is missing @@ -236,8 +241,9 @@ public function migrateToDataTiers(array $params = []) * * @return Elasticsearch|Promise */ - public function moveToStep(array $params = []) + public function moveToStep(?array $params = null) { + $params = $params ?? []; $this->checkRequiredParameters(['index'], $params); $url = '/_ilm/move/' . $this->encode($params['index']); $method = 'POST'; @@ -260,12 +266,12 @@ public function moveToStep(array $params = []) * * @param array{ * policy: string, // (REQUIRED) The name of the index lifecycle policy - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. - * body: array, // The lifecycle policy definition to register + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. + * body?: string|array, // The lifecycle policy definition to register. If body is a string must be a valid JSON. * } $params * * @throws MissingParameterException if a required parameter is missing @@ -275,8 +281,9 @@ public function moveToStep(array $params = []) * * @return Elasticsearch|Promise */ - public function putLifecycle(array $params = []) + public function putLifecycle(?array $params = null) { + $params = $params ?? []; $this->checkRequiredParameters(['policy'], $params); $url = '/_ilm/policy/' . $this->encode($params['policy']); $method = 'PUT'; @@ -299,11 +306,11 @@ public function putLifecycle(array $params = []) * * @param array{ * index: string, // (REQUIRED) The name of the index to remove policy on - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. * } $params * * @throws MissingParameterException if a required parameter is missing @@ -313,8 +320,9 @@ public function putLifecycle(array $params = []) * * @return Elasticsearch|Promise */ - public function removePolicy(array $params = []) + public function removePolicy(?array $params = null) { + $params = $params ?? []; $this->checkRequiredParameters(['index'], $params); $url = '/' . $this->encode($params['index']) . '/_ilm/remove'; $method = 'POST'; @@ -336,11 +344,11 @@ public function removePolicy(array $params = []) * * @param array{ * index: string, // (REQUIRED) The name of the indices (comma-separated) whose failed lifecycle step is to be retry - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. * } $params * * @throws MissingParameterException if a required parameter is missing @@ -350,8 +358,9 @@ public function removePolicy(array $params = []) * * @return Elasticsearch|Promise */ - public function retry(array $params = []) + public function retry(?array $params = null) { + $params = $params ?? []; $this->checkRequiredParameters(['index'], $params); $url = '/' . $this->encode($params['index']) . '/_ilm/retry'; $method = 'POST'; @@ -372,11 +381,11 @@ public function retry(array $params = []) * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/ilm-start.html * * @param array{ - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. * } $params * * @throws NoNodeAvailableException if all the hosts are offline @@ -385,8 +394,9 @@ public function retry(array $params = []) * * @return Elasticsearch|Promise */ - public function start(array $params = []) + public function start(?array $params = null) { + $params = $params ?? []; $url = '/_ilm/start'; $method = 'POST'; @@ -406,11 +416,11 @@ public function start(array $params = []) * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/ilm-stop.html * * @param array{ - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. * } $params * * @throws NoNodeAvailableException if all the hosts are offline @@ -419,8 +429,9 @@ public function start(array $params = []) * * @return Elasticsearch|Promise */ - public function stop(array $params = []) + public function stop(?array $params = null) { + $params = $params ?? []; $url = '/_ilm/stop'; $method = 'POST'; diff --git a/src/Endpoints/Indices.php b/src/Endpoints/Indices.php index 9ab3c7df0..90da135e8 100644 --- a/src/Endpoints/Indices.php +++ b/src/Endpoints/Indices.php @@ -34,18 +34,18 @@ class Indices extends AbstractEndpoint * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/index-modules-blocks.html * * @param array{ - * index: list, // (REQUIRED) A comma separated list of indices to add a block to + * index: string|array, // (REQUIRED) A comma separated list of indices to add a block to * block: string, // (REQUIRED) The block to add (one of read, write, read_only or metadata) - * timeout: time, // Explicit operation timeout - * master_timeout: time, // Specify timeout for connection to master - * ignore_unavailable: boolean, // Whether specified concrete indices should be ignored when unavailable (missing or closed) - * allow_no_indices: boolean, // Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes `_all` string or when no indices have been specified) - * expand_wildcards: enum, // Whether to expand wildcard expression to concrete indices that are open, closed or both. - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. + * timeout?: int|string, // Explicit operation timeout + * master_timeout?: int|string, // Specify timeout for connection to master + * ignore_unavailable?: bool, // Whether specified concrete indices should be ignored when unavailable (missing or closed) + * allow_no_indices?: bool, // Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes `_all` string or when no indices have been specified) + * expand_wildcards?: string, // Whether to expand wildcard expression to concrete indices that are open, closed or both. + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. * } $params * * @throws MissingParameterException if a required parameter is missing @@ -55,10 +55,11 @@ class Indices extends AbstractEndpoint * * @return Elasticsearch|Promise */ - public function addBlock(array $params = []) + public function addBlock(?array $params = null) { + $params = $params ?? []; $this->checkRequiredParameters(['index','block'], $params); - $url = '/' . $this->encode($params['index']) . '/_block/' . $this->encode($params['block']); + $url = '/' . $this->encode($this->convertValue($params['index'])) . '/_block/' . $this->encode($params['block']); $method = 'PUT'; $url = $this->addQueryString($url, $params, ['timeout','master_timeout','ignore_unavailable','allow_no_indices','expand_wildcards','pretty','human','error_trace','source','filter_path']); @@ -77,13 +78,13 @@ public function addBlock(array $params = []) * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-analyze.html * * @param array{ - * index: string, // The name of the index to scope the operation - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. - * body: array, // Define analyzer/tokenizer parameters and the text on which the analysis should be performed + * index?: string, // The name of the index to scope the operation + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. + * body?: string|array, // Define analyzer/tokenizer parameters and the text on which the analysis should be performed. If body is a string must be a valid JSON. * } $params * * @throws NoNodeAvailableException if all the hosts are offline @@ -92,8 +93,9 @@ public function addBlock(array $params = []) * * @return Elasticsearch|Promise */ - public function analyze(array $params = []) + public function analyze(?array $params = null) { + $params = $params ?? []; if (isset($params['index'])) { $url = '/' . $this->encode($params['index']) . '/_analyze'; $method = empty($params['body']) ? 'GET' : 'POST'; @@ -118,19 +120,19 @@ public function analyze(array $params = []) * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-clearcache.html * * @param array{ - * index: list, // A comma-separated list of index name to limit the operation - * fielddata: boolean, // Clear field data - * fields: list, // A comma-separated list of fields to clear when using the `fielddata` parameter (default: all) - * query: boolean, // Clear query caches - * ignore_unavailable: boolean, // Whether specified concrete indices should be ignored when unavailable (missing or closed) - * allow_no_indices: boolean, // Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes `_all` string or when no indices have been specified) - * expand_wildcards: enum, // Whether to expand wildcard expression to concrete indices that are open, closed or both. - * request: boolean, // Clear request cache - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. + * index?: string|array, // A comma-separated list of index name to limit the operation + * fielddata?: bool, // Clear field data + * fields?: string|array, // A comma-separated list of fields to clear when using the `fielddata` parameter (default: all) + * query?: bool, // Clear query caches + * ignore_unavailable?: bool, // Whether specified concrete indices should be ignored when unavailable (missing or closed) + * allow_no_indices?: bool, // Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes `_all` string or when no indices have been specified) + * expand_wildcards?: string, // Whether to expand wildcard expression to concrete indices that are open, closed or both. + * request?: bool, // Clear request cache + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. * } $params * * @throws NoNodeAvailableException if all the hosts are offline @@ -139,10 +141,11 @@ public function analyze(array $params = []) * * @return Elasticsearch|Promise */ - public function clearCache(array $params = []) + public function clearCache(?array $params = null) { + $params = $params ?? []; if (isset($params['index'])) { - $url = '/' . $this->encode($params['index']) . '/_cache/clear'; + $url = '/' . $this->encode($this->convertValue($params['index'])) . '/_cache/clear'; $method = 'POST'; } else { $url = '/_cache/clear'; @@ -166,15 +169,15 @@ public function clearCache(array $params = []) * @param array{ * index: string, // (REQUIRED) The name of the source index to clone * target: string, // (REQUIRED) The name of the target index to clone into - * timeout: time, // Explicit operation timeout - * master_timeout: time, // Specify timeout for connection to master - * wait_for_active_shards: string, // Set the number of active shards to wait for on the cloned index before the operation returns. - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. - * body: array, // The configuration for the target index (`settings` and `aliases`) + * timeout?: int|string, // Explicit operation timeout + * master_timeout?: int|string, // Specify timeout for connection to master + * wait_for_active_shards?: string, // Set the number of active shards to wait for on the cloned index before the operation returns. + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. + * body?: string|array, // The configuration for the target index (`settings` and `aliases`). If body is a string must be a valid JSON. * } $params * * @throws MissingParameterException if a required parameter is missing @@ -184,8 +187,9 @@ public function clearCache(array $params = []) * * @return Elasticsearch|Promise */ - public function clone(array $params = []) + public function clone(?array $params = null) { + $params = $params ?? []; $this->checkRequiredParameters(['index','target'], $params); $url = '/' . $this->encode($params['index']) . '/_clone/' . $this->encode($params['target']); $method = 'PUT'; @@ -207,18 +211,18 @@ public function clone(array $params = []) * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-open-close.html * * @param array{ - * index: list, // (REQUIRED) A comma separated list of indices to close - * timeout: time, // Explicit operation timeout - * master_timeout: time, // Specify timeout for connection to master - * ignore_unavailable: boolean, // Whether specified concrete indices should be ignored when unavailable (missing or closed) - * allow_no_indices: boolean, // Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes `_all` string or when no indices have been specified) - * expand_wildcards: enum, // Whether to expand wildcard expression to concrete indices that are open, closed or both. - * wait_for_active_shards: string, // Sets the number of active shards to wait for before the operation returns. - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. + * index: string|array, // (REQUIRED) A comma separated list of indices to close + * timeout?: int|string, // Explicit operation timeout + * master_timeout?: int|string, // Specify timeout for connection to master + * ignore_unavailable?: bool, // Whether specified concrete indices should be ignored when unavailable (missing or closed) + * allow_no_indices?: bool, // Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes `_all` string or when no indices have been specified) + * expand_wildcards?: string, // Whether to expand wildcard expression to concrete indices that are open, closed or both. + * wait_for_active_shards?: string, // Sets the number of active shards to wait for before the operation returns. + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. * } $params * * @throws MissingParameterException if a required parameter is missing @@ -228,10 +232,11 @@ public function clone(array $params = []) * * @return Elasticsearch|Promise */ - public function close(array $params = []) + public function close(?array $params = null) { + $params = $params ?? []; $this->checkRequiredParameters(['index'], $params); - $url = '/' . $this->encode($params['index']) . '/_close'; + $url = '/' . $this->encode($this->convertValue($params['index'])) . '/_close'; $method = 'POST'; $url = $this->addQueryString($url, $params, ['timeout','master_timeout','ignore_unavailable','allow_no_indices','expand_wildcards','wait_for_active_shards','pretty','human','error_trace','source','filter_path']); @@ -251,15 +256,15 @@ public function close(array $params = []) * * @param array{ * index: string, // (REQUIRED) The name of the index - * wait_for_active_shards: string, // Set the number of active shards to wait for before the operation returns. - * timeout: time, // Explicit operation timeout - * master_timeout: time, // Specify timeout for connection to master - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. - * body: array, // The configuration for the index (`settings` and `mappings`) + * wait_for_active_shards?: string, // Set the number of active shards to wait for before the operation returns. + * timeout?: int|string, // Explicit operation timeout + * master_timeout?: int|string, // Specify timeout for connection to master + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. + * body?: string|array, // The configuration for the index (`settings` and `mappings`). If body is a string must be a valid JSON. * } $params * * @throws MissingParameterException if a required parameter is missing @@ -269,8 +274,9 @@ public function close(array $params = []) * * @return Elasticsearch|Promise */ - public function create(array $params = []) + public function create(?array $params = null) { + $params = $params ?? []; $this->checkRequiredParameters(['index'], $params); $url = '/' . $this->encode($params['index']); $method = 'PUT'; @@ -293,11 +299,13 @@ public function create(array $params = []) * * @param array{ * name: string, // (REQUIRED) The name of the data stream - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. + * timeout?: int|string, // Specify timeout for acknowledging the cluster state update + * master_timeout?: int|string, // Specify timeout for connection to master + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. * } $params * * @throws MissingParameterException if a required parameter is missing @@ -307,13 +315,14 @@ public function create(array $params = []) * * @return Elasticsearch|Promise */ - public function createDataStream(array $params = []) + public function createDataStream(?array $params = null) { + $params = $params ?? []; $this->checkRequiredParameters(['name'], $params); $url = '/_data_stream/' . $this->encode($params['name']); $method = 'PUT'; - $url = $this->addQueryString($url, $params, ['pretty','human','error_trace','source','filter_path']); + $url = $this->addQueryString($url, $params, ['timeout','master_timeout','pretty','human','error_trace','source','filter_path']); $headers = [ 'Accept' => 'application/json', ]; @@ -329,12 +338,12 @@ public function createDataStream(array $params = []) * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/data-streams.html * * @param array{ - * name: list, // A comma-separated list of data stream names; use `_all` or empty string to perform the operation on all data streams - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. + * name?: string|array, // A comma-separated list of data stream names; use `_all` or empty string to perform the operation on all data streams + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. * } $params * * @throws NoNodeAvailableException if all the hosts are offline @@ -343,10 +352,11 @@ public function createDataStream(array $params = []) * * @return Elasticsearch|Promise */ - public function dataStreamsStats(array $params = []) + public function dataStreamsStats(?array $params = null) { + $params = $params ?? []; if (isset($params['name'])) { - $url = '/_data_stream/' . $this->encode($params['name']) . '/_stats'; + $url = '/_data_stream/' . $this->encode($this->convertValue($params['name'])) . '/_stats'; $method = 'GET'; } else { $url = '/_data_stream/_stats'; @@ -368,17 +378,17 @@ public function dataStreamsStats(array $params = []) * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-delete-index.html * * @param array{ - * index: list, // (REQUIRED) A comma-separated list of indices to delete; use `_all` or `*` string to delete all indices - * timeout: time, // Explicit operation timeout - * master_timeout: time, // Specify timeout for connection to master - * ignore_unavailable: boolean, // Ignore unavailable indexes (default: false) - * allow_no_indices: boolean, // Ignore if a wildcard expression resolves to no concrete indices (default: false) - * expand_wildcards: enum, // Whether wildcard expressions should get expanded to open, closed, or hidden indices - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. + * index: string|array, // (REQUIRED) A comma-separated list of indices to delete; use `_all` or `*` string to delete all indices + * timeout?: int|string, // Explicit operation timeout + * master_timeout?: int|string, // Specify timeout for connection to master + * ignore_unavailable?: bool, // Ignore unavailable indexes (default: false) + * allow_no_indices?: bool, // Ignore if a wildcard expression resolves to no concrete indices (default: false) + * expand_wildcards?: string, // Whether wildcard expressions should get expanded to open, closed, or hidden indices + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. * } $params * * @throws MissingParameterException if a required parameter is missing @@ -388,10 +398,11 @@ public function dataStreamsStats(array $params = []) * * @return Elasticsearch|Promise */ - public function delete(array $params = []) + public function delete(?array $params = null) { + $params = $params ?? []; $this->checkRequiredParameters(['index'], $params); - $url = '/' . $this->encode($params['index']); + $url = '/' . $this->encode($this->convertValue($params['index'])); $method = 'DELETE'; $url = $this->addQueryString($url, $params, ['timeout','master_timeout','ignore_unavailable','allow_no_indices','expand_wildcards','pretty','human','error_trace','source','filter_path']); @@ -410,15 +421,15 @@ public function delete(array $params = []) * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-aliases.html * * @param array{ - * index: list, // (REQUIRED) A comma-separated list of index names (supports wildcards); use `_all` for all indices - * name: list, // (REQUIRED) A comma-separated list of aliases to delete (supports wildcards); use `_all` to delete all aliases for the specified indices. - * timeout: time, // Explicit timestamp for the document - * master_timeout: time, // Specify timeout for connection to master - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. + * index: string|array, // (REQUIRED) A comma-separated list of index names (supports wildcards); use `_all` for all indices + * name: string|array, // (REQUIRED) A comma-separated list of aliases to delete (supports wildcards); use `_all` to delete all aliases for the specified indices. + * timeout?: int|string, // Explicit timestamp for the document + * master_timeout?: int|string, // Specify timeout for connection to master + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. * } $params * * @throws MissingParameterException if a required parameter is missing @@ -428,10 +439,11 @@ public function delete(array $params = []) * * @return Elasticsearch|Promise */ - public function deleteAlias(array $params = []) + public function deleteAlias(?array $params = null) { + $params = $params ?? []; $this->checkRequiredParameters(['index','name'], $params); - $url = '/' . $this->encode($params['index']) . '/_alias/' . $this->encode($params['name']); + $url = '/' . $this->encode($this->convertValue($params['index'])) . '/_alias/' . $this->encode($this->convertValue($params['name'])); $method = 'DELETE'; $url = $this->addQueryString($url, $params, ['timeout','master_timeout','pretty','human','error_trace','source','filter_path']); @@ -448,18 +460,17 @@ public function deleteAlias(array $params = []) * Deletes the data stream lifecycle of the selected data streams. * * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/data-streams-delete-lifecycle.html - * @internal This API is EXPERIMENTAL and may be changed or removed completely in a future release * * @param array{ - * name: list, // (REQUIRED) A comma-separated list of data streams of which the data stream lifecycle will be deleted; use `*` to get all data streams - * expand_wildcards: enum, // Whether wildcard expressions should get expanded to open or closed indices (default: open) - * timeout: time, // Explicit timestamp for the document - * master_timeout: time, // Specify timeout for connection to master - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. + * name: string|array, // (REQUIRED) A comma-separated list of data streams of which the data stream lifecycle will be deleted; use `*` to get all data streams + * expand_wildcards?: string, // Whether wildcard expressions should get expanded to open or closed indices (default: open) + * timeout?: int|string, // Explicit timestamp for the document + * master_timeout?: int|string, // Specify timeout for connection to master + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. * } $params * * @throws MissingParameterException if a required parameter is missing @@ -469,10 +480,11 @@ public function deleteAlias(array $params = []) * * @return Elasticsearch|Promise */ - public function deleteDataLifecycle(array $params = []) + public function deleteDataLifecycle(?array $params = null) { + $params = $params ?? []; $this->checkRequiredParameters(['name'], $params); - $url = '/_data_stream/' . $this->encode($params['name']) . '/_lifecycle'; + $url = '/_data_stream/' . $this->encode($this->convertValue($params['name'])) . '/_lifecycle'; $method = 'DELETE'; $url = $this->addQueryString($url, $params, ['expand_wildcards','timeout','master_timeout','pretty','human','error_trace','source','filter_path']); @@ -491,13 +503,14 @@ public function deleteDataLifecycle(array $params = []) * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/data-streams.html * * @param array{ - * name: list, // (REQUIRED) A comma-separated list of data streams to delete; use `*` to delete all data streams - * expand_wildcards: enum, // Whether wildcard expressions should get expanded to open or closed indices (default: open) - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. + * name: string|array, // (REQUIRED) A comma-separated list of data streams to delete; use `*` to delete all data streams + * expand_wildcards?: string, // Whether wildcard expressions should get expanded to open or closed indices (default: open) + * master_timeout?: int|string, // Specify timeout for connection to master + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. * } $params * * @throws MissingParameterException if a required parameter is missing @@ -507,13 +520,14 @@ public function deleteDataLifecycle(array $params = []) * * @return Elasticsearch|Promise */ - public function deleteDataStream(array $params = []) + public function deleteDataStream(?array $params = null) { + $params = $params ?? []; $this->checkRequiredParameters(['name'], $params); - $url = '/_data_stream/' . $this->encode($params['name']); + $url = '/_data_stream/' . $this->encode($this->convertValue($params['name'])); $method = 'DELETE'; - $url = $this->addQueryString($url, $params, ['expand_wildcards','pretty','human','error_trace','source','filter_path']); + $url = $this->addQueryString($url, $params, ['expand_wildcards','master_timeout','pretty','human','error_trace','source','filter_path']); $headers = [ 'Accept' => 'application/json', ]; @@ -530,13 +544,13 @@ public function deleteDataStream(array $params = []) * * @param array{ * name: string, // (REQUIRED) The name of the template - * timeout: time, // Explicit operation timeout - * master_timeout: time, // Specify timeout for connection to master - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. + * timeout?: int|string, // Explicit operation timeout + * master_timeout?: int|string, // Specify timeout for connection to master + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. * } $params * * @throws MissingParameterException if a required parameter is missing @@ -546,8 +560,9 @@ public function deleteDataStream(array $params = []) * * @return Elasticsearch|Promise */ - public function deleteIndexTemplate(array $params = []) + public function deleteIndexTemplate(?array $params = null) { + $params = $params ?? []; $this->checkRequiredParameters(['name'], $params); $url = '/_index_template/' . $this->encode($params['name']); $method = 'DELETE'; @@ -569,13 +584,13 @@ public function deleteIndexTemplate(array $params = []) * * @param array{ * name: string, // (REQUIRED) The name of the template - * timeout: time, // Explicit operation timeout - * master_timeout: time, // Specify timeout for connection to master - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. + * timeout?: int|string, // Explicit operation timeout + * master_timeout?: int|string, // Specify timeout for connection to master + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. * } $params * * @throws MissingParameterException if a required parameter is missing @@ -585,8 +600,9 @@ public function deleteIndexTemplate(array $params = []) * * @return Elasticsearch|Promise */ - public function deleteTemplate(array $params = []) + public function deleteTemplate(?array $params = null) { + $params = $params ?? []; $this->checkRequiredParameters(['name'], $params); $url = '/_template/' . $this->encode($params['name']); $method = 'DELETE'; @@ -609,16 +625,16 @@ public function deleteTemplate(array $params = []) * * @param array{ * index: string, // (REQUIRED) Comma-separated list of indices or data streams to analyze the disk usage - * run_expensive_tasks: boolean, // Must be set to [true] in order for the task to be performed. Defaults to false. - * flush: boolean, // Whether flush or not before analyzing the index disk usage. Defaults to true - * ignore_unavailable: boolean, // Whether specified concrete indices should be ignored when unavailable (missing or closed) - * allow_no_indices: boolean, // Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes `_all` string or when no indices have been specified) - * expand_wildcards: enum, // Whether to expand wildcard expression to concrete indices that are open, closed or both. - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. + * run_expensive_tasks?: bool, // Must be set to [true] in order for the task to be performed. Defaults to false. + * flush?: bool, // Whether flush or not before analyzing the index disk usage. Defaults to true + * ignore_unavailable?: bool, // Whether specified concrete indices should be ignored when unavailable (missing or closed) + * allow_no_indices?: bool, // Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes `_all` string or when no indices have been specified) + * expand_wildcards?: string, // Whether to expand wildcard expression to concrete indices that are open, closed or both. + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. * } $params * * @throws MissingParameterException if a required parameter is missing @@ -628,8 +644,9 @@ public function deleteTemplate(array $params = []) * * @return Elasticsearch|Promise */ - public function diskUsage(array $params = []) + public function diskUsage(?array $params = null) { + $params = $params ?? []; $this->checkRequiredParameters(['index'], $params); $url = '/' . $this->encode($params['index']) . '/_disk_usage'; $method = 'POST'; @@ -653,12 +670,12 @@ public function diskUsage(array $params = []) * @param array{ * index: string, // (REQUIRED) The index to downsample * target_index: string, // (REQUIRED) The name of the target index to store downsampled data - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. - * body: array, // (REQUIRED) The downsampling configuration + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. + * body: string|array, // (REQUIRED) The downsampling configuration. If body is a string must be a valid JSON. * } $params * * @throws MissingParameterException if a required parameter is missing @@ -668,8 +685,9 @@ public function diskUsage(array $params = []) * * @return Elasticsearch|Promise */ - public function downsample(array $params = []) + public function downsample(?array $params = null) { + $params = $params ?? []; $this->checkRequiredParameters(['index','target_index','body'], $params); $url = '/' . $this->encode($params['index']) . '/_downsample/' . $this->encode($params['target_index']); $method = 'POST'; @@ -691,18 +709,18 @@ public function downsample(array $params = []) * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-exists.html * * @param array{ - * index: list, // (REQUIRED) A comma-separated list of index names - * local: boolean, // Return local information, do not retrieve the state from master node (default: false) - * ignore_unavailable: boolean, // Ignore unavailable indexes (default: false) - * allow_no_indices: boolean, // Ignore if a wildcard expression resolves to no concrete indices (default: false) - * expand_wildcards: enum, // Whether wildcard expressions should get expanded to open or closed indices (default: open) - * flat_settings: boolean, // Return settings in flat format (default: false) - * include_defaults: boolean, // Whether to return all default setting for each of the indices. - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. + * index: string|array, // (REQUIRED) A comma-separated list of index names + * local?: bool, // Return local information, do not retrieve the state from master node (default: false) + * ignore_unavailable?: bool, // Ignore unavailable indexes (default: false) + * allow_no_indices?: bool, // Ignore if a wildcard expression resolves to no concrete indices (default: false) + * expand_wildcards?: string, // Whether wildcard expressions should get expanded to open or closed indices (default: open) + * flat_settings?: bool, // Return settings in flat format (default: false) + * include_defaults?: bool, // Whether to return all default setting for each of the indices. + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. * } $params * * @throws MissingParameterException if a required parameter is missing @@ -712,10 +730,11 @@ public function downsample(array $params = []) * * @return Elasticsearch|Promise */ - public function exists(array $params = []) + public function exists(?array $params = null) { + $params = $params ?? []; $this->checkRequiredParameters(['index'], $params); - $url = '/' . $this->encode($params['index']); + $url = '/' . $this->encode($this->convertValue($params['index'])); $method = 'HEAD'; $url = $this->addQueryString($url, $params, ['local','ignore_unavailable','allow_no_indices','expand_wildcards','flat_settings','include_defaults','pretty','human','error_trace','source','filter_path']); @@ -734,17 +753,17 @@ public function exists(array $params = []) * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-aliases.html * * @param array{ - * name: list, // (REQUIRED) A comma-separated list of alias names to return - * index: list, // A comma-separated list of index names to filter aliases - * ignore_unavailable: boolean, // Whether specified concrete indices should be ignored when unavailable (missing or closed) - * allow_no_indices: boolean, // Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes `_all` string or when no indices have been specified) - * expand_wildcards: enum, // Whether to expand wildcard expression to concrete indices that are open, closed or both. - * local: boolean, // Return local information, do not retrieve the state from master node (default: false) - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. + * name: string|array, // (REQUIRED) A comma-separated list of alias names to return + * index?: string|array, // A comma-separated list of index names to filter aliases + * ignore_unavailable?: bool, // Whether specified concrete indices should be ignored when unavailable (missing or closed) + * allow_no_indices?: bool, // Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes `_all` string or when no indices have been specified) + * expand_wildcards?: string, // Whether to expand wildcard expression to concrete indices that are open, closed or both. + * local?: bool, // Return local information, do not retrieve the state from master node (default: false) + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. * } $params * * @throws MissingParameterException if a required parameter is missing @@ -754,14 +773,15 @@ public function exists(array $params = []) * * @return Elasticsearch|Promise */ - public function existsAlias(array $params = []) + public function existsAlias(?array $params = null) { + $params = $params ?? []; $this->checkRequiredParameters(['name'], $params); if (isset($params['index'])) { - $url = '/' . $this->encode($params['index']) . '/_alias/' . $this->encode($params['name']); + $url = '/' . $this->encode($this->convertValue($params['index'])) . '/_alias/' . $this->encode($this->convertValue($params['name'])); $method = 'HEAD'; } else { - $url = '/_alias/' . $this->encode($params['name']); + $url = '/_alias/' . $this->encode($this->convertValue($params['name'])); $method = 'HEAD'; } $url = $this->addQueryString($url, $params, ['ignore_unavailable','allow_no_indices','expand_wildcards','local','pretty','human','error_trace','source','filter_path']); @@ -781,14 +801,14 @@ public function existsAlias(array $params = []) * * @param array{ * name: string, // (REQUIRED) The name of the template - * flat_settings: boolean, // Return settings in flat format (default: false) - * master_timeout: time, // Explicit operation timeout for connection to master node - * local: boolean, // Return local information, do not retrieve the state from master node (default: false) - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. + * flat_settings?: bool, // Return settings in flat format (default: false) + * master_timeout?: int|string, // Explicit operation timeout for connection to master node + * local?: bool, // Return local information, do not retrieve the state from master node (default: false) + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. * } $params * * @throws MissingParameterException if a required parameter is missing @@ -798,8 +818,9 @@ public function existsAlias(array $params = []) * * @return Elasticsearch|Promise */ - public function existsIndexTemplate(array $params = []) + public function existsIndexTemplate(?array $params = null) { + $params = $params ?? []; $this->checkRequiredParameters(['name'], $params); $url = '/_index_template/' . $this->encode($params['name']); $method = 'HEAD'; @@ -820,15 +841,15 @@ public function existsIndexTemplate(array $params = []) * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-template-exists-v1.html * * @param array{ - * name: list, // (REQUIRED) The comma separated names of the index templates - * flat_settings: boolean, // Return settings in flat format (default: false) - * master_timeout: time, // Explicit operation timeout for connection to master node - * local: boolean, // Return local information, do not retrieve the state from master node (default: false) - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. + * name: string|array, // (REQUIRED) The comma separated names of the index templates + * flat_settings?: bool, // Return settings in flat format (default: false) + * master_timeout?: int|string, // Explicit operation timeout for connection to master node + * local?: bool, // Return local information, do not retrieve the state from master node (default: false) + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. * } $params * * @throws MissingParameterException if a required parameter is missing @@ -838,10 +859,11 @@ public function existsIndexTemplate(array $params = []) * * @return Elasticsearch|Promise */ - public function existsTemplate(array $params = []) + public function existsTemplate(?array $params = null) { + $params = $params ?? []; $this->checkRequiredParameters(['name'], $params); - $url = '/_template/' . $this->encode($params['name']); + $url = '/_template/' . $this->encode($this->convertValue($params['name'])); $method = 'HEAD'; $url = $this->addQueryString($url, $params, ['flat_settings','master_timeout','local','pretty','human','error_trace','source','filter_path']); @@ -858,17 +880,16 @@ public function existsTemplate(array $params = []) * Retrieves information about the index's current data stream lifecycle, such as any potential encountered error, time since creation etc. * * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/data-streams-explain-lifecycle.html - * @internal This API is EXPERIMENTAL and may be changed or removed completely in a future release * * @param array{ * index: string, // (REQUIRED) The name of the index to explain - * include_defaults: boolean, // indicates if the API should return the default values the system uses for the index's lifecycle - * master_timeout: time, // Specify timeout for connection to master - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. + * include_defaults?: bool, // indicates if the API should return the default values the system uses for the index's lifecycle + * master_timeout?: int|string, // Specify timeout for connection to master + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. * } $params * * @throws MissingParameterException if a required parameter is missing @@ -878,8 +899,9 @@ public function existsTemplate(array $params = []) * * @return Elasticsearch|Promise */ - public function explainDataLifecycle(array $params = []) + public function explainDataLifecycle(?array $params = null) { + $params = $params ?? []; $this->checkRequiredParameters(['index'], $params); $url = '/' . $this->encode($params['index']) . '/_lifecycle/explain'; $method = 'GET'; @@ -902,15 +924,15 @@ public function explainDataLifecycle(array $params = []) * * @param array{ * index: string, // (REQUIRED) A comma-separated list of index names; use `_all` or empty string to perform the operation on all indices - * fields: list, // A comma-separated list of fields to include in the stats if only a subset of fields should be returned (supports wildcards) - * ignore_unavailable: boolean, // Whether specified concrete indices should be ignored when unavailable (missing or closed) - * allow_no_indices: boolean, // Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes `_all` string or when no indices have been specified) - * expand_wildcards: enum, // Whether to expand wildcard expression to concrete indices that are open, closed or both. - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. + * fields?: string|array, // A comma-separated list of fields to include in the stats if only a subset of fields should be returned (supports wildcards) + * ignore_unavailable?: bool, // Whether specified concrete indices should be ignored when unavailable (missing or closed) + * allow_no_indices?: bool, // Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes `_all` string or when no indices have been specified) + * expand_wildcards?: string, // Whether to expand wildcard expression to concrete indices that are open, closed or both. + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. * } $params * * @throws MissingParameterException if a required parameter is missing @@ -920,8 +942,9 @@ public function explainDataLifecycle(array $params = []) * * @return Elasticsearch|Promise */ - public function fieldUsageStats(array $params = []) + public function fieldUsageStats(?array $params = null) { + $params = $params ?? []; $this->checkRequiredParameters(['index'], $params); $url = '/' . $this->encode($params['index']) . '/_field_usage_stats'; $method = 'GET'; @@ -942,17 +965,17 @@ public function fieldUsageStats(array $params = []) * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-flush.html * * @param array{ - * index: list, // A comma-separated list of index names; use `_all` or empty string for all indices - * force: boolean, // Whether a flush should be forced even if it is not necessarily needed ie. if no changes will be committed to the index. This is useful if transaction log IDs should be incremented even if no uncommitted changes are present. (This setting can be considered as internal) - * wait_if_ongoing: boolean, // If set to true the flush operation will block until the flush can be executed if another flush operation is already executing. The default is true. If set to false the flush will be skipped iff if another flush operation is already running. - * ignore_unavailable: boolean, // Whether specified concrete indices should be ignored when unavailable (missing or closed) - * allow_no_indices: boolean, // Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes `_all` string or when no indices have been specified) - * expand_wildcards: enum, // Whether to expand wildcard expression to concrete indices that are open, closed or both. - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. + * index?: string|array, // A comma-separated list of index names; use `_all` or empty string for all indices + * force?: bool, // Whether a flush should be forced even if it is not necessarily needed ie. if no changes will be committed to the index. This is useful if transaction log IDs should be incremented even if no uncommitted changes are present. (This setting can be considered as internal) + * wait_if_ongoing?: bool, // If set to true the flush operation will block until the flush can be executed if another flush operation is already executing. The default is true. If set to false the flush will be skipped iff if another flush operation is already running. + * ignore_unavailable?: bool, // Whether specified concrete indices should be ignored when unavailable (missing or closed) + * allow_no_indices?: bool, // Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes `_all` string or when no indices have been specified) + * expand_wildcards?: string, // Whether to expand wildcard expression to concrete indices that are open, closed or both. + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. * } $params * * @throws NoNodeAvailableException if all the hosts are offline @@ -961,14 +984,15 @@ public function fieldUsageStats(array $params = []) * * @return Elasticsearch|Promise */ - public function flush(array $params = []) + public function flush(?array $params = null) { + $params = $params ?? []; if (isset($params['index'])) { - $url = '/' . $this->encode($params['index']) . '/_flush'; - $method = empty($params['body']) ? 'GET' : 'POST'; + $url = '/' . $this->encode($this->convertValue($params['index'])) . '/_flush'; + $method = 'POST'; } else { $url = '/_flush'; - $method = empty($params['body']) ? 'GET' : 'POST'; + $method = 'POST'; } $url = $this->addQueryString($url, $params, ['force','wait_if_ongoing','ignore_unavailable','allow_no_indices','expand_wildcards','pretty','human','error_trace','source','filter_path']); $headers = [ @@ -986,19 +1010,19 @@ public function flush(array $params = []) * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-forcemerge.html * * @param array{ - * index: list, // A comma-separated list of index names; use `_all` or empty string to perform the operation on all indices - * flush: boolean, // Specify whether the index should be flushed after performing the operation (default: true) - * ignore_unavailable: boolean, // Whether specified concrete indices should be ignored when unavailable (missing or closed) - * allow_no_indices: boolean, // Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes `_all` string or when no indices have been specified) - * expand_wildcards: enum, // Whether to expand wildcard expression to concrete indices that are open, closed or both. - * max_num_segments: number, // The number of segments the index should be merged into (default: dynamic) - * only_expunge_deletes: boolean, // Specify whether the operation should only expunge deleted documents - * wait_for_completion: boolean, // Should the request wait until the force merge is completed. - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. + * index?: string|array, // A comma-separated list of index names; use `_all` or empty string to perform the operation on all indices + * flush?: bool, // Specify whether the index should be flushed after performing the operation (default: true) + * ignore_unavailable?: bool, // Whether specified concrete indices should be ignored when unavailable (missing or closed) + * allow_no_indices?: bool, // Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes `_all` string or when no indices have been specified) + * expand_wildcards?: string, // Whether to expand wildcard expression to concrete indices that are open, closed or both. + * max_num_segments?: int, // The number of segments the index should be merged into (default: dynamic) + * only_expunge_deletes?: bool, // Specify whether the operation should only expunge deleted documents + * wait_for_completion?: bool, // Should the request wait until the force merge is completed. + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. * } $params * * @throws NoNodeAvailableException if all the hosts are offline @@ -1007,10 +1031,11 @@ public function flush(array $params = []) * * @return Elasticsearch|Promise */ - public function forcemerge(array $params = []) + public function forcemerge(?array $params = null) { + $params = $params ?? []; if (isset($params['index'])) { - $url = '/' . $this->encode($params['index']) . '/_forcemerge'; + $url = '/' . $this->encode($this->convertValue($params['index'])) . '/_forcemerge'; $method = 'POST'; } else { $url = '/_forcemerge'; @@ -1032,20 +1057,20 @@ public function forcemerge(array $params = []) * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-get-index.html * * @param array{ - * index: list, // (REQUIRED) A comma-separated list of index names - * local: boolean, // Return local information, do not retrieve the state from master node (default: false) - * ignore_unavailable: boolean, // Ignore unavailable indexes (default: false) - * allow_no_indices: boolean, // Ignore if a wildcard expression resolves to no concrete indices (default: false) - * expand_wildcards: enum, // Whether wildcard expressions should get expanded to open or closed indices (default: open) - * features: enum, // Return only information on specified index features - * flat_settings: boolean, // Return settings in flat format (default: false) - * include_defaults: boolean, // Whether to return all default setting for each of the indices. - * master_timeout: time, // Specify timeout for connection to master - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. + * index: string|array, // (REQUIRED) A comma-separated list of index names + * local?: bool, // Return local information, do not retrieve the state from master node (default: false) + * ignore_unavailable?: bool, // Ignore unavailable indexes (default: false) + * allow_no_indices?: bool, // Ignore if a wildcard expression resolves to no concrete indices (default: false) + * expand_wildcards?: string, // Whether wildcard expressions should get expanded to open or closed indices (default: open) + * features?: string, // Return only information on specified index features + * flat_settings?: bool, // Return settings in flat format (default: false) + * include_defaults?: bool, // Whether to return all default setting for each of the indices. + * master_timeout?: int|string, // Specify timeout for connection to master + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. * } $params * * @throws MissingParameterException if a required parameter is missing @@ -1055,10 +1080,11 @@ public function forcemerge(array $params = []) * * @return Elasticsearch|Promise */ - public function get(array $params = []) + public function get(?array $params = null) { + $params = $params ?? []; $this->checkRequiredParameters(['index'], $params); - $url = '/' . $this->encode($params['index']); + $url = '/' . $this->encode($this->convertValue($params['index'])); $method = 'GET'; $url = $this->addQueryString($url, $params, ['local','ignore_unavailable','allow_no_indices','expand_wildcards','features','flat_settings','include_defaults','master_timeout','pretty','human','error_trace','source','filter_path']); @@ -1077,17 +1103,17 @@ public function get(array $params = []) * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-aliases.html * * @param array{ - * name: list, // A comma-separated list of alias names to return - * index: list, // A comma-separated list of index names to filter aliases - * ignore_unavailable: boolean, // Whether specified concrete indices should be ignored when unavailable (missing or closed) - * allow_no_indices: boolean, // Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes `_all` string or when no indices have been specified) - * expand_wildcards: enum, // Whether to expand wildcard expression to concrete indices that are open, closed or both. - * local: boolean, // Return local information, do not retrieve the state from master node (default: false) - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. + * name?: string|array, // A comma-separated list of alias names to return + * index?: string|array, // A comma-separated list of index names to filter aliases + * ignore_unavailable?: bool, // Whether specified concrete indices should be ignored when unavailable (missing or closed) + * allow_no_indices?: bool, // Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes `_all` string or when no indices have been specified) + * expand_wildcards?: string, // Whether to expand wildcard expression to concrete indices that are open, closed or both. + * local?: bool, // Return local information, do not retrieve the state from master node (default: false) + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. * } $params * * @throws NoNodeAvailableException if all the hosts are offline @@ -1096,16 +1122,17 @@ public function get(array $params = []) * * @return Elasticsearch|Promise */ - public function getAlias(array $params = []) + public function getAlias(?array $params = null) { + $params = $params ?? []; if (isset($params['index']) && isset($params['name'])) { - $url = '/' . $this->encode($params['index']) . '/_alias/' . $this->encode($params['name']); + $url = '/' . $this->encode($this->convertValue($params['index'])) . '/_alias/' . $this->encode($this->convertValue($params['name'])); $method = 'GET'; } elseif (isset($params['name'])) { - $url = '/_alias/' . $this->encode($params['name']); + $url = '/_alias/' . $this->encode($this->convertValue($params['name'])); $method = 'GET'; } elseif (isset($params['index'])) { - $url = '/' . $this->encode($params['index']) . '/_alias'; + $url = '/' . $this->encode($this->convertValue($params['index'])) . '/_alias'; $method = 'GET'; } else { $url = '/_alias'; @@ -1125,17 +1152,17 @@ public function getAlias(array $params = []) * Returns the data stream lifecycle of the selected data streams. * * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/data-streams-get-lifecycle.html - * @internal This API is EXPERIMENTAL and may be changed or removed completely in a future release * * @param array{ - * name: list, // (REQUIRED) A comma-separated list of data streams to get; use `*` to get all data streams - * expand_wildcards: enum, // Whether wildcard expressions should get expanded to open or closed indices (default: open) - * include_defaults: boolean, // Return all relevant default configurations for the data stream (default: false) - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. + * name: string|array, // (REQUIRED) A comma-separated list of data streams to get; use `*` to get all data streams + * expand_wildcards?: string, // Whether wildcard expressions should get expanded to open or closed indices (default: open) + * include_defaults?: bool, // Return all relevant default configurations for the data stream (default: false) + * master_timeout?: int|string, // Specify timeout for connection to master + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. * } $params * * @throws MissingParameterException if a required parameter is missing @@ -1145,13 +1172,14 @@ public function getAlias(array $params = []) * * @return Elasticsearch|Promise */ - public function getDataLifecycle(array $params = []) + public function getDataLifecycle(?array $params = null) { + $params = $params ?? []; $this->checkRequiredParameters(['name'], $params); - $url = '/_data_stream/' . $this->encode($params['name']) . '/_lifecycle'; + $url = '/_data_stream/' . $this->encode($this->convertValue($params['name'])) . '/_lifecycle'; $method = 'GET'; - $url = $this->addQueryString($url, $params, ['expand_wildcards','include_defaults','pretty','human','error_trace','source','filter_path']); + $url = $this->addQueryString($url, $params, ['expand_wildcards','include_defaults','master_timeout','pretty','human','error_trace','source','filter_path']); $headers = [ 'Accept' => 'application/json', ]; @@ -1161,20 +1189,57 @@ public function getDataLifecycle(array $params = []) } + /** + * Get data stream lifecycle statistics. + * + * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/data-streams-get-lifecycle-stats.html + * + * @param array{ + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. + * } $params + * + * @throws NoNodeAvailableException if all the hosts are offline + * @throws ClientResponseException if the status code of response is 4xx + * @throws ServerResponseException if the status code of response is 5xx + * + * @return Elasticsearch|Promise + */ + public function getDataLifecycleStats(?array $params = null) + { + $params = $params ?? []; + $url = '/_lifecycle/stats'; + $method = 'GET'; + + $url = $this->addQueryString($url, $params, ['pretty','human','error_trace','source','filter_path']); + $headers = [ + 'Accept' => 'application/json', + ]; + $request = $this->createRequest($method, $url, $headers, $params['body'] ?? null); + $request = $this->addOtelAttributes($params, [], $request, 'indices.get_data_lifecycle_stats'); + return $this->client->sendRequest($request); + } + + /** * Returns data streams. * * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/data-streams.html * * @param array{ - * name: list, // A comma-separated list of data streams to get; use `*` to get all data streams - * expand_wildcards: enum, // Whether wildcard expressions should get expanded to open or closed indices (default: open) - * include_defaults: boolean, // Return all relevant default configurations for the data stream (default: false) - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. + * name?: string|array, // A comma-separated list of data streams to get; use `*` to get all data streams + * expand_wildcards?: string, // Whether wildcard expressions should get expanded to open or closed indices (default: open) + * include_defaults?: bool, // Return all relevant default configurations for the data stream (default: false) + * master_timeout?: int|string, // Specify timeout for connection to master + * verbose?: bool, // Whether the maximum timestamp for each data stream should be calculated and returned (default: false) + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. * } $params * * @throws NoNodeAvailableException if all the hosts are offline @@ -1183,16 +1248,17 @@ public function getDataLifecycle(array $params = []) * * @return Elasticsearch|Promise */ - public function getDataStream(array $params = []) + public function getDataStream(?array $params = null) { + $params = $params ?? []; if (isset($params['name'])) { - $url = '/_data_stream/' . $this->encode($params['name']); + $url = '/_data_stream/' . $this->encode($this->convertValue($params['name'])); $method = 'GET'; } else { $url = '/_data_stream'; $method = 'GET'; } - $url = $this->addQueryString($url, $params, ['expand_wildcards','include_defaults','pretty','human','error_trace','source','filter_path']); + $url = $this->addQueryString($url, $params, ['expand_wildcards','include_defaults','master_timeout','verbose','pretty','human','error_trace','source','filter_path']); $headers = [ 'Accept' => 'application/json', ]; @@ -1208,18 +1274,18 @@ public function getDataStream(array $params = []) * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-get-field-mapping.html * * @param array{ - * fields: list, // (REQUIRED) A comma-separated list of fields - * index: list, // A comma-separated list of index names - * include_defaults: boolean, // Whether the default mapping values should be returned as well - * ignore_unavailable: boolean, // Whether specified concrete indices should be ignored when unavailable (missing or closed) - * allow_no_indices: boolean, // Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes `_all` string or when no indices have been specified) - * expand_wildcards: enum, // Whether to expand wildcard expression to concrete indices that are open, closed or both. - * local: boolean, // Return local information, do not retrieve the state from master node (default: false) - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. + * fields: string|array, // (REQUIRED) A comma-separated list of fields + * index?: string|array, // A comma-separated list of index names + * include_defaults?: bool, // Whether the default mapping values should be returned as well + * ignore_unavailable?: bool, // Whether specified concrete indices should be ignored when unavailable (missing or closed) + * allow_no_indices?: bool, // Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes `_all` string or when no indices have been specified) + * expand_wildcards?: string, // Whether to expand wildcard expression to concrete indices that are open, closed or both. + * local?: bool, // Return local information, do not retrieve the state from master node (default: false) + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. * } $params * * @throws MissingParameterException if a required parameter is missing @@ -1229,14 +1295,15 @@ public function getDataStream(array $params = []) * * @return Elasticsearch|Promise */ - public function getFieldMapping(array $params = []) + public function getFieldMapping(?array $params = null) { + $params = $params ?? []; $this->checkRequiredParameters(['fields'], $params); if (isset($params['index'])) { - $url = '/' . $this->encode($params['index']) . '/_mapping/field/' . $this->encode($params['fields']); + $url = '/' . $this->encode($this->convertValue($params['index'])) . '/_mapping/field/' . $this->encode($this->convertValue($params['fields'])); $method = 'GET'; } else { - $url = '/_mapping/field/' . $this->encode($params['fields']); + $url = '/_mapping/field/' . $this->encode($this->convertValue($params['fields'])); $method = 'GET'; } $url = $this->addQueryString($url, $params, ['include_defaults','ignore_unavailable','allow_no_indices','expand_wildcards','local','pretty','human','error_trace','source','filter_path']); @@ -1255,16 +1322,16 @@ public function getFieldMapping(array $params = []) * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-get-template.html * * @param array{ - * name: string, // A pattern that returned template names must match - * flat_settings: boolean, // Return settings in flat format (default: false) - * master_timeout: time, // Explicit operation timeout for connection to master node - * local: boolean, // Return local information, do not retrieve the state from master node (default: false) - * include_defaults: boolean, // Return all relevant default configurations for the index template (default: false) - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. + * name?: string, // A pattern that returned template names must match + * flat_settings?: bool, // Return settings in flat format (default: false) + * master_timeout?: int|string, // Explicit operation timeout for connection to master node + * local?: bool, // Return local information, do not retrieve the state from master node (default: false) + * include_defaults?: bool, // Return all relevant default configurations for the index template (default: false) + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. * } $params * * @throws NoNodeAvailableException if all the hosts are offline @@ -1273,8 +1340,9 @@ public function getFieldMapping(array $params = []) * * @return Elasticsearch|Promise */ - public function getIndexTemplate(array $params = []) + public function getIndexTemplate(?array $params = null) { + $params = $params ?? []; if (isset($params['name'])) { $url = '/_index_template/' . $this->encode($params['name']); $method = 'GET'; @@ -1298,17 +1366,17 @@ public function getIndexTemplate(array $params = []) * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-get-mapping.html * * @param array{ - * index: list, // A comma-separated list of index names - * ignore_unavailable: boolean, // Whether specified concrete indices should be ignored when unavailable (missing or closed) - * allow_no_indices: boolean, // Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes `_all` string or when no indices have been specified) - * expand_wildcards: enum, // Whether to expand wildcard expression to concrete indices that are open, closed or both. - * master_timeout: time, // Specify timeout for connection to master - * local: boolean, // Return local information, do not retrieve the state from master node (default: false) - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. + * index?: string|array, // A comma-separated list of index names + * ignore_unavailable?: bool, // Whether specified concrete indices should be ignored when unavailable (missing or closed) + * allow_no_indices?: bool, // Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes `_all` string or when no indices have been specified) + * expand_wildcards?: string, // Whether to expand wildcard expression to concrete indices that are open, closed or both. + * master_timeout?: int|string, // Specify timeout for connection to master + * local?: bool, // Return local information, do not retrieve the state from master node (default: false) + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. * } $params * * @throws NoNodeAvailableException if all the hosts are offline @@ -1317,10 +1385,11 @@ public function getIndexTemplate(array $params = []) * * @return Elasticsearch|Promise */ - public function getMapping(array $params = []) + public function getMapping(?array $params = null) { + $params = $params ?? []; if (isset($params['index'])) { - $url = '/' . $this->encode($params['index']) . '/_mapping'; + $url = '/' . $this->encode($this->convertValue($params['index'])) . '/_mapping'; $method = 'GET'; } else { $url = '/_mapping'; @@ -1342,20 +1411,20 @@ public function getMapping(array $params = []) * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-get-settings.html * * @param array{ - * index: list, // A comma-separated list of index names; use `_all` or empty string to perform the operation on all indices - * name: list, // The name of the settings that should be included - * master_timeout: time, // Specify timeout for connection to master - * ignore_unavailable: boolean, // Whether specified concrete indices should be ignored when unavailable (missing or closed) - * allow_no_indices: boolean, // Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes `_all` string or when no indices have been specified) - * expand_wildcards: enum, // Whether to expand wildcard expression to concrete indices that are open, closed or both. - * flat_settings: boolean, // Return settings in flat format (default: false) - * local: boolean, // Return local information, do not retrieve the state from master node (default: false) - * include_defaults: boolean, // Whether to return all default setting for each of the indices. - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. + * index?: string|array, // A comma-separated list of index names; use `_all` or empty string to perform the operation on all indices + * name?: string|array, // The name of the settings that should be included + * master_timeout?: int|string, // Specify timeout for connection to master + * ignore_unavailable?: bool, // Whether specified concrete indices should be ignored when unavailable (missing or closed) + * allow_no_indices?: bool, // Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes `_all` string or when no indices have been specified) + * expand_wildcards?: string, // Whether to expand wildcard expression to concrete indices that are open, closed or both. + * flat_settings?: bool, // Return settings in flat format (default: false) + * local?: bool, // Return local information, do not retrieve the state from master node (default: false) + * include_defaults?: bool, // Whether to return all default setting for each of the indices. + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. * } $params * * @throws NoNodeAvailableException if all the hosts are offline @@ -1364,16 +1433,17 @@ public function getMapping(array $params = []) * * @return Elasticsearch|Promise */ - public function getSettings(array $params = []) + public function getSettings(?array $params = null) { + $params = $params ?? []; if (isset($params['index']) && isset($params['name'])) { - $url = '/' . $this->encode($params['index']) . '/_settings/' . $this->encode($params['name']); + $url = '/' . $this->encode($this->convertValue($params['index'])) . '/_settings/' . $this->encode($this->convertValue($params['name'])); $method = 'GET'; } elseif (isset($params['index'])) { - $url = '/' . $this->encode($params['index']) . '/_settings'; + $url = '/' . $this->encode($this->convertValue($params['index'])) . '/_settings'; $method = 'GET'; } elseif (isset($params['name'])) { - $url = '/_settings/' . $this->encode($params['name']); + $url = '/_settings/' . $this->encode($this->convertValue($params['name'])); $method = 'GET'; } else { $url = '/_settings'; @@ -1395,15 +1465,15 @@ public function getSettings(array $params = []) * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-get-template-v1.html * * @param array{ - * name: list, // The comma separated names of the index templates - * flat_settings: boolean, // Return settings in flat format (default: false) - * master_timeout: time, // Explicit operation timeout for connection to master node - * local: boolean, // Return local information, do not retrieve the state from master node (default: false) - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. + * name?: string|array, // The comma separated names of the index templates + * flat_settings?: bool, // Return settings in flat format (default: false) + * master_timeout?: int|string, // Explicit operation timeout for connection to master node + * local?: bool, // Return local information, do not retrieve the state from master node (default: false) + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. * } $params * * @throws NoNodeAvailableException if all the hosts are offline @@ -1412,10 +1482,11 @@ public function getSettings(array $params = []) * * @return Elasticsearch|Promise */ - public function getTemplate(array $params = []) + public function getTemplate(?array $params = null) { + $params = $params ?? []; if (isset($params['name'])) { - $url = '/_template/' . $this->encode($params['name']); + $url = '/_template/' . $this->encode($this->convertValue($params['name'])); $method = 'GET'; } else { $url = '/_template'; @@ -1438,11 +1509,13 @@ public function getTemplate(array $params = []) * * @param array{ * name: string, // (REQUIRED) The name of the alias to migrate - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. + * timeout?: int|string, // Specify timeout for acknowledging the cluster state update + * master_timeout?: int|string, // Specify timeout for connection to master + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. * } $params * * @throws MissingParameterException if a required parameter is missing @@ -1452,13 +1525,14 @@ public function getTemplate(array $params = []) * * @return Elasticsearch|Promise */ - public function migrateToDataStream(array $params = []) + public function migrateToDataStream(?array $params = null) { + $params = $params ?? []; $this->checkRequiredParameters(['name'], $params); $url = '/_data_stream/_migrate/' . $this->encode($params['name']); $method = 'POST'; - $url = $this->addQueryString($url, $params, ['pretty','human','error_trace','source','filter_path']); + $url = $this->addQueryString($url, $params, ['timeout','master_timeout','pretty','human','error_trace','source','filter_path']); $headers = [ 'Accept' => 'application/json', ]; @@ -1474,12 +1548,12 @@ public function migrateToDataStream(array $params = []) * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/data-streams.html * * @param array{ - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. - * body: array, // (REQUIRED) The data stream modifications + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. + * body: string|array, // (REQUIRED) The data stream modifications. If body is a string must be a valid JSON. * } $params * * @throws NoNodeAvailableException if all the hosts are offline @@ -1488,8 +1562,9 @@ public function migrateToDataStream(array $params = []) * * @return Elasticsearch|Promise */ - public function modifyDataStream(array $params = []) + public function modifyDataStream(?array $params = null) { + $params = $params ?? []; $this->checkRequiredParameters(['body'], $params); $url = '/_data_stream/_modify'; $method = 'POST'; @@ -1511,18 +1586,18 @@ public function modifyDataStream(array $params = []) * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-open-close.html * * @param array{ - * index: list, // (REQUIRED) A comma separated list of indices to open - * timeout: time, // Explicit operation timeout - * master_timeout: time, // Specify timeout for connection to master - * ignore_unavailable: boolean, // Whether specified concrete indices should be ignored when unavailable (missing or closed) - * allow_no_indices: boolean, // Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes `_all` string or when no indices have been specified) - * expand_wildcards: enum, // Whether to expand wildcard expression to concrete indices that are open, closed or both. - * wait_for_active_shards: string, // Sets the number of active shards to wait for before the operation returns. - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. + * index: string|array, // (REQUIRED) A comma separated list of indices to open + * timeout?: int|string, // Explicit operation timeout + * master_timeout?: int|string, // Specify timeout for connection to master + * ignore_unavailable?: bool, // Whether specified concrete indices should be ignored when unavailable (missing or closed) + * allow_no_indices?: bool, // Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes `_all` string or when no indices have been specified) + * expand_wildcards?: string, // Whether to expand wildcard expression to concrete indices that are open, closed or both. + * wait_for_active_shards?: string, // Sets the number of active shards to wait for before the operation returns. + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. * } $params * * @throws MissingParameterException if a required parameter is missing @@ -1532,10 +1607,11 @@ public function modifyDataStream(array $params = []) * * @return Elasticsearch|Promise */ - public function open(array $params = []) + public function open(?array $params = null) { + $params = $params ?? []; $this->checkRequiredParameters(['index'], $params); - $url = '/' . $this->encode($params['index']) . '/_open'; + $url = '/' . $this->encode($this->convertValue($params['index'])) . '/_open'; $method = 'POST'; $url = $this->addQueryString($url, $params, ['timeout','master_timeout','ignore_unavailable','allow_no_indices','expand_wildcards','wait_for_active_shards','pretty','human','error_trace','source','filter_path']); @@ -1555,11 +1631,12 @@ public function open(array $params = []) * * @param array{ * name: string, // (REQUIRED) The name of the data stream - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. + * master_timeout?: int|string, // Specify timeout for connection to master + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. * } $params * * @throws MissingParameterException if a required parameter is missing @@ -1569,13 +1646,14 @@ public function open(array $params = []) * * @return Elasticsearch|Promise */ - public function promoteDataStream(array $params = []) + public function promoteDataStream(?array $params = null) { + $params = $params ?? []; $this->checkRequiredParameters(['name'], $params); $url = '/_data_stream/_promote/' . $this->encode($params['name']); $method = 'POST'; - $url = $this->addQueryString($url, $params, ['pretty','human','error_trace','source','filter_path']); + $url = $this->addQueryString($url, $params, ['master_timeout','pretty','human','error_trace','source','filter_path']); $headers = [ 'Accept' => 'application/json', ]; @@ -1591,16 +1669,16 @@ public function promoteDataStream(array $params = []) * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-aliases.html * * @param array{ - * index: list, // (REQUIRED) A comma-separated list of index names the alias should point to (supports wildcards); use `_all` to perform the operation on all indices. + * index: string|array, // (REQUIRED) A comma-separated list of index names the alias should point to (supports wildcards); use `_all` to perform the operation on all indices. * name: string, // (REQUIRED) The name of the alias to be created or updated - * timeout: time, // Explicit timestamp for the document - * master_timeout: time, // Specify timeout for connection to master - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. - * body: array, // The settings for the alias, such as `routing` or `filter` + * timeout?: int|string, // Explicit timestamp for the document + * master_timeout?: int|string, // Specify timeout for connection to master + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. + * body?: string|array, // The settings for the alias, such as `routing` or `filter`. If body is a string must be a valid JSON. * } $params * * @throws MissingParameterException if a required parameter is missing @@ -1610,10 +1688,11 @@ public function promoteDataStream(array $params = []) * * @return Elasticsearch|Promise */ - public function putAlias(array $params = []) + public function putAlias(?array $params = null) { + $params = $params ?? []; $this->checkRequiredParameters(['index','name'], $params); - $url = '/' . $this->encode($params['index']) . '/_alias/' . $this->encode($params['name']); + $url = '/' . $this->encode($this->convertValue($params['index'])) . '/_alias/' . $this->encode($params['name']); $method = 'PUT'; $url = $this->addQueryString($url, $params, ['timeout','master_timeout','pretty','human','error_trace','source','filter_path']); @@ -1631,19 +1710,18 @@ public function putAlias(array $params = []) * Updates the data stream lifecycle of the selected data streams. * * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/data-streams-put-lifecycle.html - * @internal This API is EXPERIMENTAL and may be changed or removed completely in a future release * * @param array{ - * name: list, // (REQUIRED) A comma-separated list of data streams whose lifecycle will be updated; use `*` to set the lifecycle to all data streams - * expand_wildcards: enum, // Whether wildcard expressions should get expanded to open or closed indices (default: open) - * timeout: time, // Explicit timestamp for the document - * master_timeout: time, // Specify timeout for connection to master - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. - * body: array, // The data stream lifecycle configuration that consist of the data retention + * name: string|array, // (REQUIRED) A comma-separated list of data streams whose lifecycle will be updated; use `*` to set the lifecycle to all data streams + * expand_wildcards?: string, // Whether wildcard expressions should get expanded to open or closed indices (default: open) + * timeout?: int|string, // Explicit timestamp for the document + * master_timeout?: int|string, // Specify timeout for connection to master + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. + * body?: string|array, // The data stream lifecycle configuration that consist of the data retention. If body is a string must be a valid JSON. * } $params * * @throws MissingParameterException if a required parameter is missing @@ -1653,15 +1731,17 @@ public function putAlias(array $params = []) * * @return Elasticsearch|Promise */ - public function putDataLifecycle(array $params = []) + public function putDataLifecycle(?array $params = null) { + $params = $params ?? []; $this->checkRequiredParameters(['name'], $params); - $url = '/_data_stream/' . $this->encode($params['name']) . '/_lifecycle'; + $url = '/_data_stream/' . $this->encode($this->convertValue($params['name'])) . '/_lifecycle'; $method = 'PUT'; $url = $this->addQueryString($url, $params, ['expand_wildcards','timeout','master_timeout','pretty','human','error_trace','source','filter_path']); $headers = [ 'Accept' => 'application/json', + 'Content-Type' => 'application/json', ]; $request = $this->createRequest($method, $url, $headers, $params['body'] ?? null); $request = $this->addOtelAttributes($params, ['name'], $request, 'indices.put_data_lifecycle'); @@ -1676,15 +1756,15 @@ public function putDataLifecycle(array $params = []) * * @param array{ * name: string, // (REQUIRED) The name of the template - * create: boolean, // Whether the index template should only be added if new or can also replace an existing one - * cause: string, // User defined reason for creating/updating the index template - * master_timeout: time, // Specify timeout for connection to master - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. - * body: array, // (REQUIRED) The template definition + * create?: bool, // Whether the index template should only be added if new or can also replace an existing one + * cause?: string, // User defined reason for creating/updating the index template + * master_timeout?: int|string, // Specify timeout for connection to master + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. + * body: string|array, // (REQUIRED) The template definition. If body is a string must be a valid JSON. * } $params * * @throws MissingParameterException if a required parameter is missing @@ -1694,8 +1774,9 @@ public function putDataLifecycle(array $params = []) * * @return Elasticsearch|Promise */ - public function putIndexTemplate(array $params = []) + public function putIndexTemplate(?array $params = null) { + $params = $params ?? []; $this->checkRequiredParameters(['name','body'], $params); $url = '/_index_template/' . $this->encode($params['name']); $method = 'PUT'; @@ -1717,19 +1798,19 @@ public function putIndexTemplate(array $params = []) * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-put-mapping.html * * @param array{ - * index: list, // (REQUIRED) A comma-separated list of index names the mapping should be added to (supports wildcards); use `_all` or omit to add the mapping on all indices. - * timeout: time, // Explicit operation timeout - * master_timeout: time, // Specify timeout for connection to master - * ignore_unavailable: boolean, // Whether specified concrete indices should be ignored when unavailable (missing or closed) - * allow_no_indices: boolean, // Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes `_all` string or when no indices have been specified) - * expand_wildcards: enum, // Whether to expand wildcard expression to concrete indices that are open, closed or both. - * write_index_only: boolean, // When true, applies mappings only to the write index of an alias or data stream - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. - * body: array, // (REQUIRED) The mapping definition + * index: string|array, // (REQUIRED) A comma-separated list of index names the mapping should be added to (supports wildcards); use `_all` or omit to add the mapping on all indices. + * timeout?: int|string, // Explicit operation timeout + * master_timeout?: int|string, // Specify timeout for connection to master + * ignore_unavailable?: bool, // Whether specified concrete indices should be ignored when unavailable (missing or closed) + * allow_no_indices?: bool, // Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes `_all` string or when no indices have been specified) + * expand_wildcards?: string, // Whether to expand wildcard expression to concrete indices that are open, closed or both. + * write_index_only?: bool, // When true, applies mappings only to the write index of an alias or data stream + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. + * body: string|array, // (REQUIRED) The mapping definition. If body is a string must be a valid JSON. * } $params * * @throws MissingParameterException if a required parameter is missing @@ -1739,10 +1820,11 @@ public function putIndexTemplate(array $params = []) * * @return Elasticsearch|Promise */ - public function putMapping(array $params = []) + public function putMapping(?array $params = null) { + $params = $params ?? []; $this->checkRequiredParameters(['index','body'], $params); - $url = '/' . $this->encode($params['index']) . '/_mapping'; + $url = '/' . $this->encode($this->convertValue($params['index'])) . '/_mapping'; $method = 'PUT'; $url = $this->addQueryString($url, $params, ['timeout','master_timeout','ignore_unavailable','allow_no_indices','expand_wildcards','write_index_only','pretty','human','error_trace','source','filter_path']); @@ -1762,21 +1844,21 @@ public function putMapping(array $params = []) * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-update-settings.html * * @param array{ - * index: list, // A comma-separated list of index names; use `_all` or empty string to perform the operation on all indices - * master_timeout: time, // Specify timeout for connection to master - * timeout: time, // Explicit operation timeout - * preserve_existing: boolean, // Whether to update existing settings. If set to `true` existing settings on an index remain unchanged, the default is `false` - * reopen: boolean, // Whether to close and reopen the index to apply non-dynamic settings. If set to `true` the indices to which the settings are being applied will be closed temporarily and then reopened in order to apply the changes. The default is `false` - * ignore_unavailable: boolean, // Whether specified concrete indices should be ignored when unavailable (missing or closed) - * allow_no_indices: boolean, // Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes `_all` string or when no indices have been specified) - * expand_wildcards: enum, // Whether to expand wildcard expression to concrete indices that are open, closed or both. - * flat_settings: boolean, // Return settings in flat format (default: false) - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. - * body: array, // (REQUIRED) The index settings to be updated + * index?: string|array, // A comma-separated list of index names; use `_all` or empty string to perform the operation on all indices + * master_timeout?: int|string, // Specify timeout for connection to master + * timeout?: int|string, // Explicit operation timeout + * preserve_existing?: bool, // Whether to update existing settings. If set to `true` existing settings on an index remain unchanged, the default is `false` + * reopen?: bool, // Whether to close and reopen the index to apply non-dynamic settings. If set to `true` the indices to which the settings are being applied will be closed temporarily and then reopened in order to apply the changes. The default is `false` + * ignore_unavailable?: bool, // Whether specified concrete indices should be ignored when unavailable (missing or closed) + * allow_no_indices?: bool, // Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes `_all` string or when no indices have been specified) + * expand_wildcards?: string, // Whether to expand wildcard expression to concrete indices that are open, closed or both. + * flat_settings?: bool, // Return settings in flat format (default: false) + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. + * body: string|array, // (REQUIRED) The index settings to be updated. If body is a string must be a valid JSON. * } $params * * @throws NoNodeAvailableException if all the hosts are offline @@ -1785,11 +1867,12 @@ public function putMapping(array $params = []) * * @return Elasticsearch|Promise */ - public function putSettings(array $params = []) + public function putSettings(?array $params = null) { + $params = $params ?? []; $this->checkRequiredParameters(['body'], $params); if (isset($params['index'])) { - $url = '/' . $this->encode($params['index']) . '/_settings'; + $url = '/' . $this->encode($this->convertValue($params['index'])) . '/_settings'; $method = 'PUT'; } else { $url = '/_settings'; @@ -1813,15 +1896,16 @@ public function putSettings(array $params = []) * * @param array{ * name: string, // (REQUIRED) The name of the template - * order: number, // The order for this template when merging multiple matching ones (higher numbers are merged later, overriding the lower numbers) - * create: boolean, // Whether the index template should only be added if new or can also replace an existing one - * master_timeout: time, // Specify timeout for connection to master - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. - * body: array, // (REQUIRED) The template definition + * order?: int, // The order for this template when merging multiple matching ones (higher numbers are merged later, overriding the lower numbers) + * create?: bool, // Whether the index template should only be added if new or can also replace an existing one + * cause?: string, // User defined reason for creating/updating the index template + * master_timeout?: int|string, // Specify timeout for connection to master + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. + * body: string|array, // (REQUIRED) The template definition. If body is a string must be a valid JSON. * } $params * * @throws MissingParameterException if a required parameter is missing @@ -1831,13 +1915,14 @@ public function putSettings(array $params = []) * * @return Elasticsearch|Promise */ - public function putTemplate(array $params = []) + public function putTemplate(?array $params = null) { + $params = $params ?? []; $this->checkRequiredParameters(['name','body'], $params); $url = '/_template/' . $this->encode($params['name']); $method = 'PUT'; - $url = $this->addQueryString($url, $params, ['order','create','master_timeout','pretty','human','error_trace','source','filter_path']); + $url = $this->addQueryString($url, $params, ['order','create','cause','master_timeout','pretty','human','error_trace','source','filter_path']); $headers = [ 'Accept' => 'application/json', 'Content-Type' => 'application/json', @@ -1854,14 +1939,14 @@ public function putTemplate(array $params = []) * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-recovery.html * * @param array{ - * index: list, // A comma-separated list of index names; use `_all` or empty string to perform the operation on all indices - * detailed: boolean, // Whether to display detailed information about shard recovery - * active_only: boolean, // Display only those recoveries that are currently on-going - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. + * index?: string|array, // A comma-separated list of index names; use `_all` or empty string to perform the operation on all indices + * detailed?: bool, // Whether to display detailed information about shard recovery + * active_only?: bool, // Display only those recoveries that are currently on-going + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. * } $params * * @throws NoNodeAvailableException if all the hosts are offline @@ -1870,10 +1955,11 @@ public function putTemplate(array $params = []) * * @return Elasticsearch|Promise */ - public function recovery(array $params = []) + public function recovery(?array $params = null) { + $params = $params ?? []; if (isset($params['index'])) { - $url = '/' . $this->encode($params['index']) . '/_recovery'; + $url = '/' . $this->encode($this->convertValue($params['index'])) . '/_recovery'; $method = 'GET'; } else { $url = '/_recovery'; @@ -1895,15 +1981,15 @@ public function recovery(array $params = []) * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-refresh.html * * @param array{ - * index: list, // A comma-separated list of index names; use `_all` or empty string to perform the operation on all indices - * ignore_unavailable: boolean, // Whether specified concrete indices should be ignored when unavailable (missing or closed) - * allow_no_indices: boolean, // Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes `_all` string or when no indices have been specified) - * expand_wildcards: enum, // Whether to expand wildcard expression to concrete indices that are open, closed or both. - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. + * index?: string|array, // A comma-separated list of index names; use `_all` or empty string to perform the operation on all indices + * ignore_unavailable?: bool, // Whether specified concrete indices should be ignored when unavailable (missing or closed) + * allow_no_indices?: bool, // Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes `_all` string or when no indices have been specified) + * expand_wildcards?: string, // Whether to expand wildcard expression to concrete indices that are open, closed or both. + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. * } $params * * @throws NoNodeAvailableException if all the hosts are offline @@ -1912,14 +1998,15 @@ public function recovery(array $params = []) * * @return Elasticsearch|Promise */ - public function refresh(array $params = []) + public function refresh(?array $params = null) { + $params = $params ?? []; if (isset($params['index'])) { - $url = '/' . $this->encode($params['index']) . '/_refresh'; - $method = empty($params['body']) ? 'GET' : 'POST'; + $url = '/' . $this->encode($this->convertValue($params['index'])) . '/_refresh'; + $method = 'POST'; } else { $url = '/_refresh'; - $method = empty($params['body']) ? 'GET' : 'POST'; + $method = 'POST'; } $url = $this->addQueryString($url, $params, ['ignore_unavailable','allow_no_indices','expand_wildcards','pretty','human','error_trace','source','filter_path']); $headers = [ @@ -1937,16 +2024,16 @@ public function refresh(array $params = []) * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-reload-analyzers.html * * @param array{ - * index: list, // (REQUIRED) A comma-separated list of index names to reload analyzers for - * ignore_unavailable: boolean, // Whether specified concrete indices should be ignored when unavailable (missing or closed) - * allow_no_indices: boolean, // Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes `_all` string or when no indices have been specified) - * expand_wildcards: enum, // Whether to expand wildcard expression to concrete indices that are open, closed or both. - * resource: string, // changed resource to reload analyzers from if applicable - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. + * index: string|array, // (REQUIRED) A comma-separated list of index names to reload analyzers for + * ignore_unavailable?: bool, // Whether specified concrete indices should be ignored when unavailable (missing or closed) + * allow_no_indices?: bool, // Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes `_all` string or when no indices have been specified) + * expand_wildcards?: string, // Whether to expand wildcard expression to concrete indices that are open, closed or both. + * resource?: string, // changed resource to reload analyzers from if applicable + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. * } $params * * @throws MissingParameterException if a required parameter is missing @@ -1956,11 +2043,12 @@ public function refresh(array $params = []) * * @return Elasticsearch|Promise */ - public function reloadSearchAnalyzers(array $params = []) + public function reloadSearchAnalyzers(?array $params = null) { + $params = $params ?? []; $this->checkRequiredParameters(['index'], $params); - $url = '/' . $this->encode($params['index']) . '/_reload_search_analyzers'; - $method = empty($params['body']) ? 'GET' : 'POST'; + $url = '/' . $this->encode($this->convertValue($params['index'])) . '/_reload_search_analyzers'; + $method = 'GET'; $url = $this->addQueryString($url, $params, ['ignore_unavailable','allow_no_indices','expand_wildcards','resource','pretty','human','error_trace','source','filter_path']); $headers = [ @@ -1973,37 +2061,41 @@ public function reloadSearchAnalyzers(array $params = []) /** - * Resolves the specified index expressions to return information about each cluster, including the local cluster, if included. + * Resolves the specified index expressions to return information about each cluster. If no index expression is provided, this endpoint will return information about all the remote clusters that are configured on the local cluster. * * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-resolve-cluster-api.html * * @param array{ - * name: list, // (REQUIRED) A comma-separated list of cluster:index names or wildcard expressions - * ignore_unavailable: boolean, // Whether specified concrete indices should be ignored when unavailable (missing or closed) - * ignore_throttled: boolean, // Whether specified concrete, expanded or aliased indices should be ignored when throttled - * allow_no_indices: boolean, // Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes `_all` string or when no indices have been specified) - * expand_wildcards: enum, // Whether wildcard expressions should get expanded to open or closed indices (default: open) - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. + * name?: string|array, // A comma-separated list of cluster:index names or wildcard expressions + * ignore_unavailable?: bool, // Whether specified concrete indices should be ignored when unavailable (missing or closed). Only allowed when providing an index expression. + * ignore_throttled?: bool, // Whether specified concrete, expanded or aliased indices should be ignored when throttled. Only allowed when providing an index expression. + * allow_no_indices?: bool, // Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes `_all` string or when no indices have been specified). Only allowed when providing an index expression. + * expand_wildcards?: string, // Whether wildcard expressions should get expanded to open or closed indices (default: open). Only allowed when providing an index expression. + * timeout?: int|string, // The maximum time to wait for remote clusters to respond + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. * } $params * - * @throws MissingParameterException if a required parameter is missing * @throws NoNodeAvailableException if all the hosts are offline * @throws ClientResponseException if the status code of response is 4xx * @throws ServerResponseException if the status code of response is 5xx * * @return Elasticsearch|Promise */ - public function resolveCluster(array $params = []) + public function resolveCluster(?array $params = null) { - $this->checkRequiredParameters(['name'], $params); - $url = '/_resolve/cluster/' . $this->encode($params['name']); - $method = 'GET'; - - $url = $this->addQueryString($url, $params, ['ignore_unavailable','ignore_throttled','allow_no_indices','expand_wildcards','pretty','human','error_trace','source','filter_path']); + $params = $params ?? []; + if (isset($params['name'])) { + $url = '/_resolve/cluster/' . $this->encode($this->convertValue($params['name'])); + $method = 'GET'; + } else { + $url = '/_resolve/cluster'; + $method = 'GET'; + } + $url = $this->addQueryString($url, $params, ['ignore_unavailable','ignore_throttled','allow_no_indices','expand_wildcards','timeout','pretty','human','error_trace','source','filter_path']); $headers = [ 'Accept' => 'application/json', ]; @@ -2019,13 +2111,15 @@ public function resolveCluster(array $params = []) * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-resolve-index-api.html * * @param array{ - * name: list, // (REQUIRED) A comma-separated list of names or wildcard expressions - * expand_wildcards: enum, // Whether wildcard expressions should get expanded to open or closed indices (default: open) - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. + * name: string|array, // (REQUIRED) A comma-separated list of names or wildcard expressions + * expand_wildcards?: string, // Whether wildcard expressions should get expanded to open or closed indices (default: open) + * ignore_unavailable?: bool, // Whether specified concrete indices should be ignored when unavailable (missing or closed) + * allow_no_indices?: bool, // Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes `_all` string or when no indices have been specified) + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. * } $params * * @throws MissingParameterException if a required parameter is missing @@ -2035,13 +2129,14 @@ public function resolveCluster(array $params = []) * * @return Elasticsearch|Promise */ - public function resolveIndex(array $params = []) + public function resolveIndex(?array $params = null) { + $params = $params ?? []; $this->checkRequiredParameters(['name'], $params); - $url = '/_resolve/index/' . $this->encode($params['name']); + $url = '/_resolve/index/' . $this->encode($this->convertValue($params['name'])); $method = 'GET'; - $url = $this->addQueryString($url, $params, ['expand_wildcards','pretty','human','error_trace','source','filter_path']); + $url = $this->addQueryString($url, $params, ['expand_wildcards','ignore_unavailable','allow_no_indices','pretty','human','error_trace','source','filter_path']); $headers = [ 'Accept' => 'application/json', ]; @@ -2059,19 +2154,18 @@ public function resolveIndex(array $params = []) * * @param array{ * alias: string, // (REQUIRED) The name of the alias to rollover - * new_index: string, // The name of the rollover index - * timeout: time, // Explicit operation timeout - * dry_run: boolean, // If set to true the rollover action will only be validated but not actually performed even if a condition matches. The default is false - * master_timeout: time, // Specify timeout for connection to master - * wait_for_active_shards: string, // Set the number of active shards to wait for on the newly created rollover index before the operation returns. - * lazy: boolean, // If set to true, the rollover action will only mark a data stream to signal that it needs to be rolled over at the next write. Only allowed on data streams. - * target_failure_store: boolean, // If set to true, the rollover action will be applied on the failure store of the data stream. - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. - * body: array, // The conditions that needs to be met for executing rollover + * new_index?: string, // The name of the rollover index + * timeout?: int|string, // Explicit operation timeout + * dry_run?: bool, // If set to true the rollover action will only be validated but not actually performed even if a condition matches. The default is false + * master_timeout?: int|string, // Specify timeout for connection to master + * wait_for_active_shards?: string, // Set the number of active shards to wait for on the newly created rollover index before the operation returns. + * lazy?: bool, // If set to true, the rollover action will only mark a data stream to signal that it needs to be rolled over at the next write. Only allowed on data streams. + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. + * body?: string|array, // The conditions that needs to be met for executing rollover. If body is a string must be a valid JSON. * } $params * * @throws MissingParameterException if a required parameter is missing @@ -2081,8 +2175,9 @@ public function resolveIndex(array $params = []) * * @return Elasticsearch|Promise */ - public function rollover(array $params = []) + public function rollover(?array $params = null) { + $params = $params ?? []; $this->checkRequiredParameters(['alias'], $params); if (isset($params['new_index'])) { $url = '/' . $this->encode($params['alias']) . '/_rollover/' . $this->encode($params['new_index']); @@ -2091,7 +2186,7 @@ public function rollover(array $params = []) $url = '/' . $this->encode($params['alias']) . '/_rollover'; $method = 'POST'; } - $url = $this->addQueryString($url, $params, ['timeout','dry_run','master_timeout','wait_for_active_shards','lazy','target_failure_store','pretty','human','error_trace','source','filter_path']); + $url = $this->addQueryString($url, $params, ['timeout','dry_run','master_timeout','wait_for_active_shards','lazy','pretty','human','error_trace','source','filter_path']); $headers = [ 'Accept' => 'application/json', 'Content-Type' => 'application/json', @@ -2108,16 +2203,16 @@ public function rollover(array $params = []) * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-segments.html * * @param array{ - * index: list, // A comma-separated list of index names; use `_all` or empty string to perform the operation on all indices - * ignore_unavailable: boolean, // Whether specified concrete indices should be ignored when unavailable (missing or closed) - * allow_no_indices: boolean, // Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes `_all` string or when no indices have been specified) - * expand_wildcards: enum, // Whether to expand wildcard expression to concrete indices that are open, closed or both. - * verbose: boolean, // Includes detailed memory usage by Lucene. - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. + * index?: string|array, // A comma-separated list of index names; use `_all` or empty string to perform the operation on all indices + * ignore_unavailable?: bool, // Whether specified concrete indices should be ignored when unavailable (missing or closed) + * allow_no_indices?: bool, // Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes `_all` string or when no indices have been specified) + * expand_wildcards?: string, // Whether to expand wildcard expression to concrete indices that are open, closed or both. + * verbose?: bool, // Includes detailed memory usage by Lucene. + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. * } $params * * @throws NoNodeAvailableException if all the hosts are offline @@ -2126,10 +2221,11 @@ public function rollover(array $params = []) * * @return Elasticsearch|Promise */ - public function segments(array $params = []) + public function segments(?array $params = null) { + $params = $params ?? []; if (isset($params['index'])) { - $url = '/' . $this->encode($params['index']) . '/_segments'; + $url = '/' . $this->encode($this->convertValue($params['index'])) . '/_segments'; $method = 'GET'; } else { $url = '/_segments'; @@ -2151,16 +2247,16 @@ public function segments(array $params = []) * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-shards-stores.html * * @param array{ - * index: list, // A comma-separated list of index names; use `_all` or empty string to perform the operation on all indices - * status: list, // A comma-separated list of statuses used to filter on shards to get store information for - * ignore_unavailable: boolean, // Whether specified concrete indices should be ignored when unavailable (missing or closed) - * allow_no_indices: boolean, // Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes `_all` string or when no indices have been specified) - * expand_wildcards: enum, // Whether to expand wildcard expression to concrete indices that are open, closed or both. - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. + * index?: string|array, // A comma-separated list of index names; use `_all` or empty string to perform the operation on all indices + * status?: string|array, // A comma-separated list of statuses used to filter on shards to get store information for + * ignore_unavailable?: bool, // Whether specified concrete indices should be ignored when unavailable (missing or closed) + * allow_no_indices?: bool, // Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes `_all` string or when no indices have been specified) + * expand_wildcards?: string, // Whether to expand wildcard expression to concrete indices that are open, closed or both. + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. * } $params * * @throws NoNodeAvailableException if all the hosts are offline @@ -2169,10 +2265,11 @@ public function segments(array $params = []) * * @return Elasticsearch|Promise */ - public function shardStores(array $params = []) + public function shardStores(?array $params = null) { + $params = $params ?? []; if (isset($params['index'])) { - $url = '/' . $this->encode($params['index']) . '/_shard_stores'; + $url = '/' . $this->encode($this->convertValue($params['index'])) . '/_shard_stores'; $method = 'GET'; } else { $url = '/_shard_stores'; @@ -2196,15 +2293,15 @@ public function shardStores(array $params = []) * @param array{ * index: string, // (REQUIRED) The name of the source index to shrink * target: string, // (REQUIRED) The name of the target index to shrink into - * timeout: time, // Explicit operation timeout - * master_timeout: time, // Specify timeout for connection to master - * wait_for_active_shards: string, // Set the number of active shards to wait for on the shrunken index before the operation returns. - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. - * body: array, // The configuration for the target index (`settings` and `aliases`) + * timeout?: int|string, // Explicit operation timeout + * master_timeout?: int|string, // Specify timeout for connection to master + * wait_for_active_shards?: string, // Set the number of active shards to wait for on the shrunken index before the operation returns. + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. + * body?: string|array, // The configuration for the target index (`settings` and `aliases`). If body is a string must be a valid JSON. * } $params * * @throws MissingParameterException if a required parameter is missing @@ -2214,8 +2311,9 @@ public function shardStores(array $params = []) * * @return Elasticsearch|Promise */ - public function shrink(array $params = []) + public function shrink(?array $params = null) { + $params = $params ?? []; $this->checkRequiredParameters(['index','target'], $params); $url = '/' . $this->encode($params['index']) . '/_shrink/' . $this->encode($params['target']); $method = 'PUT'; @@ -2238,16 +2336,16 @@ public function shrink(array $params = []) * * @param array{ * name: string, // (REQUIRED) The name of the index (it must be a concrete index name) - * create: boolean, // 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 - * cause: string, // User defined reason for dry-run creating the new template for simulation purposes - * master_timeout: time, // Specify timeout for connection to master - * include_defaults: boolean, // Return all relevant default configurations for this index template simulation (default: false) - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. - * body: array, // New index template definition, which will be included in the simulation, as if it already exists in the system + * create?: bool, // 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 + * cause?: string, // User defined reason for dry-run creating the new template for simulation purposes + * master_timeout?: int|string, // Specify timeout for connection to master + * include_defaults?: bool, // Return all relevant default configurations for this index template simulation (default: false) + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. + * body?: string|array, // New index template definition, which will be included in the simulation, as if it already exists in the system. If body is a string must be a valid JSON. * } $params * * @throws MissingParameterException if a required parameter is missing @@ -2257,8 +2355,9 @@ public function shrink(array $params = []) * * @return Elasticsearch|Promise */ - public function simulateIndexTemplate(array $params = []) + public function simulateIndexTemplate(?array $params = null) { + $params = $params ?? []; $this->checkRequiredParameters(['name'], $params); $url = '/_index_template/_simulate_index/' . $this->encode($params['name']); $method = 'POST'; @@ -2280,17 +2379,17 @@ public function simulateIndexTemplate(array $params = []) * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-simulate-template.html * * @param array{ - * name: string, // The name of the index template - * create: boolean, // 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 - * cause: string, // User defined reason for dry-run creating the new template for simulation purposes - * master_timeout: time, // Specify timeout for connection to master - * include_defaults: boolean, // Return all relevant default configurations for this template simulation (default: false) - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. - * body: array, // New index template definition to be simulated, if no index template name is specified + * name?: string, // The name of the index template + * create?: bool, // 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 + * cause?: string, // User defined reason for dry-run creating the new template for simulation purposes + * master_timeout?: int|string, // Specify timeout for connection to master + * include_defaults?: bool, // Return all relevant default configurations for this template simulation (default: false) + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. + * body?: string|array, // New index template definition to be simulated, if no index template name is specified. If body is a string must be a valid JSON. * } $params * * @throws NoNodeAvailableException if all the hosts are offline @@ -2299,8 +2398,9 @@ public function simulateIndexTemplate(array $params = []) * * @return Elasticsearch|Promise */ - public function simulateTemplate(array $params = []) + public function simulateTemplate(?array $params = null) { + $params = $params ?? []; if (isset($params['name'])) { $url = '/_index_template/_simulate/' . $this->encode($params['name']); $method = 'POST'; @@ -2327,15 +2427,15 @@ public function simulateTemplate(array $params = []) * @param array{ * index: string, // (REQUIRED) The name of the source index to split * target: string, // (REQUIRED) The name of the target index to split into - * timeout: time, // Explicit operation timeout - * master_timeout: time, // Specify timeout for connection to master - * wait_for_active_shards: string, // Set the number of active shards to wait for on the shrunken index before the operation returns. - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. - * body: array, // The configuration for the target index (`settings` and `aliases`) + * timeout?: int|string, // Explicit operation timeout + * master_timeout?: int|string, // Specify timeout for connection to master + * wait_for_active_shards?: string, // Set the number of active shards to wait for on the shrunken index before the operation returns. + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. + * body?: string|array, // The configuration for the target index (`settings` and `aliases`). If body is a string must be a valid JSON. * } $params * * @throws MissingParameterException if a required parameter is missing @@ -2345,8 +2445,9 @@ public function simulateTemplate(array $params = []) * * @return Elasticsearch|Promise */ - public function split(array $params = []) + public function split(?array $params = null) { + $params = $params ?? []; $this->checkRequiredParameters(['index','target'], $params); $url = '/' . $this->encode($params['index']) . '/_split/' . $this->encode($params['target']); $method = 'PUT'; @@ -2368,22 +2469,22 @@ public function split(array $params = []) * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-stats.html * * @param array{ - * metric: list, // Limit the information returned the specific metrics. - * index: list, // A comma-separated list of index names; use `_all` or empty string to perform the operation on all indices - * completion_fields: list, // A comma-separated list of fields for the `completion` index metric (supports wildcards) - * fielddata_fields: list, // A comma-separated list of fields for the `fielddata` index metric (supports wildcards) - * fields: list, // A comma-separated list of fields for `fielddata` and `completion` index metric (supports wildcards) - * groups: list, // A comma-separated list of search groups for `search` index metric - * level: enum, // Return stats aggregated at cluster, index or shard level - * include_segment_file_sizes: boolean, // Whether to report the aggregated disk usage of each one of the Lucene index files (only applies if segment stats are requested) - * include_unloaded_segments: boolean, // If set to true segment stats will include stats for segments that are not currently loaded into memory - * expand_wildcards: enum, // Whether to expand wildcard expression to concrete indices that are open, closed or both. - * forbid_closed_indices: boolean, // If set to false stats will also collected from closed indices if explicitly specified or if expand_wildcards expands to closed indices - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. + * metric?: string|array, // Limit the information returned the specific metrics. + * index?: string|array, // A comma-separated list of index names; use `_all` or empty string to perform the operation on all indices + * completion_fields?: string|array, // A comma-separated list of fields for the `completion` index metric (supports wildcards) + * fielddata_fields?: string|array, // A comma-separated list of fields for the `fielddata` index metric (supports wildcards) + * fields?: string|array, // A comma-separated list of fields for `fielddata` and `completion` index metric (supports wildcards) + * groups?: string|array, // A comma-separated list of search groups for `search` index metric + * level?: string, // Return stats aggregated at cluster, index or shard level + * include_segment_file_sizes?: bool, // Whether to report the aggregated disk usage of each one of the Lucene index files (only applies if segment stats are requested) + * include_unloaded_segments?: bool, // If set to true segment stats will include stats for segments that are not currently loaded into memory + * expand_wildcards?: string, // Whether to expand wildcard expression to concrete indices that are open, closed or both. + * forbid_closed_indices?: bool, // If set to false stats will also collected from closed indices if explicitly specified or if expand_wildcards expands to closed indices + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. * } $params * * @throws NoNodeAvailableException if all the hosts are offline @@ -2392,16 +2493,17 @@ public function split(array $params = []) * * @return Elasticsearch|Promise */ - public function stats(array $params = []) + public function stats(?array $params = null) { + $params = $params ?? []; if (isset($params['index']) && isset($params['metric'])) { - $url = '/' . $this->encode($params['index']) . '/_stats/' . $this->encode($params['metric']); + $url = '/' . $this->encode($this->convertValue($params['index'])) . '/_stats/' . $this->encode($this->convertValue($params['metric'])); $method = 'GET'; } elseif (isset($params['metric'])) { - $url = '/_stats/' . $this->encode($params['metric']); + $url = '/_stats/' . $this->encode($this->convertValue($params['metric'])); $method = 'GET'; } elseif (isset($params['index'])) { - $url = '/' . $this->encode($params['index']) . '/_stats'; + $url = '/' . $this->encode($this->convertValue($params['index'])) . '/_stats'; $method = 'GET'; } else { $url = '/_stats'; @@ -2424,17 +2526,17 @@ public function stats(array $params = []) * * @param array{ * index: string, // (REQUIRED) The name of the index to unfreeze - * timeout: time, // Explicit operation timeout - * master_timeout: time, // Specify timeout for connection to master - * ignore_unavailable: boolean, // Whether specified concrete indices should be ignored when unavailable (missing or closed) - * allow_no_indices: boolean, // Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes `_all` string or when no indices have been specified) - * expand_wildcards: enum, // Whether to expand wildcard expression to concrete indices that are open, closed or both. - * wait_for_active_shards: string, // Sets the number of active shards to wait for before the operation returns. - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. + * timeout?: int|string, // Explicit operation timeout + * master_timeout?: int|string, // Specify timeout for connection to master + * ignore_unavailable?: bool, // Whether specified concrete indices should be ignored when unavailable (missing or closed) + * allow_no_indices?: bool, // Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes `_all` string or when no indices have been specified) + * expand_wildcards?: string, // Whether to expand wildcard expression to concrete indices that are open, closed or both. + * wait_for_active_shards?: string, // Sets the number of active shards to wait for before the operation returns. + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. * } $params * * @throws MissingParameterException if a required parameter is missing @@ -2444,8 +2546,9 @@ public function stats(array $params = []) * * @return Elasticsearch|Promise */ - public function unfreeze(array $params = []) + public function unfreeze(?array $params = null) { + $params = $params ?? []; $this->checkRequiredParameters(['index'], $params); $url = '/' . $this->encode($params['index']) . '/_unfreeze'; $method = 'POST'; @@ -2466,14 +2569,14 @@ public function unfreeze(array $params = []) * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-aliases.html * * @param array{ - * timeout: time, // Request timeout - * master_timeout: time, // Specify timeout for connection to master - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. - * body: array, // (REQUIRED) The definition of `actions` to perform + * timeout?: int|string, // Request timeout + * master_timeout?: int|string, // Specify timeout for connection to master + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. + * body: string|array, // (REQUIRED) The definition of `actions` to perform. If body is a string must be a valid JSON. * } $params * * @throws NoNodeAvailableException if all the hosts are offline @@ -2482,8 +2585,9 @@ public function unfreeze(array $params = []) * * @return Elasticsearch|Promise */ - public function updateAliases(array $params = []) + public function updateAliases(?array $params = null) { + $params = $params ?? []; $this->checkRequiredParameters(['body'], $params); $url = '/_aliases'; $method = 'POST'; @@ -2505,25 +2609,25 @@ public function updateAliases(array $params = []) * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/search-validate.html * * @param array{ - * index: list, // A comma-separated list of index names to restrict the operation; use `_all` or empty string to perform the operation on all indices - * explain: boolean, // Return detailed information about the error - * ignore_unavailable: boolean, // Whether specified concrete indices should be ignored when unavailable (missing or closed) - * allow_no_indices: boolean, // Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes `_all` string or when no indices have been specified) - * expand_wildcards: enum, // Whether to expand wildcard expression to concrete indices that are open, closed or both. - * q: string, // Query in the Lucene query string syntax - * analyzer: string, // The analyzer to use for the query string - * analyze_wildcard: boolean, // Specify whether wildcard and prefix queries should be analyzed (default: false) - * default_operator: enum, // The default operator for query string query (AND or OR) - * df: string, // The field to use as default where no field prefix is given in the query string - * lenient: boolean, // Specify whether format-based query failures (such as providing text to a numeric field) should be ignored - * rewrite: boolean, // Provide a more detailed explanation showing the actual Lucene query that will be executed. - * all_shards: boolean, // Execute validation on all shards instead of one random shard per index - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. - * body: array, // The query definition specified with the Query DSL + * index?: string|array, // A comma-separated list of index names to restrict the operation; use `_all` or empty string to perform the operation on all indices + * explain?: bool, // Return detailed information about the error + * ignore_unavailable?: bool, // Whether specified concrete indices should be ignored when unavailable (missing or closed) + * allow_no_indices?: bool, // Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes `_all` string or when no indices have been specified) + * expand_wildcards?: string, // Whether to expand wildcard expression to concrete indices that are open, closed or both. + * q?: string, // Query in the Lucene query string syntax + * analyzer?: string, // The analyzer to use for the query string + * analyze_wildcard?: bool, // Specify whether wildcard and prefix queries should be analyzed (default: false) + * default_operator?: string, // The default operator for query string query (AND or OR) + * df?: string, // The field to use as default where no field prefix is given in the query string + * lenient?: bool, // Specify whether format-based query failures (such as providing text to a numeric field) should be ignored + * rewrite?: bool, // Provide a more detailed explanation showing the actual Lucene query that will be executed. + * all_shards?: bool, // Execute validation on all shards instead of one random shard per index + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. + * body?: string|array, // The query definition specified with the Query DSL. If body is a string must be a valid JSON. * } $params * * @throws NoNodeAvailableException if all the hosts are offline @@ -2532,10 +2636,11 @@ public function updateAliases(array $params = []) * * @return Elasticsearch|Promise */ - public function validateQuery(array $params = []) + public function validateQuery(?array $params = null) { + $params = $params ?? []; if (isset($params['index'])) { - $url = '/' . $this->encode($params['index']) . '/_validate/query'; + $url = '/' . $this->encode($this->convertValue($params['index'])) . '/_validate/query'; $method = empty($params['body']) ? 'GET' : 'POST'; } else { $url = '/_validate/query'; diff --git a/src/Endpoints/Inference.php b/src/Endpoints/Inference.php index 65837f068..fd1ece9cf 100644 --- a/src/Endpoints/Inference.php +++ b/src/Endpoints/Inference.php @@ -28,22 +28,101 @@ */ class Inference extends AbstractEndpoint { + /** + * Perform chat completion inference + * + * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/chat-completion-inference.html + * + * @param array{ + * inference_id: string, // (REQUIRED) The inference Id + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. + * body?: string|array, // The inference payload. If body is a string must be a valid JSON. + * } $params + * + * @throws MissingParameterException if a required parameter is missing + * @throws NoNodeAvailableException if all the hosts are offline + * @throws ClientResponseException if the status code of response is 4xx + * @throws ServerResponseException if the status code of response is 5xx + * + * @return Elasticsearch|Promise + */ + public function chatCompletionUnified(?array $params = null) + { + $params = $params ?? []; + $this->checkRequiredParameters(['inference_id'], $params); + $url = '/_inference/chat_completion/' . $this->encode($params['inference_id']) . '/_stream'; + $method = 'POST'; + + $url = $this->addQueryString($url, $params, ['pretty','human','error_trace','source','filter_path']); + $headers = [ + 'Accept' => 'text/event-stream', + 'Content-Type' => 'application/json', + ]; + $request = $this->createRequest($method, $url, $headers, $params['body'] ?? null); + $request = $this->addOtelAttributes($params, ['inference_id'], $request, 'inference.chat_completion_unified'); + return $this->client->sendRequest($request); + } + + + /** + * Perform completion inference + * + * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/post-inference-api.html + * + * @param array{ + * inference_id: string, // (REQUIRED) The inference Id + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. + * body?: string|array, // The inference payload. If body is a string must be a valid JSON. + * } $params + * + * @throws MissingParameterException if a required parameter is missing + * @throws NoNodeAvailableException if all the hosts are offline + * @throws ClientResponseException if the status code of response is 4xx + * @throws ServerResponseException if the status code of response is 5xx + * + * @return Elasticsearch|Promise + */ + public function completion(?array $params = null) + { + $params = $params ?? []; + $this->checkRequiredParameters(['inference_id'], $params); + $url = '/_inference/completion/' . $this->encode($params['inference_id']); + $method = 'POST'; + + $url = $this->addQueryString($url, $params, ['pretty','human','error_trace','source','filter_path']); + $headers = [ + 'Accept' => 'application/json', + 'Content-Type' => 'application/json', + ]; + $request = $this->createRequest($method, $url, $headers, $params['body'] ?? null); + $request = $this->addOtelAttributes($params, ['inference_id'], $request, 'inference.completion'); + return $this->client->sendRequest($request); + } + + /** * Delete an inference endpoint * * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/delete-inference-api.html - * @internal This API is EXPERIMENTAL and may be changed or removed completely in a future release * * @param array{ * inference_id: string, // (REQUIRED) The inference Id - * task_type: string, // The task type - * dry_run: boolean, // If true the endpoint will not be deleted and a list of ingest processors which reference this endpoint will be returned. - * force: boolean, // If true the endpoint will be forcefully stopped (regardless of whether or not it is referenced by any ingest processors or semantic text fields). - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. + * task_type?: string, // The task type + * dry_run?: bool, // If true the endpoint will not be deleted and a list of ingest processors which reference this endpoint will be returned. + * force?: bool, // If true the endpoint will be forcefully stopped (regardless of whether or not it is referenced by any ingest processors or semantic text fields). + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. * } $params * * @throws MissingParameterException if a required parameter is missing @@ -53,8 +132,9 @@ class Inference extends AbstractEndpoint * * @return Elasticsearch|Promise */ - public function delete(array $params = []) + public function delete(?array $params = null) { + $params = $params ?? []; $this->checkRequiredParameters(['inference_id'], $params); if (isset($params['task_type'])) { $url = '/_inference/' . $this->encode($params['task_type']) . '/' . $this->encode($params['inference_id']); @@ -77,16 +157,15 @@ public function delete(array $params = []) * Get an inference endpoint * * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/get-inference-api.html - * @internal This API is EXPERIMENTAL and may be changed or removed completely in a future release * * @param array{ - * inference_id: string, // The inference Id - * task_type: string, // The task type - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. + * inference_id?: string, // The inference Id + * task_type?: string, // The task type + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. * } $params * * @throws NoNodeAvailableException if all the hosts are offline @@ -95,8 +174,9 @@ public function delete(array $params = []) * * @return Elasticsearch|Promise */ - public function get(array $params = []) + public function get(?array $params = null) { + $params = $params ?? []; if (isset($params['task_type']) && isset($params['inference_id'])) { $url = '/_inference/' . $this->encode($params['task_type']) . '/' . $this->encode($params['inference_id']); $method = 'GET'; @@ -121,17 +201,16 @@ public function get(array $params = []) * Perform inference * * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/post-inference-api.html - * @internal This API is EXPERIMENTAL and may be changed or removed completely in a future release * * @param array{ * inference_id: string, // (REQUIRED) The inference Id - * task_type: string, // The task type - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. - * body: array, // The inference payload + * task_type?: string, // The task type + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. + * body?: string|array, // The inference payload. If body is a string must be a valid JSON. * } $params * * @throws MissingParameterException if a required parameter is missing @@ -141,8 +220,9 @@ public function get(array $params = []) * * @return Elasticsearch|Promise */ - public function inference(array $params = []) + public function inference(?array $params = null) { + $params = $params ?? []; $this->checkRequiredParameters(['inference_id'], $params); if (isset($params['task_type'])) { $url = '/_inference/' . $this->encode($params['task_type']) . '/' . $this->encode($params['inference_id']); @@ -166,17 +246,16 @@ public function inference(array $params = []) * Configure an inference endpoint for use in the Inference API * * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/put-inference-api.html - * @internal This API is EXPERIMENTAL and may be changed or removed completely in a future release * * @param array{ * inference_id: string, // (REQUIRED) The inference Id - * task_type: string, // The task type - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. - * body: array, // The inference endpoint's task and service settings + * task_type?: string, // The task type + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. + * body?: string|array, // The inference endpoint's task and service settings. If body is a string must be a valid JSON. * } $params * * @throws MissingParameterException if a required parameter is missing @@ -186,8 +265,9 @@ public function inference(array $params = []) * * @return Elasticsearch|Promise */ - public function put(array $params = []) + public function put(?array $params = null) { + $params = $params ?? []; $this->checkRequiredParameters(['inference_id'], $params); if (isset($params['task_type'])) { $url = '/_inference/' . $this->encode($params['task_type']) . '/' . $this->encode($params['inference_id']); @@ -205,4 +285,865 @@ public function put(array $params = []) $request = $this->addOtelAttributes($params, ['inference_id', 'task_type'], $request, 'inference.put'); return $this->client->sendRequest($request); } + + + /** + * Configure an AlibabaCloud AI Search inference endpoint + * + * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/infer-service-alibabacloud-ai-search.html + * + * @param array{ + * task_type: string, // (REQUIRED) The task type + * alibabacloud_inference_id: string, // (REQUIRED) The inference Id + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. + * body?: string|array, // The inference endpoint's task and service settings. If body is a string must be a valid JSON. + * } $params + * + * @throws MissingParameterException if a required parameter is missing + * @throws NoNodeAvailableException if all the hosts are offline + * @throws ClientResponseException if the status code of response is 4xx + * @throws ServerResponseException if the status code of response is 5xx + * + * @return Elasticsearch|Promise + */ + public function putAlibabacloud(?array $params = null) + { + $params = $params ?? []; + $this->checkRequiredParameters(['task_type','alibabacloud_inference_id'], $params); + $url = '/_inference/' . $this->encode($params['task_type']) . '/' . $this->encode($params['alibabacloud_inference_id']); + $method = 'PUT'; + + $url = $this->addQueryString($url, $params, ['pretty','human','error_trace','source','filter_path']); + $headers = [ + 'Accept' => 'application/json', + 'Content-Type' => 'application/json', + ]; + $request = $this->createRequest($method, $url, $headers, $params['body'] ?? null); + $request = $this->addOtelAttributes($params, ['task_type', 'alibabacloud_inference_id'], $request, 'inference.put_alibabacloud'); + return $this->client->sendRequest($request); + } + + + /** + * Configure an Amazon Bedrock inference endpoint + * + * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/infer-service-amazon-bedrock.html + * + * @param array{ + * task_type: string, // (REQUIRED) The task type + * amazonbedrock_inference_id: string, // (REQUIRED) The inference Id + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. + * body?: string|array, // The inference endpoint's task and service settings. If body is a string must be a valid JSON. + * } $params + * + * @throws MissingParameterException if a required parameter is missing + * @throws NoNodeAvailableException if all the hosts are offline + * @throws ClientResponseException if the status code of response is 4xx + * @throws ServerResponseException if the status code of response is 5xx + * + * @return Elasticsearch|Promise + */ + public function putAmazonbedrock(?array $params = null) + { + $params = $params ?? []; + $this->checkRequiredParameters(['task_type','amazonbedrock_inference_id'], $params); + $url = '/_inference/' . $this->encode($params['task_type']) . '/' . $this->encode($params['amazonbedrock_inference_id']); + $method = 'PUT'; + + $url = $this->addQueryString($url, $params, ['pretty','human','error_trace','source','filter_path']); + $headers = [ + 'Accept' => 'application/json', + 'Content-Type' => 'application/json', + ]; + $request = $this->createRequest($method, $url, $headers, $params['body'] ?? null); + $request = $this->addOtelAttributes($params, ['task_type', 'amazonbedrock_inference_id'], $request, 'inference.put_amazonbedrock'); + return $this->client->sendRequest($request); + } + + + /** + * Configure an Anthropic inference endpoint + * + * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/infer-service-anthropic.html + * + * @param array{ + * task_type: string, // (REQUIRED) The task type + * anthropic_inference_id: string, // (REQUIRED) The inference Id + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. + * body?: string|array, // The inference endpoint's task and service settings. If body is a string must be a valid JSON. + * } $params + * + * @throws MissingParameterException if a required parameter is missing + * @throws NoNodeAvailableException if all the hosts are offline + * @throws ClientResponseException if the status code of response is 4xx + * @throws ServerResponseException if the status code of response is 5xx + * + * @return Elasticsearch|Promise + */ + public function putAnthropic(?array $params = null) + { + $params = $params ?? []; + $this->checkRequiredParameters(['task_type','anthropic_inference_id'], $params); + $url = '/_inference/' . $this->encode($params['task_type']) . '/' . $this->encode($params['anthropic_inference_id']); + $method = 'PUT'; + + $url = $this->addQueryString($url, $params, ['pretty','human','error_trace','source','filter_path']); + $headers = [ + 'Accept' => 'application/json', + 'Content-Type' => 'application/json', + ]; + $request = $this->createRequest($method, $url, $headers, $params['body'] ?? null); + $request = $this->addOtelAttributes($params, ['task_type', 'anthropic_inference_id'], $request, 'inference.put_anthropic'); + return $this->client->sendRequest($request); + } + + + /** + * Configure an Azure AI Studio inference endpoint + * + * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/infer-service-azure-ai-studio.html + * + * @param array{ + * task_type: string, // (REQUIRED) The task type + * azureaistudio_inference_id: string, // (REQUIRED) The inference Id + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. + * body?: string|array, // The inference endpoint's task and service settings. If body is a string must be a valid JSON. + * } $params + * + * @throws MissingParameterException if a required parameter is missing + * @throws NoNodeAvailableException if all the hosts are offline + * @throws ClientResponseException if the status code of response is 4xx + * @throws ServerResponseException if the status code of response is 5xx + * + * @return Elasticsearch|Promise + */ + public function putAzureaistudio(?array $params = null) + { + $params = $params ?? []; + $this->checkRequiredParameters(['task_type','azureaistudio_inference_id'], $params); + $url = '/_inference/' . $this->encode($params['task_type']) . '/' . $this->encode($params['azureaistudio_inference_id']); + $method = 'PUT'; + + $url = $this->addQueryString($url, $params, ['pretty','human','error_trace','source','filter_path']); + $headers = [ + 'Accept' => 'application/json', + 'Content-Type' => 'application/json', + ]; + $request = $this->createRequest($method, $url, $headers, $params['body'] ?? null); + $request = $this->addOtelAttributes($params, ['task_type', 'azureaistudio_inference_id'], $request, 'inference.put_azureaistudio'); + return $this->client->sendRequest($request); + } + + + /** + * Configure an Azure OpenAI inference endpoint + * + * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/infer-service-azure-openai.html + * + * @param array{ + * task_type: string, // (REQUIRED) The task type + * azureopenai_inference_id: string, // (REQUIRED) The inference Id + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. + * body?: string|array, // The inference endpoint's task and service settings. If body is a string must be a valid JSON. + * } $params + * + * @throws MissingParameterException if a required parameter is missing + * @throws NoNodeAvailableException if all the hosts are offline + * @throws ClientResponseException if the status code of response is 4xx + * @throws ServerResponseException if the status code of response is 5xx + * + * @return Elasticsearch|Promise + */ + public function putAzureopenai(?array $params = null) + { + $params = $params ?? []; + $this->checkRequiredParameters(['task_type','azureopenai_inference_id'], $params); + $url = '/_inference/' . $this->encode($params['task_type']) . '/' . $this->encode($params['azureopenai_inference_id']); + $method = 'PUT'; + + $url = $this->addQueryString($url, $params, ['pretty','human','error_trace','source','filter_path']); + $headers = [ + 'Accept' => 'application/json', + 'Content-Type' => 'application/json', + ]; + $request = $this->createRequest($method, $url, $headers, $params['body'] ?? null); + $request = $this->addOtelAttributes($params, ['task_type', 'azureopenai_inference_id'], $request, 'inference.put_azureopenai'); + return $this->client->sendRequest($request); + } + + + /** + * Configure a Cohere inference endpoint + * + * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/infer-service-cohere.html + * + * @param array{ + * task_type: string, // (REQUIRED) The task type + * cohere_inference_id: string, // (REQUIRED) The inference Id + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. + * body?: string|array, // The inference endpoint's task and service settings. If body is a string must be a valid JSON. + * } $params + * + * @throws MissingParameterException if a required parameter is missing + * @throws NoNodeAvailableException if all the hosts are offline + * @throws ClientResponseException if the status code of response is 4xx + * @throws ServerResponseException if the status code of response is 5xx + * + * @return Elasticsearch|Promise + */ + public function putCohere(?array $params = null) + { + $params = $params ?? []; + $this->checkRequiredParameters(['task_type','cohere_inference_id'], $params); + $url = '/_inference/' . $this->encode($params['task_type']) . '/' . $this->encode($params['cohere_inference_id']); + $method = 'PUT'; + + $url = $this->addQueryString($url, $params, ['pretty','human','error_trace','source','filter_path']); + $headers = [ + 'Accept' => 'application/json', + 'Content-Type' => 'application/json', + ]; + $request = $this->createRequest($method, $url, $headers, $params['body'] ?? null); + $request = $this->addOtelAttributes($params, ['task_type', 'cohere_inference_id'], $request, 'inference.put_cohere'); + return $this->client->sendRequest($request); + } + + + /** + * Configure an Elasticsearch inference endpoint + * + * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/infer-service-elasticsearch.html + * + * @param array{ + * task_type: string, // (REQUIRED) The task type + * elasticsearch_inference_id: string, // (REQUIRED) The inference Id + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. + * body?: string|array, // The inference endpoint's task and service settings. If body is a string must be a valid JSON. + * } $params + * + * @throws MissingParameterException if a required parameter is missing + * @throws NoNodeAvailableException if all the hosts are offline + * @throws ClientResponseException if the status code of response is 4xx + * @throws ServerResponseException if the status code of response is 5xx + * + * @return Elasticsearch|Promise + */ + public function putElasticsearch(?array $params = null) + { + $params = $params ?? []; + $this->checkRequiredParameters(['task_type','elasticsearch_inference_id'], $params); + $url = '/_inference/' . $this->encode($params['task_type']) . '/' . $this->encode($params['elasticsearch_inference_id']); + $method = 'PUT'; + + $url = $this->addQueryString($url, $params, ['pretty','human','error_trace','source','filter_path']); + $headers = [ + 'Accept' => 'application/json', + 'Content-Type' => 'application/json', + ]; + $request = $this->createRequest($method, $url, $headers, $params['body'] ?? null); + $request = $this->addOtelAttributes($params, ['task_type', 'elasticsearch_inference_id'], $request, 'inference.put_elasticsearch'); + return $this->client->sendRequest($request); + } + + + /** + * Configure an ELSER inference endpoint + * + * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/infer-service-elser.html + * + * @param array{ + * task_type: string, // (REQUIRED) The task type + * elser_inference_id: string, // (REQUIRED) The inference Id + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. + * body?: string|array, // The inference endpoint's task and service settings. If body is a string must be a valid JSON. + * } $params + * + * @throws MissingParameterException if a required parameter is missing + * @throws NoNodeAvailableException if all the hosts are offline + * @throws ClientResponseException if the status code of response is 4xx + * @throws ServerResponseException if the status code of response is 5xx + * + * @return Elasticsearch|Promise + */ + public function putElser(?array $params = null) + { + $params = $params ?? []; + $this->checkRequiredParameters(['task_type','elser_inference_id'], $params); + $url = '/_inference/' . $this->encode($params['task_type']) . '/' . $this->encode($params['elser_inference_id']); + $method = 'PUT'; + + $url = $this->addQueryString($url, $params, ['pretty','human','error_trace','source','filter_path']); + $headers = [ + 'Accept' => 'application/json', + 'Content-Type' => 'application/json', + ]; + $request = $this->createRequest($method, $url, $headers, $params['body'] ?? null); + $request = $this->addOtelAttributes($params, ['task_type', 'elser_inference_id'], $request, 'inference.put_elser'); + return $this->client->sendRequest($request); + } + + + /** + * Configure a Google AI Studio inference endpoint + * + * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/infer-service-google-ai-studio.html + * + * @param array{ + * task_type: string, // (REQUIRED) The task type + * googleaistudio_inference_id: string, // (REQUIRED) The inference Id + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. + * body?: string|array, // The inference endpoint's task and service settings. If body is a string must be a valid JSON. + * } $params + * + * @throws MissingParameterException if a required parameter is missing + * @throws NoNodeAvailableException if all the hosts are offline + * @throws ClientResponseException if the status code of response is 4xx + * @throws ServerResponseException if the status code of response is 5xx + * + * @return Elasticsearch|Promise + */ + public function putGoogleaistudio(?array $params = null) + { + $params = $params ?? []; + $this->checkRequiredParameters(['task_type','googleaistudio_inference_id'], $params); + $url = '/_inference/' . $this->encode($params['task_type']) . '/' . $this->encode($params['googleaistudio_inference_id']); + $method = 'PUT'; + + $url = $this->addQueryString($url, $params, ['pretty','human','error_trace','source','filter_path']); + $headers = [ + 'Accept' => 'application/json', + 'Content-Type' => 'application/json', + ]; + $request = $this->createRequest($method, $url, $headers, $params['body'] ?? null); + $request = $this->addOtelAttributes($params, ['task_type', 'googleaistudio_inference_id'], $request, 'inference.put_googleaistudio'); + return $this->client->sendRequest($request); + } + + + /** + * Configure a Google Vertex AI inference endpoint + * + * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/infer-service-google-vertex-ai.html + * + * @param array{ + * task_type: string, // (REQUIRED) The task type + * googlevertexai_inference_id: string, // (REQUIRED) The inference Id + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. + * body?: string|array, // The inference endpoint's task and service settings. If body is a string must be a valid JSON. + * } $params + * + * @throws MissingParameterException if a required parameter is missing + * @throws NoNodeAvailableException if all the hosts are offline + * @throws ClientResponseException if the status code of response is 4xx + * @throws ServerResponseException if the status code of response is 5xx + * + * @return Elasticsearch|Promise + */ + public function putGooglevertexai(?array $params = null) + { + $params = $params ?? []; + $this->checkRequiredParameters(['task_type','googlevertexai_inference_id'], $params); + $url = '/_inference/' . $this->encode($params['task_type']) . '/' . $this->encode($params['googlevertexai_inference_id']); + $method = 'PUT'; + + $url = $this->addQueryString($url, $params, ['pretty','human','error_trace','source','filter_path']); + $headers = [ + 'Accept' => 'application/json', + 'Content-Type' => 'application/json', + ]; + $request = $this->createRequest($method, $url, $headers, $params['body'] ?? null); + $request = $this->addOtelAttributes($params, ['task_type', 'googlevertexai_inference_id'], $request, 'inference.put_googlevertexai'); + return $this->client->sendRequest($request); + } + + + /** + * Configure a HuggingFace inference endpoint + * + * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/infer-service-hugging-face.html + * + * @param array{ + * task_type: string, // (REQUIRED) The task type + * huggingface_inference_id: string, // (REQUIRED) The inference Id + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. + * body?: string|array, // The inference endpoint's task and service settings. If body is a string must be a valid JSON. + * } $params + * + * @throws MissingParameterException if a required parameter is missing + * @throws NoNodeAvailableException if all the hosts are offline + * @throws ClientResponseException if the status code of response is 4xx + * @throws ServerResponseException if the status code of response is 5xx + * + * @return Elasticsearch|Promise + */ + public function putHuggingFace(?array $params = null) + { + $params = $params ?? []; + $this->checkRequiredParameters(['task_type','huggingface_inference_id'], $params); + $url = '/_inference/' . $this->encode($params['task_type']) . '/' . $this->encode($params['huggingface_inference_id']); + $method = 'PUT'; + + $url = $this->addQueryString($url, $params, ['pretty','human','error_trace','source','filter_path']); + $headers = [ + 'Accept' => 'application/json', + 'Content-Type' => 'application/json', + ]; + $request = $this->createRequest($method, $url, $headers, $params['body'] ?? null); + $request = $this->addOtelAttributes($params, ['task_type', 'huggingface_inference_id'], $request, 'inference.put_hugging_face'); + return $this->client->sendRequest($request); + } + + + /** + * Configure a JinaAI inference endpoint + * + * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/infer-service-jinaai.html + * + * @param array{ + * task_type: string, // (REQUIRED) The task type + * jinaai_inference_id: string, // (REQUIRED) The inference Id + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. + * body?: string|array, // The inference endpoint's task and service settings. If body is a string must be a valid JSON. + * } $params + * + * @throws MissingParameterException if a required parameter is missing + * @throws NoNodeAvailableException if all the hosts are offline + * @throws ClientResponseException if the status code of response is 4xx + * @throws ServerResponseException if the status code of response is 5xx + * + * @return Elasticsearch|Promise + */ + public function putJinaai(?array $params = null) + { + $params = $params ?? []; + $this->checkRequiredParameters(['task_type','jinaai_inference_id'], $params); + $url = '/_inference/' . $this->encode($params['task_type']) . '/' . $this->encode($params['jinaai_inference_id']); + $method = 'PUT'; + + $url = $this->addQueryString($url, $params, ['pretty','human','error_trace','source','filter_path']); + $headers = [ + 'Accept' => 'application/json', + 'Content-Type' => 'application/json', + ]; + $request = $this->createRequest($method, $url, $headers, $params['body'] ?? null); + $request = $this->addOtelAttributes($params, ['task_type', 'jinaai_inference_id'], $request, 'inference.put_jinaai'); + return $this->client->sendRequest($request); + } + + + /** + * Configure a Mistral inference endpoint + * + * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/infer-service-mistral.html + * + * @param array{ + * task_type: string, // (REQUIRED) The task type + * mistral_inference_id: string, // (REQUIRED) The inference Id + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. + * body?: string|array, // The inference endpoint's task and service settings. If body is a string must be a valid JSON. + * } $params + * + * @throws MissingParameterException if a required parameter is missing + * @throws NoNodeAvailableException if all the hosts are offline + * @throws ClientResponseException if the status code of response is 4xx + * @throws ServerResponseException if the status code of response is 5xx + * + * @return Elasticsearch|Promise + */ + public function putMistral(?array $params = null) + { + $params = $params ?? []; + $this->checkRequiredParameters(['task_type','mistral_inference_id'], $params); + $url = '/_inference/' . $this->encode($params['task_type']) . '/' . $this->encode($params['mistral_inference_id']); + $method = 'PUT'; + + $url = $this->addQueryString($url, $params, ['pretty','human','error_trace','source','filter_path']); + $headers = [ + 'Accept' => 'application/json', + 'Content-Type' => 'application/json', + ]; + $request = $this->createRequest($method, $url, $headers, $params['body'] ?? null); + $request = $this->addOtelAttributes($params, ['task_type', 'mistral_inference_id'], $request, 'inference.put_mistral'); + return $this->client->sendRequest($request); + } + + + /** + * Configure an OpenAI inference endpoint + * + * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/infer-service-openai.html + * + * @param array{ + * task_type: string, // (REQUIRED) The task type + * openai_inference_id: string, // (REQUIRED) The inference ID + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. + * body?: string|array, // The inference endpoint's task and service settings. If body is a string must be a valid JSON. + * } $params + * + * @throws MissingParameterException if a required parameter is missing + * @throws NoNodeAvailableException if all the hosts are offline + * @throws ClientResponseException if the status code of response is 4xx + * @throws ServerResponseException if the status code of response is 5xx + * + * @return Elasticsearch|Promise + */ + public function putOpenai(?array $params = null) + { + $params = $params ?? []; + $this->checkRequiredParameters(['task_type','openai_inference_id'], $params); + $url = '/_inference/' . $this->encode($params['task_type']) . '/' . $this->encode($params['openai_inference_id']); + $method = 'PUT'; + + $url = $this->addQueryString($url, $params, ['pretty','human','error_trace','source','filter_path']); + $headers = [ + 'Accept' => 'application/json', + 'Content-Type' => 'application/json', + ]; + $request = $this->createRequest($method, $url, $headers, $params['body'] ?? null); + $request = $this->addOtelAttributes($params, ['task_type', 'openai_inference_id'], $request, 'inference.put_openai'); + return $this->client->sendRequest($request); + } + + + /** + * Configure a VoyageAI inference endpoint + * + * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/inference-apis.html + * + * @param array{ + * task_type: string, // (REQUIRED) The task type + * voyageai_inference_id: string, // (REQUIRED) The inference ID + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. + * body?: string|array, // The inference endpoint's task and service settings. If body is a string must be a valid JSON. + * } $params + * + * @throws MissingParameterException if a required parameter is missing + * @throws NoNodeAvailableException if all the hosts are offline + * @throws ClientResponseException if the status code of response is 4xx + * @throws ServerResponseException if the status code of response is 5xx + * + * @return Elasticsearch|Promise + */ + public function putVoyageai(?array $params = null) + { + $params = $params ?? []; + $this->checkRequiredParameters(['task_type','voyageai_inference_id'], $params); + $url = '/_inference/' . $this->encode($params['task_type']) . '/' . $this->encode($params['voyageai_inference_id']); + $method = 'PUT'; + + $url = $this->addQueryString($url, $params, ['pretty','human','error_trace','source','filter_path']); + $headers = [ + 'Accept' => 'application/json', + 'Content-Type' => 'application/json', + ]; + $request = $this->createRequest($method, $url, $headers, $params['body'] ?? null); + $request = $this->addOtelAttributes($params, ['task_type', 'voyageai_inference_id'], $request, 'inference.put_voyageai'); + return $this->client->sendRequest($request); + } + + + /** + * Configure a Watsonx inference endpoint + * + * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/infer-service-watsonx-ai.html + * + * @param array{ + * task_type: string, // (REQUIRED) The task type + * watsonx_inference_id: string, // (REQUIRED) The inference Id + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. + * body?: string|array, // The inference endpoint's task and service settings. If body is a string must be a valid JSON. + * } $params + * + * @throws MissingParameterException if a required parameter is missing + * @throws NoNodeAvailableException if all the hosts are offline + * @throws ClientResponseException if the status code of response is 4xx + * @throws ServerResponseException if the status code of response is 5xx + * + * @return Elasticsearch|Promise + */ + public function putWatsonx(?array $params = null) + { + $params = $params ?? []; + $this->checkRequiredParameters(['task_type','watsonx_inference_id'], $params); + $url = '/_inference/' . $this->encode($params['task_type']) . '/' . $this->encode($params['watsonx_inference_id']); + $method = 'PUT'; + + $url = $this->addQueryString($url, $params, ['pretty','human','error_trace','source','filter_path']); + $headers = [ + 'Accept' => 'application/json', + 'Content-Type' => 'application/json', + ]; + $request = $this->createRequest($method, $url, $headers, $params['body'] ?? null); + $request = $this->addOtelAttributes($params, ['task_type', 'watsonx_inference_id'], $request, 'inference.put_watsonx'); + return $this->client->sendRequest($request); + } + + + /** + * Perform reranking inference + * + * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/post-inference-api.html + * + * @param array{ + * inference_id: string, // (REQUIRED) The inference Id + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. + * body?: string|array, // The inference payload. If body is a string must be a valid JSON. + * } $params + * + * @throws MissingParameterException if a required parameter is missing + * @throws NoNodeAvailableException if all the hosts are offline + * @throws ClientResponseException if the status code of response is 4xx + * @throws ServerResponseException if the status code of response is 5xx + * + * @return Elasticsearch|Promise + */ + public function rerank(?array $params = null) + { + $params = $params ?? []; + $this->checkRequiredParameters(['inference_id'], $params); + $url = '/_inference/rerank/' . $this->encode($params['inference_id']); + $method = 'POST'; + + $url = $this->addQueryString($url, $params, ['pretty','human','error_trace','source','filter_path']); + $headers = [ + 'Accept' => 'application/json', + 'Content-Type' => 'application/json', + ]; + $request = $this->createRequest($method, $url, $headers, $params['body'] ?? null); + $request = $this->addOtelAttributes($params, ['inference_id'], $request, 'inference.rerank'); + return $this->client->sendRequest($request); + } + + + /** + * Perform sparse embedding inference + * + * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/post-inference-api.html + * + * @param array{ + * inference_id: string, // (REQUIRED) The inference Id + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. + * body?: string|array, // The inference payload. If body is a string must be a valid JSON. + * } $params + * + * @throws MissingParameterException if a required parameter is missing + * @throws NoNodeAvailableException if all the hosts are offline + * @throws ClientResponseException if the status code of response is 4xx + * @throws ServerResponseException if the status code of response is 5xx + * + * @return Elasticsearch|Promise + */ + public function sparseEmbedding(?array $params = null) + { + $params = $params ?? []; + $this->checkRequiredParameters(['inference_id'], $params); + $url = '/_inference/sparse_embedding/' . $this->encode($params['inference_id']); + $method = 'POST'; + + $url = $this->addQueryString($url, $params, ['pretty','human','error_trace','source','filter_path']); + $headers = [ + 'Accept' => 'application/json', + 'Content-Type' => 'application/json', + ]; + $request = $this->createRequest($method, $url, $headers, $params['body'] ?? null); + $request = $this->addOtelAttributes($params, ['inference_id'], $request, 'inference.sparse_embedding'); + return $this->client->sendRequest($request); + } + + + /** + * Perform streaming completion inference + * + * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/post-stream-inference-api.html + * + * @param array{ + * inference_id: string, // (REQUIRED) The inference Id + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. + * body?: string|array, // The inference payload. If body is a string must be a valid JSON. + * } $params + * + * @throws MissingParameterException if a required parameter is missing + * @throws NoNodeAvailableException if all the hosts are offline + * @throws ClientResponseException if the status code of response is 4xx + * @throws ServerResponseException if the status code of response is 5xx + * + * @return Elasticsearch|Promise + */ + public function streamCompletion(?array $params = null) + { + $params = $params ?? []; + $this->checkRequiredParameters(['inference_id'], $params); + $url = '/_inference/completion/' . $this->encode($params['inference_id']) . '/_stream'; + $method = 'POST'; + + $url = $this->addQueryString($url, $params, ['pretty','human','error_trace','source','filter_path']); + $headers = [ + 'Accept' => 'text/event-stream', + 'Content-Type' => 'application/json', + ]; + $request = $this->createRequest($method, $url, $headers, $params['body'] ?? null); + $request = $this->addOtelAttributes($params, ['inference_id'], $request, 'inference.stream_completion'); + return $this->client->sendRequest($request); + } + + + /** + * Perform text embedding inference + * + * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/post-inference-api.html + * + * @param array{ + * inference_id: string, // (REQUIRED) The inference Id + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. + * body?: string|array, // The inference payload. If body is a string must be a valid JSON. + * } $params + * + * @throws MissingParameterException if a required parameter is missing + * @throws NoNodeAvailableException if all the hosts are offline + * @throws ClientResponseException if the status code of response is 4xx + * @throws ServerResponseException if the status code of response is 5xx + * + * @return Elasticsearch|Promise + */ + public function textEmbedding(?array $params = null) + { + $params = $params ?? []; + $this->checkRequiredParameters(['inference_id'], $params); + $url = '/_inference/text_embedding/' . $this->encode($params['inference_id']); + $method = 'POST'; + + $url = $this->addQueryString($url, $params, ['pretty','human','error_trace','source','filter_path']); + $headers = [ + 'Accept' => 'application/json', + 'Content-Type' => 'application/json', + ]; + $request = $this->createRequest($method, $url, $headers, $params['body'] ?? null); + $request = $this->addOtelAttributes($params, ['inference_id'], $request, 'inference.text_embedding'); + return $this->client->sendRequest($request); + } + + + /** + * Update inference + * + * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/update-inference-api.html + * + * @param array{ + * inference_id: string, // (REQUIRED) The inference Id + * task_type?: string, // The task type + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. + * body?: string|array, // The inference endpoint's task and service settings. If body is a string must be a valid JSON. + * } $params + * + * @throws MissingParameterException if a required parameter is missing + * @throws NoNodeAvailableException if all the hosts are offline + * @throws ClientResponseException if the status code of response is 4xx + * @throws ServerResponseException if the status code of response is 5xx + * + * @return Elasticsearch|Promise + */ + public function update(?array $params = null) + { + $params = $params ?? []; + $this->checkRequiredParameters(['inference_id'], $params); + if (isset($params['task_type'])) { + $url = '/_inference/' . $this->encode($params['task_type']) . '/' . $this->encode($params['inference_id']) . '/_update'; + $method = 'PUT'; + } else { + $url = '/_inference/' . $this->encode($params['inference_id']) . '/_update'; + $method = 'PUT'; + } + $url = $this->addQueryString($url, $params, ['pretty','human','error_trace','source','filter_path']); + $headers = [ + 'Accept' => 'application/json', + 'Content-Type' => 'application/json', + ]; + $request = $this->createRequest($method, $url, $headers, $params['body'] ?? null); + $request = $this->addOtelAttributes($params, ['inference_id', 'task_type'], $request, 'inference.update'); + return $this->client->sendRequest($request); + } } diff --git a/src/Endpoints/Ingest.php b/src/Endpoints/Ingest.php index 0626caa35..83ade1f60 100644 --- a/src/Endpoints/Ingest.php +++ b/src/Endpoints/Ingest.php @@ -31,15 +31,15 @@ class Ingest extends AbstractEndpoint /** * Deletes a geoip database configuration * - * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/TODO.html + * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/delete-geoip-database-api.html * * @param array{ - * id: list, // (REQUIRED) A comma-separated list of geoip database configurations to delete - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. + * id: string|array, // (REQUIRED) A comma-separated list of geoip database configurations to delete + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. * } $params * * @throws MissingParameterException if a required parameter is missing @@ -49,10 +49,11 @@ class Ingest extends AbstractEndpoint * * @return Elasticsearch|Promise */ - public function deleteGeoipDatabase(array $params = []) + public function deleteGeoipDatabase(?array $params = null) { + $params = $params ?? []; $this->checkRequiredParameters(['id'], $params); - $url = '/_ingest/geoip/database/' . $this->encode($params['id']); + $url = '/_ingest/geoip/database/' . $this->encode($this->convertValue($params['id'])); $method = 'DELETE'; $url = $this->addQueryString($url, $params, ['pretty','human','error_trace','source','filter_path']); @@ -65,6 +66,44 @@ public function deleteGeoipDatabase(array $params = []) } + /** + * Deletes an ip location database configuration + * + * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/delete-ip-location-database-api.html + * + * @param array{ + * id: string|array, // (REQUIRED) A comma-separated list of ip location database configurations to delete + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. + * } $params + * + * @throws MissingParameterException if a required parameter is missing + * @throws NoNodeAvailableException if all the hosts are offline + * @throws ClientResponseException if the status code of response is 4xx + * @throws ServerResponseException if the status code of response is 5xx + * + * @return Elasticsearch|Promise + */ + public function deleteIpLocationDatabase(?array $params = null) + { + $params = $params ?? []; + $this->checkRequiredParameters(['id'], $params); + $url = '/_ingest/ip_location/database/' . $this->encode($this->convertValue($params['id'])); + $method = 'DELETE'; + + $url = $this->addQueryString($url, $params, ['pretty','human','error_trace','source','filter_path']); + $headers = [ + 'Accept' => 'application/json', + ]; + $request = $this->createRequest($method, $url, $headers, $params['body'] ?? null); + $request = $this->addOtelAttributes($params, ['id'], $request, 'ingest.delete_ip_location_database'); + return $this->client->sendRequest($request); + } + + /** * Deletes a pipeline. * @@ -72,13 +111,13 @@ public function deleteGeoipDatabase(array $params = []) * * @param array{ * id: string, // (REQUIRED) Pipeline ID - * master_timeout: time, // Explicit operation timeout for connection to master node - * timeout: time, // Explicit operation timeout - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. + * master_timeout?: int|string, // Explicit operation timeout for connection to master node + * timeout?: int|string, // Explicit operation timeout + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. * } $params * * @throws MissingParameterException if a required parameter is missing @@ -88,8 +127,9 @@ public function deleteGeoipDatabase(array $params = []) * * @return Elasticsearch|Promise */ - public function deletePipeline(array $params = []) + public function deletePipeline(?array $params = null) { + $params = $params ?? []; $this->checkRequiredParameters(['id'], $params); $url = '/_ingest/pipeline/' . $this->encode($params['id']); $method = 'DELETE'; @@ -110,11 +150,11 @@ public function deletePipeline(array $params = []) * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/geoip-stats-api.html * * @param array{ - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. * } $params * * @throws NoNodeAvailableException if all the hosts are offline @@ -123,8 +163,9 @@ public function deletePipeline(array $params = []) * * @return Elasticsearch|Promise */ - public function geoIpStats(array $params = []) + public function geoIpStats(?array $params = null) { + $params = $params ?? []; $url = '/_ingest/geoip/stats'; $method = 'GET'; @@ -141,15 +182,15 @@ public function geoIpStats(array $params = []) /** * Returns geoip database configuration. * - * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/TODO.html + * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/get-geoip-database-api.html * * @param array{ - * id: list, // A comma-separated list of geoip database configurations to get; use `*` to get all geoip database configurations - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. + * id?: string|array, // A comma-separated list of geoip database configurations to get; use `*` to get all geoip database configurations + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. * } $params * * @throws NoNodeAvailableException if all the hosts are offline @@ -158,10 +199,11 @@ public function geoIpStats(array $params = []) * * @return Elasticsearch|Promise */ - public function getGeoipDatabase(array $params = []) + public function getGeoipDatabase(?array $params = null) { + $params = $params ?? []; if (isset($params['id'])) { - $url = '/_ingest/geoip/database/' . $this->encode($params['id']); + $url = '/_ingest/geoip/database/' . $this->encode($this->convertValue($params['id'])); $method = 'GET'; } else { $url = '/_ingest/geoip/database'; @@ -177,20 +219,60 @@ public function getGeoipDatabase(array $params = []) } + /** + * Returns the specified ip location database configuration + * + * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/get-ip-location-database-api.html + * + * @param array{ + * id?: string|array, // A comma-separated list of ip location database configurations to get; use `*` to get all ip location database configurations + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. + * } $params + * + * @throws NoNodeAvailableException if all the hosts are offline + * @throws ClientResponseException if the status code of response is 4xx + * @throws ServerResponseException if the status code of response is 5xx + * + * @return Elasticsearch|Promise + */ + public function getIpLocationDatabase(?array $params = null) + { + $params = $params ?? []; + if (isset($params['id'])) { + $url = '/_ingest/ip_location/database/' . $this->encode($this->convertValue($params['id'])); + $method = 'GET'; + } else { + $url = '/_ingest/ip_location/database'; + $method = 'GET'; + } + $url = $this->addQueryString($url, $params, ['pretty','human','error_trace','source','filter_path']); + $headers = [ + 'Accept' => 'application/json', + ]; + $request = $this->createRequest($method, $url, $headers, $params['body'] ?? null); + $request = $this->addOtelAttributes($params, ['id'], $request, 'ingest.get_ip_location_database'); + return $this->client->sendRequest($request); + } + + /** * Returns a pipeline. * * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/get-pipeline-api.html * * @param array{ - * id: string, // Comma separated list of pipeline ids. Wildcards supported - * summary: boolean, // Return pipelines without their definitions (default: false) - * master_timeout: time, // Explicit operation timeout for connection to master node - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. + * id?: string, // Comma separated list of pipeline ids. Wildcards supported + * summary?: bool, // Return pipelines without their definitions (default: false) + * master_timeout?: int|string, // Explicit operation timeout for connection to master node + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. * } $params * * @throws NoNodeAvailableException if all the hosts are offline @@ -199,8 +281,9 @@ public function getGeoipDatabase(array $params = []) * * @return Elasticsearch|Promise */ - public function getPipeline(array $params = []) + public function getPipeline(?array $params = null) { + $params = $params ?? []; if (isset($params['id'])) { $url = '/_ingest/pipeline/' . $this->encode($params['id']); $method = 'GET'; @@ -224,11 +307,11 @@ public function getPipeline(array $params = []) * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/grok-processor.html#grok-processor-rest-get * * @param array{ - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. * } $params * * @throws NoNodeAvailableException if all the hosts are offline @@ -237,8 +320,9 @@ public function getPipeline(array $params = []) * * @return Elasticsearch|Promise */ - public function processorGrok(array $params = []) + public function processorGrok(?array $params = null) { + $params = $params ?? []; $url = '/_ingest/processor/grok'; $method = 'GET'; @@ -255,16 +339,16 @@ public function processorGrok(array $params = []) /** * Puts the configuration for a geoip database to be downloaded * - * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/TODO.html + * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/put-geoip-database-api.html * * @param array{ * id: string, // (REQUIRED) The id of the database configuration - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. - * body: array, // (REQUIRED) The database configuration definition + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. + * body: string|array, // (REQUIRED) The database configuration definition. If body is a string must be a valid JSON. * } $params * * @throws MissingParameterException if a required parameter is missing @@ -274,8 +358,9 @@ public function processorGrok(array $params = []) * * @return Elasticsearch|Promise */ - public function putGeoipDatabase(array $params = []) + public function putGeoipDatabase(?array $params = null) { + $params = $params ?? []; $this->checkRequiredParameters(['id','body'], $params); $url = '/_ingest/geoip/database/' . $this->encode($params['id']); $method = 'PUT'; @@ -283,6 +368,7 @@ public function putGeoipDatabase(array $params = []) $url = $this->addQueryString($url, $params, ['pretty','human','error_trace','source','filter_path']); $headers = [ 'Accept' => 'application/json', + 'Content-Type' => 'application/json', ]; $request = $this->createRequest($method, $url, $headers, $params['body'] ?? null); $request = $this->addOtelAttributes($params, ['id'], $request, 'ingest.put_geoip_database'); @@ -290,6 +376,46 @@ public function putGeoipDatabase(array $params = []) } + /** + * Puts the configuration for a ip location database to be downloaded + * + * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/put-ip-location-database-api.html + * + * @param array{ + * id: string, // (REQUIRED) The id of the database configuration + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. + * body: string|array, // (REQUIRED) The database configuration definition. If body is a string must be a valid JSON. + * } $params + * + * @throws MissingParameterException if a required parameter is missing + * @throws NoNodeAvailableException if all the hosts are offline + * @throws ClientResponseException if the status code of response is 4xx + * @throws ServerResponseException if the status code of response is 5xx + * + * @return Elasticsearch|Promise + */ + public function putIpLocationDatabase(?array $params = null) + { + $params = $params ?? []; + $this->checkRequiredParameters(['id','body'], $params); + $url = '/_ingest/ip_location/database/' . $this->encode($params['id']); + $method = 'PUT'; + + $url = $this->addQueryString($url, $params, ['pretty','human','error_trace','source','filter_path']); + $headers = [ + 'Accept' => 'application/json', + 'Content-Type' => 'application/json', + ]; + $request = $this->createRequest($method, $url, $headers, $params['body'] ?? null); + $request = $this->addOtelAttributes($params, ['id'], $request, 'ingest.put_ip_location_database'); + return $this->client->sendRequest($request); + } + + /** * Creates or updates a pipeline. * @@ -297,15 +423,15 @@ public function putGeoipDatabase(array $params = []) * * @param array{ * id: string, // (REQUIRED) Pipeline ID - * if_version: int, // Required version for optimistic concurrency control for pipeline updates - * master_timeout: time, // Explicit operation timeout for connection to master node - * timeout: time, // Explicit operation timeout - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. - * body: array, // (REQUIRED) The ingest definition + * if_version?: int, // Required version for optimistic concurrency control for pipeline updates + * master_timeout?: int|string, // Explicit operation timeout for connection to master node + * timeout?: int|string, // Explicit operation timeout + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. + * body: string|array, // (REQUIRED) The ingest definition. If body is a string must be a valid JSON. * } $params * * @throws MissingParameterException if a required parameter is missing @@ -315,8 +441,9 @@ public function putGeoipDatabase(array $params = []) * * @return Elasticsearch|Promise */ - public function putPipeline(array $params = []) + public function putPipeline(?array $params = null) { + $params = $params ?? []; $this->checkRequiredParameters(['id','body'], $params); $url = '/_ingest/pipeline/' . $this->encode($params['id']); $method = 'PUT'; @@ -338,14 +465,14 @@ public function putPipeline(array $params = []) * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/simulate-pipeline-api.html * * @param array{ - * id: string, // Pipeline ID - * verbose: boolean, // Verbose mode. Display data output for each processor in executed pipeline - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. - * body: array, // (REQUIRED) The simulate definition + * id?: string, // Pipeline ID + * verbose?: bool, // Verbose mode. Display data output for each processor in executed pipeline + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. + * body: string|array, // (REQUIRED) The simulate definition. If body is a string must be a valid JSON. * } $params * * @throws NoNodeAvailableException if all the hosts are offline @@ -354,8 +481,9 @@ public function putPipeline(array $params = []) * * @return Elasticsearch|Promise */ - public function simulate(array $params = []) + public function simulate(?array $params = null) { + $params = $params ?? []; $this->checkRequiredParameters(['body'], $params); if (isset($params['id'])) { $url = '/_ingest/pipeline/' . $this->encode($params['id']) . '/_simulate'; diff --git a/src/Endpoints/License.php b/src/Endpoints/License.php index 1c60053a4..79e9e6108 100644 --- a/src/Endpoints/License.php +++ b/src/Endpoints/License.php @@ -34,13 +34,13 @@ class License extends AbstractEndpoint * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/delete-license.html * * @param array{ - * master_timeout: time, // Timeout for processing on master node - * timeout: time, // Timeout for acknowledgement of update from all nodes in cluster - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. + * master_timeout?: int|string, // Timeout for processing on master node + * timeout?: int|string, // Timeout for acknowledgement of update from all nodes in cluster + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. * } $params * * @throws NoNodeAvailableException if all the hosts are offline @@ -49,8 +49,9 @@ class License extends AbstractEndpoint * * @return Elasticsearch|Promise */ - public function delete(array $params = []) + public function delete(?array $params = null) { + $params = $params ?? []; $url = '/_license'; $method = 'DELETE'; @@ -70,13 +71,13 @@ public function delete(array $params = []) * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/get-license.html * * @param array{ - * local: boolean, // Return local information, do not retrieve the state from master node (default: false) - * accept_enterprise: boolean, // Supported for backwards compatibility with 7.x. If this param is used it must be set to true - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. + * local?: bool, // Return local information, do not retrieve the state from master node (default: false) + * accept_enterprise?: bool, // Supported for backwards compatibility with 7.x. If this param is used it must be set to true + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. * } $params * * @throws NoNodeAvailableException if all the hosts are offline @@ -85,8 +86,9 @@ public function delete(array $params = []) * * @return Elasticsearch|Promise */ - public function get(array $params = []) + public function get(?array $params = null) { + $params = $params ?? []; $url = '/_license'; $method = 'GET'; @@ -106,11 +108,11 @@ public function get(array $params = []) * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/get-basic-status.html * * @param array{ - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. * } $params * * @throws NoNodeAvailableException if all the hosts are offline @@ -119,8 +121,9 @@ public function get(array $params = []) * * @return Elasticsearch|Promise */ - public function getBasicStatus(array $params = []) + public function getBasicStatus(?array $params = null) { + $params = $params ?? []; $url = '/_license/basic_status'; $method = 'GET'; @@ -140,11 +143,11 @@ public function getBasicStatus(array $params = []) * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/get-trial-status.html * * @param array{ - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. * } $params * * @throws NoNodeAvailableException if all the hosts are offline @@ -153,8 +156,9 @@ public function getBasicStatus(array $params = []) * * @return Elasticsearch|Promise */ - public function getTrialStatus(array $params = []) + public function getTrialStatus(?array $params = null) { + $params = $params ?? []; $url = '/_license/trial_status'; $method = 'GET'; @@ -174,15 +178,15 @@ public function getTrialStatus(array $params = []) * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/update-license.html * * @param array{ - * acknowledge: boolean, // whether the user has acknowledged acknowledge messages (default: false) - * master_timeout: time, // Timeout for processing on master node - * timeout: time, // Timeout for acknowledgement of update from all nodes in cluster - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. - * body: array, // licenses to be installed + * acknowledge?: bool, // whether the user has acknowledged acknowledge messages (default: false) + * master_timeout?: int|string, // Timeout for processing on master node + * timeout?: int|string, // Timeout for acknowledgement of update from all nodes in cluster + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. + * body?: string|array, // licenses to be installed. If body is a string must be a valid JSON. * } $params * * @throws NoNodeAvailableException if all the hosts are offline @@ -191,8 +195,9 @@ public function getTrialStatus(array $params = []) * * @return Elasticsearch|Promise */ - public function post(array $params = []) + public function post(?array $params = null) { + $params = $params ?? []; $url = '/_license'; $method = 'PUT'; @@ -213,14 +218,14 @@ public function post(array $params = []) * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/start-basic.html * * @param array{ - * acknowledge: boolean, // whether the user has acknowledged acknowledge messages (default: false) - * master_timeout: time, // Timeout for processing on master node - * timeout: time, // Timeout for acknowledgement of update from all nodes in cluster - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. + * acknowledge?: bool, // whether the user has acknowledged acknowledge messages (default: false) + * master_timeout?: int|string, // Timeout for processing on master node + * timeout?: int|string, // Timeout for acknowledgement of update from all nodes in cluster + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. * } $params * * @throws NoNodeAvailableException if all the hosts are offline @@ -229,8 +234,9 @@ public function post(array $params = []) * * @return Elasticsearch|Promise */ - public function postStartBasic(array $params = []) + public function postStartBasic(?array $params = null) { + $params = $params ?? []; $url = '/_license/start_basic'; $method = 'POST'; @@ -250,15 +256,14 @@ public function postStartBasic(array $params = []) * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/start-trial.html * * @param array{ - * type: string, // The type of trial license to generate (default: "trial") - * acknowledge: boolean, // whether the user has acknowledged acknowledge messages (default: false) - * master_timeout: time, // Timeout for processing on master node - * timeout: time, // Timeout for acknowledgement of update from all nodes in cluster - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. + * type?: string, // The type of trial license to generate (default: "trial") + * acknowledge?: bool, // whether the user has acknowledged acknowledge messages (default: false) + * master_timeout?: int|string, // Timeout for processing on master node + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. * } $params * * @throws NoNodeAvailableException if all the hosts are offline @@ -267,12 +272,13 @@ public function postStartBasic(array $params = []) * * @return Elasticsearch|Promise */ - public function postStartTrial(array $params = []) + public function postStartTrial(?array $params = null) { + $params = $params ?? []; $url = '/_license/start_trial'; $method = 'POST'; - $url = $this->addQueryString($url, $params, ['type','acknowledge','master_timeout','timeout','pretty','human','error_trace','source','filter_path']); + $url = $this->addQueryString($url, $params, ['type','acknowledge','master_timeout','pretty','human','error_trace','source','filter_path']); $headers = [ 'Accept' => 'application/json', ]; diff --git a/src/Endpoints/Logstash.php b/src/Endpoints/Logstash.php index 643942d78..19cc50b61 100644 --- a/src/Endpoints/Logstash.php +++ b/src/Endpoints/Logstash.php @@ -35,11 +35,11 @@ class Logstash extends AbstractEndpoint * * @param array{ * id: string, // (REQUIRED) The ID of the Pipeline - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. * } $params * * @throws MissingParameterException if a required parameter is missing @@ -49,8 +49,9 @@ class Logstash extends AbstractEndpoint * * @return Elasticsearch|Promise */ - public function deletePipeline(array $params = []) + public function deletePipeline(?array $params = null) { + $params = $params ?? []; $this->checkRequiredParameters(['id'], $params); $url = '/_logstash/pipeline/' . $this->encode($params['id']); $method = 'DELETE'; @@ -71,12 +72,12 @@ public function deletePipeline(array $params = []) * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/logstash-api-get-pipeline.html * * @param array{ - * id: string, // A comma-separated list of Pipeline IDs - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. + * id?: string, // A comma-separated list of Pipeline IDs + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. * } $params * * @throws NoNodeAvailableException if all the hosts are offline @@ -85,8 +86,9 @@ public function deletePipeline(array $params = []) * * @return Elasticsearch|Promise */ - public function getPipeline(array $params = []) + public function getPipeline(?array $params = null) { + $params = $params ?? []; if (isset($params['id'])) { $url = '/_logstash/pipeline/' . $this->encode($params['id']); $method = 'GET'; @@ -111,12 +113,12 @@ public function getPipeline(array $params = []) * * @param array{ * id: string, // (REQUIRED) The ID of the Pipeline - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. - * body: array, // (REQUIRED) The Pipeline to add or update + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. + * body: string|array, // (REQUIRED) The Pipeline to add or update. If body is a string must be a valid JSON. * } $params * * @throws MissingParameterException if a required parameter is missing @@ -126,8 +128,9 @@ public function getPipeline(array $params = []) * * @return Elasticsearch|Promise */ - public function putPipeline(array $params = []) + public function putPipeline(?array $params = null) { + $params = $params ?? []; $this->checkRequiredParameters(['id','body'], $params); $url = '/_logstash/pipeline/' . $this->encode($params['id']); $method = 'PUT'; diff --git a/src/Endpoints/Migration.php b/src/Endpoints/Migration.php index a14b729a6..93f985f75 100644 --- a/src/Endpoints/Migration.php +++ b/src/Endpoints/Migration.php @@ -34,12 +34,12 @@ class Migration extends AbstractEndpoint * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/migration-api-deprecation.html * * @param array{ - * index: string, // Index pattern - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. + * index?: string, // Index pattern + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. * } $params * * @throws NoNodeAvailableException if all the hosts are offline @@ -48,8 +48,9 @@ class Migration extends AbstractEndpoint * * @return Elasticsearch|Promise */ - public function deprecations(array $params = []) + public function deprecations(?array $params = null) { + $params = $params ?? []; if (isset($params['index'])) { $url = '/' . $this->encode($params['index']) . '/_migration/deprecations'; $method = 'GET'; @@ -73,11 +74,11 @@ public function deprecations(array $params = []) * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/migration-api-feature-upgrade.html * * @param array{ - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. * } $params * * @throws NoNodeAvailableException if all the hosts are offline @@ -86,8 +87,9 @@ public function deprecations(array $params = []) * * @return Elasticsearch|Promise */ - public function getFeatureUpgradeStatus(array $params = []) + public function getFeatureUpgradeStatus(?array $params = null) { + $params = $params ?? []; $url = '/_migration/system_features'; $method = 'GET'; @@ -107,11 +109,11 @@ public function getFeatureUpgradeStatus(array $params = []) * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/migration-api-feature-upgrade.html * * @param array{ - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. * } $params * * @throws NoNodeAvailableException if all the hosts are offline @@ -120,8 +122,9 @@ public function getFeatureUpgradeStatus(array $params = []) * * @return Elasticsearch|Promise */ - public function postFeatureUpgrade(array $params = []) + public function postFeatureUpgrade(?array $params = null) { + $params = $params ?? []; $url = '/_migration/system_features'; $method = 'POST'; diff --git a/src/Endpoints/Ml.php b/src/Endpoints/Ml.php index 3cdadf612..b219947e8 100644 --- a/src/Endpoints/Ml.php +++ b/src/Endpoints/Ml.php @@ -35,11 +35,11 @@ class Ml extends AbstractEndpoint * * @param array{ * model_id: string, // (REQUIRED) The unique identifier of the trained model. - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. * } $params * * @throws MissingParameterException if a required parameter is missing @@ -49,8 +49,9 @@ class Ml extends AbstractEndpoint * * @return Elasticsearch|Promise */ - public function clearTrainedModelDeploymentCache(array $params = []) + public function clearTrainedModelDeploymentCache(?array $params = null) { + $params = $params ?? []; $this->checkRequiredParameters(['model_id'], $params); $url = '/_ml/trained_models/' . $this->encode($params['model_id']) . '/deployment/cache/_clear'; $method = 'POST'; @@ -73,15 +74,15 @@ public function clearTrainedModelDeploymentCache(array $params = []) * * @param array{ * job_id: string, // (REQUIRED) The name of the job to close - * allow_no_match: boolean, // Whether to ignore if a wildcard expression matches no jobs. (This includes `_all` string or when no jobs have been specified) - * force: boolean, // True if the job should be forcefully closed - * timeout: time, // Controls the time to wait until a job has closed. Default to 30 minutes - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. - * body: array, // The URL params optionally sent in the body + * allow_no_match?: bool, // Whether to ignore if a wildcard expression matches no jobs. (This includes `_all` string or when no jobs have been specified) + * force?: bool, // True if the job should be forcefully closed + * timeout?: int|string, // Controls the time to wait until a job has closed. Default to 30 minutes + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. + * body?: string|array, // The URL params optionally sent in the body. If body is a string must be a valid JSON. * } $params * * @throws MissingParameterException if a required parameter is missing @@ -91,8 +92,9 @@ public function clearTrainedModelDeploymentCache(array $params = []) * * @return Elasticsearch|Promise */ - public function closeJob(array $params = []) + public function closeJob(?array $params = null) { + $params = $params ?? []; $this->checkRequiredParameters(['job_id'], $params); $url = '/_ml/anomaly_detectors/' . $this->encode($params['job_id']) . '/_close'; $method = 'POST'; @@ -115,11 +117,11 @@ public function closeJob(array $params = []) * * @param array{ * calendar_id: string, // (REQUIRED) The ID of the calendar to delete - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. * } $params * * @throws MissingParameterException if a required parameter is missing @@ -129,8 +131,9 @@ public function closeJob(array $params = []) * * @return Elasticsearch|Promise */ - public function deleteCalendar(array $params = []) + public function deleteCalendar(?array $params = null) { + $params = $params ?? []; $this->checkRequiredParameters(['calendar_id'], $params); $url = '/_ml/calendars/' . $this->encode($params['calendar_id']); $method = 'DELETE'; @@ -153,11 +156,11 @@ public function deleteCalendar(array $params = []) * @param array{ * calendar_id: string, // (REQUIRED) The ID of the calendar to modify * event_id: string, // (REQUIRED) The ID of the event to remove from the calendar - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. * } $params * * @throws MissingParameterException if a required parameter is missing @@ -167,8 +170,9 @@ public function deleteCalendar(array $params = []) * * @return Elasticsearch|Promise */ - public function deleteCalendarEvent(array $params = []) + public function deleteCalendarEvent(?array $params = null) { + $params = $params ?? []; $this->checkRequiredParameters(['calendar_id','event_id'], $params); $url = '/_ml/calendars/' . $this->encode($params['calendar_id']) . '/events/' . $this->encode($params['event_id']); $method = 'DELETE'; @@ -191,11 +195,11 @@ public function deleteCalendarEvent(array $params = []) * @param array{ * calendar_id: string, // (REQUIRED) The ID of the calendar to modify * job_id: string, // (REQUIRED) The ID of the job to remove from the calendar - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. * } $params * * @throws MissingParameterException if a required parameter is missing @@ -205,8 +209,9 @@ public function deleteCalendarEvent(array $params = []) * * @return Elasticsearch|Promise */ - public function deleteCalendarJob(array $params = []) + public function deleteCalendarJob(?array $params = null) { + $params = $params ?? []; $this->checkRequiredParameters(['calendar_id','job_id'], $params); $url = '/_ml/calendars/' . $this->encode($params['calendar_id']) . '/jobs/' . $this->encode($params['job_id']); $method = 'DELETE'; @@ -228,13 +233,13 @@ public function deleteCalendarJob(array $params = []) * * @param array{ * id: string, // (REQUIRED) The ID of the data frame analytics to delete - * force: boolean, // True if the job should be forcefully deleted - * timeout: time, // Controls the time to wait until a job is deleted. Defaults to 1 minute - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. + * force?: bool, // True if the job should be forcefully deleted + * timeout?: int|string, // Controls the time to wait until a job is deleted. Defaults to 1 minute + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. * } $params * * @throws MissingParameterException if a required parameter is missing @@ -244,8 +249,9 @@ public function deleteCalendarJob(array $params = []) * * @return Elasticsearch|Promise */ - public function deleteDataFrameAnalytics(array $params = []) + public function deleteDataFrameAnalytics(?array $params = null) { + $params = $params ?? []; $this->checkRequiredParameters(['id'], $params); $url = '/_ml/data_frame/analytics/' . $this->encode($params['id']); $method = 'DELETE'; @@ -267,12 +273,12 @@ public function deleteDataFrameAnalytics(array $params = []) * * @param array{ * datafeed_id: string, // (REQUIRED) The ID of the datafeed to delete - * force: boolean, // True if the datafeed should be forcefully deleted - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. + * force?: bool, // True if the datafeed should be forcefully deleted + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. * } $params * * @throws MissingParameterException if a required parameter is missing @@ -282,8 +288,9 @@ public function deleteDataFrameAnalytics(array $params = []) * * @return Elasticsearch|Promise */ - public function deleteDatafeed(array $params = []) + public function deleteDatafeed(?array $params = null) { + $params = $params ?? []; $this->checkRequiredParameters(['datafeed_id'], $params); $url = '/_ml/datafeeds/' . $this->encode($params['datafeed_id']); $method = 'DELETE'; @@ -304,15 +311,15 @@ public function deleteDatafeed(array $params = []) * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/ml-delete-expired-data.html * * @param array{ - * job_id: string, // The ID of the job(s) to perform expired data hygiene for - * requests_per_second: number, // The desired requests per second for the deletion processes. - * timeout: time, // How long can the underlying delete processes run until they are canceled - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. - * body: array, // deleting expired data parameters + * job_id?: string, // The ID of the job(s) to perform expired data hygiene for + * requests_per_second?: int, // The desired requests per second for the deletion processes. + * timeout?: int|string, // How long can the underlying delete processes run until they are canceled + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. + * body?: string|array, // deleting expired data parameters. If body is a string must be a valid JSON. * } $params * * @throws NoNodeAvailableException if all the hosts are offline @@ -321,8 +328,9 @@ public function deleteDatafeed(array $params = []) * * @return Elasticsearch|Promise */ - public function deleteExpiredData(array $params = []) + public function deleteExpiredData(?array $params = null) { + $params = $params ?? []; if (isset($params['job_id'])) { $url = '/_ml/_delete_expired_data/' . $this->encode($params['job_id']); $method = 'DELETE'; @@ -348,11 +356,11 @@ public function deleteExpiredData(array $params = []) * * @param array{ * filter_id: string, // (REQUIRED) The ID of the filter to delete - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. * } $params * * @throws MissingParameterException if a required parameter is missing @@ -362,8 +370,9 @@ public function deleteExpiredData(array $params = []) * * @return Elasticsearch|Promise */ - public function deleteFilter(array $params = []) + public function deleteFilter(?array $params = null) { + $params = $params ?? []; $this->checkRequiredParameters(['filter_id'], $params); $url = '/_ml/filters/' . $this->encode($params['filter_id']); $method = 'DELETE'; @@ -385,14 +394,14 @@ public function deleteFilter(array $params = []) * * @param array{ * job_id: string, // (REQUIRED) The ID of the job from which to delete forecasts - * forecast_id: string, // The ID of the forecast to delete, can be comma delimited list. Leaving blank implies `_all` - * allow_no_forecasts: boolean, // Whether to ignore if `_all` matches no forecasts - * timeout: time, // Controls the time to wait until the forecast(s) are deleted. Default to 30 seconds - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. + * forecast_id?: string, // The ID of the forecast to delete, can be comma delimited list. Leaving blank implies `_all` + * allow_no_forecasts?: bool, // Whether to ignore if `_all` matches no forecasts + * timeout?: int|string, // Controls the time to wait until the forecast(s) are deleted. Default to 30 seconds + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. * } $params * * @throws MissingParameterException if a required parameter is missing @@ -402,8 +411,9 @@ public function deleteFilter(array $params = []) * * @return Elasticsearch|Promise */ - public function deleteForecast(array $params = []) + public function deleteForecast(?array $params = null) { + $params = $params ?? []; $this->checkRequiredParameters(['job_id'], $params); if (isset($params['forecast_id'])) { $url = '/_ml/anomaly_detectors/' . $this->encode($params['job_id']) . '/_forecast/' . $this->encode($params['forecast_id']); @@ -429,14 +439,14 @@ public function deleteForecast(array $params = []) * * @param array{ * job_id: string, // (REQUIRED) The ID of the job to delete - * force: boolean, // True if the job should be forcefully deleted - * wait_for_completion: boolean, // Should this request wait until the operation has completed before returning - * delete_user_annotations: boolean, // Should annotations added by the user be deleted - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. + * force?: bool, // True if the job should be forcefully deleted + * wait_for_completion?: bool, // Should this request wait until the operation has completed before returning + * delete_user_annotations?: bool, // Should annotations added by the user be deleted + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. * } $params * * @throws MissingParameterException if a required parameter is missing @@ -446,8 +456,9 @@ public function deleteForecast(array $params = []) * * @return Elasticsearch|Promise */ - public function deleteJob(array $params = []) + public function deleteJob(?array $params = null) { + $params = $params ?? []; $this->checkRequiredParameters(['job_id'], $params); $url = '/_ml/anomaly_detectors/' . $this->encode($params['job_id']); $method = 'DELETE'; @@ -470,11 +481,11 @@ public function deleteJob(array $params = []) * @param array{ * job_id: string, // (REQUIRED) The ID of the job to fetch * snapshot_id: string, // (REQUIRED) The ID of the snapshot to delete - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. * } $params * * @throws MissingParameterException if a required parameter is missing @@ -484,8 +495,9 @@ public function deleteJob(array $params = []) * * @return Elasticsearch|Promise */ - public function deleteModelSnapshot(array $params = []) + public function deleteModelSnapshot(?array $params = null) { + $params = $params ?? []; $this->checkRequiredParameters(['job_id','snapshot_id'], $params); $url = '/_ml/anomaly_detectors/' . $this->encode($params['job_id']) . '/model_snapshots/' . $this->encode($params['snapshot_id']); $method = 'DELETE'; @@ -507,13 +519,13 @@ public function deleteModelSnapshot(array $params = []) * * @param array{ * model_id: string, // (REQUIRED) The ID of the trained model to delete - * timeout: time, // Controls the amount of time to wait for the model to be deleted. - * force: boolean, // True if the model should be forcefully deleted - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. + * timeout?: int|string, // Controls the amount of time to wait for the model to be deleted. + * force?: bool, // True if the model should be forcefully deleted + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. * } $params * * @throws MissingParameterException if a required parameter is missing @@ -523,8 +535,9 @@ public function deleteModelSnapshot(array $params = []) * * @return Elasticsearch|Promise */ - public function deleteTrainedModel(array $params = []) + public function deleteTrainedModel(?array $params = null) { + $params = $params ?? []; $this->checkRequiredParameters(['model_id'], $params); $url = '/_ml/trained_models/' . $this->encode($params['model_id']); $method = 'DELETE'; @@ -547,11 +560,11 @@ public function deleteTrainedModel(array $params = []) * @param array{ * model_alias: string, // (REQUIRED) The trained model alias to delete * model_id: string, // (REQUIRED) The trained model where the model alias is assigned - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. * } $params * * @throws MissingParameterException if a required parameter is missing @@ -561,8 +574,9 @@ public function deleteTrainedModel(array $params = []) * * @return Elasticsearch|Promise */ - public function deleteTrainedModelAlias(array $params = []) + public function deleteTrainedModelAlias(?array $params = null) { + $params = $params ?? []; $this->checkRequiredParameters(['model_alias','model_id'], $params); $url = '/_ml/trained_models/' . $this->encode($params['model_id']) . '/model_aliases/' . $this->encode($params['model_alias']); $method = 'DELETE'; @@ -584,12 +598,12 @@ public function deleteTrainedModelAlias(array $params = []) * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/ml-apis.html * * @param array{ - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. - * body: array, // (REQUIRED) The analysis config, plus cardinality estimates for fields it references + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. + * body: string|array, // (REQUIRED) The analysis config, plus cardinality estimates for fields it references. If body is a string must be a valid JSON. * } $params * * @throws NoNodeAvailableException if all the hosts are offline @@ -598,8 +612,9 @@ public function deleteTrainedModelAlias(array $params = []) * * @return Elasticsearch|Promise */ - public function estimateModelMemory(array $params = []) + public function estimateModelMemory(?array $params = null) { + $params = $params ?? []; $this->checkRequiredParameters(['body'], $params); $url = '/_ml/anomaly_detectors/_estimate_model_memory'; $method = 'POST'; @@ -621,12 +636,12 @@ public function estimateModelMemory(array $params = []) * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/evaluate-dfanalytics.html * * @param array{ - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. - * body: array, // (REQUIRED) The evaluation definition + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. + * body: string|array, // (REQUIRED) The evaluation definition. If body is a string must be a valid JSON. * } $params * * @throws NoNodeAvailableException if all the hosts are offline @@ -635,8 +650,9 @@ public function estimateModelMemory(array $params = []) * * @return Elasticsearch|Promise */ - public function evaluateDataFrame(array $params = []) + public function evaluateDataFrame(?array $params = null) { + $params = $params ?? []; $this->checkRequiredParameters(['body'], $params); $url = '/_ml/data_frame/_evaluate'; $method = 'POST'; @@ -658,13 +674,13 @@ public function evaluateDataFrame(array $params = []) * @see http://www.elastic.co/guide/en/elasticsearch/reference/current/explain-dfanalytics.html * * @param array{ - * id: string, // The ID of the data frame analytics to explain - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. - * body: array, // The data frame analytics config to explain + * id?: string, // The ID of the data frame analytics to explain + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. + * body?: string|array, // The data frame analytics config to explain. If body is a string must be a valid JSON. * } $params * * @throws NoNodeAvailableException if all the hosts are offline @@ -673,8 +689,9 @@ public function evaluateDataFrame(array $params = []) * * @return Elasticsearch|Promise */ - public function explainDataFrameAnalytics(array $params = []) + public function explainDataFrameAnalytics(?array $params = null) { + $params = $params ?? []; if (isset($params['id'])) { $url = '/_ml/data_frame/analytics/' . $this->encode($params['id']) . '/_explain'; $method = empty($params['body']) ? 'GET' : 'POST'; @@ -700,17 +717,17 @@ public function explainDataFrameAnalytics(array $params = []) * * @param array{ * job_id: string, // (REQUIRED) The name of the job to flush - * calc_interim: boolean, // Calculates interim results for the most recent bucket or all buckets within the latency period - * start: string, // When used in conjunction with calc_interim, specifies the range of buckets on which to calculate interim results - * end: string, // When used in conjunction with calc_interim, specifies the range of buckets on which to calculate interim results - * advance_time: string, // Advances time to the given value generating results and updating the model for the advanced interval - * skip_time: string, // Skips time to the given value without generating results or updating the model for the skipped interval - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. - * body: array, // Flush parameters + * calc_interim?: bool, // Calculates interim results for the most recent bucket or all buckets within the latency period + * start?: string, // When used in conjunction with calc_interim, specifies the range of buckets on which to calculate interim results + * end?: string, // When used in conjunction with calc_interim, specifies the range of buckets on which to calculate interim results + * advance_time?: string, // Advances time to the given value generating results and updating the model for the advanced interval + * skip_time?: string, // Skips time to the given value without generating results or updating the model for the skipped interval + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. + * body?: string|array, // Flush parameters. If body is a string must be a valid JSON. * } $params * * @throws MissingParameterException if a required parameter is missing @@ -720,8 +737,9 @@ public function explainDataFrameAnalytics(array $params = []) * * @return Elasticsearch|Promise */ - public function flushJob(array $params = []) + public function flushJob(?array $params = null) { + $params = $params ?? []; $this->checkRequiredParameters(['job_id'], $params); $url = '/_ml/anomaly_detectors/' . $this->encode($params['job_id']) . '/_flush'; $method = 'POST'; @@ -744,15 +762,15 @@ public function flushJob(array $params = []) * * @param array{ * job_id: string, // (REQUIRED) The ID of the job to forecast for - * duration: time, // The duration of the forecast - * expires_in: time, // The time interval after which the forecast expires. Expired forecasts will be deleted at the first opportunity. - * max_model_memory: string, // The max memory able to be used by the forecast. Default is 20mb. - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. - * body: array, // Query parameters can be specified in the body + * duration?: int|string, // The duration of the forecast + * expires_in?: int|string, // The time interval after which the forecast expires. Expired forecasts will be deleted at the first opportunity. + * max_model_memory?: string, // The max memory able to be used by the forecast. Default is 20mb. + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. + * body?: string|array, // Query parameters can be specified in the body. If body is a string must be a valid JSON. * } $params * * @throws MissingParameterException if a required parameter is missing @@ -762,8 +780,9 @@ public function flushJob(array $params = []) * * @return Elasticsearch|Promise */ - public function forecast(array $params = []) + public function forecast(?array $params = null) { + $params = $params ?? []; $this->checkRequiredParameters(['job_id'], $params); $url = '/_ml/anomaly_detectors/' . $this->encode($params['job_id']) . '/_forecast'; $method = 'POST'; @@ -786,22 +805,22 @@ public function forecast(array $params = []) * * @param array{ * job_id: string, // (REQUIRED) ID of the job to get bucket results from - * timestamp: string, // The timestamp of the desired single bucket result - * expand: boolean, // Include anomaly records - * exclude_interim: boolean, // Exclude interim results - * from: int, // skips a number of buckets - * size: int, // specifies a max number of buckets to get - * start: string, // Start time filter for buckets - * end: string, // End time filter for buckets - * anomaly_score: double, // Filter for the most anomalous buckets - * sort: string, // Sort buckets by a particular field - * desc: boolean, // Set the sort direction - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. - * body: array, // Bucket selection details if not provided in URI + * timestamp?: string, // The timestamp of the desired single bucket result + * expand?: bool, // Include anomaly records + * exclude_interim?: bool, // Exclude interim results + * from?: int, // skips a number of buckets + * size?: int, // specifies a max number of buckets to get + * start?: string, // Start time filter for buckets + * end?: string, // End time filter for buckets + * anomaly_score?: float, // Filter for the most anomalous buckets + * sort?: string, // Sort buckets by a particular field + * desc?: bool, // Set the sort direction + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. + * body?: string|array, // Bucket selection details if not provided in URI. If body is a string must be a valid JSON. * } $params * * @throws MissingParameterException if a required parameter is missing @@ -811,8 +830,9 @@ public function forecast(array $params = []) * * @return Elasticsearch|Promise */ - public function getBuckets(array $params = []) + public function getBuckets(?array $params = null) { + $params = $params ?? []; $this->checkRequiredParameters(['job_id'], $params); if (isset($params['timestamp'])) { $url = '/_ml/anomaly_detectors/' . $this->encode($params['job_id']) . '/results/buckets/' . $this->encode($params['timestamp']); @@ -839,16 +859,16 @@ public function getBuckets(array $params = []) * * @param array{ * calendar_id: string, // (REQUIRED) The ID of the calendar containing the events - * job_id: string, // Get events for the job. When this option is used calendar_id must be '_all' - * start: string, // Get events after this time - * end: date, // Get events before this time - * from: int, // Skips a number of events - * size: int, // Specifies a max number of events to get - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. + * job_id?: string, // Get events for the job. When this option is used calendar_id must be '_all' + * start?: string, // Get events after this time + * end?: string, // Get events before this time + * from?: int, // Skips a number of events + * size?: int, // Specifies a max number of events to get + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. * } $params * * @throws MissingParameterException if a required parameter is missing @@ -858,8 +878,9 @@ public function getBuckets(array $params = []) * * @return Elasticsearch|Promise */ - public function getCalendarEvents(array $params = []) + public function getCalendarEvents(?array $params = null) { + $params = $params ?? []; $this->checkRequiredParameters(['calendar_id'], $params); $url = '/_ml/calendars/' . $this->encode($params['calendar_id']) . '/events'; $method = 'GET'; @@ -880,15 +901,15 @@ public function getCalendarEvents(array $params = []) * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/ml-get-calendar.html * * @param array{ - * calendar_id: string, // The ID of the calendar to fetch - * from: int, // skips a number of calendars - * size: int, // specifies a max number of calendars to get - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. - * body: array, // The from and size parameters optionally sent in the body + * calendar_id?: string, // The ID of the calendar to fetch + * from?: int, // skips a number of calendars + * size?: int, // specifies a max number of calendars to get + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. + * body?: string|array, // The from and size parameters optionally sent in the body. If body is a string must be a valid JSON. * } $params * * @throws NoNodeAvailableException if all the hosts are offline @@ -897,8 +918,9 @@ public function getCalendarEvents(array $params = []) * * @return Elasticsearch|Promise */ - public function getCalendars(array $params = []) + public function getCalendars(?array $params = null) { + $params = $params ?? []; if (isset($params['calendar_id'])) { $url = '/_ml/calendars/' . $this->encode($params['calendar_id']); $method = empty($params['body']) ? 'GET' : 'POST'; @@ -924,16 +946,16 @@ public function getCalendars(array $params = []) * * @param array{ * job_id: string, // (REQUIRED) The name of the job - * category_id: long, // The identifier of the category definition of interest - * from: int, // skips a number of categories - * size: int, // specifies a max number of categories to get - * partition_field_value: string, // Specifies the partition to retrieve categories for. This is optional, and should never be used for jobs where per-partition categorization is disabled. - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. - * body: array, // Category selection details if not provided in URI + * category_id?: int, // The identifier of the category definition of interest + * from?: int, // skips a number of categories + * size?: int, // specifies a max number of categories to get + * partition_field_value?: string, // Specifies the partition to retrieve categories for. This is optional, and should never be used for jobs where per-partition categorization is disabled. + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. + * body?: string|array, // Category selection details if not provided in URI. If body is a string must be a valid JSON. * } $params * * @throws MissingParameterException if a required parameter is missing @@ -943,8 +965,9 @@ public function getCalendars(array $params = []) * * @return Elasticsearch|Promise */ - public function getCategories(array $params = []) + public function getCategories(?array $params = null) { + $params = $params ?? []; $this->checkRequiredParameters(['job_id'], $params); if (isset($params['category_id'])) { $url = '/_ml/anomaly_detectors/' . $this->encode($params['job_id']) . '/results/categories/' . $this->encode($params['category_id']); @@ -970,16 +993,16 @@ public function getCategories(array $params = []) * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/get-dfanalytics.html * * @param array{ - * id: string, // The ID of the data frame analytics to fetch - * allow_no_match: boolean, // 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) - * from: int, // skips a number of analytics - * size: int, // specifies a max number of analytics to get - * exclude_generated: boolean, // Omits fields that are illegal to set on data frame analytics PUT - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. + * id?: string, // The ID of the data frame analytics to fetch + * allow_no_match?: bool, // 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) + * from?: int, // skips a number of analytics + * size?: int, // specifies a max number of analytics to get + * exclude_generated?: bool, // Omits fields that are illegal to set on data frame analytics PUT + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. * } $params * * @throws NoNodeAvailableException if all the hosts are offline @@ -988,8 +1011,9 @@ public function getCategories(array $params = []) * * @return Elasticsearch|Promise */ - public function getDataFrameAnalytics(array $params = []) + public function getDataFrameAnalytics(?array $params = null) { + $params = $params ?? []; if (isset($params['id'])) { $url = '/_ml/data_frame/analytics/' . $this->encode($params['id']); $method = 'GET'; @@ -1013,16 +1037,16 @@ public function getDataFrameAnalytics(array $params = []) * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/get-dfanalytics-stats.html * * @param array{ - * id: string, // The ID of the data frame analytics stats to fetch - * allow_no_match: boolean, // 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) - * from: int, // skips a number of analytics - * size: int, // specifies a max number of analytics to get - * verbose: boolean, // whether the stats response should be verbose - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. + * id?: string, // The ID of the data frame analytics stats to fetch + * allow_no_match?: bool, // 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) + * from?: int, // skips a number of analytics + * size?: int, // specifies a max number of analytics to get + * verbose?: bool, // whether the stats response should be verbose + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. * } $params * * @throws NoNodeAvailableException if all the hosts are offline @@ -1031,8 +1055,9 @@ public function getDataFrameAnalytics(array $params = []) * * @return Elasticsearch|Promise */ - public function getDataFrameAnalyticsStats(array $params = []) + public function getDataFrameAnalyticsStats(?array $params = null) { + $params = $params ?? []; if (isset($params['id'])) { $url = '/_ml/data_frame/analytics/' . $this->encode($params['id']) . '/_stats'; $method = 'GET'; @@ -1056,13 +1081,13 @@ public function getDataFrameAnalyticsStats(array $params = []) * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/ml-get-datafeed-stats.html * * @param array{ - * datafeed_id: string, // The ID of the datafeeds stats to fetch - * allow_no_match: boolean, // Whether to ignore if a wildcard expression matches no datafeeds. (This includes `_all` string or when no datafeeds have been specified) - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. + * datafeed_id?: string, // The ID of the datafeeds stats to fetch + * allow_no_match?: bool, // Whether to ignore if a wildcard expression matches no datafeeds. (This includes `_all` string or when no datafeeds have been specified) + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. * } $params * * @throws NoNodeAvailableException if all the hosts are offline @@ -1071,8 +1096,9 @@ public function getDataFrameAnalyticsStats(array $params = []) * * @return Elasticsearch|Promise */ - public function getDatafeedStats(array $params = []) + public function getDatafeedStats(?array $params = null) { + $params = $params ?? []; if (isset($params['datafeed_id'])) { $url = '/_ml/datafeeds/' . $this->encode($params['datafeed_id']) . '/_stats'; $method = 'GET'; @@ -1096,14 +1122,14 @@ public function getDatafeedStats(array $params = []) * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/ml-get-datafeed.html * * @param array{ - * datafeed_id: string, // The ID of the datafeeds to fetch - * allow_no_match: boolean, // Whether to ignore if a wildcard expression matches no datafeeds. (This includes `_all` string or when no datafeeds have been specified) - * exclude_generated: boolean, // Omits fields that are illegal to set on datafeed PUT - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. + * datafeed_id?: string, // The ID of the datafeeds to fetch + * allow_no_match?: bool, // Whether to ignore if a wildcard expression matches no datafeeds. (This includes `_all` string or when no datafeeds have been specified) + * exclude_generated?: bool, // Omits fields that are illegal to set on datafeed PUT + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. * } $params * * @throws NoNodeAvailableException if all the hosts are offline @@ -1112,8 +1138,9 @@ public function getDatafeedStats(array $params = []) * * @return Elasticsearch|Promise */ - public function getDatafeeds(array $params = []) + public function getDatafeeds(?array $params = null) { + $params = $params ?? []; if (isset($params['datafeed_id'])) { $url = '/_ml/datafeeds/' . $this->encode($params['datafeed_id']); $method = 'GET'; @@ -1137,14 +1164,14 @@ public function getDatafeeds(array $params = []) * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/ml-get-filter.html * * @param array{ - * filter_id: string, // The ID of the filter to fetch - * from: int, // skips a number of filters - * size: int, // specifies a max number of filters to get - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. + * filter_id?: string, // The ID of the filter to fetch + * from?: int, // skips a number of filters + * size?: int, // specifies a max number of filters to get + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. * } $params * * @throws NoNodeAvailableException if all the hosts are offline @@ -1153,8 +1180,9 @@ public function getDatafeeds(array $params = []) * * @return Elasticsearch|Promise */ - public function getFilters(array $params = []) + public function getFilters(?array $params = null) { + $params = $params ?? []; if (isset($params['filter_id'])) { $url = '/_ml/filters/' . $this->encode($params['filter_id']); $method = 'GET'; @@ -1179,20 +1207,20 @@ public function getFilters(array $params = []) * * @param array{ * job_id: string, // (REQUIRED) Identifier for the anomaly detection job - * exclude_interim: boolean, // Exclude interim results - * from: int, // skips a number of influencers - * size: int, // specifies a max number of influencers to get - * start: string, // start timestamp for the requested influencers - * end: string, // end timestamp for the requested influencers - * influencer_score: double, // influencer score threshold for the requested influencers - * sort: string, // sort field for the requested influencers - * desc: boolean, // whether the results should be sorted in decending order - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. - * body: array, // Influencer selection criteria + * exclude_interim?: bool, // Exclude interim results + * from?: int, // skips a number of influencers + * size?: int, // specifies a max number of influencers to get + * start?: string, // start timestamp for the requested influencers + * end?: string, // end timestamp for the requested influencers + * influencer_score?: float, // influencer score threshold for the requested influencers + * sort?: string, // sort field for the requested influencers + * desc?: bool, // whether the results should be sorted in decending order + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. + * body?: string|array, // Influencer selection criteria. If body is a string must be a valid JSON. * } $params * * @throws MissingParameterException if a required parameter is missing @@ -1202,8 +1230,9 @@ public function getFilters(array $params = []) * * @return Elasticsearch|Promise */ - public function getInfluencers(array $params = []) + public function getInfluencers(?array $params = null) { + $params = $params ?? []; $this->checkRequiredParameters(['job_id'], $params); $url = '/_ml/anomaly_detectors/' . $this->encode($params['job_id']) . '/results/influencers'; $method = empty($params['body']) ? 'GET' : 'POST'; @@ -1225,13 +1254,13 @@ public function getInfluencers(array $params = []) * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/ml-get-job-stats.html * * @param array{ - * job_id: string, // The ID of the jobs stats to fetch - * allow_no_match: boolean, // Whether to ignore if a wildcard expression matches no jobs. (This includes `_all` string or when no jobs have been specified) - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. + * job_id?: string, // The ID of the jobs stats to fetch + * allow_no_match?: bool, // Whether to ignore if a wildcard expression matches no jobs. (This includes `_all` string or when no jobs have been specified) + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. * } $params * * @throws NoNodeAvailableException if all the hosts are offline @@ -1240,8 +1269,9 @@ public function getInfluencers(array $params = []) * * @return Elasticsearch|Promise */ - public function getJobStats(array $params = []) + public function getJobStats(?array $params = null) { + $params = $params ?? []; if (isset($params['job_id'])) { $url = '/_ml/anomaly_detectors/' . $this->encode($params['job_id']) . '/_stats'; $method = 'GET'; @@ -1265,14 +1295,14 @@ public function getJobStats(array $params = []) * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/ml-get-job.html * * @param array{ - * job_id: string, // The ID of the jobs to fetch - * allow_no_match: boolean, // Whether to ignore if a wildcard expression matches no jobs. (This includes `_all` string or when no jobs have been specified) - * exclude_generated: boolean, // Omits fields that are illegal to set on job PUT - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. + * job_id?: string, // The ID of the jobs to fetch + * allow_no_match?: bool, // Whether to ignore if a wildcard expression matches no jobs. (This includes `_all` string or when no jobs have been specified) + * exclude_generated?: bool, // Omits fields that are illegal to set on job PUT + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. * } $params * * @throws NoNodeAvailableException if all the hosts are offline @@ -1281,8 +1311,9 @@ public function getJobStats(array $params = []) * * @return Elasticsearch|Promise */ - public function getJobs(array $params = []) + public function getJobs(?array $params = null) { + $params = $params ?? []; if (isset($params['job_id'])) { $url = '/_ml/anomaly_detectors/' . $this->encode($params['job_id']); $method = 'GET'; @@ -1306,14 +1337,14 @@ public function getJobs(array $params = []) * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/get-ml-memory.html * * @param array{ - * node_id: string, // Specifies the node or nodes to retrieve stats for. - * master_timeout: time, // Explicit operation timeout for connection to master node - * timeout: time, // Explicit operation timeout - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. + * node_id?: string, // Specifies the node or nodes to retrieve stats for. + * master_timeout?: int|string, // Explicit operation timeout for connection to master node + * timeout?: int|string, // Explicit operation timeout + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. * } $params * * @throws NoNodeAvailableException if all the hosts are offline @@ -1322,8 +1353,9 @@ public function getJobs(array $params = []) * * @return Elasticsearch|Promise */ - public function getMemoryStats(array $params = []) + public function getMemoryStats(?array $params = null) { + $params = $params ?? []; if (isset($params['node_id'])) { $url = '/_ml/memory/' . $this->encode($params['node_id']) . '/_stats'; $method = 'GET'; @@ -1349,12 +1381,12 @@ public function getMemoryStats(array $params = []) * @param array{ * job_id: string, // (REQUIRED) The ID of the job. May be a wildcard, comma separated list or `_all`. * snapshot_id: string, // (REQUIRED) The ID of the snapshot. May be a wildcard, comma separated list or `_all`. - * allow_no_match: boolean, // Whether to ignore if a wildcard expression matches no jobs or no snapshots. (This includes the `_all` string.) - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. + * allow_no_match?: bool, // Whether to ignore if a wildcard expression matches no jobs or no snapshots. (This includes the `_all` string.) + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. * } $params * * @throws MissingParameterException if a required parameter is missing @@ -1364,8 +1396,9 @@ public function getMemoryStats(array $params = []) * * @return Elasticsearch|Promise */ - public function getModelSnapshotUpgradeStats(array $params = []) + public function getModelSnapshotUpgradeStats(?array $params = null) { + $params = $params ?? []; $this->checkRequiredParameters(['job_id','snapshot_id'], $params); $url = '/_ml/anomaly_detectors/' . $this->encode($params['job_id']) . '/model_snapshots/' . $this->encode($params['snapshot_id']) . '/_upgrade/_stats'; $method = 'GET'; @@ -1387,19 +1420,19 @@ public function getModelSnapshotUpgradeStats(array $params = []) * * @param array{ * job_id: string, // (REQUIRED) The ID of the job to fetch - * snapshot_id: string, // The ID of the snapshot to fetch - * from: int, // Skips a number of documents - * size: int, // The default number of documents returned in queries as a string. - * start: date, // The filter 'start' query parameter - * end: date, // The filter 'end' query parameter - * sort: string, // Name of the field to sort on - * desc: boolean, // True if the results should be sorted in descending order - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. - * body: array, // Model snapshot selection criteria + * snapshot_id?: string, // The ID of the snapshot to fetch + * from?: int, // Skips a number of documents + * size?: int, // The default number of documents returned in queries as a string. + * start?: string, // The filter 'start' query parameter + * end?: string, // The filter 'end' query parameter + * sort?: string, // Name of the field to sort on + * desc?: bool, // True if the results should be sorted in descending order + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. + * body?: string|array, // Model snapshot selection criteria. If body is a string must be a valid JSON. * } $params * * @throws MissingParameterException if a required parameter is missing @@ -1409,8 +1442,9 @@ public function getModelSnapshotUpgradeStats(array $params = []) * * @return Elasticsearch|Promise */ - public function getModelSnapshots(array $params = []) + public function getModelSnapshots(?array $params = null) { + $params = $params ?? []; $this->checkRequiredParameters(['job_id'], $params); if (isset($params['snapshot_id'])) { $url = '/_ml/anomaly_detectors/' . $this->encode($params['job_id']) . '/model_snapshots/' . $this->encode($params['snapshot_id']); @@ -1437,19 +1471,19 @@ public function getModelSnapshots(array $params = []) * * @param array{ * job_id: string, // (REQUIRED) The job IDs for which to calculate overall bucket results - * top_n: int, // The number of top job bucket scores to be used in the overall_score calculation - * bucket_span: string, // The span of the overall buckets. Defaults to the longest job bucket_span - * overall_score: double, // Returns overall buckets with overall scores higher than this value - * exclude_interim: boolean, // If true overall buckets that include interim buckets will be excluded - * start: string, // Returns overall buckets with timestamps after this time - * end: string, // Returns overall buckets with timestamps earlier than this time - * allow_no_match: boolean, // Whether to ignore if a wildcard expression matches no jobs. (This includes `_all` string or when no jobs have been specified) - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. - * body: array, // Overall bucket selection details if not provided in URI + * top_n?: int, // The number of top job bucket scores to be used in the overall_score calculation + * bucket_span?: string, // The span of the overall buckets. Defaults to the longest job bucket_span + * overall_score?: float, // Returns overall buckets with overall scores higher than this value + * exclude_interim?: bool, // If true overall buckets that include interim buckets will be excluded + * start?: string, // Returns overall buckets with timestamps after this time + * end?: string, // Returns overall buckets with timestamps earlier than this time + * allow_no_match?: bool, // Whether to ignore if a wildcard expression matches no jobs. (This includes `_all` string or when no jobs have been specified) + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. + * body?: string|array, // Overall bucket selection details if not provided in URI. If body is a string must be a valid JSON. * } $params * * @throws MissingParameterException if a required parameter is missing @@ -1459,8 +1493,9 @@ public function getModelSnapshots(array $params = []) * * @return Elasticsearch|Promise */ - public function getOverallBuckets(array $params = []) + public function getOverallBuckets(?array $params = null) { + $params = $params ?? []; $this->checkRequiredParameters(['job_id'], $params); $url = '/_ml/anomaly_detectors/' . $this->encode($params['job_id']) . '/results/overall_buckets'; $method = empty($params['body']) ? 'GET' : 'POST'; @@ -1483,20 +1518,20 @@ public function getOverallBuckets(array $params = []) * * @param array{ * job_id: string, // (REQUIRED) The ID of the job - * exclude_interim: boolean, // Exclude interim results - * from: int, // skips a number of records - * size: int, // specifies a max number of records to get - * start: string, // Start time filter for records - * end: string, // End time filter for records - * record_score: double, // Returns records with anomaly scores greater or equal than this value - * sort: string, // Sort records by a particular field - * desc: boolean, // Set the sort direction - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. - * body: array, // Record selection criteria + * exclude_interim?: bool, // Exclude interim results + * from?: int, // skips a number of records + * size?: int, // specifies a max number of records to get + * start?: string, // Start time filter for records + * end?: string, // End time filter for records + * record_score?: float, // Returns records with anomaly scores greater or equal than this value + * sort?: string, // Sort records by a particular field + * desc?: bool, // Set the sort direction + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. + * body?: string|array, // Record selection criteria. If body is a string must be a valid JSON. * } $params * * @throws MissingParameterException if a required parameter is missing @@ -1506,8 +1541,9 @@ public function getOverallBuckets(array $params = []) * * @return Elasticsearch|Promise */ - public function getRecords(array $params = []) + public function getRecords(?array $params = null) { + $params = $params ?? []; $this->checkRequiredParameters(['job_id'], $params); $url = '/_ml/anomaly_detectors/' . $this->encode($params['job_id']) . '/results/records'; $method = empty($params['body']) ? 'GET' : 'POST'; @@ -1529,20 +1565,20 @@ public function getRecords(array $params = []) * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/get-trained-models.html * * @param array{ - * model_id: string, // The ID of the trained models to fetch - * allow_no_match: boolean, // Whether to ignore if a wildcard expression matches no trained models. (This includes `_all` string or when no trained models have been specified) - * include: string, // A comma-separate list of fields to optionally include. Valid options are 'definition' and 'total_feature_importance'. Default is none. - * include_model_definition: boolean, // Should the full model definition be included in the results. These definitions can be large. So be cautious when including them. Defaults to false. - * decompress_definition: boolean, // Should the model definition be decompressed into valid JSON or returned in a custom compressed format. Defaults to true. - * from: int, // skips a number of trained models - * size: int, // specifies a max number of trained models to get - * tags: list, // A comma-separated list of tags that the model must have. - * exclude_generated: boolean, // Omits fields that are illegal to set on model PUT - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. + * model_id?: string, // The ID of the trained models to fetch + * allow_no_match?: bool, // Whether to ignore if a wildcard expression matches no trained models. (This includes `_all` string or when no trained models have been specified) + * include?: string, // A comma-separate list of fields to optionally include. Valid options are 'definition' and 'total_feature_importance'. Default is none. + * include_model_definition?: bool, // Should the full model definition be included in the results. These definitions can be large. So be cautious when including them. Defaults to false. + * decompress_definition?: bool, // Should the model definition be decompressed into valid JSON or returned in a custom compressed format. Defaults to true. + * from?: int, // skips a number of trained models + * size?: int, // specifies a max number of trained models to get + * tags?: string|array, // A comma-separated list of tags that the model must have. + * exclude_generated?: bool, // Omits fields that are illegal to set on model PUT + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. * } $params * * @throws NoNodeAvailableException if all the hosts are offline @@ -1551,8 +1587,9 @@ public function getRecords(array $params = []) * * @return Elasticsearch|Promise */ - public function getTrainedModels(array $params = []) + public function getTrainedModels(?array $params = null) { + $params = $params ?? []; if (isset($params['model_id'])) { $url = '/_ml/trained_models/' . $this->encode($params['model_id']); $method = 'GET'; @@ -1576,15 +1613,15 @@ public function getTrainedModels(array $params = []) * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/get-trained-models-stats.html * * @param array{ - * model_id: string, // The ID of the trained models stats to fetch - * allow_no_match: boolean, // Whether to ignore if a wildcard expression matches no trained models. (This includes `_all` string or when no trained models have been specified) - * from: int, // skips a number of trained models - * size: int, // specifies a max number of trained models to get - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. + * model_id?: string, // The ID of the trained models stats to fetch + * allow_no_match?: bool, // Whether to ignore if a wildcard expression matches no trained models. (This includes `_all` string or when no trained models have been specified) + * from?: int, // skips a number of trained models + * size?: int, // specifies a max number of trained models to get + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. * } $params * * @throws NoNodeAvailableException if all the hosts are offline @@ -1593,8 +1630,9 @@ public function getTrainedModels(array $params = []) * * @return Elasticsearch|Promise */ - public function getTrainedModelsStats(array $params = []) + public function getTrainedModelsStats(?array $params = null) { + $params = $params ?? []; if (isset($params['model_id'])) { $url = '/_ml/trained_models/' . $this->encode($params['model_id']) . '/_stats'; $method = 'GET'; @@ -1619,13 +1657,13 @@ public function getTrainedModelsStats(array $params = []) * * @param array{ * model_id: string, // (REQUIRED) The unique identifier of the trained model. - * timeout: time, // Controls the amount of time to wait for inference results. - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. - * body: array, // (REQUIRED) The docs to apply inference on and inference configuration overrides + * timeout?: int|string, // Controls the amount of time to wait for inference results. + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. + * body: string|array, // (REQUIRED) The docs to apply inference on and inference configuration overrides. If body is a string must be a valid JSON. * } $params * * @throws MissingParameterException if a required parameter is missing @@ -1635,8 +1673,9 @@ public function getTrainedModelsStats(array $params = []) * * @return Elasticsearch|Promise */ - public function inferTrainedModel(array $params = []) + public function inferTrainedModel(?array $params = null) { + $params = $params ?? []; $this->checkRequiredParameters(['model_id','body'], $params); $url = '/_ml/trained_models/' . $this->encode($params['model_id']) . '/_infer'; $method = 'POST'; @@ -1658,11 +1697,11 @@ public function inferTrainedModel(array $params = []) * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/get-ml-info.html * * @param array{ - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. * } $params * * @throws NoNodeAvailableException if all the hosts are offline @@ -1671,8 +1710,9 @@ public function inferTrainedModel(array $params = []) * * @return Elasticsearch|Promise */ - public function info(array $params = []) + public function info(?array $params = null) { + $params = $params ?? []; $url = '/_ml/info'; $method = 'GET'; @@ -1693,12 +1733,12 @@ public function info(array $params = []) * * @param array{ * job_id: string, // (REQUIRED) The ID of the job to open - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. - * body: array, // Query parameters can be specified in the body + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. + * body?: string|array, // Query parameters can be specified in the body. If body is a string must be a valid JSON. * } $params * * @throws MissingParameterException if a required parameter is missing @@ -1708,8 +1748,9 @@ public function info(array $params = []) * * @return Elasticsearch|Promise */ - public function openJob(array $params = []) + public function openJob(?array $params = null) { + $params = $params ?? []; $this->checkRequiredParameters(['job_id'], $params); $url = '/_ml/anomaly_detectors/' . $this->encode($params['job_id']) . '/_open'; $method = 'POST'; @@ -1732,12 +1773,12 @@ public function openJob(array $params = []) * * @param array{ * calendar_id: string, // (REQUIRED) The ID of the calendar to modify - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. - * body: array, // (REQUIRED) A list of events + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. + * body: string|array, // (REQUIRED) A list of events. If body is a string must be a valid JSON. * } $params * * @throws MissingParameterException if a required parameter is missing @@ -1747,8 +1788,9 @@ public function openJob(array $params = []) * * @return Elasticsearch|Promise */ - public function postCalendarEvents(array $params = []) + public function postCalendarEvents(?array $params = null) { + $params = $params ?? []; $this->checkRequiredParameters(['calendar_id','body'], $params); $url = '/_ml/calendars/' . $this->encode($params['calendar_id']) . '/events'; $method = 'POST'; @@ -1771,14 +1813,14 @@ public function postCalendarEvents(array $params = []) * * @param array{ * job_id: string, // (REQUIRED) The name of the job receiving the data - * reset_start: string, // Optional parameter to specify the start of the bucket resetting range - * reset_end: string, // Optional parameter to specify the end of the bucket resetting range - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. - * body: array, // (REQUIRED) The data to process + * reset_start?: string, // Optional parameter to specify the start of the bucket resetting range + * reset_end?: string, // Optional parameter to specify the end of the bucket resetting range + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. + * body: string|array, // (REQUIRED) The data to process. If body is a string must be a valid JSON. * } $params * * @throws MissingParameterException if a required parameter is missing @@ -1788,8 +1830,9 @@ public function postCalendarEvents(array $params = []) * * @return Elasticsearch|Promise */ - public function postData(array $params = []) + public function postData(?array $params = null) { + $params = $params ?? []; $this->checkRequiredParameters(['job_id','body'], $params); $url = '/_ml/anomaly_detectors/' . $this->encode($params['job_id']) . '/_data'; $method = 'POST'; @@ -1797,7 +1840,7 @@ public function postData(array $params = []) $url = $this->addQueryString($url, $params, ['reset_start','reset_end','pretty','human','error_trace','source','filter_path']); $headers = [ 'Accept' => 'application/json', - 'Content-Type' => isset($params['body']) && (is_string($params['body']) || $this->isAssociativeArray($params['body'])) ? 'application/json' : 'application/x-ndjson', + 'Content-Type' => is_string($params['body']) || $this->isAssociativeArray($params['body']) ? 'application/json' : 'application/x-ndjson', ]; $request = $this->createRequest($method, $url, $headers, $params['body'] ?? null); $request = $this->addOtelAttributes($params, ['job_id'], $request, 'ml.post_data'); @@ -1811,13 +1854,13 @@ public function postData(array $params = []) * @see http://www.elastic.co/guide/en/elasticsearch/reference/current/preview-dfanalytics.html * * @param array{ - * id: string, // The ID of the data frame analytics to preview - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. - * body: array, // The data frame analytics config to preview + * id?: string, // The ID of the data frame analytics to preview + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. + * body?: string|array, // The data frame analytics config to preview. If body is a string must be a valid JSON. * } $params * * @throws NoNodeAvailableException if all the hosts are offline @@ -1826,8 +1869,9 @@ public function postData(array $params = []) * * @return Elasticsearch|Promise */ - public function previewDataFrameAnalytics(array $params = []) + public function previewDataFrameAnalytics(?array $params = null) { + $params = $params ?? []; if (isset($params['id'])) { $url = '/_ml/data_frame/analytics/' . $this->encode($params['id']) . '/_preview'; $method = empty($params['body']) ? 'GET' : 'POST'; @@ -1852,15 +1896,15 @@ public function previewDataFrameAnalytics(array $params = []) * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/ml-preview-datafeed.html * * @param array{ - * datafeed_id: string, // The ID of the datafeed to preview - * start: string, // The start time from where the datafeed preview should begin - * end: string, // The end time when the datafeed preview should stop - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. - * body: array, // The datafeed config and job config with which to execute the preview + * datafeed_id?: string, // The ID of the datafeed to preview + * start?: string, // The start time from where the datafeed preview should begin + * end?: string, // The end time when the datafeed preview should stop + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. + * body?: string|array, // The datafeed config and job config with which to execute the preview. If body is a string must be a valid JSON. * } $params * * @throws NoNodeAvailableException if all the hosts are offline @@ -1869,8 +1913,9 @@ public function previewDataFrameAnalytics(array $params = []) * * @return Elasticsearch|Promise */ - public function previewDatafeed(array $params = []) + public function previewDatafeed(?array $params = null) { + $params = $params ?? []; if (isset($params['datafeed_id'])) { $url = '/_ml/datafeeds/' . $this->encode($params['datafeed_id']) . '/_preview'; $method = empty($params['body']) ? 'GET' : 'POST'; @@ -1896,12 +1941,12 @@ public function previewDatafeed(array $params = []) * * @param array{ * calendar_id: string, // (REQUIRED) The ID of the calendar to create - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. - * body: array, // The calendar details + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. + * body?: string|array, // The calendar details. If body is a string must be a valid JSON. * } $params * * @throws MissingParameterException if a required parameter is missing @@ -1911,8 +1956,9 @@ public function previewDatafeed(array $params = []) * * @return Elasticsearch|Promise */ - public function putCalendar(array $params = []) + public function putCalendar(?array $params = null) { + $params = $params ?? []; $this->checkRequiredParameters(['calendar_id'], $params); $url = '/_ml/calendars/' . $this->encode($params['calendar_id']); $method = 'PUT'; @@ -1936,11 +1982,11 @@ public function putCalendar(array $params = []) * @param array{ * calendar_id: string, // (REQUIRED) The ID of the calendar to modify * job_id: string, // (REQUIRED) The ID of the job to add to the calendar - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. * } $params * * @throws MissingParameterException if a required parameter is missing @@ -1950,8 +1996,9 @@ public function putCalendar(array $params = []) * * @return Elasticsearch|Promise */ - public function putCalendarJob(array $params = []) + public function putCalendarJob(?array $params = null) { + $params = $params ?? []; $this->checkRequiredParameters(['calendar_id','job_id'], $params); $url = '/_ml/calendars/' . $this->encode($params['calendar_id']) . '/jobs/' . $this->encode($params['job_id']); $method = 'PUT'; @@ -1973,12 +2020,12 @@ public function putCalendarJob(array $params = []) * * @param array{ * id: string, // (REQUIRED) The ID of the data frame analytics to create - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. - * body: array, // (REQUIRED) The data frame analytics configuration + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. + * body: string|array, // (REQUIRED) The data frame analytics configuration. If body is a string must be a valid JSON. * } $params * * @throws MissingParameterException if a required parameter is missing @@ -1988,8 +2035,9 @@ public function putCalendarJob(array $params = []) * * @return Elasticsearch|Promise */ - public function putDataFrameAnalytics(array $params = []) + public function putDataFrameAnalytics(?array $params = null) { + $params = $params ?? []; $this->checkRequiredParameters(['id','body'], $params); $url = '/_ml/data_frame/analytics/' . $this->encode($params['id']); $method = 'PUT'; @@ -2012,16 +2060,16 @@ public function putDataFrameAnalytics(array $params = []) * * @param array{ * datafeed_id: string, // (REQUIRED) The ID of the datafeed to create - * ignore_unavailable: boolean, // Ignore unavailable indexes (default: false) - * allow_no_indices: boolean, // Ignore if the source indices expressions resolves to no concrete indices (default: true) - * ignore_throttled: boolean, // Ignore indices that are marked as throttled (default: true) - * expand_wildcards: enum, // Whether source index expressions should get expanded to open or closed indices (default: open) - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. - * body: array, // (REQUIRED) The datafeed config + * ignore_unavailable?: bool, // Ignore unavailable indexes (default: false) + * allow_no_indices?: bool, // Ignore if the source indices expressions resolves to no concrete indices (default: true) + * ignore_throttled?: bool, // Ignore indices that are marked as throttled (default: true) + * expand_wildcards?: string, // Whether source index expressions should get expanded to open or closed indices (default: open) + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. + * body: string|array, // (REQUIRED) The datafeed config. If body is a string must be a valid JSON. * } $params * * @throws MissingParameterException if a required parameter is missing @@ -2031,8 +2079,9 @@ public function putDataFrameAnalytics(array $params = []) * * @return Elasticsearch|Promise */ - public function putDatafeed(array $params = []) + public function putDatafeed(?array $params = null) { + $params = $params ?? []; $this->checkRequiredParameters(['datafeed_id','body'], $params); $url = '/_ml/datafeeds/' . $this->encode($params['datafeed_id']); $method = 'PUT'; @@ -2055,12 +2104,12 @@ public function putDatafeed(array $params = []) * * @param array{ * filter_id: string, // (REQUIRED) The ID of the filter to create - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. - * body: array, // (REQUIRED) The filter details + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. + * body: string|array, // (REQUIRED) The filter details. If body is a string must be a valid JSON. * } $params * * @throws MissingParameterException if a required parameter is missing @@ -2070,8 +2119,9 @@ public function putDatafeed(array $params = []) * * @return Elasticsearch|Promise */ - public function putFilter(array $params = []) + public function putFilter(?array $params = null) { + $params = $params ?? []; $this->checkRequiredParameters(['filter_id','body'], $params); $url = '/_ml/filters/' . $this->encode($params['filter_id']); $method = 'PUT'; @@ -2094,16 +2144,16 @@ public function putFilter(array $params = []) * * @param array{ * job_id: string, // (REQUIRED) The ID of the job to create - * ignore_unavailable: boolean, // Ignore unavailable indexes (default: false). Only set if datafeed_config is provided. - * allow_no_indices: boolean, // Ignore if the source indices expressions resolves to no concrete indices (default: true). Only set if datafeed_config is provided. - * ignore_throttled: boolean, // Ignore indices that are marked as throttled (default: true). Only set if datafeed_config is provided. - * expand_wildcards: enum, // Whether source index expressions should get expanded to open or closed indices (default: open). Only set if datafeed_config is provided. - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. - * body: array, // (REQUIRED) The job + * ignore_unavailable?: bool, // Ignore unavailable indexes (default: false). Only set if datafeed_config is provided. + * allow_no_indices?: bool, // Ignore if the source indices expressions resolves to no concrete indices (default: true). Only set if datafeed_config is provided. + * ignore_throttled?: bool, // Ignore indices that are marked as throttled (default: true). Only set if datafeed_config is provided. + * expand_wildcards?: string, // Whether source index expressions should get expanded to open or closed indices (default: open). Only set if datafeed_config is provided. + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. + * body: string|array, // (REQUIRED) The job. If body is a string must be a valid JSON. * } $params * * @throws MissingParameterException if a required parameter is missing @@ -2113,8 +2163,9 @@ public function putFilter(array $params = []) * * @return Elasticsearch|Promise */ - public function putJob(array $params = []) + public function putJob(?array $params = null) { + $params = $params ?? []; $this->checkRequiredParameters(['job_id','body'], $params); $url = '/_ml/anomaly_detectors/' . $this->encode($params['job_id']); $method = 'PUT'; @@ -2137,14 +2188,14 @@ public function putJob(array $params = []) * * @param array{ * model_id: string, // (REQUIRED) The ID of the trained models to store - * defer_definition_decompression: boolean, // If set to `true` and a `compressed_definition` is provided, the request defers definition decompression and skips relevant validations. - * wait_for_completion: boolean, // Whether to wait for all child operations(e.g. model download) to complete, before returning or not. Default to false - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. - * body: array, // (REQUIRED) The trained model configuration + * defer_definition_decompression?: bool, // If set to `true` and a `compressed_definition` is provided, the request defers definition decompression and skips relevant validations. + * wait_for_completion?: bool, // Whether to wait for all child operations(e.g. model download) to complete, before returning or not. Default to false + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. + * body: string|array, // (REQUIRED) The trained model configuration. If body is a string must be a valid JSON. * } $params * * @throws MissingParameterException if a required parameter is missing @@ -2154,8 +2205,9 @@ public function putJob(array $params = []) * * @return Elasticsearch|Promise */ - public function putTrainedModel(array $params = []) + public function putTrainedModel(?array $params = null) { + $params = $params ?? []; $this->checkRequiredParameters(['model_id','body'], $params); $url = '/_ml/trained_models/' . $this->encode($params['model_id']); $method = 'PUT'; @@ -2179,12 +2231,12 @@ public function putTrainedModel(array $params = []) * @param array{ * model_alias: string, // (REQUIRED) The trained model alias to update * model_id: string, // (REQUIRED) The trained model where the model alias should be assigned - * reassign: boolean, // If the model_alias already exists and points to a separate model_id, this parameter must be true. Defaults to false. - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. + * reassign?: bool, // If the model_alias already exists and points to a separate model_id, this parameter must be true. Defaults to false. + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. * } $params * * @throws MissingParameterException if a required parameter is missing @@ -2194,8 +2246,9 @@ public function putTrainedModel(array $params = []) * * @return Elasticsearch|Promise */ - public function putTrainedModelAlias(array $params = []) + public function putTrainedModelAlias(?array $params = null) { + $params = $params ?? []; $this->checkRequiredParameters(['model_alias','model_id'], $params); $url = '/_ml/trained_models/' . $this->encode($params['model_id']) . '/model_aliases/' . $this->encode($params['model_alias']); $method = 'PUT'; @@ -2219,12 +2272,12 @@ public function putTrainedModelAlias(array $params = []) * @param array{ * model_id: string, // (REQUIRED) The ID of the trained model for this definition part * part: int, // (REQUIRED) The part number - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. - * body: array, // (REQUIRED) The trained model definition part + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. + * body: string|array, // (REQUIRED) The trained model definition part. If body is a string must be a valid JSON. * } $params * * @throws MissingParameterException if a required parameter is missing @@ -2234,8 +2287,9 @@ public function putTrainedModelAlias(array $params = []) * * @return Elasticsearch|Promise */ - public function putTrainedModelDefinitionPart(array $params = []) + public function putTrainedModelDefinitionPart(?array $params = null) { + $params = $params ?? []; $this->checkRequiredParameters(['model_id','part','body'], $params); $url = '/_ml/trained_models/' . $this->encode($params['model_id']) . '/definition/' . $this->encode($params['part']); $method = 'PUT'; @@ -2258,12 +2312,12 @@ public function putTrainedModelDefinitionPart(array $params = []) * * @param array{ * model_id: string, // (REQUIRED) The ID of the trained model for this vocabulary - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. - * body: array, // (REQUIRED) The trained model vocabulary + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. + * body: string|array, // (REQUIRED) The trained model vocabulary. If body is a string must be a valid JSON. * } $params * * @throws MissingParameterException if a required parameter is missing @@ -2273,8 +2327,9 @@ public function putTrainedModelDefinitionPart(array $params = []) * * @return Elasticsearch|Promise */ - public function putTrainedModelVocabulary(array $params = []) + public function putTrainedModelVocabulary(?array $params = null) { + $params = $params ?? []; $this->checkRequiredParameters(['model_id','body'], $params); $url = '/_ml/trained_models/' . $this->encode($params['model_id']) . '/vocabulary'; $method = 'PUT'; @@ -2297,13 +2352,13 @@ public function putTrainedModelVocabulary(array $params = []) * * @param array{ * job_id: string, // (REQUIRED) The ID of the job to reset - * wait_for_completion: boolean, // Should this request wait until the operation has completed before returning - * delete_user_annotations: boolean, // Should annotations added by the user be deleted - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. + * wait_for_completion?: bool, // Should this request wait until the operation has completed before returning + * delete_user_annotations?: bool, // Should annotations added by the user be deleted + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. * } $params * * @throws MissingParameterException if a required parameter is missing @@ -2313,8 +2368,9 @@ public function putTrainedModelVocabulary(array $params = []) * * @return Elasticsearch|Promise */ - public function resetJob(array $params = []) + public function resetJob(?array $params = null) { + $params = $params ?? []; $this->checkRequiredParameters(['job_id'], $params); $url = '/_ml/anomaly_detectors/' . $this->encode($params['job_id']) . '/_reset'; $method = 'POST'; @@ -2337,13 +2393,13 @@ public function resetJob(array $params = []) * @param array{ * job_id: string, // (REQUIRED) The ID of the job to fetch * snapshot_id: string, // (REQUIRED) The ID of the snapshot to revert to - * delete_intervening_results: boolean, // Should we reset the results back to the time of the snapshot? - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. - * body: array, // Reversion options + * delete_intervening_results?: bool, // Should we reset the results back to the time of the snapshot? + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. + * body?: string|array, // Reversion options. If body is a string must be a valid JSON. * } $params * * @throws MissingParameterException if a required parameter is missing @@ -2353,8 +2409,9 @@ public function resetJob(array $params = []) * * @return Elasticsearch|Promise */ - public function revertModelSnapshot(array $params = []) + public function revertModelSnapshot(?array $params = null) { + $params = $params ?? []; $this->checkRequiredParameters(['job_id','snapshot_id'], $params); $url = '/_ml/anomaly_detectors/' . $this->encode($params['job_id']) . '/model_snapshots/' . $this->encode($params['snapshot_id']) . '/_revert'; $method = 'POST'; @@ -2376,13 +2433,13 @@ public function revertModelSnapshot(array $params = []) * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/ml-set-upgrade-mode.html * * @param array{ - * enabled: boolean, // Whether to enable upgrade_mode ML setting or not. Defaults to false. - * timeout: time, // Controls the time to wait before action times out. Defaults to 30 seconds - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. + * enabled?: bool, // Whether to enable upgrade_mode ML setting or not. Defaults to false. + * timeout?: int|string, // Controls the time to wait before action times out. Defaults to 30 seconds + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. * } $params * * @throws NoNodeAvailableException if all the hosts are offline @@ -2391,8 +2448,9 @@ public function revertModelSnapshot(array $params = []) * * @return Elasticsearch|Promise */ - public function setUpgradeMode(array $params = []) + public function setUpgradeMode(?array $params = null) { + $params = $params ?? []; $url = '/_ml/set_upgrade_mode'; $method = 'POST'; @@ -2413,13 +2471,13 @@ public function setUpgradeMode(array $params = []) * * @param array{ * id: string, // (REQUIRED) The ID of the data frame analytics to start - * timeout: time, // Controls the time to wait until the task has started. Defaults to 20 seconds - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. - * body: array, // The start data frame analytics parameters + * timeout?: int|string, // Controls the time to wait until the task has started. Defaults to 20 seconds + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. + * body?: string|array, // The start data frame analytics parameters. If body is a string must be a valid JSON. * } $params * * @throws MissingParameterException if a required parameter is missing @@ -2429,8 +2487,9 @@ public function setUpgradeMode(array $params = []) * * @return Elasticsearch|Promise */ - public function startDataFrameAnalytics(array $params = []) + public function startDataFrameAnalytics(?array $params = null) { + $params = $params ?? []; $this->checkRequiredParameters(['id'], $params); $url = '/_ml/data_frame/analytics/' . $this->encode($params['id']) . '/_start'; $method = 'POST'; @@ -2453,15 +2512,15 @@ public function startDataFrameAnalytics(array $params = []) * * @param array{ * datafeed_id: string, // (REQUIRED) The ID of the datafeed to start - * start: string, // The start time from where the datafeed should begin - * end: string, // The end time when the datafeed should stop. When not set, the datafeed continues in real time - * timeout: time, // Controls the time to wait until a datafeed has started. Default to 20 seconds - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. - * body: array, // The start datafeed parameters + * start?: string, // The start time from where the datafeed should begin + * end?: string, // The end time when the datafeed should stop. When not set, the datafeed continues in real time + * timeout?: int|string, // Controls the time to wait until a datafeed has started. Default to 20 seconds + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. + * body?: string|array, // The start datafeed parameters. If body is a string must be a valid JSON. * } $params * * @throws MissingParameterException if a required parameter is missing @@ -2471,8 +2530,9 @@ public function startDataFrameAnalytics(array $params = []) * * @return Elasticsearch|Promise */ - public function startDatafeed(array $params = []) + public function startDatafeed(?array $params = null) { + $params = $params ?? []; $this->checkRequiredParameters(['datafeed_id'], $params); $url = '/_ml/datafeeds/' . $this->encode($params['datafeed_id']) . '/_start'; $method = 'POST'; @@ -2495,19 +2555,20 @@ public function startDatafeed(array $params = []) * * @param array{ * model_id: string, // (REQUIRED) The unique identifier of the trained model. - * cache_size: string, // A byte-size value for configuring the inference cache size. For example, 20mb. - * deployment_id: string, // The Id of the new deployment. Defaults to the model_id if not set. - * number_of_allocations: int, // The total number of allocations this model is assigned across machine learning nodes. - * threads_per_allocation: int, // The number of threads used by each model allocation during inference. - * priority: string, // The deployment priority. - * queue_capacity: int, // Controls how many inference requests are allowed in the queue at a time. - * timeout: time, // Controls the amount of time to wait for the model to deploy. - * wait_for: string, // The allocation status for which to wait - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. + * cache_size?: string, // A byte-size value for configuring the inference cache size. For example, 20mb. + * deployment_id?: string, // The Id of the new deployment. Defaults to the model_id if not set. + * number_of_allocations?: int, // The total number of allocations this model is assigned across machine learning nodes. + * threads_per_allocation?: int, // The number of threads used by each model allocation during inference. + * priority?: string, // The deployment priority. + * queue_capacity?: int, // Controls how many inference requests are allowed in the queue at a time. + * timeout?: int|string, // Controls the amount of time to wait for the model to deploy. + * wait_for?: string, // The allocation status for which to wait + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. + * body?: string|array, // The settings for the trained model deployment. If body is a string must be a valid JSON. * } $params * * @throws MissingParameterException if a required parameter is missing @@ -2517,8 +2578,9 @@ public function startDatafeed(array $params = []) * * @return Elasticsearch|Promise */ - public function startTrainedModelDeployment(array $params = []) + public function startTrainedModelDeployment(?array $params = null) { + $params = $params ?? []; $this->checkRequiredParameters(['model_id'], $params); $url = '/_ml/trained_models/' . $this->encode($params['model_id']) . '/deployment/_start'; $method = 'POST'; @@ -2541,15 +2603,15 @@ public function startTrainedModelDeployment(array $params = []) * * @param array{ * id: string, // (REQUIRED) The ID of the data frame analytics to stop - * allow_no_match: boolean, // 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) - * force: boolean, // True if the data frame analytics should be forcefully stopped - * timeout: time, // Controls the time to wait until the task has stopped. Defaults to 20 seconds - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. - * body: array, // The stop data frame analytics parameters + * allow_no_match?: bool, // 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) + * force?: bool, // True if the data frame analytics should be forcefully stopped + * timeout?: int|string, // Controls the time to wait until the task has stopped. Defaults to 20 seconds + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. + * body?: string|array, // The stop data frame analytics parameters. If body is a string must be a valid JSON. * } $params * * @throws MissingParameterException if a required parameter is missing @@ -2559,8 +2621,9 @@ public function startTrainedModelDeployment(array $params = []) * * @return Elasticsearch|Promise */ - public function stopDataFrameAnalytics(array $params = []) + public function stopDataFrameAnalytics(?array $params = null) { + $params = $params ?? []; $this->checkRequiredParameters(['id'], $params); $url = '/_ml/data_frame/analytics/' . $this->encode($params['id']) . '/_stop'; $method = 'POST'; @@ -2583,16 +2646,16 @@ public function stopDataFrameAnalytics(array $params = []) * * @param array{ * datafeed_id: string, // (REQUIRED) The ID of the datafeed to stop - * allow_no_match: boolean, // Whether to ignore if a wildcard expression matches no datafeeds. (This includes `_all` string or when no datafeeds have been specified) - * allow_no_datafeeds: boolean, // Whether to ignore if a wildcard expression matches no datafeeds. (This includes `_all` string or when no datafeeds have been specified) - * force: boolean, // True if the datafeed should be forcefully stopped. - * timeout: time, // Controls the time to wait until a datafeed has stopped. Default to 20 seconds - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. - * body: array, // The URL params optionally sent in the body + * allow_no_match?: bool, // Whether to ignore if a wildcard expression matches no datafeeds. (This includes `_all` string or when no datafeeds have been specified) + * allow_no_datafeeds?: bool, // Whether to ignore if a wildcard expression matches no datafeeds. (This includes `_all` string or when no datafeeds have been specified) + * force?: bool, // True if the datafeed should be forcefully stopped. + * timeout?: int|string, // Controls the time to wait until a datafeed has stopped. Default to 20 seconds + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. + * body?: string|array, // The URL params optionally sent in the body. If body is a string must be a valid JSON. * } $params * * @throws MissingParameterException if a required parameter is missing @@ -2602,8 +2665,9 @@ public function stopDataFrameAnalytics(array $params = []) * * @return Elasticsearch|Promise */ - public function stopDatafeed(array $params = []) + public function stopDatafeed(?array $params = null) { + $params = $params ?? []; $this->checkRequiredParameters(['datafeed_id'], $params); $url = '/_ml/datafeeds/' . $this->encode($params['datafeed_id']) . '/_stop'; $method = 'POST'; @@ -2626,14 +2690,14 @@ public function stopDatafeed(array $params = []) * * @param array{ * model_id: string, // (REQUIRED) The unique identifier of the trained model. - * allow_no_match: boolean, // Whether to ignore if a wildcard expression matches no deployments. (This includes `_all` string or when no deployments have been specified) - * force: boolean, // True if the deployment should be forcefully stopped - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. - * body: array, // The stop deployment parameters + * allow_no_match?: bool, // Whether to ignore if a wildcard expression matches no deployments. (This includes `_all` string or when no deployments have been specified) + * force?: bool, // True if the deployment should be forcefully stopped + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. + * body?: string|array, // The stop deployment parameters. If body is a string must be a valid JSON. * } $params * * @throws MissingParameterException if a required parameter is missing @@ -2643,8 +2707,9 @@ public function stopDatafeed(array $params = []) * * @return Elasticsearch|Promise */ - public function stopTrainedModelDeployment(array $params = []) + public function stopTrainedModelDeployment(?array $params = null) { + $params = $params ?? []; $this->checkRequiredParameters(['model_id'], $params); $url = '/_ml/trained_models/' . $this->encode($params['model_id']) . '/deployment/_stop'; $method = 'POST'; @@ -2667,12 +2732,12 @@ public function stopTrainedModelDeployment(array $params = []) * * @param array{ * id: string, // (REQUIRED) The ID of the data frame analytics to update - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. - * body: array, // (REQUIRED) The data frame analytics settings to update + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. + * body: string|array, // (REQUIRED) The data frame analytics settings to update. If body is a string must be a valid JSON. * } $params * * @throws MissingParameterException if a required parameter is missing @@ -2682,8 +2747,9 @@ public function stopTrainedModelDeployment(array $params = []) * * @return Elasticsearch|Promise */ - public function updateDataFrameAnalytics(array $params = []) + public function updateDataFrameAnalytics(?array $params = null) { + $params = $params ?? []; $this->checkRequiredParameters(['id','body'], $params); $url = '/_ml/data_frame/analytics/' . $this->encode($params['id']) . '/_update'; $method = 'POST'; @@ -2706,16 +2772,16 @@ public function updateDataFrameAnalytics(array $params = []) * * @param array{ * datafeed_id: string, // (REQUIRED) The ID of the datafeed to update - * ignore_unavailable: boolean, // Ignore unavailable indexes (default: false) - * allow_no_indices: boolean, // Ignore if the source indices expressions resolves to no concrete indices (default: true) - * ignore_throttled: boolean, // Ignore indices that are marked as throttled (default: true) - * expand_wildcards: enum, // Whether source index expressions should get expanded to open or closed indices (default: open) - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. - * body: array, // (REQUIRED) The datafeed update settings + * ignore_unavailable?: bool, // Ignore unavailable indexes (default: false) + * allow_no_indices?: bool, // Ignore if the source indices expressions resolves to no concrete indices (default: true) + * ignore_throttled?: bool, // Ignore indices that are marked as throttled (default: true) + * expand_wildcards?: string, // Whether source index expressions should get expanded to open or closed indices (default: open) + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. + * body: string|array, // (REQUIRED) The datafeed update settings. If body is a string must be a valid JSON. * } $params * * @throws MissingParameterException if a required parameter is missing @@ -2725,8 +2791,9 @@ public function updateDataFrameAnalytics(array $params = []) * * @return Elasticsearch|Promise */ - public function updateDatafeed(array $params = []) + public function updateDatafeed(?array $params = null) { + $params = $params ?? []; $this->checkRequiredParameters(['datafeed_id','body'], $params); $url = '/_ml/datafeeds/' . $this->encode($params['datafeed_id']) . '/_update'; $method = 'POST'; @@ -2749,12 +2816,12 @@ public function updateDatafeed(array $params = []) * * @param array{ * filter_id: string, // (REQUIRED) The ID of the filter to update - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. - * body: array, // (REQUIRED) The filter update + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. + * body: string|array, // (REQUIRED) The filter update. If body is a string must be a valid JSON. * } $params * * @throws MissingParameterException if a required parameter is missing @@ -2764,8 +2831,9 @@ public function updateDatafeed(array $params = []) * * @return Elasticsearch|Promise */ - public function updateFilter(array $params = []) + public function updateFilter(?array $params = null) { + $params = $params ?? []; $this->checkRequiredParameters(['filter_id','body'], $params); $url = '/_ml/filters/' . $this->encode($params['filter_id']) . '/_update'; $method = 'POST'; @@ -2788,12 +2856,12 @@ public function updateFilter(array $params = []) * * @param array{ * job_id: string, // (REQUIRED) The ID of the job to create - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. - * body: array, // (REQUIRED) The job update settings + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. + * body: string|array, // (REQUIRED) The job update settings. If body is a string must be a valid JSON. * } $params * * @throws MissingParameterException if a required parameter is missing @@ -2803,8 +2871,9 @@ public function updateFilter(array $params = []) * * @return Elasticsearch|Promise */ - public function updateJob(array $params = []) + public function updateJob(?array $params = null) { + $params = $params ?? []; $this->checkRequiredParameters(['job_id','body'], $params); $url = '/_ml/anomaly_detectors/' . $this->encode($params['job_id']) . '/_update'; $method = 'POST'; @@ -2828,12 +2897,12 @@ public function updateJob(array $params = []) * @param array{ * job_id: string, // (REQUIRED) The ID of the job to fetch * snapshot_id: string, // (REQUIRED) The ID of the snapshot to update - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. - * body: array, // (REQUIRED) The model snapshot properties to update + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. + * body: string|array, // (REQUIRED) The model snapshot properties to update. If body is a string must be a valid JSON. * } $params * * @throws MissingParameterException if a required parameter is missing @@ -2843,8 +2912,9 @@ public function updateJob(array $params = []) * * @return Elasticsearch|Promise */ - public function updateModelSnapshot(array $params = []) + public function updateModelSnapshot(?array $params = null) { + $params = $params ?? []; $this->checkRequiredParameters(['job_id','snapshot_id','body'], $params); $url = '/_ml/anomaly_detectors/' . $this->encode($params['job_id']) . '/model_snapshots/' . $this->encode($params['snapshot_id']) . '/_update'; $method = 'POST'; @@ -2867,13 +2937,13 @@ public function updateModelSnapshot(array $params = []) * * @param array{ * model_id: string, // (REQUIRED) The unique identifier of the trained model. - * number_of_allocations: int, // Update the model deployment to this number of allocations. - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. - * body: array, // The updated trained model deployment settings + * number_of_allocations?: int, // Update the model deployment to this number of allocations. + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. + * body?: string|array, // The updated trained model deployment settings. If body is a string must be a valid JSON. * } $params * * @throws MissingParameterException if a required parameter is missing @@ -2883,8 +2953,9 @@ public function updateModelSnapshot(array $params = []) * * @return Elasticsearch|Promise */ - public function updateTrainedModelDeployment(array $params = []) + public function updateTrainedModelDeployment(?array $params = null) { + $params = $params ?? []; $this->checkRequiredParameters(['model_id'], $params); $url = '/_ml/trained_models/' . $this->encode($params['model_id']) . '/deployment/_update'; $method = 'POST'; @@ -2908,13 +2979,13 @@ public function updateTrainedModelDeployment(array $params = []) * @param array{ * job_id: string, // (REQUIRED) The ID of the job * snapshot_id: string, // (REQUIRED) The ID of the snapshot - * timeout: time, // How long should the API wait for the job to be opened and the old snapshot to be loaded. - * wait_for_completion: boolean, // Should the request wait until the task is complete before responding to the caller. Default is false. - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. + * timeout?: int|string, // How long should the API wait for the job to be opened and the old snapshot to be loaded. + * wait_for_completion?: bool, // Should the request wait until the task is complete before responding to the caller. Default is false. + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. * } $params * * @throws MissingParameterException if a required parameter is missing @@ -2924,8 +2995,9 @@ public function updateTrainedModelDeployment(array $params = []) * * @return Elasticsearch|Promise */ - public function upgradeJobSnapshot(array $params = []) + public function upgradeJobSnapshot(?array $params = null) { + $params = $params ?? []; $this->checkRequiredParameters(['job_id','snapshot_id'], $params); $url = '/_ml/anomaly_detectors/' . $this->encode($params['job_id']) . '/model_snapshots/' . $this->encode($params['snapshot_id']) . '/_upgrade'; $method = 'POST'; @@ -2946,12 +3018,12 @@ public function upgradeJobSnapshot(array $params = []) * @see https://www.elastic.co/guide/en/machine-learning/current/ml-jobs.html * * @param array{ - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. - * body: array, // (REQUIRED) The job config + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. + * body: string|array, // (REQUIRED) The job config. If body is a string must be a valid JSON. * } $params * * @throws NoNodeAvailableException if all the hosts are offline @@ -2960,8 +3032,9 @@ public function upgradeJobSnapshot(array $params = []) * * @return Elasticsearch|Promise */ - public function validate(array $params = []) + public function validate(?array $params = null) { + $params = $params ?? []; $this->checkRequiredParameters(['body'], $params); $url = '/_ml/anomaly_detectors/_validate'; $method = 'POST'; @@ -2983,12 +3056,12 @@ public function validate(array $params = []) * @see https://www.elastic.co/guide/en/machine-learning/current/ml-jobs.html * * @param array{ - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. - * body: array, // (REQUIRED) The detector + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. + * body: string|array, // (REQUIRED) The detector. If body is a string must be a valid JSON. * } $params * * @throws NoNodeAvailableException if all the hosts are offline @@ -2997,8 +3070,9 @@ public function validate(array $params = []) * * @return Elasticsearch|Promise */ - public function validateDetector(array $params = []) + public function validateDetector(?array $params = null) { + $params = $params ?? []; $this->checkRequiredParameters(['body'], $params); $url = '/_ml/anomaly_detectors/_validate/detector'; $method = 'POST'; diff --git a/src/Endpoints/Monitoring.php b/src/Endpoints/Monitoring.php index c642629a5..52a878535 100644 --- a/src/Endpoints/Monitoring.php +++ b/src/Endpoints/Monitoring.php @@ -34,16 +34,16 @@ class Monitoring extends AbstractEndpoint * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/monitor-elasticsearch-cluster.html * * @param array{ - * type: string, // Default document type for items which don't provide one - * system_id: string, // Identifier of the monitored system - * system_api_version: string, // API Version of the monitored system - * interval: string, // Collection interval (e.g., '10s' or '10000ms') of the payload - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. - * body: array, // (REQUIRED) The operation definition and data (action-data pairs), separated by newlines + * type?: string, // Default document type for items which don't provide one + * system_id?: string, // Identifier of the monitored system + * system_api_version?: string, // API Version of the monitored system + * interval?: string, // Collection interval (e.g., '10s' or '10000ms') of the payload + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. + * body: string|array, // (REQUIRED) The operation definition and data (action-data pairs), separated by newlines. If body is a string must be a valid JSON. * } $params * * @throws NoNodeAvailableException if all the hosts are offline @@ -52,8 +52,9 @@ class Monitoring extends AbstractEndpoint * * @return Elasticsearch|Promise */ - public function bulk(array $params = []) + public function bulk(?array $params = null) { + $params = $params ?? []; $this->checkRequiredParameters(['body'], $params); if (isset($params['type'])) { $url = '/_monitoring/' . $this->encode($params['type']) . '/bulk'; diff --git a/src/Endpoints/Nodes.php b/src/Endpoints/Nodes.php index a4f3a93fa..5ad20abea 100644 --- a/src/Endpoints/Nodes.php +++ b/src/Endpoints/Nodes.php @@ -35,13 +35,13 @@ class Nodes extends AbstractEndpoint * @internal This API is EXPERIMENTAL and may be changed or removed completely in a future release * * @param array{ - * node_id: list, // (REQUIRED) Comma-separated list of node IDs or names used to limit returned information. - * max_archive_version: long, // (REQUIRED) Specifies the maximum archive_version to be cleared from the archive. - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. + * node_id: string|array, // (REQUIRED) Comma-separated list of node IDs or names used to limit returned information. + * max_archive_version: int, // (REQUIRED) Specifies the maximum archive_version to be cleared from the archive. + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. * } $params * * @throws MissingParameterException if a required parameter is missing @@ -51,10 +51,11 @@ class Nodes extends AbstractEndpoint * * @return Elasticsearch|Promise */ - public function clearRepositoriesMeteringArchive(array $params = []) + public function clearRepositoriesMeteringArchive(?array $params = null) { + $params = $params ?? []; $this->checkRequiredParameters(['node_id','max_archive_version'], $params); - $url = '/_nodes/' . $this->encode($params['node_id']) . '/_repositories_metering/' . $this->encode($params['max_archive_version']); + $url = '/_nodes/' . $this->encode($this->convertValue($params['node_id'])) . '/_repositories_metering/' . $this->encode($params['max_archive_version']); $method = 'DELETE'; $url = $this->addQueryString($url, $params, ['pretty','human','error_trace','source','filter_path']); @@ -74,12 +75,12 @@ public function clearRepositoriesMeteringArchive(array $params = []) * @internal This API is EXPERIMENTAL and may be changed or removed completely in a future release * * @param array{ - * node_id: list, // (REQUIRED) A comma-separated list of node IDs or names to limit the returned information. - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. + * node_id: string|array, // (REQUIRED) A comma-separated list of node IDs or names to limit the returned information. + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. * } $params * * @throws MissingParameterException if a required parameter is missing @@ -89,10 +90,11 @@ public function clearRepositoriesMeteringArchive(array $params = []) * * @return Elasticsearch|Promise */ - public function getRepositoriesMeteringInfo(array $params = []) + public function getRepositoriesMeteringInfo(?array $params = null) { + $params = $params ?? []; $this->checkRequiredParameters(['node_id'], $params); - $url = '/_nodes/' . $this->encode($params['node_id']) . '/_repositories_metering'; + $url = '/_nodes/' . $this->encode($this->convertValue($params['node_id'])) . '/_repositories_metering'; $method = 'GET'; $url = $this->addQueryString($url, $params, ['pretty','human','error_trace','source','filter_path']); @@ -111,19 +113,19 @@ public function getRepositoriesMeteringInfo(array $params = []) * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/cluster-nodes-hot-threads.html * * @param array{ - * node_id: list, // 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 - * interval: time, // The interval for the second sampling of threads - * snapshots: number, // Number of samples of thread stacktrace (default: 10) - * threads: number, // Specify the number of threads to provide information for (default: 3) - * ignore_idle_threads: boolean, // Don't show threads that are in known-idle places, such as waiting on a socket select or pulling from an empty task queue (default: true) - * type: enum, // The type to sample (default: cpu) - * sort: enum, // The sort order for 'cpu' type (default: total) - * timeout: time, // Explicit operation timeout - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. + * node_id?: string|array, // 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 + * interval?: int|string, // The interval for the second sampling of threads + * snapshots?: int, // Number of samples of thread stacktrace (default: 10) + * threads?: int, // Specify the number of threads to provide information for (default: 3) + * ignore_idle_threads?: bool, // Don't show threads that are in known-idle places, such as waiting on a socket select or pulling from an empty task queue (default: true) + * type?: string, // The type to sample (default: cpu) + * sort?: string, // The sort order for 'cpu' type (default: total) + * timeout?: int|string, // Explicit operation timeout + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. * } $params * * @throws NoNodeAvailableException if all the hosts are offline @@ -132,10 +134,11 @@ public function getRepositoriesMeteringInfo(array $params = []) * * @return Elasticsearch|Promise */ - public function hotThreads(array $params = []) + public function hotThreads(?array $params = null) { + $params = $params ?? []; if (isset($params['node_id'])) { - $url = '/_nodes/' . $this->encode($params['node_id']) . '/hot_threads'; + $url = '/_nodes/' . $this->encode($this->convertValue($params['node_id'])) . '/hot_threads'; $method = 'GET'; } else { $url = '/_nodes/hot_threads'; @@ -157,15 +160,15 @@ public function hotThreads(array $params = []) * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/cluster-nodes-info.html * * @param array{ - * node_id: list, // 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 - * metric: list, // A comma-separated list of metrics you wish returned. Use `_all` to retrieve all metrics and `_none` to retrieve the node identity without any additional metrics. - * flat_settings: boolean, // Return settings in flat format (default: false) - * timeout: time, // Explicit operation timeout - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. + * node_id?: string|array, // 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 + * metric?: string|array, // A comma-separated list of metrics you wish returned. Use `_all` to retrieve all metrics and `_none` to retrieve the node identity without any additional metrics. + * flat_settings?: bool, // Return settings in flat format (default: false) + * timeout?: int|string, // Explicit operation timeout + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. * } $params * * @throws NoNodeAvailableException if all the hosts are offline @@ -174,16 +177,17 @@ public function hotThreads(array $params = []) * * @return Elasticsearch|Promise */ - public function info(array $params = []) + public function info(?array $params = null) { + $params = $params ?? []; if (isset($params['node_id']) && isset($params['metric'])) { - $url = '/_nodes/' . $this->encode($params['node_id']) . '/' . $this->encode($params['metric']); + $url = '/_nodes/' . $this->encode($this->convertValue($params['node_id'])) . '/' . $this->encode($this->convertValue($params['metric'])); $method = 'GET'; } elseif (isset($params['node_id'])) { - $url = '/_nodes/' . $this->encode($params['node_id']); + $url = '/_nodes/' . $this->encode($this->convertValue($params['node_id'])); $method = 'GET'; } elseif (isset($params['metric'])) { - $url = '/_nodes/' . $this->encode($params['metric']); + $url = '/_nodes/' . $this->encode($this->convertValue($params['metric'])); $method = 'GET'; } else { $url = '/_nodes'; @@ -205,14 +209,14 @@ public function info(array $params = []) * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/secure-settings.html#reloadable-secure-settings * * @param array{ - * node_id: list, // A comma-separated list of node IDs to span the reload/reinit call. Should stay empty because reloading usually involves all cluster nodes. - * timeout: time, // Explicit operation timeout - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. - * body: array, // An object containing the password for the elasticsearch keystore + * node_id?: string|array, // A comma-separated list of node IDs to span the reload/reinit call. Should stay empty because reloading usually involves all cluster nodes. + * timeout?: int|string, // Explicit operation timeout + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. + * body?: string|array, // An object containing the password for the elasticsearch keystore. If body is a string must be a valid JSON. * } $params * * @throws NoNodeAvailableException if all the hosts are offline @@ -221,10 +225,11 @@ public function info(array $params = []) * * @return Elasticsearch|Promise */ - public function reloadSecureSettings(array $params = []) + public function reloadSecureSettings(?array $params = null) { + $params = $params ?? []; if (isset($params['node_id'])) { - $url = '/_nodes/' . $this->encode($params['node_id']) . '/reload_secure_settings'; + $url = '/_nodes/' . $this->encode($this->convertValue($params['node_id'])) . '/reload_secure_settings'; $method = 'POST'; } else { $url = '/_nodes/reload_secure_settings'; @@ -247,23 +252,23 @@ public function reloadSecureSettings(array $params = []) * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/cluster-nodes-stats.html * * @param array{ - * node_id: list, // 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 - * metric: list, // Limit the information returned to the specified metrics - * index_metric: list, // Limit the information returned for `indices` metric to the specific index metrics. Isn't used if `indices` (or `all`) metric isn't specified. - * completion_fields: list, // A comma-separated list of fields for the `completion` index metric (supports wildcards) - * fielddata_fields: list, // A comma-separated list of fields for the `fielddata` index metric (supports wildcards) - * fields: list, // A comma-separated list of fields for `fielddata` and `completion` index metric (supports wildcards) - * groups: boolean, // A comma-separated list of search groups for `search` index metric - * level: enum, // Return indices stats aggregated at index, node or shard level - * types: list, // A comma-separated list of document types for the `indexing` index metric - * timeout: time, // Explicit operation timeout - * include_segment_file_sizes: boolean, // Whether to report the aggregated disk usage of each one of the Lucene index files (only applies if segment stats are requested) - * include_unloaded_segments: boolean, // If set to true segment stats will include stats for segments that are not currently loaded into memory - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. + * node_id?: string|array, // 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 + * metric?: string|array, // Limit the information returned to the specified metrics + * index_metric?: string|array, // Limit the information returned for `indices` metric to the specific index metrics. Isn't used if `indices` (or `all`) metric isn't specified. + * completion_fields?: string|array, // A comma-separated list of fields for the `completion` index metric (supports wildcards) + * fielddata_fields?: string|array, // A comma-separated list of fields for the `fielddata` index metric (supports wildcards) + * fields?: string|array, // A comma-separated list of fields for `fielddata` and `completion` index metric (supports wildcards) + * groups?: bool, // A comma-separated list of search groups for `search` index metric + * level?: string, // Return indices stats aggregated at index, node or shard level + * types?: string|array, // A comma-separated list of document types for the `indexing` index metric + * timeout?: int|string, // Explicit operation timeout + * include_segment_file_sizes?: bool, // Whether to report the aggregated disk usage of each one of the Lucene index files (only applies if segment stats are requested) + * include_unloaded_segments?: bool, // If set to true segment stats will include stats for segments that are not currently loaded into memory + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. * } $params * * @throws NoNodeAvailableException if all the hosts are offline @@ -272,22 +277,23 @@ public function reloadSecureSettings(array $params = []) * * @return Elasticsearch|Promise */ - public function stats(array $params = []) + public function stats(?array $params = null) { + $params = $params ?? []; if (isset($params['metric']) && isset($params['index_metric']) && isset($params['node_id'])) { - $url = '/_nodes/' . $this->encode($params['node_id']) . '/stats/' . $this->encode($params['metric']) . '/' . $this->encode($params['index_metric']); + $url = '/_nodes/' . $this->encode($this->convertValue($params['node_id'])) . '/stats/' . $this->encode($this->convertValue($params['metric'])) . '/' . $this->encode($this->convertValue($params['index_metric'])); $method = 'GET'; } elseif (isset($params['metric']) && isset($params['node_id'])) { - $url = '/_nodes/' . $this->encode($params['node_id']) . '/stats/' . $this->encode($params['metric']); + $url = '/_nodes/' . $this->encode($this->convertValue($params['node_id'])) . '/stats/' . $this->encode($this->convertValue($params['metric'])); $method = 'GET'; } elseif (isset($params['metric']) && isset($params['index_metric'])) { - $url = '/_nodes/stats/' . $this->encode($params['metric']) . '/' . $this->encode($params['index_metric']); + $url = '/_nodes/stats/' . $this->encode($this->convertValue($params['metric'])) . '/' . $this->encode($this->convertValue($params['index_metric'])); $method = 'GET'; } elseif (isset($params['node_id'])) { - $url = '/_nodes/' . $this->encode($params['node_id']) . '/stats'; + $url = '/_nodes/' . $this->encode($this->convertValue($params['node_id'])) . '/stats'; $method = 'GET'; } elseif (isset($params['metric'])) { - $url = '/_nodes/stats/' . $this->encode($params['metric']); + $url = '/_nodes/stats/' . $this->encode($this->convertValue($params['metric'])); $method = 'GET'; } else { $url = '/_nodes/stats'; @@ -309,14 +315,14 @@ public function stats(array $params = []) * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/cluster-nodes-usage.html * * @param array{ - * node_id: list, // 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 - * metric: list, // Limit the information returned to the specified metrics - * timeout: time, // Explicit operation timeout - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. + * node_id?: string|array, // 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 + * metric?: string|array, // Limit the information returned to the specified metrics + * timeout?: int|string, // Explicit operation timeout + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. * } $params * * @throws NoNodeAvailableException if all the hosts are offline @@ -325,16 +331,17 @@ public function stats(array $params = []) * * @return Elasticsearch|Promise */ - public function usage(array $params = []) + public function usage(?array $params = null) { + $params = $params ?? []; if (isset($params['metric']) && isset($params['node_id'])) { - $url = '/_nodes/' . $this->encode($params['node_id']) . '/usage/' . $this->encode($params['metric']); + $url = '/_nodes/' . $this->encode($this->convertValue($params['node_id'])) . '/usage/' . $this->encode($this->convertValue($params['metric'])); $method = 'GET'; } elseif (isset($params['node_id'])) { - $url = '/_nodes/' . $this->encode($params['node_id']) . '/usage'; + $url = '/_nodes/' . $this->encode($this->convertValue($params['node_id'])) . '/usage'; $method = 'GET'; } elseif (isset($params['metric'])) { - $url = '/_nodes/usage/' . $this->encode($params['metric']); + $url = '/_nodes/usage/' . $this->encode($this->convertValue($params['metric'])); $method = 'GET'; } else { $url = '/_nodes/usage'; diff --git a/src/Endpoints/Profiling.php b/src/Endpoints/Profiling.php index 18c43dac2..9a22b870d 100644 --- a/src/Endpoints/Profiling.php +++ b/src/Endpoints/Profiling.php @@ -34,12 +34,12 @@ class Profiling extends AbstractEndpoint * @see https://www.elastic.co/guide/en/observability/current/universal-profiling.html * * @param array{ - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. - * body: array, // (REQUIRED) The filter conditions for the flamegraph + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. + * body: string|array, // (REQUIRED) The filter conditions for the flamegraph. If body is a string must be a valid JSON. * } $params * * @throws NoNodeAvailableException if all the hosts are offline @@ -48,8 +48,9 @@ class Profiling extends AbstractEndpoint * * @return Elasticsearch|Promise */ - public function flamegraph(array $params = []) + public function flamegraph(?array $params = null) { + $params = $params ?? []; $this->checkRequiredParameters(['body'], $params); $url = '/_profiling/flamegraph'; $method = 'POST'; @@ -71,12 +72,12 @@ public function flamegraph(array $params = []) * @see https://www.elastic.co/guide/en/observability/current/universal-profiling.html * * @param array{ - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. - * body: array, // (REQUIRED) The filter conditions for stacktraces + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. + * body: string|array, // (REQUIRED) The filter conditions for stacktraces. If body is a string must be a valid JSON. * } $params * * @throws NoNodeAvailableException if all the hosts are offline @@ -85,8 +86,9 @@ public function flamegraph(array $params = []) * * @return Elasticsearch|Promise */ - public function stacktraces(array $params = []) + public function stacktraces(?array $params = null) { + $params = $params ?? []; $this->checkRequiredParameters(['body'], $params); $url = '/_profiling/stacktraces'; $method = 'POST'; @@ -108,14 +110,14 @@ public function stacktraces(array $params = []) * @see https://www.elastic.co/guide/en/observability/current/universal-profiling.html * * @param array{ - * master_timeout: time, // Explicit operation timeout for connection to master node - * timeout: time, // Explicit operation timeout - * wait_for_resources_created: boolean, // Whether to return immediately or wait until resources have been created - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. + * master_timeout?: int|string, // Explicit operation timeout for connection to master node + * timeout?: int|string, // Explicit operation timeout + * wait_for_resources_created?: bool, // Whether to return immediately or wait until resources have been created + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. * } $params * * @throws NoNodeAvailableException if all the hosts are offline @@ -124,8 +126,9 @@ public function stacktraces(array $params = []) * * @return Elasticsearch|Promise */ - public function status(array $params = []) + public function status(?array $params = null) { + $params = $params ?? []; $url = '/_profiling/status'; $method = 'GET'; @@ -145,12 +148,12 @@ public function status(array $params = []) * @see https://www.elastic.co/guide/en/observability/current/universal-profiling.html * * @param array{ - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. - * body: array, // (REQUIRED) The filter conditions for stacktraces + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. + * body: string|array, // (REQUIRED) The filter conditions for stacktraces. If body is a string must be a valid JSON. * } $params * * @throws NoNodeAvailableException if all the hosts are offline @@ -159,8 +162,9 @@ public function status(array $params = []) * * @return Elasticsearch|Promise */ - public function topnFunctions(array $params = []) + public function topnFunctions(?array $params = null) { + $params = $params ?? []; $this->checkRequiredParameters(['body'], $params); $url = '/_profiling/topn/functions'; $method = 'POST'; diff --git a/src/Endpoints/QueryRules.php b/src/Endpoints/QueryRules.php index 1da8b22f1..2dc54b8de 100644 --- a/src/Endpoints/QueryRules.php +++ b/src/Endpoints/QueryRules.php @@ -36,11 +36,11 @@ class QueryRules extends AbstractEndpoint * @param array{ * ruleset_id: string, // (REQUIRED) The unique identifier of the query ruleset this rule exists in * rule_id: string, // (REQUIRED) The unique identifier of the rule to delete. - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. * } $params * * @throws MissingParameterException if a required parameter is missing @@ -50,8 +50,9 @@ class QueryRules extends AbstractEndpoint * * @return Elasticsearch|Promise */ - public function deleteRule(array $params = []) + public function deleteRule(?array $params = null) { + $params = $params ?? []; $this->checkRequiredParameters(['ruleset_id','rule_id'], $params); $url = '/_query_rules/' . $this->encode($params['ruleset_id']) . '/_rule/' . $this->encode($params['rule_id']); $method = 'DELETE'; @@ -73,11 +74,11 @@ public function deleteRule(array $params = []) * * @param array{ * ruleset_id: string, // (REQUIRED) The unique identifier of the query ruleset to delete - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. * } $params * * @throws MissingParameterException if a required parameter is missing @@ -87,8 +88,9 @@ public function deleteRule(array $params = []) * * @return Elasticsearch|Promise */ - public function deleteRuleset(array $params = []) + public function deleteRuleset(?array $params = null) { + $params = $params ?? []; $this->checkRequiredParameters(['ruleset_id'], $params); $url = '/_query_rules/' . $this->encode($params['ruleset_id']); $method = 'DELETE'; @@ -111,11 +113,11 @@ public function deleteRuleset(array $params = []) * @param array{ * ruleset_id: string, // (REQUIRED) The unique identifier of the query ruleset the rule exists within * rule_id: string, // (REQUIRED) The unique identifier of the rule to be retrieved. - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. * } $params * * @throws MissingParameterException if a required parameter is missing @@ -125,8 +127,9 @@ public function deleteRuleset(array $params = []) * * @return Elasticsearch|Promise */ - public function getRule(array $params = []) + public function getRule(?array $params = null) { + $params = $params ?? []; $this->checkRequiredParameters(['ruleset_id','rule_id'], $params); $url = '/_query_rules/' . $this->encode($params['ruleset_id']) . '/_rule/' . $this->encode($params['rule_id']); $method = 'GET'; @@ -148,11 +151,11 @@ public function getRule(array $params = []) * * @param array{ * ruleset_id: string, // (REQUIRED) The unique identifier of the query ruleset - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. * } $params * * @throws MissingParameterException if a required parameter is missing @@ -162,8 +165,9 @@ public function getRule(array $params = []) * * @return Elasticsearch|Promise */ - public function getRuleset(array $params = []) + public function getRuleset(?array $params = null) { + $params = $params ?? []; $this->checkRequiredParameters(['ruleset_id'], $params); $url = '/_query_rules/' . $this->encode($params['ruleset_id']); $method = 'GET'; @@ -184,13 +188,13 @@ public function getRuleset(array $params = []) * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/list-query-rulesets.html * * @param array{ - * from: int, // Starting offset (default: 0) - * size: int, // specifies a max number of results to get (default: 100) - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. + * from?: int, // Starting offset (default: 0) + * size?: int, // specifies a max number of results to get (default: 100) + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. * } $params * * @throws NoNodeAvailableException if all the hosts are offline @@ -199,8 +203,9 @@ public function getRuleset(array $params = []) * * @return Elasticsearch|Promise */ - public function listRulesets(array $params = []) + public function listRulesets(?array $params = null) { + $params = $params ?? []; $url = '/_query_rules'; $method = 'GET'; @@ -222,12 +227,12 @@ public function listRulesets(array $params = []) * @param array{ * ruleset_id: string, // (REQUIRED) The unique identifier of the ruleset this rule should be added to. The ruleset will be created if it does not exist. * rule_id: string, // (REQUIRED) The unique identifier of the rule to be created or updated. - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. - * body: array, // (REQUIRED) The query rule configuration, including the type of rule, the criteria to match the rule, and the action that should be taken if the rule matches. + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. + * body: string|array, // (REQUIRED) The query rule configuration, including the type of rule, the criteria to match the rule, and the action that should be taken if the rule matches.. If body is a string must be a valid JSON. * } $params * * @throws MissingParameterException if a required parameter is missing @@ -237,8 +242,9 @@ public function listRulesets(array $params = []) * * @return Elasticsearch|Promise */ - public function putRule(array $params = []) + public function putRule(?array $params = null) { + $params = $params ?? []; $this->checkRequiredParameters(['ruleset_id','rule_id','body'], $params); $url = '/_query_rules/' . $this->encode($params['ruleset_id']) . '/_rule/' . $this->encode($params['rule_id']); $method = 'PUT'; @@ -261,12 +267,12 @@ public function putRule(array $params = []) * * @param array{ * ruleset_id: string, // (REQUIRED) The unique identifier of the ruleset to be created or updated. - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. - * body: array, // (REQUIRED) The query ruleset configuration, including `rules` + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. + * body: string|array, // (REQUIRED) The query ruleset configuration, including `rules`. If body is a string must be a valid JSON. * } $params * * @throws MissingParameterException if a required parameter is missing @@ -276,8 +282,9 @@ public function putRule(array $params = []) * * @return Elasticsearch|Promise */ - public function putRuleset(array $params = []) + public function putRuleset(?array $params = null) { + $params = $params ?? []; $this->checkRequiredParameters(['ruleset_id','body'], $params); $url = '/_query_rules/' . $this->encode($params['ruleset_id']); $method = 'PUT'; @@ -291,4 +298,45 @@ public function putRuleset(array $params = []) $request = $this->addOtelAttributes($params, ['ruleset_id'], $request, 'query_rules.put_ruleset'); return $this->client->sendRequest($request); } + + + /** + * Tests a query ruleset to identify the rules that would match input criteria + * + * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/test-query-ruleset.html + * @internal This API is EXPERIMENTAL and may be changed or removed completely in a future release + * + * @param array{ + * ruleset_id: string, // (REQUIRED) The unique identifier of the ruleset to test. + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. + * body: string|array, // (REQUIRED) The match criteria to test against the ruleset. If body is a string must be a valid JSON. + * } $params + * + * @throws MissingParameterException if a required parameter is missing + * @throws NoNodeAvailableException if all the hosts are offline + * @throws ClientResponseException if the status code of response is 4xx + * @throws ServerResponseException if the status code of response is 5xx + * + * @return Elasticsearch|Promise + */ + public function test(?array $params = null) + { + $params = $params ?? []; + $this->checkRequiredParameters(['ruleset_id','body'], $params); + $url = '/_query_rules/' . $this->encode($params['ruleset_id']) . '/_test'; + $method = 'POST'; + + $url = $this->addQueryString($url, $params, ['pretty','human','error_trace','source','filter_path']); + $headers = [ + 'Accept' => 'application/json', + 'Content-Type' => 'application/json', + ]; + $request = $this->createRequest($method, $url, $headers, $params['body'] ?? null); + $request = $this->addOtelAttributes($params, ['ruleset_id'], $request, 'query_rules.test'); + return $this->client->sendRequest($request); + } } diff --git a/src/Endpoints/Rollup.php b/src/Endpoints/Rollup.php index e2f00b076..2e2a3d8a7 100644 --- a/src/Endpoints/Rollup.php +++ b/src/Endpoints/Rollup.php @@ -36,11 +36,11 @@ class Rollup extends AbstractEndpoint * * @param array{ * id: string, // (REQUIRED) The ID of the job to delete - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. * } $params * * @throws MissingParameterException if a required parameter is missing @@ -50,8 +50,9 @@ class Rollup extends AbstractEndpoint * * @return Elasticsearch|Promise */ - public function deleteJob(array $params = []) + public function deleteJob(?array $params = null) { + $params = $params ?? []; $this->checkRequiredParameters(['id'], $params); $url = '/_rollup/job/' . $this->encode($params['id']); $method = 'DELETE'; @@ -73,12 +74,12 @@ public function deleteJob(array $params = []) * @internal This API is EXPERIMENTAL and may be changed or removed completely in a future release * * @param array{ - * id: string, // The ID of the job(s) to fetch. Accepts glob patterns, or left blank for all jobs - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. + * id?: string, // The ID of the job(s) to fetch. Accepts glob patterns, or left blank for all jobs + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. * } $params * * @throws NoNodeAvailableException if all the hosts are offline @@ -87,8 +88,9 @@ public function deleteJob(array $params = []) * * @return Elasticsearch|Promise */ - public function getJobs(array $params = []) + public function getJobs(?array $params = null) { + $params = $params ?? []; if (isset($params['id'])) { $url = '/_rollup/job/' . $this->encode($params['id']); $method = 'GET'; @@ -113,12 +115,12 @@ public function getJobs(array $params = []) * @internal This API is EXPERIMENTAL and may be changed or removed completely in a future release * * @param array{ - * id: string, // The ID of the index to check rollup capabilities on, or left blank for all jobs - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. + * id?: string, // The ID of the index to check rollup capabilities on, or left blank for all jobs + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. * } $params * * @throws NoNodeAvailableException if all the hosts are offline @@ -127,8 +129,9 @@ public function getJobs(array $params = []) * * @return Elasticsearch|Promise */ - public function getRollupCaps(array $params = []) + public function getRollupCaps(?array $params = null) { + $params = $params ?? []; if (isset($params['id'])) { $url = '/_rollup/data/' . $this->encode($params['id']); $method = 'GET'; @@ -154,11 +157,11 @@ public function getRollupCaps(array $params = []) * * @param array{ * index: string, // (REQUIRED) The rollup index or index pattern to obtain rollup capabilities from. - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. * } $params * * @throws MissingParameterException if a required parameter is missing @@ -168,8 +171,9 @@ public function getRollupCaps(array $params = []) * * @return Elasticsearch|Promise */ - public function getRollupIndexCaps(array $params = []) + public function getRollupIndexCaps(?array $params = null) { + $params = $params ?? []; $this->checkRequiredParameters(['index'], $params); $url = '/' . $this->encode($params['index']) . '/_rollup/data'; $method = 'GET'; @@ -192,12 +196,12 @@ public function getRollupIndexCaps(array $params = []) * * @param array{ * id: string, // (REQUIRED) The ID of the job to create - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. - * body: array, // (REQUIRED) The job configuration + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. + * body: string|array, // (REQUIRED) The job configuration. If body is a string must be a valid JSON. * } $params * * @throws MissingParameterException if a required parameter is missing @@ -207,8 +211,9 @@ public function getRollupIndexCaps(array $params = []) * * @return Elasticsearch|Promise */ - public function putJob(array $params = []) + public function putJob(?array $params = null) { + $params = $params ?? []; $this->checkRequiredParameters(['id','body'], $params); $url = '/_rollup/job/' . $this->encode($params['id']); $method = 'PUT'; @@ -231,15 +236,15 @@ public function putJob(array $params = []) * @internal This API is EXPERIMENTAL and may be changed or removed completely in a future release * * @param array{ - * index: list, // (REQUIRED) The indices or index-pattern(s) (containing rollup or regular data) that should be searched - * typed_keys: boolean, // Specify whether aggregation and suggester names should be prefixed by their respective types in the response - * rest_total_hits_as_int: boolean, // Indicates whether hits.total should be rendered as an integer or an object in the rest search response - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. - * body: array, // (REQUIRED) The search request body + * index: string|array, // (REQUIRED) The indices or index-pattern(s) (containing rollup or regular data) that should be searched + * typed_keys?: bool, // Specify whether aggregation and suggester names should be prefixed by their respective types in the response + * rest_total_hits_as_int?: bool, // Indicates whether hits.total should be rendered as an integer or an object in the rest search response + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. + * body: string|array, // (REQUIRED) The search request body. If body is a string must be a valid JSON. * } $params * * @throws MissingParameterException if a required parameter is missing @@ -249,10 +254,11 @@ public function putJob(array $params = []) * * @return Elasticsearch|Promise */ - public function rollupSearch(array $params = []) + public function rollupSearch(?array $params = null) { + $params = $params ?? []; $this->checkRequiredParameters(['index','body'], $params); - $url = '/' . $this->encode($params['index']) . '/_rollup_search'; + $url = '/' . $this->encode($this->convertValue($params['index'])) . '/_rollup_search'; $method = empty($params['body']) ? 'GET' : 'POST'; $url = $this->addQueryString($url, $params, ['typed_keys','rest_total_hits_as_int','pretty','human','error_trace','source','filter_path']); @@ -274,11 +280,11 @@ public function rollupSearch(array $params = []) * * @param array{ * id: string, // (REQUIRED) The ID of the job to start - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. * } $params * * @throws MissingParameterException if a required parameter is missing @@ -288,8 +294,9 @@ public function rollupSearch(array $params = []) * * @return Elasticsearch|Promise */ - public function startJob(array $params = []) + public function startJob(?array $params = null) { + $params = $params ?? []; $this->checkRequiredParameters(['id'], $params); $url = '/_rollup/job/' . $this->encode($params['id']) . '/_start'; $method = 'POST'; @@ -312,13 +319,13 @@ public function startJob(array $params = []) * * @param array{ * id: string, // (REQUIRED) The ID of the job to stop - * wait_for_completion: boolean, // True if the API should block until the job has fully stopped, false if should be executed async. Defaults to false. - * timeout: time, // Block for (at maximum) the specified duration while waiting for the job to stop. Defaults to 30s. - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. + * wait_for_completion?: bool, // True if the API should block until the job has fully stopped, false if should be executed async. Defaults to false. + * timeout?: int|string, // Block for (at maximum) the specified duration while waiting for the job to stop. Defaults to 30s. + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. * } $params * * @throws MissingParameterException if a required parameter is missing @@ -328,8 +335,9 @@ public function startJob(array $params = []) * * @return Elasticsearch|Promise */ - public function stopJob(array $params = []) + public function stopJob(?array $params = null) { + $params = $params ?? []; $this->checkRequiredParameters(['id'], $params); $url = '/_rollup/job/' . $this->encode($params['id']) . '/_stop'; $method = 'POST'; diff --git a/src/Endpoints/SearchApplication.php b/src/Endpoints/SearchApplication.php index fe70863a1..3c3eba13c 100644 --- a/src/Endpoints/SearchApplication.php +++ b/src/Endpoints/SearchApplication.php @@ -36,11 +36,11 @@ class SearchApplication extends AbstractEndpoint * * @param array{ * name: string, // (REQUIRED) The name of the search application - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. * } $params * * @throws MissingParameterException if a required parameter is missing @@ -50,8 +50,9 @@ class SearchApplication extends AbstractEndpoint * * @return Elasticsearch|Promise */ - public function delete(array $params = []) + public function delete(?array $params = null) { + $params = $params ?? []; $this->checkRequiredParameters(['name'], $params); $url = '/_application/search_application/' . $this->encode($params['name']); $method = 'DELETE'; @@ -74,11 +75,11 @@ public function delete(array $params = []) * * @param array{ * name: string, // (REQUIRED) The name of the analytics collection to be deleted - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. * } $params * * @throws MissingParameterException if a required parameter is missing @@ -88,8 +89,9 @@ public function delete(array $params = []) * * @return Elasticsearch|Promise */ - public function deleteBehavioralAnalytics(array $params = []) + public function deleteBehavioralAnalytics(?array $params = null) { + $params = $params ?? []; $this->checkRequiredParameters(['name'], $params); $url = '/_application/analytics/' . $this->encode($params['name']); $method = 'DELETE'; @@ -112,11 +114,11 @@ public function deleteBehavioralAnalytics(array $params = []) * * @param array{ * name: string, // (REQUIRED) The name of the search application - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. * } $params * * @throws MissingParameterException if a required parameter is missing @@ -126,8 +128,9 @@ public function deleteBehavioralAnalytics(array $params = []) * * @return Elasticsearch|Promise */ - public function get(array $params = []) + public function get(?array $params = null) { + $params = $params ?? []; $this->checkRequiredParameters(['name'], $params); $url = '/_application/search_application/' . $this->encode($params['name']); $method = 'GET'; @@ -149,12 +152,12 @@ public function get(array $params = []) * @internal This API is EXPERIMENTAL and may be changed or removed completely in a future release * * @param array{ - * name: list, // A comma-separated list of analytics collections to limit the returned information - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. + * name?: string|array, // A comma-separated list of analytics collections to limit the returned information + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. * } $params * * @throws NoNodeAvailableException if all the hosts are offline @@ -163,10 +166,11 @@ public function get(array $params = []) * * @return Elasticsearch|Promise */ - public function getBehavioralAnalytics(array $params = []) + public function getBehavioralAnalytics(?array $params = null) { + $params = $params ?? []; if (isset($params['name'])) { - $url = '/_application/analytics/' . $this->encode($params['name']); + $url = '/_application/analytics/' . $this->encode($this->convertValue($params['name'])); $method = 'GET'; } else { $url = '/_application/analytics'; @@ -189,14 +193,14 @@ public function getBehavioralAnalytics(array $params = []) * @internal This API is EXPERIMENTAL and may be changed or removed completely in a future release * * @param array{ - * q: string, // Query in the Lucene query string syntax - * from: int, // Starting offset (default: 0) - * size: int, // specifies a max number of results to get - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. + * q?: string, // Query in the Lucene query string syntax + * from?: int, // Starting offset (default: 0) + * size?: int, // specifies a max number of results to get + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. * } $params * * @throws NoNodeAvailableException if all the hosts are offline @@ -205,8 +209,9 @@ public function getBehavioralAnalytics(array $params = []) * * @return Elasticsearch|Promise */ - public function list(array $params = []) + public function list(?array $params = null) { + $params = $params ?? []; $url = '/_application/search_application'; $method = 'GET'; @@ -229,13 +234,13 @@ public function list(array $params = []) * @param array{ * collection_name: string, // (REQUIRED) The name of behavioral analytics collection * event_type: string, // (REQUIRED) Behavioral analytics event type. Available: page_view, search, search_click - * debug: boolean, // If true, returns event information that will be stored - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. - * body: array, // (REQUIRED) The event definition + * debug?: bool, // If true, returns event information that will be stored + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. + * body: string|array, // (REQUIRED) The event definition. If body is a string must be a valid JSON. * } $params * * @throws MissingParameterException if a required parameter is missing @@ -245,8 +250,9 @@ public function list(array $params = []) * * @return Elasticsearch|Promise */ - public function postBehavioralAnalyticsEvent(array $params = []) + public function postBehavioralAnalyticsEvent(?array $params = null) { + $params = $params ?? []; $this->checkRequiredParameters(['collection_name','event_type','body'], $params); $url = '/_application/analytics/' . $this->encode($params['collection_name']) . '/event/' . $this->encode($params['event_type']); $method = 'POST'; @@ -270,13 +276,13 @@ public function postBehavioralAnalyticsEvent(array $params = []) * * @param array{ * name: string, // (REQUIRED) The name of the search application to be created or updated - * create: boolean, // If true, requires that a search application with the specified resource_id does not already exist. (default: false) - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. - * body: array, // (REQUIRED) The search application configuration, including `indices` + * create?: bool, // If true, requires that a search application with the specified resource_id does not already exist. (default: false) + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. + * body: string|array, // (REQUIRED) The search application configuration, including `indices`. If body is a string must be a valid JSON. * } $params * * @throws MissingParameterException if a required parameter is missing @@ -286,8 +292,9 @@ public function postBehavioralAnalyticsEvent(array $params = []) * * @return Elasticsearch|Promise */ - public function put(array $params = []) + public function put(?array $params = null) { + $params = $params ?? []; $this->checkRequiredParameters(['name','body'], $params); $url = '/_application/search_application/' . $this->encode($params['name']); $method = 'PUT'; @@ -311,11 +318,11 @@ public function put(array $params = []) * * @param array{ * name: string, // (REQUIRED) The name of the analytics collection to be created or updated - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. * } $params * * @throws MissingParameterException if a required parameter is missing @@ -325,8 +332,9 @@ public function put(array $params = []) * * @return Elasticsearch|Promise */ - public function putBehavioralAnalytics(array $params = []) + public function putBehavioralAnalytics(?array $params = null) { + $params = $params ?? []; $this->checkRequiredParameters(['name'], $params); $url = '/_application/analytics/' . $this->encode($params['name']); $method = 'PUT'; @@ -349,12 +357,12 @@ public function putBehavioralAnalytics(array $params = []) * * @param array{ * name: string, // (REQUIRED) The name of the search application to render the query for - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. - * body: array, // Search parameters, which will override any default search parameters defined in the search application template + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. + * body?: string|array, // Search parameters, which will override any default search parameters defined in the search application template. If body is a string must be a valid JSON. * } $params * * @throws MissingParameterException if a required parameter is missing @@ -364,8 +372,9 @@ public function putBehavioralAnalytics(array $params = []) * * @return Elasticsearch|Promise */ - public function renderQuery(array $params = []) + public function renderQuery(?array $params = null) { + $params = $params ?? []; $this->checkRequiredParameters(['name'], $params); $url = '/_application/search_application/' . $this->encode($params['name']) . '/_render_query'; $method = 'POST'; @@ -389,13 +398,13 @@ public function renderQuery(array $params = []) * * @param array{ * name: string, // (REQUIRED) The name of the search application to be searched - * typed_keys: boolean, // Specify whether aggregation and suggester names should be prefixed by their respective types in the response - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. - * body: array, // Search parameters, including template parameters that override defaults + * typed_keys?: bool, // Specify whether aggregation and suggester names should be prefixed by their respective types in the response + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. + * body?: string|array, // Search parameters, including template parameters that override defaults. If body is a string must be a valid JSON. * } $params * * @throws MissingParameterException if a required parameter is missing @@ -405,8 +414,9 @@ public function renderQuery(array $params = []) * * @return Elasticsearch|Promise */ - public function search(array $params = []) + public function search(?array $params = null) { + $params = $params ?? []; $this->checkRequiredParameters(['name'], $params); $url = '/_application/search_application/' . $this->encode($params['name']) . '/_search'; $method = empty($params['body']) ? 'GET' : 'POST'; diff --git a/src/Endpoints/SearchableSnapshots.php b/src/Endpoints/SearchableSnapshots.php index 7eac97558..9ab106475 100644 --- a/src/Endpoints/SearchableSnapshots.php +++ b/src/Endpoints/SearchableSnapshots.php @@ -35,12 +35,12 @@ class SearchableSnapshots extends AbstractEndpoint * @internal This API is EXPERIMENTAL and may be changed or removed completely in a future release * * @param array{ - * node_id: list, // 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 - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. + * node_id?: string|array, // 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 + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. * } $params * * @throws NoNodeAvailableException if all the hosts are offline @@ -49,10 +49,11 @@ class SearchableSnapshots extends AbstractEndpoint * * @return Elasticsearch|Promise */ - public function cacheStats(array $params = []) + public function cacheStats(?array $params = null) { + $params = $params ?? []; if (isset($params['node_id'])) { - $url = '/_searchable_snapshots/' . $this->encode($params['node_id']) . '/cache/stats'; + $url = '/_searchable_snapshots/' . $this->encode($this->convertValue($params['node_id'])) . '/cache/stats'; $method = 'GET'; } else { $url = '/_searchable_snapshots/cache/stats'; @@ -75,15 +76,15 @@ public function cacheStats(array $params = []) * @internal This API is EXPERIMENTAL and may be changed or removed completely in a future release * * @param array{ - * index: list, // A comma-separated list of index names - * ignore_unavailable: boolean, // Whether specified concrete indices should be ignored when unavailable (missing or closed) - * allow_no_indices: boolean, // Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes `_all` string or when no indices have been specified) - * expand_wildcards: enum, // Whether to expand wildcard expression to concrete indices that are open, closed or both. - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. + * index?: string|array, // A comma-separated list of index names + * ignore_unavailable?: bool, // Whether specified concrete indices should be ignored when unavailable (missing or closed) + * allow_no_indices?: bool, // Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes `_all` string or when no indices have been specified) + * expand_wildcards?: string, // Whether to expand wildcard expression to concrete indices that are open, closed or both. + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. * } $params * * @throws NoNodeAvailableException if all the hosts are offline @@ -92,10 +93,11 @@ public function cacheStats(array $params = []) * * @return Elasticsearch|Promise */ - public function clearCache(array $params = []) + public function clearCache(?array $params = null) { + $params = $params ?? []; if (isset($params['index'])) { - $url = '/' . $this->encode($params['index']) . '/_searchable_snapshots/cache/clear'; + $url = '/' . $this->encode($this->convertValue($params['index'])) . '/_searchable_snapshots/cache/clear'; $method = 'POST'; } else { $url = '/_searchable_snapshots/cache/clear'; @@ -119,15 +121,15 @@ public function clearCache(array $params = []) * @param array{ * repository: string, // (REQUIRED) The name of the repository containing the snapshot of the index to mount * snapshot: string, // (REQUIRED) The name of the snapshot of the index to mount - * master_timeout: time, // Explicit operation timeout for connection to master node - * wait_for_completion: boolean, // Should this request wait until the operation has completed before returning - * storage: string, // Selects the kind of local storage used to accelerate searches. Experimental, and defaults to `full_copy` - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. - * body: array, // (REQUIRED) The restore configuration for mounting the snapshot as searchable + * master_timeout?: int|string, // Explicit operation timeout for connection to master node + * wait_for_completion?: bool, // Should this request wait until the operation has completed before returning + * storage?: string, // Selects the kind of local storage used to accelerate searches. Experimental, and defaults to `full_copy` + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. + * body: string|array, // (REQUIRED) The restore configuration for mounting the snapshot as searchable. If body is a string must be a valid JSON. * } $params * * @throws MissingParameterException if a required parameter is missing @@ -137,8 +139,9 @@ public function clearCache(array $params = []) * * @return Elasticsearch|Promise */ - public function mount(array $params = []) + public function mount(?array $params = null) { + $params = $params ?? []; $this->checkRequiredParameters(['repository','snapshot','body'], $params); $url = '/_snapshot/' . $this->encode($params['repository']) . '/' . $this->encode($params['snapshot']) . '/_mount'; $method = 'POST'; @@ -160,13 +163,13 @@ public function mount(array $params = []) * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/searchable-snapshots-apis.html * * @param array{ - * index: list, // A comma-separated list of index names - * level: enum, // Return stats aggregated at cluster, index or shard level - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. + * index?: string|array, // A comma-separated list of index names + * level?: string, // Return stats aggregated at cluster, index or shard level + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. * } $params * * @throws NoNodeAvailableException if all the hosts are offline @@ -175,10 +178,11 @@ public function mount(array $params = []) * * @return Elasticsearch|Promise */ - public function stats(array $params = []) + public function stats(?array $params = null) { + $params = $params ?? []; if (isset($params['index'])) { - $url = '/' . $this->encode($params['index']) . '/_searchable_snapshots/stats'; + $url = '/' . $this->encode($this->convertValue($params['index'])) . '/_searchable_snapshots/stats'; $method = 'GET'; } else { $url = '/_searchable_snapshots/stats'; diff --git a/src/Endpoints/Security.php b/src/Endpoints/Security.php index 6841eb65c..53696bf11 100644 --- a/src/Endpoints/Security.php +++ b/src/Endpoints/Security.php @@ -34,12 +34,12 @@ class Security extends AbstractEndpoint * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-activate-user-profile.html * * @param array{ - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. - * body: array, // (REQUIRED) The grant type and user's credential + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. + * body: string|array, // (REQUIRED) The grant type and user's credential. If body is a string must be a valid JSON. * } $params * * @throws NoNodeAvailableException if all the hosts are offline @@ -48,8 +48,9 @@ class Security extends AbstractEndpoint * * @return Elasticsearch|Promise */ - public function activateUserProfile(array $params = []) + public function activateUserProfile(?array $params = null) { + $params = $params ?? []; $this->checkRequiredParameters(['body'], $params); $url = '/_security/profile/_activate'; $method = 'POST'; @@ -71,11 +72,11 @@ public function activateUserProfile(array $params = []) * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-authenticate.html * * @param array{ - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. * } $params * * @throws NoNodeAvailableException if all the hosts are offline @@ -84,8 +85,9 @@ public function activateUserProfile(array $params = []) * * @return Elasticsearch|Promise */ - public function authenticate(array $params = []) + public function authenticate(?array $params = null) { + $params = $params ?? []; $url = '/_security/_authenticate'; $method = 'GET'; @@ -105,13 +107,13 @@ public function authenticate(array $params = []) * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-bulk-delete-role.html * * @param array{ - * refresh: enum, // 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. - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. - * body: array, // (REQUIRED) The roles to delete + * refresh?: string, // 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. + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. + * body: string|array, // (REQUIRED) The roles to delete. If body is a string must be a valid JSON. * } $params * * @throws NoNodeAvailableException if all the hosts are offline @@ -120,8 +122,9 @@ public function authenticate(array $params = []) * * @return Elasticsearch|Promise */ - public function bulkDeleteRole(array $params = []) + public function bulkDeleteRole(?array $params = null) { + $params = $params ?? []; $this->checkRequiredParameters(['body'], $params); $url = '/_security/role'; $method = 'DELETE'; @@ -143,13 +146,13 @@ public function bulkDeleteRole(array $params = []) * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-bulk-put-role.html * * @param array{ - * refresh: enum, // 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. - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. - * body: array, // (REQUIRED) The roles to add + * refresh?: string, // 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. + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. + * body: string|array, // (REQUIRED) The roles to add. If body is a string must be a valid JSON. * } $params * * @throws NoNodeAvailableException if all the hosts are offline @@ -158,8 +161,9 @@ public function bulkDeleteRole(array $params = []) * * @return Elasticsearch|Promise */ - public function bulkPutRole(array $params = []) + public function bulkPutRole(?array $params = null) { + $params = $params ?? []; $this->checkRequiredParameters(['body'], $params); $url = '/_security/role'; $method = 'POST'; @@ -181,12 +185,12 @@ public function bulkPutRole(array $params = []) * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-bulk-update-api-keys.html * * @param array{ - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. - * body: array, // (REQUIRED) The API key request to update the attributes of multiple API keys. + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. + * body: string|array, // (REQUIRED) The API key request to update the attributes of multiple API keys.. If body is a string must be a valid JSON. * } $params * * @throws NoNodeAvailableException if all the hosts are offline @@ -195,8 +199,9 @@ public function bulkPutRole(array $params = []) * * @return Elasticsearch|Promise */ - public function bulkUpdateApiKeys(array $params = []) + public function bulkUpdateApiKeys(?array $params = null) { + $params = $params ?? []; $this->checkRequiredParameters(['body'], $params); $url = '/_security/api_key/_bulk_update'; $method = 'POST'; @@ -218,14 +223,14 @@ public function bulkUpdateApiKeys(array $params = []) * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-change-password.html * * @param array{ - * username: string, // The username of the user to change the password for - * refresh: enum, // 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. - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. - * body: array, // (REQUIRED) the new password for the user + * username?: string, // The username of the user to change the password for + * refresh?: string, // 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. + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. + * body: string|array, // (REQUIRED) the new password for the user. If body is a string must be a valid JSON. * } $params * * @throws NoNodeAvailableException if all the hosts are offline @@ -234,8 +239,9 @@ public function bulkUpdateApiKeys(array $params = []) * * @return Elasticsearch|Promise */ - public function changePassword(array $params = []) + public function changePassword(?array $params = null) { + $params = $params ?? []; $this->checkRequiredParameters(['body'], $params); if (isset($params['username'])) { $url = '/_security/user/' . $this->encode($params['username']) . '/_password'; @@ -261,12 +267,12 @@ public function changePassword(array $params = []) * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-clear-api-key-cache.html * * @param array{ - * ids: list, // (REQUIRED) A comma-separated list of IDs of API keys to clear from the cache - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. + * ids: string|array, // (REQUIRED) A comma-separated list of IDs of API keys to clear from the cache + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. * } $params * * @throws MissingParameterException if a required parameter is missing @@ -276,10 +282,11 @@ public function changePassword(array $params = []) * * @return Elasticsearch|Promise */ - public function clearApiKeyCache(array $params = []) + public function clearApiKeyCache(?array $params = null) { + $params = $params ?? []; $this->checkRequiredParameters(['ids'], $params); - $url = '/_security/api_key/' . $this->encode($params['ids']) . '/_clear_cache'; + $url = '/_security/api_key/' . $this->encode($this->convertValue($params['ids'])) . '/_clear_cache'; $method = 'POST'; $url = $this->addQueryString($url, $params, ['pretty','human','error_trace','source','filter_path']); @@ -298,12 +305,12 @@ public function clearApiKeyCache(array $params = []) * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-clear-privilege-cache.html * * @param array{ - * application: list, // (REQUIRED) A comma-separated list of application names - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. + * application: string|array, // (REQUIRED) A comma-separated list of application names + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. * } $params * * @throws MissingParameterException if a required parameter is missing @@ -313,10 +320,11 @@ public function clearApiKeyCache(array $params = []) * * @return Elasticsearch|Promise */ - public function clearCachedPrivileges(array $params = []) + public function clearCachedPrivileges(?array $params = null) { + $params = $params ?? []; $this->checkRequiredParameters(['application'], $params); - $url = '/_security/privilege/' . $this->encode($params['application']) . '/_clear_cache'; + $url = '/_security/privilege/' . $this->encode($this->convertValue($params['application'])) . '/_clear_cache'; $method = 'POST'; $url = $this->addQueryString($url, $params, ['pretty','human','error_trace','source','filter_path']); @@ -335,13 +343,13 @@ public function clearCachedPrivileges(array $params = []) * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-clear-cache.html * * @param array{ - * realms: list, // (REQUIRED) Comma-separated list of realms to clear - * usernames: list, // Comma-separated list of usernames to clear from the cache - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. + * realms: string|array, // (REQUIRED) Comma-separated list of realms to clear + * usernames?: string|array, // Comma-separated list of usernames to clear from the cache + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. * } $params * * @throws MissingParameterException if a required parameter is missing @@ -351,10 +359,11 @@ public function clearCachedPrivileges(array $params = []) * * @return Elasticsearch|Promise */ - public function clearCachedRealms(array $params = []) + public function clearCachedRealms(?array $params = null) { + $params = $params ?? []; $this->checkRequiredParameters(['realms'], $params); - $url = '/_security/realm/' . $this->encode($params['realms']) . '/_clear_cache'; + $url = '/_security/realm/' . $this->encode($this->convertValue($params['realms'])) . '/_clear_cache'; $method = 'POST'; $url = $this->addQueryString($url, $params, ['usernames','pretty','human','error_trace','source','filter_path']); @@ -373,12 +382,12 @@ public function clearCachedRealms(array $params = []) * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-clear-role-cache.html * * @param array{ - * name: list, // (REQUIRED) Role name - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. + * name: string|array, // (REQUIRED) Role name + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. * } $params * * @throws MissingParameterException if a required parameter is missing @@ -388,10 +397,11 @@ public function clearCachedRealms(array $params = []) * * @return Elasticsearch|Promise */ - public function clearCachedRoles(array $params = []) + public function clearCachedRoles(?array $params = null) { + $params = $params ?? []; $this->checkRequiredParameters(['name'], $params); - $url = '/_security/role/' . $this->encode($params['name']) . '/_clear_cache'; + $url = '/_security/role/' . $this->encode($this->convertValue($params['name'])) . '/_clear_cache'; $method = 'POST'; $url = $this->addQueryString($url, $params, ['pretty','human','error_trace','source','filter_path']); @@ -412,12 +422,12 @@ public function clearCachedRoles(array $params = []) * @param array{ * namespace: string, // (REQUIRED) An identifier for the namespace * service: string, // (REQUIRED) An identifier for the service name - * name: list, // (REQUIRED) A comma-separated list of service token names - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. + * name: string|array, // (REQUIRED) A comma-separated list of service token names + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. * } $params * * @throws MissingParameterException if a required parameter is missing @@ -427,10 +437,11 @@ public function clearCachedRoles(array $params = []) * * @return Elasticsearch|Promise */ - public function clearCachedServiceTokens(array $params = []) + public function clearCachedServiceTokens(?array $params = null) { + $params = $params ?? []; $this->checkRequiredParameters(['namespace','service','name'], $params); - $url = '/_security/service/' . $this->encode($params['namespace']) . '/' . $this->encode($params['service']) . '/credential/token/' . $this->encode($params['name']) . '/_clear_cache'; + $url = '/_security/service/' . $this->encode($params['namespace']) . '/' . $this->encode($params['service']) . '/credential/token/' . $this->encode($this->convertValue($params['name'])) . '/_clear_cache'; $method = 'POST'; $url = $this->addQueryString($url, $params, ['pretty','human','error_trace','source','filter_path']); @@ -449,13 +460,13 @@ public function clearCachedServiceTokens(array $params = []) * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-create-api-key.html * * @param array{ - * refresh: enum, // 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. - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. - * body: array, // (REQUIRED) The api key request to create an API key + * refresh?: string, // 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. + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. + * body: string|array, // (REQUIRED) The api key request to create an API key. If body is a string must be a valid JSON. * } $params * * @throws NoNodeAvailableException if all the hosts are offline @@ -464,8 +475,9 @@ public function clearCachedServiceTokens(array $params = []) * * @return Elasticsearch|Promise */ - public function createApiKey(array $params = []) + public function createApiKey(?array $params = null) { + $params = $params ?? []; $this->checkRequiredParameters(['body'], $params); $url = '/_security/api_key'; $method = 'PUT'; @@ -487,12 +499,12 @@ public function createApiKey(array $params = []) * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-create-cross-cluster-api-key.html * * @param array{ - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. - * body: array, // (REQUIRED) The request to create a cross-cluster API key + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. + * body: string|array, // (REQUIRED) The request to create a cross-cluster API key. If body is a string must be a valid JSON. * } $params * * @throws NoNodeAvailableException if all the hosts are offline @@ -501,8 +513,9 @@ public function createApiKey(array $params = []) * * @return Elasticsearch|Promise */ - public function createCrossClusterApiKey(array $params = []) + public function createCrossClusterApiKey(?array $params = null) { + $params = $params ?? []; $this->checkRequiredParameters(['body'], $params); $url = '/_security/cross_cluster/api_key'; $method = 'POST'; @@ -526,13 +539,13 @@ public function createCrossClusterApiKey(array $params = []) * @param array{ * namespace: string, // (REQUIRED) An identifier for the namespace * service: string, // (REQUIRED) An identifier for the service name - * name: string, // An identifier for the token name - * refresh: enum, // If `true` then refresh the affected shards to make this operation visible to search, if `wait_for` (the default) then wait for a refresh to make this operation visible to search, if `false` then do nothing with refreshes. - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. + * name?: string, // An identifier for the token name + * refresh?: string, // If `true` then refresh the affected shards to make this operation visible to search, if `wait_for` (the default) then wait for a refresh to make this operation visible to search, if `false` then do nothing with refreshes. + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. * } $params * * @throws MissingParameterException if a required parameter is missing @@ -542,8 +555,9 @@ public function createCrossClusterApiKey(array $params = []) * * @return Elasticsearch|Promise */ - public function createServiceToken(array $params = []) + public function createServiceToken(?array $params = null) { + $params = $params ?? []; $this->checkRequiredParameters(['namespace','service'], $params); if (isset($params['name'])) { $url = '/_security/service/' . $this->encode($params['namespace']) . '/' . $this->encode($params['service']) . '/credential/token/' . $this->encode($params['name']); @@ -562,6 +576,43 @@ public function createServiceToken(array $params = []) } + /** + * Delegate PKI authentication. + * + * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/security-api-delegate-pki-authentication.html + * + * @param array{ + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. + * body: string|array, // (REQUIRED) The X509Certificate chain.. If body is a string must be a valid JSON. + * } $params + * + * @throws NoNodeAvailableException if all the hosts are offline + * @throws ClientResponseException if the status code of response is 4xx + * @throws ServerResponseException if the status code of response is 5xx + * + * @return Elasticsearch|Promise + */ + public function delegatePki(?array $params = null) + { + $params = $params ?? []; + $this->checkRequiredParameters(['body'], $params); + $url = '/_security/delegate_pki'; + $method = 'POST'; + + $url = $this->addQueryString($url, $params, ['pretty','human','error_trace','source','filter_path']); + $headers = [ + 'Accept' => 'application/json', + ]; + $request = $this->createRequest($method, $url, $headers, $params['body'] ?? null); + $request = $this->addOtelAttributes($params, [], $request, 'security.delegate_pki'); + return $this->client->sendRequest($request); + } + + /** * Removes application privileges. * @@ -570,12 +621,12 @@ public function createServiceToken(array $params = []) * @param array{ * application: string, // (REQUIRED) Application name * name: string, // (REQUIRED) Privilege name - * refresh: enum, // 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. - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. + * refresh?: string, // 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. + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. * } $params * * @throws MissingParameterException if a required parameter is missing @@ -585,8 +636,9 @@ public function createServiceToken(array $params = []) * * @return Elasticsearch|Promise */ - public function deletePrivileges(array $params = []) + public function deletePrivileges(?array $params = null) { + $params = $params ?? []; $this->checkRequiredParameters(['application','name'], $params); $url = '/_security/privilege/' . $this->encode($params['application']) . '/' . $this->encode($params['name']); $method = 'DELETE'; @@ -608,12 +660,12 @@ public function deletePrivileges(array $params = []) * * @param array{ * name: string, // (REQUIRED) Role name - * refresh: enum, // 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. - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. + * refresh?: string, // 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. + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. * } $params * * @throws MissingParameterException if a required parameter is missing @@ -623,8 +675,9 @@ public function deletePrivileges(array $params = []) * * @return Elasticsearch|Promise */ - public function deleteRole(array $params = []) + public function deleteRole(?array $params = null) { + $params = $params ?? []; $this->checkRequiredParameters(['name'], $params); $url = '/_security/role/' . $this->encode($params['name']); $method = 'DELETE'; @@ -646,12 +699,12 @@ public function deleteRole(array $params = []) * * @param array{ * name: string, // (REQUIRED) Role-mapping name - * refresh: enum, // 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. - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. + * refresh?: string, // 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. + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. * } $params * * @throws MissingParameterException if a required parameter is missing @@ -661,8 +714,9 @@ public function deleteRole(array $params = []) * * @return Elasticsearch|Promise */ - public function deleteRoleMapping(array $params = []) + public function deleteRoleMapping(?array $params = null) { + $params = $params ?? []; $this->checkRequiredParameters(['name'], $params); $url = '/_security/role_mapping/' . $this->encode($params['name']); $method = 'DELETE'; @@ -686,12 +740,12 @@ public function deleteRoleMapping(array $params = []) * namespace: string, // (REQUIRED) An identifier for the namespace * service: string, // (REQUIRED) An identifier for the service name * name: string, // (REQUIRED) An identifier for the token name - * refresh: enum, // If `true` then refresh the affected shards to make this operation visible to search, if `wait_for` (the default) then wait for a refresh to make this operation visible to search, if `false` then do nothing with refreshes. - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. + * refresh?: string, // If `true` then refresh the affected shards to make this operation visible to search, if `wait_for` (the default) then wait for a refresh to make this operation visible to search, if `false` then do nothing with refreshes. + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. * } $params * * @throws MissingParameterException if a required parameter is missing @@ -701,8 +755,9 @@ public function deleteRoleMapping(array $params = []) * * @return Elasticsearch|Promise */ - public function deleteServiceToken(array $params = []) + public function deleteServiceToken(?array $params = null) { + $params = $params ?? []; $this->checkRequiredParameters(['namespace','service','name'], $params); $url = '/_security/service/' . $this->encode($params['namespace']) . '/' . $this->encode($params['service']) . '/credential/token/' . $this->encode($params['name']); $method = 'DELETE'; @@ -724,12 +779,12 @@ public function deleteServiceToken(array $params = []) * * @param array{ * username: string, // (REQUIRED) username - * refresh: enum, // 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. - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. + * refresh?: string, // 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. + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. * } $params * * @throws MissingParameterException if a required parameter is missing @@ -739,8 +794,9 @@ public function deleteServiceToken(array $params = []) * * @return Elasticsearch|Promise */ - public function deleteUser(array $params = []) + public function deleteUser(?array $params = null) { + $params = $params ?? []; $this->checkRequiredParameters(['username'], $params); $url = '/_security/user/' . $this->encode($params['username']); $method = 'DELETE'; @@ -762,12 +818,12 @@ public function deleteUser(array $params = []) * * @param array{ * username: string, // (REQUIRED) The username of the user to disable - * refresh: enum, // 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. - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. + * refresh?: string, // 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. + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. * } $params * * @throws MissingParameterException if a required parameter is missing @@ -777,8 +833,9 @@ public function deleteUser(array $params = []) * * @return Elasticsearch|Promise */ - public function disableUser(array $params = []) + public function disableUser(?array $params = null) { + $params = $params ?? []; $this->checkRequiredParameters(['username'], $params); $url = '/_security/user/' . $this->encode($params['username']) . '/_disable'; $method = 'PUT'; @@ -800,12 +857,12 @@ public function disableUser(array $params = []) * * @param array{ * uid: string, // (REQUIRED) Unique identifier for the user profile - * refresh: enum, // If `true` then refresh the affected shards to make this operation visible to search, if `wait_for` (the default) then wait for a refresh to make this operation visible to search, if `false` then do nothing with refreshes. - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. + * refresh?: string, // If `true` then refresh the affected shards to make this operation visible to search, if `wait_for` (the default) then wait for a refresh to make this operation visible to search, if `false` then do nothing with refreshes. + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. * } $params * * @throws MissingParameterException if a required parameter is missing @@ -815,8 +872,9 @@ public function disableUser(array $params = []) * * @return Elasticsearch|Promise */ - public function disableUserProfile(array $params = []) + public function disableUserProfile(?array $params = null) { + $params = $params ?? []; $this->checkRequiredParameters(['uid'], $params); $url = '/_security/profile/' . $this->encode($params['uid']) . '/_disable'; $method = 'PUT'; @@ -838,12 +896,12 @@ public function disableUserProfile(array $params = []) * * @param array{ * username: string, // (REQUIRED) The username of the user to enable - * refresh: enum, // 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. - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. + * refresh?: string, // 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. + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. * } $params * * @throws MissingParameterException if a required parameter is missing @@ -853,8 +911,9 @@ public function disableUserProfile(array $params = []) * * @return Elasticsearch|Promise */ - public function enableUser(array $params = []) + public function enableUser(?array $params = null) { + $params = $params ?? []; $this->checkRequiredParameters(['username'], $params); $url = '/_security/user/' . $this->encode($params['username']) . '/_enable'; $method = 'PUT'; @@ -876,12 +935,12 @@ public function enableUser(array $params = []) * * @param array{ * uid: string, // (REQUIRED) An unique identifier of the user profile - * refresh: enum, // If `true` then refresh the affected shards to make this operation visible to search, if `wait_for` (the default) then wait for a refresh to make this operation visible to search, if `false` then do nothing with refreshes. - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. + * refresh?: string, // If `true` then refresh the affected shards to make this operation visible to search, if `wait_for` (the default) then wait for a refresh to make this operation visible to search, if `false` then do nothing with refreshes. + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. * } $params * * @throws MissingParameterException if a required parameter is missing @@ -891,8 +950,9 @@ public function enableUser(array $params = []) * * @return Elasticsearch|Promise */ - public function enableUserProfile(array $params = []) + public function enableUserProfile(?array $params = null) { + $params = $params ?? []; $this->checkRequiredParameters(['uid'], $params); $url = '/_security/profile/' . $this->encode($params['uid']) . '/_enable'; $method = 'PUT'; @@ -913,11 +973,11 @@ public function enableUserProfile(array $params = []) * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/security-api-kibana-enrollment.html * * @param array{ - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. * } $params * * @throws NoNodeAvailableException if all the hosts are offline @@ -926,8 +986,9 @@ public function enableUserProfile(array $params = []) * * @return Elasticsearch|Promise */ - public function enrollKibana(array $params = []) + public function enrollKibana(?array $params = null) { + $params = $params ?? []; $url = '/_security/enroll/kibana'; $method = 'GET'; @@ -948,11 +1009,11 @@ public function enrollKibana(array $params = []) * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/security-api-node-enrollment.html * * @param array{ - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. * } $params * * @throws NoNodeAvailableException if all the hosts are offline @@ -961,8 +1022,9 @@ public function enrollKibana(array $params = []) * * @return Elasticsearch|Promise */ - public function enrollNode(array $params = []) + public function enrollNode(?array $params = null) { + $params = $params ?? []; $url = '/_security/enroll/node'; $method = 'GET'; @@ -983,19 +1045,19 @@ public function enrollNode(array $params = []) * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-get-api-key.html * * @param array{ - * id: string, // API key id of the API key to be retrieved - * name: string, // API key name of the API key to be retrieved - * username: string, // user name of the user who created this API key to be retrieved - * realm_name: string, // realm name of the user who created this API key to be retrieved - * owner: boolean, // flag to query API keys owned by the currently authenticated user - * with_limited_by: boolean, // flag to show the limited-by role descriptors of API Keys - * with_profile_uid: boolean, // flag to also retrieve the API Key's owner profile uid, if it exists - * active_only: boolean, // flag to limit response to only active (not invalidated or expired) API keys - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. + * id?: string, // API key id of the API key to be retrieved + * name?: string, // API key name of the API key to be retrieved + * username?: string, // user name of the user who created this API key to be retrieved + * realm_name?: string, // realm name of the user who created this API key to be retrieved + * owner?: bool, // flag to query API keys owned by the currently authenticated user + * with_limited_by?: bool, // flag to show the limited-by role descriptors of API Keys + * with_profile_uid?: bool, // flag to also retrieve the API Key's owner profile uid, if it exists + * active_only?: bool, // flag to limit response to only active (not invalidated or expired) API keys + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. * } $params * * @throws NoNodeAvailableException if all the hosts are offline @@ -1004,8 +1066,9 @@ public function enrollNode(array $params = []) * * @return Elasticsearch|Promise */ - public function getApiKey(array $params = []) + public function getApiKey(?array $params = null) { + $params = $params ?? []; $url = '/_security/api_key'; $method = 'GET'; @@ -1025,11 +1088,11 @@ public function getApiKey(array $params = []) * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-get-builtin-privileges.html * * @param array{ - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. * } $params * * @throws NoNodeAvailableException if all the hosts are offline @@ -1038,8 +1101,9 @@ public function getApiKey(array $params = []) * * @return Elasticsearch|Promise */ - public function getBuiltinPrivileges(array $params = []) + public function getBuiltinPrivileges(?array $params = null) { + $params = $params ?? []; $url = '/_security/privilege/_builtin'; $method = 'GET'; @@ -1059,13 +1123,13 @@ public function getBuiltinPrivileges(array $params = []) * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-get-privileges.html * * @param array{ - * application: string, // Application name - * name: string, // Privilege name - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. + * application?: string, // Application name + * name?: string, // Privilege name + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. * } $params * * @throws NoNodeAvailableException if all the hosts are offline @@ -1074,8 +1138,9 @@ public function getBuiltinPrivileges(array $params = []) * * @return Elasticsearch|Promise */ - public function getPrivileges(array $params = []) + public function getPrivileges(?array $params = null) { + $params = $params ?? []; if (isset($params['application']) && isset($params['name'])) { $url = '/_security/privilege/' . $this->encode($params['application']) . '/' . $this->encode($params['name']); $method = 'GET'; @@ -1102,12 +1167,12 @@ public function getPrivileges(array $params = []) * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-get-role.html * * @param array{ - * name: list, // A comma-separated list of role names - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. + * name?: string|array, // A comma-separated list of role names + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. * } $params * * @throws NoNodeAvailableException if all the hosts are offline @@ -1116,10 +1181,11 @@ public function getPrivileges(array $params = []) * * @return Elasticsearch|Promise */ - public function getRole(array $params = []) + public function getRole(?array $params = null) { + $params = $params ?? []; if (isset($params['name'])) { - $url = '/_security/role/' . $this->encode($params['name']); + $url = '/_security/role/' . $this->encode($this->convertValue($params['name'])); $method = 'GET'; } else { $url = '/_security/role'; @@ -1141,12 +1207,12 @@ public function getRole(array $params = []) * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-get-role-mapping.html * * @param array{ - * name: list, // A comma-separated list of role-mapping names - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. + * name?: string|array, // A comma-separated list of role-mapping names + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. * } $params * * @throws NoNodeAvailableException if all the hosts are offline @@ -1155,10 +1221,11 @@ public function getRole(array $params = []) * * @return Elasticsearch|Promise */ - public function getRoleMapping(array $params = []) + public function getRoleMapping(?array $params = null) { + $params = $params ?? []; if (isset($params['name'])) { - $url = '/_security/role_mapping/' . $this->encode($params['name']); + $url = '/_security/role_mapping/' . $this->encode($this->convertValue($params['name'])); $method = 'GET'; } else { $url = '/_security/role_mapping'; @@ -1180,13 +1247,13 @@ public function getRoleMapping(array $params = []) * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-get-service-accounts.html * * @param array{ - * namespace: string, // An identifier for the namespace - * service: string, // An identifier for the service name - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. + * namespace?: string, // An identifier for the namespace + * service?: string, // An identifier for the service name + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. * } $params * * @throws NoNodeAvailableException if all the hosts are offline @@ -1195,8 +1262,9 @@ public function getRoleMapping(array $params = []) * * @return Elasticsearch|Promise */ - public function getServiceAccounts(array $params = []) + public function getServiceAccounts(?array $params = null) { + $params = $params ?? []; if (isset($params['namespace']) && isset($params['service'])) { $url = '/_security/service/' . $this->encode($params['namespace']) . '/' . $this->encode($params['service']); $method = 'GET'; @@ -1225,11 +1293,11 @@ public function getServiceAccounts(array $params = []) * @param array{ * namespace: string, // (REQUIRED) An identifier for the namespace * service: string, // (REQUIRED) An identifier for the service name - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. * } $params * * @throws MissingParameterException if a required parameter is missing @@ -1239,8 +1307,9 @@ public function getServiceAccounts(array $params = []) * * @return Elasticsearch|Promise */ - public function getServiceCredentials(array $params = []) + public function getServiceCredentials(?array $params = null) { + $params = $params ?? []; $this->checkRequiredParameters(['namespace','service'], $params); $url = '/_security/service/' . $this->encode($params['namespace']) . '/' . $this->encode($params['service']) . '/credential'; $method = 'GET'; @@ -1261,12 +1330,12 @@ public function getServiceCredentials(array $params = []) * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-get-settings.html * * @param array{ - * master_timeout: time, // Timeout for connection to master - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. + * master_timeout?: int|string, // Timeout for connection to master + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. * } $params * * @throws NoNodeAvailableException if all the hosts are offline @@ -1275,8 +1344,9 @@ public function getServiceCredentials(array $params = []) * * @return Elasticsearch|Promise */ - public function getSettings(array $params = []) + public function getSettings(?array $params = null) { + $params = $params ?? []; $url = '/_security/settings'; $method = 'GET'; @@ -1297,12 +1367,12 @@ public function getSettings(array $params = []) * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-get-token.html * * @param array{ - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. - * body: array, // (REQUIRED) The token request to get + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. + * body: string|array, // (REQUIRED) The token request to get. If body is a string must be a valid JSON. * } $params * * @throws NoNodeAvailableException if all the hosts are offline @@ -1311,8 +1381,9 @@ public function getSettings(array $params = []) * * @return Elasticsearch|Promise */ - public function getToken(array $params = []) + public function getToken(?array $params = null) { + $params = $params ?? []; $this->checkRequiredParameters(['body'], $params); $url = '/_security/oauth2/token'; $method = 'POST'; @@ -1334,13 +1405,13 @@ public function getToken(array $params = []) * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-get-user.html * * @param array{ - * username: list, // A comma-separated list of usernames - * with_profile_uid: boolean, // flag to retrieve profile uid (if exists) associated to the user - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. + * username?: string|array, // A comma-separated list of usernames + * with_profile_uid?: bool, // flag to retrieve profile uid (if exists) associated to the user + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. * } $params * * @throws NoNodeAvailableException if all the hosts are offline @@ -1349,10 +1420,11 @@ public function getToken(array $params = []) * * @return Elasticsearch|Promise */ - public function getUser(array $params = []) + public function getUser(?array $params = null) { + $params = $params ?? []; if (isset($params['username'])) { - $url = '/_security/user/' . $this->encode($params['username']); + $url = '/_security/user/' . $this->encode($this->convertValue($params['username'])); $method = 'GET'; } else { $url = '/_security/user'; @@ -1374,11 +1446,11 @@ public function getUser(array $params = []) * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-get-user-privileges.html * * @param array{ - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. * } $params * * @throws NoNodeAvailableException if all the hosts are offline @@ -1387,8 +1459,9 @@ public function getUser(array $params = []) * * @return Elasticsearch|Promise */ - public function getUserPrivileges(array $params = []) + public function getUserPrivileges(?array $params = null) { + $params = $params ?? []; $url = '/_security/user/_privileges'; $method = 'GET'; @@ -1408,13 +1481,13 @@ public function getUserPrivileges(array $params = []) * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-get-user-profile.html * * @param array{ - * uid: list, // (REQUIRED) A comma-separated list of unique identifier for user profiles - * data: list, // A comma-separated list of keys for which the corresponding application data are retrieved. - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. + * uid: string|array, // (REQUIRED) A comma-separated list of unique identifier for user profiles + * data?: string|array, // A comma-separated list of keys for which the corresponding application data are retrieved. + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. * } $params * * @throws MissingParameterException if a required parameter is missing @@ -1424,10 +1497,11 @@ public function getUserPrivileges(array $params = []) * * @return Elasticsearch|Promise */ - public function getUserProfile(array $params = []) + public function getUserProfile(?array $params = null) { + $params = $params ?? []; $this->checkRequiredParameters(['uid'], $params); - $url = '/_security/profile/' . $this->encode($params['uid']); + $url = '/_security/profile/' . $this->encode($this->convertValue($params['uid'])); $method = 'GET'; $url = $this->addQueryString($url, $params, ['data','pretty','human','error_trace','source','filter_path']); @@ -1446,13 +1520,13 @@ public function getUserProfile(array $params = []) * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-grant-api-key.html * * @param array{ - * refresh: enum, // 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. - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. - * body: array, // (REQUIRED) The api key request to create an API key + * refresh?: string, // 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. + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. + * body: string|array, // (REQUIRED) The api key request to create an API key. If body is a string must be a valid JSON. * } $params * * @throws NoNodeAvailableException if all the hosts are offline @@ -1461,8 +1535,9 @@ public function getUserProfile(array $params = []) * * @return Elasticsearch|Promise */ - public function grantApiKey(array $params = []) + public function grantApiKey(?array $params = null) { + $params = $params ?? []; $this->checkRequiredParameters(['body'], $params); $url = '/_security/api_key/grant'; $method = 'POST'; @@ -1484,13 +1559,13 @@ public function grantApiKey(array $params = []) * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-has-privileges.html * * @param array{ - * user: string, // Username - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. - * body: array, // (REQUIRED) The privileges to test + * user?: string, // Username + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. + * body: string|array, // (REQUIRED) The privileges to test. If body is a string must be a valid JSON. * } $params * * @throws NoNodeAvailableException if all the hosts are offline @@ -1499,8 +1574,9 @@ public function grantApiKey(array $params = []) * * @return Elasticsearch|Promise */ - public function hasPrivileges(array $params = []) + public function hasPrivileges(?array $params = null) { + $params = $params ?? []; $this->checkRequiredParameters(['body'], $params); if (isset($params['user'])) { $url = '/_security/user/' . $this->encode($params['user']) . '/_has_privileges'; @@ -1526,12 +1602,12 @@ public function hasPrivileges(array $params = []) * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-has-privileges-user-profile.html * * @param array{ - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. - * body: array, // (REQUIRED) The privileges to check and the list of profile IDs + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. + * body: string|array, // (REQUIRED) The privileges to check and the list of profile IDs. If body is a string must be a valid JSON. * } $params * * @throws NoNodeAvailableException if all the hosts are offline @@ -1540,8 +1616,9 @@ public function hasPrivileges(array $params = []) * * @return Elasticsearch|Promise */ - public function hasPrivilegesUserProfile(array $params = []) + public function hasPrivilegesUserProfile(?array $params = null) { + $params = $params ?? []; $this->checkRequiredParameters(['body'], $params); $url = '/_security/profile/_has_privileges'; $method = empty($params['body']) ? 'GET' : 'POST'; @@ -1563,12 +1640,12 @@ public function hasPrivilegesUserProfile(array $params = []) * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-invalidate-api-key.html * * @param array{ - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. - * body: array, // (REQUIRED) The api key request to invalidate API key(s) + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. + * body: string|array, // (REQUIRED) The api key request to invalidate API key(s). If body is a string must be a valid JSON. * } $params * * @throws NoNodeAvailableException if all the hosts are offline @@ -1577,8 +1654,9 @@ public function hasPrivilegesUserProfile(array $params = []) * * @return Elasticsearch|Promise */ - public function invalidateApiKey(array $params = []) + public function invalidateApiKey(?array $params = null) { + $params = $params ?? []; $this->checkRequiredParameters(['body'], $params); $url = '/_security/api_key'; $method = 'DELETE'; @@ -1600,12 +1678,12 @@ public function invalidateApiKey(array $params = []) * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-invalidate-token.html * * @param array{ - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. - * body: array, // (REQUIRED) The token to invalidate + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. + * body: string|array, // (REQUIRED) The token to invalidate. If body is a string must be a valid JSON. * } $params * * @throws NoNodeAvailableException if all the hosts are offline @@ -1614,8 +1692,9 @@ public function invalidateApiKey(array $params = []) * * @return Elasticsearch|Promise */ - public function invalidateToken(array $params = []) + public function invalidateToken(?array $params = null) { + $params = $params ?? []; $this->checkRequiredParameters(['body'], $params); $url = '/_security/oauth2/token'; $method = 'DELETE'; @@ -1637,12 +1716,12 @@ public function invalidateToken(array $params = []) * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-oidc-authenticate.html * * @param array{ - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. - * body: array, // (REQUIRED) The OpenID Connect response to authenticate + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. + * body: string|array, // (REQUIRED) The OpenID Connect response to authenticate. If body is a string must be a valid JSON. * } $params * * @throws NoNodeAvailableException if all the hosts are offline @@ -1651,8 +1730,9 @@ public function invalidateToken(array $params = []) * * @return Elasticsearch|Promise */ - public function oidcAuthenticate(array $params = []) + public function oidcAuthenticate(?array $params = null) { + $params = $params ?? []; $this->checkRequiredParameters(['body'], $params); $url = '/_security/oidc/authenticate'; $method = 'POST'; @@ -1674,12 +1754,12 @@ public function oidcAuthenticate(array $params = []) * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-oidc-logout.html * * @param array{ - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. - * body: array, // (REQUIRED) Access token and refresh token to invalidate + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. + * body: string|array, // (REQUIRED) Access token and refresh token to invalidate. If body is a string must be a valid JSON. * } $params * * @throws NoNodeAvailableException if all the hosts are offline @@ -1688,8 +1768,9 @@ public function oidcAuthenticate(array $params = []) * * @return Elasticsearch|Promise */ - public function oidcLogout(array $params = []) + public function oidcLogout(?array $params = null) { + $params = $params ?? []; $this->checkRequiredParameters(['body'], $params); $url = '/_security/oidc/logout'; $method = 'POST'; @@ -1711,12 +1792,12 @@ public function oidcLogout(array $params = []) * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-oidc-prepare-authentication.html * * @param array{ - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. - * body: array, // (REQUIRED) The OpenID Connect authentication realm configuration + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. + * body: string|array, // (REQUIRED) The OpenID Connect authentication realm configuration. If body is a string must be a valid JSON. * } $params * * @throws NoNodeAvailableException if all the hosts are offline @@ -1725,8 +1806,9 @@ public function oidcLogout(array $params = []) * * @return Elasticsearch|Promise */ - public function oidcPrepareAuthentication(array $params = []) + public function oidcPrepareAuthentication(?array $params = null) { + $params = $params ?? []; $this->checkRequiredParameters(['body'], $params); $url = '/_security/oidc/prepare'; $method = 'POST'; @@ -1748,13 +1830,13 @@ public function oidcPrepareAuthentication(array $params = []) * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-put-privileges.html * * @param array{ - * refresh: enum, // 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. - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. - * body: array, // (REQUIRED) The privilege(s) to add + * refresh?: string, // 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. + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. + * body: string|array, // (REQUIRED) The privilege(s) to add. If body is a string must be a valid JSON. * } $params * * @throws NoNodeAvailableException if all the hosts are offline @@ -1763,8 +1845,9 @@ public function oidcPrepareAuthentication(array $params = []) * * @return Elasticsearch|Promise */ - public function putPrivileges(array $params = []) + public function putPrivileges(?array $params = null) { + $params = $params ?? []; $this->checkRequiredParameters(['body'], $params); $url = '/_security/privilege'; $method = 'PUT'; @@ -1787,13 +1870,13 @@ public function putPrivileges(array $params = []) * * @param array{ * name: string, // (REQUIRED) Role name - * refresh: enum, // 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. - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. - * body: array, // (REQUIRED) The role to add + * refresh?: string, // 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. + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. + * body: string|array, // (REQUIRED) The role to add. If body is a string must be a valid JSON. * } $params * * @throws MissingParameterException if a required parameter is missing @@ -1803,8 +1886,9 @@ public function putPrivileges(array $params = []) * * @return Elasticsearch|Promise */ - public function putRole(array $params = []) + public function putRole(?array $params = null) { + $params = $params ?? []; $this->checkRequiredParameters(['name','body'], $params); $url = '/_security/role/' . $this->encode($params['name']); $method = 'PUT'; @@ -1827,13 +1911,13 @@ public function putRole(array $params = []) * * @param array{ * name: string, // (REQUIRED) Role-mapping name - * refresh: enum, // 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. - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. - * body: array, // (REQUIRED) The role mapping to add + * refresh?: string, // 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. + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. + * body: string|array, // (REQUIRED) The role mapping to add. If body is a string must be a valid JSON. * } $params * * @throws MissingParameterException if a required parameter is missing @@ -1843,8 +1927,9 @@ public function putRole(array $params = []) * * @return Elasticsearch|Promise */ - public function putRoleMapping(array $params = []) + public function putRoleMapping(?array $params = null) { + $params = $params ?? []; $this->checkRequiredParameters(['name','body'], $params); $url = '/_security/role_mapping/' . $this->encode($params['name']); $method = 'PUT'; @@ -1867,13 +1952,13 @@ public function putRoleMapping(array $params = []) * * @param array{ * username: string, // (REQUIRED) The username of the User - * refresh: enum, // 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. - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. - * body: array, // (REQUIRED) The user to add + * refresh?: string, // 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. + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. + * body: string|array, // (REQUIRED) The user to add. If body is a string must be a valid JSON. * } $params * * @throws MissingParameterException if a required parameter is missing @@ -1883,8 +1968,9 @@ public function putRoleMapping(array $params = []) * * @return Elasticsearch|Promise */ - public function putUser(array $params = []) + public function putUser(?array $params = null) { + $params = $params ?? []; $this->checkRequiredParameters(['username','body'], $params); $url = '/_security/user/' . $this->encode($params['username']); $method = 'PUT'; @@ -1906,15 +1992,15 @@ public function putUser(array $params = []) * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-query-api-key.html * * @param array{ - * with_limited_by: boolean, // flag to show the limited-by role descriptors of API Keys - * with_profile_uid: boolean, // flag to also retrieve the API Key's owner profile uid, if it exists - * typed_keys: boolean, // flag to prefix aggregation names by their respective types in the response - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. - * body: array, // From, size, query, sort and search_after + * with_limited_by?: bool, // flag to show the limited-by role descriptors of API Keys + * with_profile_uid?: bool, // flag to also retrieve the API Key's owner profile uid, if it exists + * typed_keys?: bool, // flag to prefix aggregation names by their respective types in the response + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. + * body?: string|array, // From, size, query, sort and search_after. If body is a string must be a valid JSON. * } $params * * @throws NoNodeAvailableException if all the hosts are offline @@ -1923,8 +2009,9 @@ public function putUser(array $params = []) * * @return Elasticsearch|Promise */ - public function queryApiKeys(array $params = []) + public function queryApiKeys(?array $params = null) { + $params = $params ?? []; $url = '/_security/_query/api_key'; $method = empty($params['body']) ? 'GET' : 'POST'; @@ -1945,12 +2032,12 @@ public function queryApiKeys(array $params = []) * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-query-role.html * * @param array{ - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. - * body: array, // From, size, query, sort and search_after + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. + * body?: string|array, // From, size, query, sort and search_after. If body is a string must be a valid JSON. * } $params * * @throws NoNodeAvailableException if all the hosts are offline @@ -1959,8 +2046,9 @@ public function queryApiKeys(array $params = []) * * @return Elasticsearch|Promise */ - public function queryRole(array $params = []) + public function queryRole(?array $params = null) { + $params = $params ?? []; $url = '/_security/_query/role'; $method = empty($params['body']) ? 'GET' : 'POST'; @@ -1981,13 +2069,13 @@ public function queryRole(array $params = []) * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-query-user.html * * @param array{ - * with_profile_uid: boolean, // flag to retrieve profile uid (if exists) associated with the user - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. - * body: array, // From, size, query, sort and search_after + * with_profile_uid?: bool, // flag to retrieve profile uid (if exists) associated with the user + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. + * body?: string|array, // From, size, query, sort and search_after. If body is a string must be a valid JSON. * } $params * * @throws NoNodeAvailableException if all the hosts are offline @@ -1996,8 +2084,9 @@ public function queryRole(array $params = []) * * @return Elasticsearch|Promise */ - public function queryUser(array $params = []) + public function queryUser(?array $params = null) { + $params = $params ?? []; $url = '/_security/_query/user'; $method = empty($params['body']) ? 'GET' : 'POST'; @@ -2018,12 +2107,12 @@ public function queryUser(array $params = []) * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-saml-authenticate.html * * @param array{ - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. - * body: array, // (REQUIRED) The SAML response to authenticate + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. + * body: string|array, // (REQUIRED) The SAML response to authenticate. If body is a string must be a valid JSON. * } $params * * @throws NoNodeAvailableException if all the hosts are offline @@ -2032,8 +2121,9 @@ public function queryUser(array $params = []) * * @return Elasticsearch|Promise */ - public function samlAuthenticate(array $params = []) + public function samlAuthenticate(?array $params = null) { + $params = $params ?? []; $this->checkRequiredParameters(['body'], $params); $url = '/_security/saml/authenticate'; $method = 'POST'; @@ -2055,12 +2145,12 @@ public function samlAuthenticate(array $params = []) * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-saml-complete-logout.html * * @param array{ - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. - * body: array, // (REQUIRED) The logout response to verify + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. + * body: string|array, // (REQUIRED) The logout response to verify. If body is a string must be a valid JSON. * } $params * * @throws NoNodeAvailableException if all the hosts are offline @@ -2069,8 +2159,9 @@ public function samlAuthenticate(array $params = []) * * @return Elasticsearch|Promise */ - public function samlCompleteLogout(array $params = []) + public function samlCompleteLogout(?array $params = null) { + $params = $params ?? []; $this->checkRequiredParameters(['body'], $params); $url = '/_security/saml/complete_logout'; $method = 'POST'; @@ -2092,12 +2183,12 @@ public function samlCompleteLogout(array $params = []) * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-saml-invalidate.html * * @param array{ - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. - * body: array, // (REQUIRED) The LogoutRequest message + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. + * body: string|array, // (REQUIRED) The LogoutRequest message. If body is a string must be a valid JSON. * } $params * * @throws NoNodeAvailableException if all the hosts are offline @@ -2106,8 +2197,9 @@ public function samlCompleteLogout(array $params = []) * * @return Elasticsearch|Promise */ - public function samlInvalidate(array $params = []) + public function samlInvalidate(?array $params = null) { + $params = $params ?? []; $this->checkRequiredParameters(['body'], $params); $url = '/_security/saml/invalidate'; $method = 'POST'; @@ -2129,12 +2221,12 @@ public function samlInvalidate(array $params = []) * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-saml-logout.html * * @param array{ - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. - * body: array, // (REQUIRED) The tokens to invalidate + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. + * body: string|array, // (REQUIRED) The tokens to invalidate. If body is a string must be a valid JSON. * } $params * * @throws NoNodeAvailableException if all the hosts are offline @@ -2143,8 +2235,9 @@ public function samlInvalidate(array $params = []) * * @return Elasticsearch|Promise */ - public function samlLogout(array $params = []) + public function samlLogout(?array $params = null) { + $params = $params ?? []; $this->checkRequiredParameters(['body'], $params); $url = '/_security/saml/logout'; $method = 'POST'; @@ -2166,12 +2259,12 @@ public function samlLogout(array $params = []) * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-saml-prepare-authentication.html * * @param array{ - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. - * body: array, // (REQUIRED) The realm for which to create the authentication request, identified by either its name or the ACS URL + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. + * body: string|array, // (REQUIRED) The realm for which to create the authentication request, identified by either its name or the ACS URL. If body is a string must be a valid JSON. * } $params * * @throws NoNodeAvailableException if all the hosts are offline @@ -2180,8 +2273,9 @@ public function samlLogout(array $params = []) * * @return Elasticsearch|Promise */ - public function samlPrepareAuthentication(array $params = []) + public function samlPrepareAuthentication(?array $params = null) { + $params = $params ?? []; $this->checkRequiredParameters(['body'], $params); $url = '/_security/saml/prepare'; $method = 'POST'; @@ -2204,11 +2298,11 @@ public function samlPrepareAuthentication(array $params = []) * * @param array{ * realm_name: string, // (REQUIRED) The name of the SAML realm to get the metadata for - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. * } $params * * @throws MissingParameterException if a required parameter is missing @@ -2218,8 +2312,9 @@ public function samlPrepareAuthentication(array $params = []) * * @return Elasticsearch|Promise */ - public function samlServiceProviderMetadata(array $params = []) + public function samlServiceProviderMetadata(?array $params = null) { + $params = $params ?? []; $this->checkRequiredParameters(['realm_name'], $params); $url = '/_security/saml/metadata/' . $this->encode($params['realm_name']); $method = 'GET'; @@ -2241,13 +2336,13 @@ public function samlServiceProviderMetadata(array $params = []) * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/security-api-suggest-user-profile.html * * @param array{ - * data: list, // A comma-separated list of keys for which the corresponding application data are retrieved. - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. - * body: array, // The suggestion definition for user profiles + * data?: string|array, // A comma-separated list of keys for which the corresponding application data are retrieved. + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. + * body?: string|array, // The suggestion definition for user profiles. If body is a string must be a valid JSON. * } $params * * @throws NoNodeAvailableException if all the hosts are offline @@ -2256,8 +2351,9 @@ public function samlServiceProviderMetadata(array $params = []) * * @return Elasticsearch|Promise */ - public function suggestUserProfiles(array $params = []) + public function suggestUserProfiles(?array $params = null) { + $params = $params ?? []; $url = '/_security/profile/_suggest'; $method = empty($params['body']) ? 'GET' : 'POST'; @@ -2279,12 +2375,12 @@ public function suggestUserProfiles(array $params = []) * * @param array{ * id: string, // (REQUIRED) The ID of the API key to update - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. - * body: array, // The API key request to update attributes of an API key. + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. + * body?: string|array, // The API key request to update attributes of an API key.. If body is a string must be a valid JSON. * } $params * * @throws MissingParameterException if a required parameter is missing @@ -2294,8 +2390,9 @@ public function suggestUserProfiles(array $params = []) * * @return Elasticsearch|Promise */ - public function updateApiKey(array $params = []) + public function updateApiKey(?array $params = null) { + $params = $params ?? []; $this->checkRequiredParameters(['id'], $params); $url = '/_security/api_key/' . $this->encode($params['id']); $method = 'PUT'; @@ -2318,12 +2415,12 @@ public function updateApiKey(array $params = []) * * @param array{ * id: string, // (REQUIRED) The ID of the cross-cluster API key to update - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. - * body: array, // (REQUIRED) The request to update attributes of a cross-cluster API key. + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. + * body: string|array, // (REQUIRED) The request to update attributes of a cross-cluster API key.. If body is a string must be a valid JSON. * } $params * * @throws MissingParameterException if a required parameter is missing @@ -2333,8 +2430,9 @@ public function updateApiKey(array $params = []) * * @return Elasticsearch|Promise */ - public function updateCrossClusterApiKey(array $params = []) + public function updateCrossClusterApiKey(?array $params = null) { + $params = $params ?? []; $this->checkRequiredParameters(['id','body'], $params); $url = '/_security/cross_cluster/api_key/' . $this->encode($params['id']); $method = 'PUT'; @@ -2356,14 +2454,14 @@ public function updateCrossClusterApiKey(array $params = []) * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-update-settings.html * * @param array{ - * master_timeout: time, // Timeout for connection to master - * timeout: time, // Timeout for acknowledgements from all nodes - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. - * body: array, // (REQUIRED) An object with the new settings for each index, if any + * master_timeout?: int|string, // Timeout for connection to master + * timeout?: int|string, // Timeout for acknowledgements from all nodes + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. + * body: string|array, // (REQUIRED) An object with the new settings for each index, if any. If body is a string must be a valid JSON. * } $params * * @throws NoNodeAvailableException if all the hosts are offline @@ -2372,8 +2470,9 @@ public function updateCrossClusterApiKey(array $params = []) * * @return Elasticsearch|Promise */ - public function updateSettings(array $params = []) + public function updateSettings(?array $params = null) { + $params = $params ?? []; $this->checkRequiredParameters(['body'], $params); $url = '/_security/settings'; $method = 'PUT'; @@ -2396,15 +2495,15 @@ public function updateSettings(array $params = []) * * @param array{ * uid: string, // (REQUIRED) An unique identifier of the user profile - * if_seq_no: number, // only perform the update operation if the last operation that has changed the document has the specified sequence number - * if_primary_term: number, // only perform the update operation if the last operation that has changed the document has the specified primary term - * refresh: enum, // 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. - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. - * body: array, // (REQUIRED) The application data to update + * if_seq_no?: int, // only perform the update operation if the last operation that has changed the document has the specified sequence number + * if_primary_term?: int, // only perform the update operation if the last operation that has changed the document has the specified primary term + * refresh?: string, // 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. + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. + * body: string|array, // (REQUIRED) The application data to update. If body is a string must be a valid JSON. * } $params * * @throws MissingParameterException if a required parameter is missing @@ -2414,8 +2513,9 @@ public function updateSettings(array $params = []) * * @return Elasticsearch|Promise */ - public function updateUserProfileData(array $params = []) + public function updateUserProfileData(?array $params = null) { + $params = $params ?? []; $this->checkRequiredParameters(['uid','body'], $params); $url = '/_security/profile/' . $this->encode($params['uid']) . '/_data'; $method = 'PUT'; diff --git a/src/Endpoints/Shutdown.php b/src/Endpoints/Shutdown.php index a03144389..079954bfc 100644 --- a/src/Endpoints/Shutdown.php +++ b/src/Endpoints/Shutdown.php @@ -35,11 +35,13 @@ class Shutdown extends AbstractEndpoint * * @param array{ * node_id: string, // (REQUIRED) The node id of node to be removed from the shutdown state - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. + * master_timeout?: int|string, // Explicit operation timeout for connection to master node + * timeout?: int|string, // Explicit operation timeout + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. * } $params * * @throws MissingParameterException if a required parameter is missing @@ -49,13 +51,14 @@ class Shutdown extends AbstractEndpoint * * @return Elasticsearch|Promise */ - public function deleteNode(array $params = []) + public function deleteNode(?array $params = null) { + $params = $params ?? []; $this->checkRequiredParameters(['node_id'], $params); $url = '/_nodes/' . $this->encode($params['node_id']) . '/shutdown'; $method = 'DELETE'; - $url = $this->addQueryString($url, $params, ['pretty','human','error_trace','source','filter_path']); + $url = $this->addQueryString($url, $params, ['master_timeout','timeout','pretty','human','error_trace','source','filter_path']); $headers = [ 'Accept' => 'application/json', 'Content-Type' => 'application/json', @@ -72,13 +75,13 @@ public function deleteNode(array $params = []) * @see https://www.elastic.co/guide/en/elasticsearch/reference/current * * @param array{ - * node_id: string, // Which node for which to retrieve the shutdown status - * master_timeout: time, // Timeout for processing on master node - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. + * node_id?: string, // Which node for which to retrieve the shutdown status + * master_timeout?: int|string, // Timeout for processing on master node + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. * } $params * * @throws NoNodeAvailableException if all the hosts are offline @@ -87,8 +90,9 @@ public function deleteNode(array $params = []) * * @return Elasticsearch|Promise */ - public function getNode(array $params = []) + public function getNode(?array $params = null) { + $params = $params ?? []; if (isset($params['node_id'])) { $url = '/_nodes/' . $this->encode($params['node_id']) . '/shutdown'; $method = 'GET'; @@ -114,12 +118,14 @@ public function getNode(array $params = []) * * @param array{ * node_id: string, // (REQUIRED) The node id of node to be shut down - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. - * body: array, // (REQUIRED) The shutdown type definition to register + * master_timeout?: int|string, // Explicit operation timeout for connection to master node + * timeout?: int|string, // Explicit operation timeout + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. + * body: string|array, // (REQUIRED) The shutdown type definition to register. If body is a string must be a valid JSON. * } $params * * @throws MissingParameterException if a required parameter is missing @@ -129,13 +135,14 @@ public function getNode(array $params = []) * * @return Elasticsearch|Promise */ - public function putNode(array $params = []) + public function putNode(?array $params = null) { + $params = $params ?? []; $this->checkRequiredParameters(['node_id','body'], $params); $url = '/_nodes/' . $this->encode($params['node_id']) . '/shutdown'; $method = 'PUT'; - $url = $this->addQueryString($url, $params, ['pretty','human','error_trace','source','filter_path']); + $url = $this->addQueryString($url, $params, ['master_timeout','timeout','pretty','human','error_trace','source','filter_path']); $headers = [ 'Accept' => 'application/json', 'Content-Type' => 'application/json', diff --git a/src/Endpoints/Simulate.php b/src/Endpoints/Simulate.php index 02b987137..20437ded2 100644 --- a/src/Endpoints/Simulate.php +++ b/src/Endpoints/Simulate.php @@ -35,14 +35,14 @@ class Simulate extends AbstractEndpoint * @internal This API is EXPERIMENTAL and may be changed or removed completely in a future release * * @param array{ - * index: string, // Default index for docs which don't provide one - * pipeline: string, // The pipeline id to preprocess incoming documents with if no pipeline is given for a particular document - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. - * body: array, // (REQUIRED) The simulate definition + * index?: string, // Default index for docs which don't provide one + * pipeline?: string, // The pipeline id to preprocess incoming documents with if no pipeline is given for a particular document + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. + * body: string|array, // (REQUIRED) The simulate definition. If body is a string must be a valid JSON. * } $params * * @throws NoNodeAvailableException if all the hosts are offline @@ -51,8 +51,9 @@ class Simulate extends AbstractEndpoint * * @return Elasticsearch|Promise */ - public function ingest(array $params = []) + public function ingest(?array $params = null) { + $params = $params ?? []; $this->checkRequiredParameters(['body'], $params); if (isset($params['index'])) { $url = '/_ingest/' . $this->encode($params['index']) . '/_simulate'; diff --git a/src/Endpoints/Slm.php b/src/Endpoints/Slm.php index 48369ae79..0034a2f29 100644 --- a/src/Endpoints/Slm.php +++ b/src/Endpoints/Slm.php @@ -35,11 +35,13 @@ class Slm extends AbstractEndpoint * * @param array{ * policy_id: string, // (REQUIRED) The id of the snapshot lifecycle policy to remove - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. + * master_timeout?: int|string, // Explicit operation timeout for connection to master node + * timeout?: int|string, // Explicit operation timeout + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. * } $params * * @throws MissingParameterException if a required parameter is missing @@ -49,13 +51,14 @@ class Slm extends AbstractEndpoint * * @return Elasticsearch|Promise */ - public function deleteLifecycle(array $params = []) + public function deleteLifecycle(?array $params = null) { + $params = $params ?? []; $this->checkRequiredParameters(['policy_id'], $params); $url = '/_slm/policy/' . $this->encode($params['policy_id']); $method = 'DELETE'; - $url = $this->addQueryString($url, $params, ['pretty','human','error_trace','source','filter_path']); + $url = $this->addQueryString($url, $params, ['master_timeout','timeout','pretty','human','error_trace','source','filter_path']); $headers = [ 'Accept' => 'application/json', ]; @@ -72,11 +75,13 @@ public function deleteLifecycle(array $params = []) * * @param array{ * policy_id: string, // (REQUIRED) The id of the snapshot lifecycle policy to be executed - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. + * master_timeout?: int|string, // Explicit operation timeout for connection to master node + * timeout?: int|string, // Explicit operation timeout + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. * } $params * * @throws MissingParameterException if a required parameter is missing @@ -86,13 +91,14 @@ public function deleteLifecycle(array $params = []) * * @return Elasticsearch|Promise */ - public function executeLifecycle(array $params = []) + public function executeLifecycle(?array $params = null) { + $params = $params ?? []; $this->checkRequiredParameters(['policy_id'], $params); $url = '/_slm/policy/' . $this->encode($params['policy_id']) . '/_execute'; $method = 'PUT'; - $url = $this->addQueryString($url, $params, ['pretty','human','error_trace','source','filter_path']); + $url = $this->addQueryString($url, $params, ['master_timeout','timeout','pretty','human','error_trace','source','filter_path']); $headers = [ 'Accept' => 'application/json', ]; @@ -108,11 +114,13 @@ public function executeLifecycle(array $params = []) * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/slm-api-execute-retention.html * * @param array{ - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. + * master_timeout?: int|string, // Explicit operation timeout for connection to master node + * timeout?: int|string, // Explicit operation timeout + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. * } $params * * @throws NoNodeAvailableException if all the hosts are offline @@ -121,12 +129,13 @@ public function executeLifecycle(array $params = []) * * @return Elasticsearch|Promise */ - public function executeRetention(array $params = []) + public function executeRetention(?array $params = null) { + $params = $params ?? []; $url = '/_slm/_execute_retention'; $method = 'POST'; - $url = $this->addQueryString($url, $params, ['pretty','human','error_trace','source','filter_path']); + $url = $this->addQueryString($url, $params, ['master_timeout','timeout','pretty','human','error_trace','source','filter_path']); $headers = [ 'Accept' => 'application/json', ]; @@ -142,12 +151,14 @@ public function executeRetention(array $params = []) * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/slm-api-get-policy.html * * @param array{ - * policy_id: list, // Comma-separated list of snapshot lifecycle policies to retrieve - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. + * policy_id?: string|array, // Comma-separated list of snapshot lifecycle policies to retrieve + * master_timeout?: int|string, // Explicit operation timeout for connection to master node + * timeout?: int|string, // Explicit operation timeout + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. * } $params * * @throws NoNodeAvailableException if all the hosts are offline @@ -156,16 +167,17 @@ public function executeRetention(array $params = []) * * @return Elasticsearch|Promise */ - public function getLifecycle(array $params = []) + public function getLifecycle(?array $params = null) { + $params = $params ?? []; if (isset($params['policy_id'])) { - $url = '/_slm/policy/' . $this->encode($params['policy_id']); + $url = '/_slm/policy/' . $this->encode($this->convertValue($params['policy_id'])); $method = 'GET'; } else { $url = '/_slm/policy'; $method = 'GET'; } - $url = $this->addQueryString($url, $params, ['pretty','human','error_trace','source','filter_path']); + $url = $this->addQueryString($url, $params, ['master_timeout','timeout','pretty','human','error_trace','source','filter_path']); $headers = [ 'Accept' => 'application/json', ]; @@ -181,11 +193,13 @@ public function getLifecycle(array $params = []) * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/slm-api-get-stats.html * * @param array{ - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. + * master_timeout?: int|string, // Explicit operation timeout for connection to master node + * timeout?: int|string, // Explicit operation timeout + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. * } $params * * @throws NoNodeAvailableException if all the hosts are offline @@ -194,12 +208,13 @@ public function getLifecycle(array $params = []) * * @return Elasticsearch|Promise */ - public function getStats(array $params = []) + public function getStats(?array $params = null) { + $params = $params ?? []; $url = '/_slm/stats'; $method = 'GET'; - $url = $this->addQueryString($url, $params, ['pretty','human','error_trace','source','filter_path']); + $url = $this->addQueryString($url, $params, ['master_timeout','timeout','pretty','human','error_trace','source','filter_path']); $headers = [ 'Accept' => 'application/json', ]; @@ -215,11 +230,13 @@ public function getStats(array $params = []) * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/slm-api-get-status.html * * @param array{ - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. + * master_timeout?: int|string, // Explicit operation timeout for connection to master node + * timeout?: int|string, // Explicit operation timeout + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. * } $params * * @throws NoNodeAvailableException if all the hosts are offline @@ -228,12 +245,13 @@ public function getStats(array $params = []) * * @return Elasticsearch|Promise */ - public function getStatus(array $params = []) + public function getStatus(?array $params = null) { + $params = $params ?? []; $url = '/_slm/status'; $method = 'GET'; - $url = $this->addQueryString($url, $params, ['pretty','human','error_trace','source','filter_path']); + $url = $this->addQueryString($url, $params, ['master_timeout','timeout','pretty','human','error_trace','source','filter_path']); $headers = [ 'Accept' => 'application/json', ]; @@ -250,12 +268,14 @@ public function getStatus(array $params = []) * * @param array{ * policy_id: string, // (REQUIRED) The id of the snapshot lifecycle policy - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. - * body: array, // The snapshot lifecycle policy definition to register + * master_timeout?: int|string, // Explicit operation timeout for connection to master node + * timeout?: int|string, // Explicit operation timeout + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. + * body?: string|array, // The snapshot lifecycle policy definition to register. If body is a string must be a valid JSON. * } $params * * @throws MissingParameterException if a required parameter is missing @@ -265,13 +285,14 @@ public function getStatus(array $params = []) * * @return Elasticsearch|Promise */ - public function putLifecycle(array $params = []) + public function putLifecycle(?array $params = null) { + $params = $params ?? []; $this->checkRequiredParameters(['policy_id'], $params); $url = '/_slm/policy/' . $this->encode($params['policy_id']); $method = 'PUT'; - $url = $this->addQueryString($url, $params, ['pretty','human','error_trace','source','filter_path']); + $url = $this->addQueryString($url, $params, ['master_timeout','timeout','pretty','human','error_trace','source','filter_path']); $headers = [ 'Accept' => 'application/json', 'Content-Type' => 'application/json', @@ -288,13 +309,13 @@ public function putLifecycle(array $params = []) * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/slm-api-start.html * * @param array{ - * master_timeout: time, // Timeout for processing on master node - * timeout: time, // Timeout for acknowledgement of update from all nodes in cluster - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. + * master_timeout?: int|string, // Timeout for processing on master node + * timeout?: int|string, // Timeout for acknowledgement of update from all nodes in cluster + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. * } $params * * @throws NoNodeAvailableException if all the hosts are offline @@ -303,8 +324,9 @@ public function putLifecycle(array $params = []) * * @return Elasticsearch|Promise */ - public function start(array $params = []) + public function start(?array $params = null) { + $params = $params ?? []; $url = '/_slm/start'; $method = 'POST'; @@ -324,13 +346,13 @@ public function start(array $params = []) * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/slm-api-stop.html * * @param array{ - * master_timeout: time, // Timeout for processing on master node - * timeout: time, // Timeout for acknowledgement of update from all nodes in cluster - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. + * master_timeout?: int|string, // Timeout for processing on master node + * timeout?: int|string, // Timeout for acknowledgement of update from all nodes in cluster + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. * } $params * * @throws NoNodeAvailableException if all the hosts are offline @@ -339,8 +361,9 @@ public function start(array $params = []) * * @return Elasticsearch|Promise */ - public function stop(array $params = []) + public function stop(?array $params = null) { + $params = $params ?? []; $url = '/_slm/stop'; $method = 'POST'; diff --git a/src/Endpoints/Snapshot.php b/src/Endpoints/Snapshot.php index 331d36295..1dab50820 100644 --- a/src/Endpoints/Snapshot.php +++ b/src/Endpoints/Snapshot.php @@ -35,13 +35,13 @@ class Snapshot extends AbstractEndpoint * * @param array{ * repository: string, // (REQUIRED) A repository name - * master_timeout: time, // Explicit operation timeout for connection to master node - * timeout: time, // Explicit operation timeout - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. + * master_timeout?: int|string, // Explicit operation timeout for connection to master node + * timeout?: int|string, // Explicit operation timeout + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. * } $params * * @throws MissingParameterException if a required parameter is missing @@ -51,8 +51,9 @@ class Snapshot extends AbstractEndpoint * * @return Elasticsearch|Promise */ - public function cleanupRepository(array $params = []) + public function cleanupRepository(?array $params = null) { + $params = $params ?? []; $this->checkRequiredParameters(['repository'], $params); $url = '/_snapshot/' . $this->encode($params['repository']) . '/_cleanup'; $method = 'POST'; @@ -76,13 +77,13 @@ public function cleanupRepository(array $params = []) * repository: string, // (REQUIRED) A repository name * snapshot: string, // (REQUIRED) The name of the snapshot to clone from * target_snapshot: string, // (REQUIRED) The name of the cloned snapshot to create - * master_timeout: time, // Explicit operation timeout for connection to master node - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. - * body: array, // (REQUIRED) The snapshot clone definition + * master_timeout?: int|string, // Explicit operation timeout for connection to master node + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. + * body: string|array, // (REQUIRED) The snapshot clone definition. If body is a string must be a valid JSON. * } $params * * @throws MissingParameterException if a required parameter is missing @@ -92,8 +93,9 @@ public function cleanupRepository(array $params = []) * * @return Elasticsearch|Promise */ - public function clone(array $params = []) + public function clone(?array $params = null) { + $params = $params ?? []; $this->checkRequiredParameters(['repository','snapshot','target_snapshot','body'], $params); $url = '/_snapshot/' . $this->encode($params['repository']) . '/' . $this->encode($params['snapshot']) . '/_clone/' . $this->encode($params['target_snapshot']); $method = 'PUT'; @@ -117,14 +119,14 @@ public function clone(array $params = []) * @param array{ * repository: string, // (REQUIRED) A repository name * snapshot: string, // (REQUIRED) A snapshot name - * master_timeout: time, // Explicit operation timeout for connection to master node - * wait_for_completion: boolean, // Should this request wait until the operation has completed before returning - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. - * body: array, // The snapshot definition + * master_timeout?: int|string, // Explicit operation timeout for connection to master node + * wait_for_completion?: bool, // Should this request wait until the operation has completed before returning + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. + * body?: string|array, // The snapshot definition. If body is a string must be a valid JSON. * } $params * * @throws MissingParameterException if a required parameter is missing @@ -134,8 +136,9 @@ public function clone(array $params = []) * * @return Elasticsearch|Promise */ - public function create(array $params = []) + public function create(?array $params = null) { + $params = $params ?? []; $this->checkRequiredParameters(['repository','snapshot'], $params); $url = '/_snapshot/' . $this->encode($params['repository']) . '/' . $this->encode($params['snapshot']); $method = 'PUT'; @@ -158,15 +161,15 @@ public function create(array $params = []) * * @param array{ * repository: string, // (REQUIRED) A repository name - * master_timeout: time, // Explicit operation timeout for connection to master node - * timeout: time, // Explicit operation timeout - * verify: boolean, // Whether to verify the repository after creation - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. - * body: array, // (REQUIRED) The repository definition + * master_timeout?: int|string, // Explicit operation timeout for connection to master node + * timeout?: int|string, // Explicit operation timeout + * verify?: bool, // Whether to verify the repository after creation + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. + * body: string|array, // (REQUIRED) The repository definition. If body is a string must be a valid JSON. * } $params * * @throws MissingParameterException if a required parameter is missing @@ -176,8 +179,9 @@ public function create(array $params = []) * * @return Elasticsearch|Promise */ - public function createRepository(array $params = []) + public function createRepository(?array $params = null) { + $params = $params ?? []; $this->checkRequiredParameters(['repository','body'], $params); $url = '/_snapshot/' . $this->encode($params['repository']); $method = 'PUT'; @@ -200,14 +204,14 @@ public function createRepository(array $params = []) * * @param array{ * repository: string, // (REQUIRED) A repository name - * snapshot: list, // (REQUIRED) A comma-separated list of snapshot names - * master_timeout: time, // Explicit operation timeout for connection to master node - * wait_for_completion: boolean, // Should this request wait until the operation has completed before returning - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. + * snapshot: string|array, // (REQUIRED) A comma-separated list of snapshot names + * master_timeout?: int|string, // Explicit operation timeout for connection to master node + * wait_for_completion?: bool, // Should this request wait until the operation has completed before returning + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. * } $params * * @throws MissingParameterException if a required parameter is missing @@ -217,10 +221,11 @@ public function createRepository(array $params = []) * * @return Elasticsearch|Promise */ - public function delete(array $params = []) + public function delete(?array $params = null) { + $params = $params ?? []; $this->checkRequiredParameters(['repository','snapshot'], $params); - $url = '/_snapshot/' . $this->encode($params['repository']) . '/' . $this->encode($params['snapshot']); + $url = '/_snapshot/' . $this->encode($params['repository']) . '/' . $this->encode($this->convertValue($params['snapshot'])); $method = 'DELETE'; $url = $this->addQueryString($url, $params, ['master_timeout','wait_for_completion','pretty','human','error_trace','source','filter_path']); @@ -239,14 +244,14 @@ public function delete(array $params = []) * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/modules-snapshots.html * * @param array{ - * repository: list, // (REQUIRED) Name of the snapshot repository to unregister. Wildcard (`*`) patterns are supported. - * master_timeout: time, // Explicit operation timeout for connection to master node - * timeout: time, // Explicit operation timeout - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. + * repository: string|array, // (REQUIRED) Name of the snapshot repository to unregister. Wildcard (`*`) patterns are supported. + * master_timeout?: int|string, // Explicit operation timeout for connection to master node + * timeout?: int|string, // Explicit operation timeout + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. * } $params * * @throws MissingParameterException if a required parameter is missing @@ -256,10 +261,11 @@ public function delete(array $params = []) * * @return Elasticsearch|Promise */ - public function deleteRepository(array $params = []) + public function deleteRepository(?array $params = null) { + $params = $params ?? []; $this->checkRequiredParameters(['repository'], $params); - $url = '/_snapshot/' . $this->encode($params['repository']); + $url = '/_snapshot/' . $this->encode($this->convertValue($params['repository'])); $method = 'DELETE'; $url = $this->addQueryString($url, $params, ['master_timeout','timeout','pretty','human','error_trace','source','filter_path']); @@ -279,25 +285,25 @@ public function deleteRepository(array $params = []) * * @param array{ * repository: string, // (REQUIRED) A repository name - * snapshot: list, // (REQUIRED) A comma-separated list of snapshot names - * master_timeout: time, // Explicit operation timeout for connection to master node - * ignore_unavailable: boolean, // Whether to ignore unavailable snapshots, defaults to false which means a SnapshotMissingException is thrown - * index_names: boolean, // Whether to include the name of each index in the snapshot. Defaults to true. - * index_details: boolean, // Whether to include details of each index in the snapshot, if those details are available. Defaults to false. - * include_repository: boolean, // Whether to include the repository name in the snapshot info. Defaults to true. - * sort: enum, // Allows setting a sort order for the result. Defaults to start_time - * size: integer, // Maximum number of snapshots to return. Defaults to 0 which means return all that match without limit. - * order: enum, // Sort order - * from_sort_value: string, // Value of the current sort column at which to start retrieval. - * after: string, // Offset identifier to start pagination from as returned by the 'next' field in the response body. - * offset: integer, // Numeric offset to start pagination based on the snapshots matching the request. Defaults to 0 - * slm_policy_filter: string, // Filter snapshots by a comma-separated list of SLM policy names that snapshots belong to. Accepts wildcards. Use the special pattern '_none' to match snapshots without an SLM policy - * verbose: boolean, // Whether to show verbose snapshot info or only show the basic info found in the repository index blob - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. + * snapshot: string|array, // (REQUIRED) A comma-separated list of snapshot names + * master_timeout?: int|string, // Explicit operation timeout for connection to master node + * ignore_unavailable?: bool, // Whether to ignore unavailable snapshots, defaults to false which means a SnapshotMissingException is thrown + * index_names?: bool, // Whether to include the name of each index in the snapshot. Defaults to true. + * index_details?: bool, // Whether to include details of each index in the snapshot, if those details are available. Defaults to false. + * include_repository?: bool, // Whether to include the repository name in the snapshot info. Defaults to true. + * sort?: string, // Allows setting a sort order for the result. Defaults to start_time + * size?: int, // Maximum number of snapshots to return. Defaults to 0 which means return all that match without limit. + * order?: string, // Sort order + * from_sort_value?: string, // Value of the current sort column at which to start retrieval. + * after?: string, // Offset identifier to start pagination from as returned by the 'next' field in the response body. + * offset?: int, // Numeric offset to start pagination based on the snapshots matching the request. Defaults to 0 + * slm_policy_filter?: string, // Filter snapshots by a comma-separated list of SLM policy names that snapshots belong to. Accepts wildcards. Use the special pattern '_none' to match snapshots without an SLM policy + * verbose?: bool, // Whether to show verbose snapshot info or only show the basic info found in the repository index blob + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. * } $params * * @throws MissingParameterException if a required parameter is missing @@ -307,10 +313,11 @@ public function deleteRepository(array $params = []) * * @return Elasticsearch|Promise */ - public function get(array $params = []) + public function get(?array $params = null) { + $params = $params ?? []; $this->checkRequiredParameters(['repository','snapshot'], $params); - $url = '/_snapshot/' . $this->encode($params['repository']) . '/' . $this->encode($params['snapshot']); + $url = '/_snapshot/' . $this->encode($params['repository']) . '/' . $this->encode($this->convertValue($params['snapshot'])); $method = 'GET'; $url = $this->addQueryString($url, $params, ['master_timeout','ignore_unavailable','index_names','index_details','include_repository','sort','size','order','from_sort_value','after','offset','slm_policy_filter','verbose','pretty','human','error_trace','source','filter_path']); @@ -329,14 +336,14 @@ public function get(array $params = []) * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/modules-snapshots.html * * @param array{ - * repository: list, // A comma-separated list of repository names - * master_timeout: time, // Explicit operation timeout for connection to master node - * local: boolean, // Return local information, do not retrieve the state from master node (default: false) - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. + * repository?: string|array, // A comma-separated list of repository names + * master_timeout?: int|string, // Explicit operation timeout for connection to master node + * local?: bool, // Return local information, do not retrieve the state from master node (default: false) + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. * } $params * * @throws NoNodeAvailableException if all the hosts are offline @@ -345,10 +352,11 @@ public function get(array $params = []) * * @return Elasticsearch|Promise */ - public function getRepository(array $params = []) + public function getRepository(?array $params = null) { + $params = $params ?? []; if (isset($params['repository'])) { - $url = '/_snapshot/' . $this->encode($params['repository']); + $url = '/_snapshot/' . $this->encode($this->convertValue($params['repository'])); $method = 'GET'; } else { $url = '/_snapshot'; @@ -371,22 +379,22 @@ public function getRepository(array $params = []) * * @param array{ * repository: string, // (REQUIRED) A repository name - * blob_count: number, // Number of blobs to create during the test. Defaults to 100. - * concurrency: number, // Number of operations to run concurrently during the test. Defaults to 10. - * read_node_count: number, // Number of nodes on which to read a blob after writing. Defaults to 10. - * early_read_node_count: number, // Number of nodes on which to perform an early read on a blob, i.e. before writing has completed. Early reads are rare actions so the 'rare_action_probability' parameter is also relevant. Defaults to 2. - * seed: number, // Seed for the random number generator used to create the test workload. Defaults to a random value. - * rare_action_probability: number, // Probability of taking a rare action such as an early read or an overwrite. Defaults to 0.02. - * max_blob_size: string, // Maximum size of a blob to create during the test, e.g '1gb' or '100mb'. Defaults to '10mb'. - * max_total_data_size: string, // Maximum total size of all blobs to create during the test, e.g '1tb' or '100gb'. Defaults to '1gb'. - * timeout: time, // Explicit operation timeout. Defaults to '30s'. - * detailed: boolean, // Whether to return detailed results or a summary. Defaults to 'false' so that only the summary is returned. - * rarely_abort_writes: boolean, // Whether to rarely abort writes before they complete. Defaults to 'true'. - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. + * blob_count?: int, // Number of blobs to create during the test. Defaults to 100. + * concurrency?: int, // Number of operations to run concurrently during the test. Defaults to 10. + * read_node_count?: int, // Number of nodes on which to read a blob after writing. Defaults to 10. + * early_read_node_count?: int, // Number of nodes on which to perform an early read on a blob, i.e. before writing has completed. Early reads are rare actions so the 'rare_action_probability' parameter is also relevant. Defaults to 2. + * seed?: int, // Seed for the random number generator used to create the test workload. Defaults to a random value. + * rare_action_probability?: int, // Probability of taking a rare action such as an early read or an overwrite. Defaults to 0.02. + * max_blob_size?: string, // Maximum size of a blob to create during the test, e.g '1gb' or '100mb'. Defaults to '10mb'. + * max_total_data_size?: string, // Maximum total size of all blobs to create during the test, e.g '1tb' or '100gb'. Defaults to '1gb'. + * timeout?: int|string, // Explicit operation timeout. Defaults to '30s'. + * detailed?: bool, // Whether to return detailed results or a summary. Defaults to 'false' so that only the summary is returned. + * rarely_abort_writes?: bool, // Whether to rarely abort writes before they complete. Defaults to 'true'. + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. * } $params * * @throws MissingParameterException if a required parameter is missing @@ -396,8 +404,9 @@ public function getRepository(array $params = []) * * @return Elasticsearch|Promise */ - public function repositoryAnalyze(array $params = []) + public function repositoryAnalyze(?array $params = null) { + $params = $params ?? []; $this->checkRequiredParameters(['repository'], $params); $url = '/_snapshot/' . $this->encode($params['repository']) . '/_analyze'; $method = 'POST'; @@ -420,14 +429,14 @@ public function repositoryAnalyze(array $params = []) * @param array{ * repository: string, // (REQUIRED) A repository name * snapshot: string, // (REQUIRED) A snapshot name - * master_timeout: time, // Explicit operation timeout for connection to master node - * wait_for_completion: boolean, // Should this request wait until the operation has completed before returning - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. - * body: array, // Details of what to restore + * master_timeout?: int|string, // Explicit operation timeout for connection to master node + * wait_for_completion?: bool, // Should this request wait until the operation has completed before returning + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. + * body?: string|array, // Details of what to restore. If body is a string must be a valid JSON. * } $params * * @throws MissingParameterException if a required parameter is missing @@ -437,8 +446,9 @@ public function repositoryAnalyze(array $params = []) * * @return Elasticsearch|Promise */ - public function restore(array $params = []) + public function restore(?array $params = null) { + $params = $params ?? []; $this->checkRequiredParameters(['repository','snapshot'], $params); $url = '/_snapshot/' . $this->encode($params['repository']) . '/' . $this->encode($params['snapshot']) . '/_restore'; $method = 'POST'; @@ -460,15 +470,15 @@ public function restore(array $params = []) * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/modules-snapshots.html * * @param array{ - * repository: string, // A repository name - * snapshot: list, // A comma-separated list of snapshot names - * master_timeout: time, // Explicit operation timeout for connection to master node - * ignore_unavailable: boolean, // Whether to ignore unavailable snapshots, defaults to false which means a SnapshotMissingException is thrown - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. + * repository?: string, // A repository name + * snapshot?: string|array, // A comma-separated list of snapshot names + * master_timeout?: int|string, // Explicit operation timeout for connection to master node + * ignore_unavailable?: bool, // Whether to ignore unavailable snapshots, defaults to false which means a SnapshotMissingException is thrown + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. * } $params * * @throws NoNodeAvailableException if all the hosts are offline @@ -477,10 +487,11 @@ public function restore(array $params = []) * * @return Elasticsearch|Promise */ - public function status(array $params = []) + public function status(?array $params = null) { + $params = $params ?? []; if (isset($params['repository']) && isset($params['snapshot'])) { - $url = '/_snapshot/' . $this->encode($params['repository']) . '/' . $this->encode($params['snapshot']) . '/_status'; + $url = '/_snapshot/' . $this->encode($params['repository']) . '/' . $this->encode($this->convertValue($params['snapshot'])) . '/_status'; $method = 'GET'; } elseif (isset($params['repository'])) { $url = '/_snapshot/' . $this->encode($params['repository']) . '/_status'; @@ -506,13 +517,13 @@ public function status(array $params = []) * * @param array{ * repository: string, // (REQUIRED) A repository name - * master_timeout: time, // Explicit operation timeout for connection to master node - * timeout: time, // Explicit operation timeout - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. + * master_timeout?: int|string, // Explicit operation timeout for connection to master node + * timeout?: int|string, // Explicit operation timeout + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. * } $params * * @throws MissingParameterException if a required parameter is missing @@ -522,8 +533,9 @@ public function status(array $params = []) * * @return Elasticsearch|Promise */ - public function verifyRepository(array $params = []) + public function verifyRepository(?array $params = null) { + $params = $params ?? []; $this->checkRequiredParameters(['repository'], $params); $url = '/_snapshot/' . $this->encode($params['repository']) . '/_verify'; $method = 'POST'; diff --git a/src/Endpoints/Sql.php b/src/Endpoints/Sql.php index 1524f3da6..e7bfad528 100644 --- a/src/Endpoints/Sql.php +++ b/src/Endpoints/Sql.php @@ -34,12 +34,12 @@ class Sql extends AbstractEndpoint * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/clear-sql-cursor-api.html * * @param array{ - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. - * body: array, // (REQUIRED) Specify the cursor value in the `cursor` element to clean the cursor. + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. + * body: string|array, // (REQUIRED) Specify the cursor value in the `cursor` element to clean the cursor.. If body is a string must be a valid JSON. * } $params * * @throws NoNodeAvailableException if all the hosts are offline @@ -48,8 +48,9 @@ class Sql extends AbstractEndpoint * * @return Elasticsearch|Promise */ - public function clearCursor(array $params = []) + public function clearCursor(?array $params = null) { + $params = $params ?? []; $this->checkRequiredParameters(['body'], $params); $url = '/_sql/close'; $method = 'POST'; @@ -72,11 +73,11 @@ public function clearCursor(array $params = []) * * @param array{ * id: string, // (REQUIRED) The async search ID - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. * } $params * * @throws MissingParameterException if a required parameter is missing @@ -86,8 +87,9 @@ public function clearCursor(array $params = []) * * @return Elasticsearch|Promise */ - public function deleteAsync(array $params = []) + public function deleteAsync(?array $params = null) { + $params = $params ?? []; $this->checkRequiredParameters(['id'], $params); $url = '/_sql/async/delete/' . $this->encode($params['id']); $method = 'DELETE'; @@ -109,15 +111,15 @@ public function deleteAsync(array $params = []) * * @param array{ * id: string, // (REQUIRED) The async search ID - * delimiter: string, // Separator for CSV results - * format: string, // Short version of the Accept header, e.g. json, yaml - * keep_alive: time, // Retention period for the search and its results - * wait_for_completion_timeout: time, // Duration to wait for complete results - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. + * delimiter?: string, // Separator for CSV results + * format?: string, // Short version of the Accept header, e.g. json, yaml + * keep_alive?: int|string, // Retention period for the search and its results + * wait_for_completion_timeout?: int|string, // Duration to wait for complete results + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. * } $params * * @throws MissingParameterException if a required parameter is missing @@ -127,8 +129,9 @@ public function deleteAsync(array $params = []) * * @return Elasticsearch|Promise */ - public function getAsync(array $params = []) + public function getAsync(?array $params = null) { + $params = $params ?? []; $this->checkRequiredParameters(['id'], $params); $url = '/_sql/async/' . $this->encode($params['id']); $method = 'GET'; @@ -150,11 +153,11 @@ public function getAsync(array $params = []) * * @param array{ * id: string, // (REQUIRED) The async search ID - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. * } $params * * @throws MissingParameterException if a required parameter is missing @@ -164,8 +167,9 @@ public function getAsync(array $params = []) * * @return Elasticsearch|Promise */ - public function getAsyncStatus(array $params = []) + public function getAsyncStatus(?array $params = null) { + $params = $params ?? []; $this->checkRequiredParameters(['id'], $params); $url = '/_sql/async/status/' . $this->encode($params['id']); $method = 'GET'; @@ -186,13 +190,13 @@ public function getAsyncStatus(array $params = []) * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/sql-search-api.html * * @param array{ - * format: string, // a short version of the Accept header, e.g. json, yaml - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. - * body: array, // (REQUIRED) Use the `query` element to start a query. Use the `cursor` element to continue a query. + * format?: string, // a short version of the Accept header, e.g. json, yaml + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. + * body: string|array, // (REQUIRED) Use the `query` element to start a query. Use the `cursor` element to continue a query.. If body is a string must be a valid JSON. * } $params * * @throws NoNodeAvailableException if all the hosts are offline @@ -201,8 +205,9 @@ public function getAsyncStatus(array $params = []) * * @return Elasticsearch|Promise */ - public function query(array $params = []) + public function query(?array $params = null) { + $params = $params ?? []; $this->checkRequiredParameters(['body'], $params); $url = '/_sql'; $method = empty($params['body']) ? 'GET' : 'POST'; @@ -224,12 +229,12 @@ public function query(array $params = []) * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/sql-translate-api.html * * @param array{ - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. - * body: array, // (REQUIRED) Specify the query in the `query` element. + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. + * body: string|array, // (REQUIRED) Specify the query in the `query` element.. If body is a string must be a valid JSON. * } $params * * @throws NoNodeAvailableException if all the hosts are offline @@ -238,8 +243,9 @@ public function query(array $params = []) * * @return Elasticsearch|Promise */ - public function translate(array $params = []) + public function translate(?array $params = null) { + $params = $params ?? []; $this->checkRequiredParameters(['body'], $params); $url = '/_sql/translate'; $method = empty($params['body']) ? 'GET' : 'POST'; diff --git a/src/Endpoints/Ssl.php b/src/Endpoints/Ssl.php index 81ca3786e..01ebcdcdc 100644 --- a/src/Endpoints/Ssl.php +++ b/src/Endpoints/Ssl.php @@ -34,11 +34,11 @@ class Ssl extends AbstractEndpoint * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-ssl.html * * @param array{ - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. * } $params * * @throws NoNodeAvailableException if all the hosts are offline @@ -47,8 +47,9 @@ class Ssl extends AbstractEndpoint * * @return Elasticsearch|Promise */ - public function certificates(array $params = []) + public function certificates(?array $params = null) { + $params = $params ?? []; $url = '/_ssl/certificates'; $method = 'GET'; diff --git a/src/Endpoints/Synonyms.php b/src/Endpoints/Synonyms.php index 8f79597e7..992b48c9c 100644 --- a/src/Endpoints/Synonyms.php +++ b/src/Endpoints/Synonyms.php @@ -35,11 +35,11 @@ class Synonyms extends AbstractEndpoint * * @param array{ * id: string, // (REQUIRED) The id of the synonyms set to be deleted - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. * } $params * * @throws MissingParameterException if a required parameter is missing @@ -49,8 +49,9 @@ class Synonyms extends AbstractEndpoint * * @return Elasticsearch|Promise */ - public function deleteSynonym(array $params = []) + public function deleteSynonym(?array $params = null) { + $params = $params ?? []; $this->checkRequiredParameters(['id'], $params); $url = '/_synonyms/' . $this->encode($params['id']); $method = 'DELETE'; @@ -73,11 +74,11 @@ public function deleteSynonym(array $params = []) * @param array{ * set_id: string, // (REQUIRED) The id of the synonym set to be updated * rule_id: string, // (REQUIRED) The id of the synonym rule to be deleted - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. * } $params * * @throws MissingParameterException if a required parameter is missing @@ -87,8 +88,9 @@ public function deleteSynonym(array $params = []) * * @return Elasticsearch|Promise */ - public function deleteSynonymRule(array $params = []) + public function deleteSynonymRule(?array $params = null) { + $params = $params ?? []; $this->checkRequiredParameters(['set_id','rule_id'], $params); $url = '/_synonyms/' . $this->encode($params['set_id']) . '/' . $this->encode($params['rule_id']); $method = 'DELETE'; @@ -111,13 +113,13 @@ public function deleteSynonymRule(array $params = []) * * @param array{ * id: string, // (REQUIRED) The name of the synonyms set to be retrieved - * from: int, // Starting offset - * size: int, // specifies a max number of results to get - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. + * from?: int, // Starting offset + * size?: int, // specifies a max number of results to get + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. * } $params * * @throws MissingParameterException if a required parameter is missing @@ -127,8 +129,9 @@ public function deleteSynonymRule(array $params = []) * * @return Elasticsearch|Promise */ - public function getSynonym(array $params = []) + public function getSynonym(?array $params = null) { + $params = $params ?? []; $this->checkRequiredParameters(['id'], $params); $url = '/_synonyms/' . $this->encode($params['id']); $method = 'GET'; @@ -151,11 +154,11 @@ public function getSynonym(array $params = []) * @param array{ * set_id: string, // (REQUIRED) The id of the synonym set to retrieve the synonym rule from * rule_id: string, // (REQUIRED) The id of the synonym rule to retrieve - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. * } $params * * @throws MissingParameterException if a required parameter is missing @@ -165,8 +168,9 @@ public function getSynonym(array $params = []) * * @return Elasticsearch|Promise */ - public function getSynonymRule(array $params = []) + public function getSynonymRule(?array $params = null) { + $params = $params ?? []; $this->checkRequiredParameters(['set_id','rule_id'], $params); $url = '/_synonyms/' . $this->encode($params['set_id']) . '/' . $this->encode($params['rule_id']); $method = 'GET'; @@ -188,13 +192,13 @@ public function getSynonymRule(array $params = []) * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/list-synonyms-sets.html * * @param array{ - * from: int, // Starting offset - * size: int, // specifies a max number of results to get - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. + * from?: int, // Starting offset + * size?: int, // specifies a max number of results to get + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. * } $params * * @throws NoNodeAvailableException if all the hosts are offline @@ -203,8 +207,9 @@ public function getSynonymRule(array $params = []) * * @return Elasticsearch|Promise */ - public function getSynonymsSets(array $params = []) + public function getSynonymsSets(?array $params = null) { + $params = $params ?? []; $url = '/_synonyms'; $method = 'GET'; @@ -225,12 +230,12 @@ public function getSynonymsSets(array $params = []) * * @param array{ * id: string, // (REQUIRED) The id of the synonyms set to be created or updated - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. - * body: array, // (REQUIRED) Synonyms set rules + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. + * body: string|array, // (REQUIRED) Synonyms set rules. If body is a string must be a valid JSON. * } $params * * @throws MissingParameterException if a required parameter is missing @@ -240,8 +245,9 @@ public function getSynonymsSets(array $params = []) * * @return Elasticsearch|Promise */ - public function putSynonym(array $params = []) + public function putSynonym(?array $params = null) { + $params = $params ?? []; $this->checkRequiredParameters(['id','body'], $params); $url = '/_synonyms/' . $this->encode($params['id']); $method = 'PUT'; @@ -265,12 +271,12 @@ public function putSynonym(array $params = []) * @param array{ * set_id: string, // (REQUIRED) The id of the synonym set to be updated with the synonym rule * rule_id: string, // (REQUIRED) The id of the synonym rule to be updated or created - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. - * body: array, // (REQUIRED) Synonym rule + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. + * body: string|array, // (REQUIRED) Synonym rule. If body is a string must be a valid JSON. * } $params * * @throws MissingParameterException if a required parameter is missing @@ -280,8 +286,9 @@ public function putSynonym(array $params = []) * * @return Elasticsearch|Promise */ - public function putSynonymRule(array $params = []) + public function putSynonymRule(?array $params = null) { + $params = $params ?? []; $this->checkRequiredParameters(['set_id','rule_id','body'], $params); $url = '/_synonyms/' . $this->encode($params['set_id']) . '/' . $this->encode($params['rule_id']); $method = 'PUT'; diff --git a/src/Endpoints/Tasks.php b/src/Endpoints/Tasks.php index a305f5c54..5952ae53a 100644 --- a/src/Endpoints/Tasks.php +++ b/src/Endpoints/Tasks.php @@ -35,16 +35,16 @@ class Tasks extends AbstractEndpoint * @internal This API is EXPERIMENTAL and may be changed or removed completely in a future release * * @param array{ - * task_id: string, // Cancel the task with specified task id (node_id:task_number) - * nodes: list, // 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 - * actions: list, // A comma-separated list of actions that should be cancelled. Leave empty to cancel all. - * parent_task_id: string, // Cancel tasks with specified parent task id (node_id:task_number). Set to -1 to cancel all. - * wait_for_completion: boolean, // Should the request block until the cancellation of the task and its descendant tasks is completed. Defaults to false - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. + * task_id?: string, // Cancel the task with specified task id (node_id:task_number) + * nodes?: string|array, // 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 + * actions?: string|array, // A comma-separated list of actions that should be cancelled. Leave empty to cancel all. + * parent_task_id?: string, // Cancel tasks with specified parent task id (node_id:task_number). Set to -1 to cancel all. + * wait_for_completion?: bool, // Should the request block until the cancellation of the task and its descendant tasks is completed. Defaults to false + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. * } $params * * @throws NoNodeAvailableException if all the hosts are offline @@ -53,8 +53,9 @@ class Tasks extends AbstractEndpoint * * @return Elasticsearch|Promise */ - public function cancel(array $params = []) + public function cancel(?array $params = null) { + $params = $params ?? []; if (isset($params['task_id'])) { $url = '/_tasks/' . $this->encode($params['task_id']) . '/_cancel'; $method = 'POST'; @@ -80,13 +81,13 @@ public function cancel(array $params = []) * * @param array{ * task_id: string, // (REQUIRED) Return the task with specified id (node_id:task_number) - * wait_for_completion: boolean, // Wait for the matching tasks to complete (default: false) - * timeout: time, // Explicit operation timeout - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. + * wait_for_completion?: bool, // Wait for the matching tasks to complete (default: false) + * timeout?: int|string, // Explicit operation timeout + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. * } $params * * @throws MissingParameterException if a required parameter is missing @@ -96,8 +97,9 @@ public function cancel(array $params = []) * * @return Elasticsearch|Promise */ - public function get(array $params = []) + public function get(?array $params = null) { + $params = $params ?? []; $this->checkRequiredParameters(['task_id'], $params); $url = '/_tasks/' . $this->encode($params['task_id']); $method = 'GET'; @@ -119,18 +121,18 @@ public function get(array $params = []) * @internal This API is EXPERIMENTAL and may be changed or removed completely in a future release * * @param array{ - * nodes: list, // 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 - * actions: list, // A comma-separated list of actions that should be returned. Leave empty to return all. - * detailed: boolean, // Return detailed task information (default: false) - * parent_task_id: string, // Return tasks with specified parent task id (node_id:task_number). Set to -1 to return all. - * wait_for_completion: boolean, // Wait for the matching tasks to complete (default: false) - * group_by: enum, // Group tasks by nodes or parent/child relationships - * timeout: time, // Explicit operation timeout - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. + * nodes?: string|array, // 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 + * actions?: string|array, // A comma-separated list of actions that should be returned. Leave empty to return all. + * detailed?: bool, // Return detailed task information (default: false) + * parent_task_id?: string, // Return tasks with specified parent task id (node_id:task_number). Set to -1 to return all. + * wait_for_completion?: bool, // Wait for the matching tasks to complete (default: false) + * group_by?: string, // Group tasks by nodes or parent/child relationships + * timeout?: int|string, // Explicit operation timeout + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. * } $params * * @throws NoNodeAvailableException if all the hosts are offline @@ -139,8 +141,9 @@ public function get(array $params = []) * * @return Elasticsearch|Promise */ - public function list(array $params = []) + public function list(?array $params = null) { + $params = $params ?? []; $url = '/_tasks'; $method = 'GET'; diff --git a/src/Endpoints/TextStructure.php b/src/Endpoints/TextStructure.php index a9e121ecd..079b61171 100644 --- a/src/Endpoints/TextStructure.php +++ b/src/Endpoints/TextStructure.php @@ -34,25 +34,25 @@ class TextStructure extends AbstractEndpoint * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/find-field-structure.html * * @param array{ - * index: string, // The index containing the analyzed field - * field: string, // The field that should be analyzed - * documents_to_sample: int, // How many documents should be included in the analysis - * timeout: time, // Timeout after which the analysis will be aborted - * format: enum, // Optional parameter to specify the high level file format - * column_names: list, // Optional parameter containing a comma separated list of the column names for a delimited file - * delimiter: string, // Optional parameter to specify the delimiter character for a delimited file - must be a single character - * quote: string, // Optional parameter to specify the quote character for a delimited file - must be a single character - * should_trim_fields: boolean, // Optional parameter to specify whether the values between delimiters in a delimited file should have whitespace trimmed from them - * grok_pattern: string, // Optional parameter to specify the Grok pattern that should be used to extract fields from messages in a semi-structured text file - * ecs_compatibility: string, // Optional parameter to specify the compatibility mode with ECS Grok patterns - may be either 'v1' or 'disabled' - * timestamp_field: string, // Optional parameter to specify the timestamp field in the file - * timestamp_format: string, // Optional parameter to specify the timestamp format in the file - may be either a Joda or Java time format - * explain: boolean, // Whether to include a commentary on how the structure was derived - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. + * index?: string, // The index containing the analyzed field + * field?: string, // The field that should be analyzed + * documents_to_sample?: int, // How many documents should be included in the analysis + * timeout?: int|string, // Timeout after which the analysis will be aborted + * format?: string, // Optional parameter to specify the high level file format + * column_names?: string|array, // Optional parameter containing a comma separated list of the column names for a delimited file + * delimiter?: string, // Optional parameter to specify the delimiter character for a delimited file - must be a single character + * quote?: string, // Optional parameter to specify the quote character for a delimited file - must be a single character + * should_trim_fields?: bool, // Optional parameter to specify whether the values between delimiters in a delimited file should have whitespace trimmed from them + * grok_pattern?: string, // Optional parameter to specify the Grok pattern that should be used to extract fields from messages in a semi-structured text file + * ecs_compatibility?: string, // Optional parameter to specify the compatibility mode with ECS Grok patterns - may be either 'v1' or 'disabled' + * timestamp_field?: string, // Optional parameter to specify the timestamp field in the file + * timestamp_format?: string, // Optional parameter to specify the timestamp format in the file - may be either a Joda or Java time format + * explain?: bool, // Whether to include a commentary on how the structure was derived + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. * } $params * * @throws NoNodeAvailableException if all the hosts are offline @@ -61,8 +61,9 @@ class TextStructure extends AbstractEndpoint * * @return Elasticsearch|Promise */ - public function findFieldStructure(array $params = []) + public function findFieldStructure(?array $params = null) { + $params = $params ?? []; $this->checkRequiredParameters(['index','field'], $params); $url = '/_text_structure/find_field_structure'; $method = 'GET'; @@ -83,23 +84,23 @@ public function findFieldStructure(array $params = []) * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/find-message-structure.html * * @param array{ - * timeout: time, // Timeout after which the analysis will be aborted - * format: enum, // Optional parameter to specify the high level file format - * column_names: list, // Optional parameter containing a comma separated list of the column names for a delimited file - * delimiter: string, // Optional parameter to specify the delimiter character for a delimited file - must be a single character - * quote: string, // Optional parameter to specify the quote character for a delimited file - must be a single character - * should_trim_fields: boolean, // Optional parameter to specify whether the values between delimiters in a delimited file should have whitespace trimmed from them - * grok_pattern: string, // Optional parameter to specify the Grok pattern that should be used to extract fields from messages in a semi-structured text file - * ecs_compatibility: string, // Optional parameter to specify the compatibility mode with ECS Grok patterns - may be either 'v1' or 'disabled' - * timestamp_field: string, // Optional parameter to specify the timestamp field in the file - * timestamp_format: string, // Optional parameter to specify the timestamp format in the file - may be either a Joda or Java time format - * explain: boolean, // Whether to include a commentary on how the structure was derived - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. - * body: array, // (REQUIRED) JSON object with one field [messages], containing an array of messages to be analyzed + * timeout?: int|string, // Timeout after which the analysis will be aborted + * format?: string, // Optional parameter to specify the high level file format + * column_names?: string|array, // Optional parameter containing a comma separated list of the column names for a delimited file + * delimiter?: string, // Optional parameter to specify the delimiter character for a delimited file - must be a single character + * quote?: string, // Optional parameter to specify the quote character for a delimited file - must be a single character + * should_trim_fields?: bool, // Optional parameter to specify whether the values between delimiters in a delimited file should have whitespace trimmed from them + * grok_pattern?: string, // Optional parameter to specify the Grok pattern that should be used to extract fields from messages in a semi-structured text file + * ecs_compatibility?: string, // Optional parameter to specify the compatibility mode with ECS Grok patterns - may be either 'v1' or 'disabled' + * timestamp_field?: string, // Optional parameter to specify the timestamp field in the file + * timestamp_format?: string, // Optional parameter to specify the timestamp format in the file - may be either a Joda or Java time format + * explain?: bool, // Whether to include a commentary on how the structure was derived + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. + * body: string|array, // (REQUIRED) JSON object with one field [messages], containing an array of messages to be analyzed. If body is a string must be a valid JSON. * } $params * * @throws NoNodeAvailableException if all the hosts are offline @@ -108,8 +109,9 @@ public function findFieldStructure(array $params = []) * * @return Elasticsearch|Promise */ - public function findMessageStructure(array $params = []) + public function findMessageStructure(?array $params = null) { + $params = $params ?? []; $this->checkRequiredParameters(['body'], $params); $url = '/_text_structure/find_message_structure'; $method = empty($params['body']) ? 'GET' : 'POST'; @@ -131,27 +133,27 @@ public function findMessageStructure(array $params = []) * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/find-structure.html * * @param array{ - * lines_to_sample: int, // How many lines of the file should be included in the analysis - * line_merge_size_limit: int, // Maximum number of characters permitted in a single message when lines are merged to create messages. - * timeout: time, // Timeout after which the analysis will be aborted - * charset: string, // Optional parameter to specify the character set of the file - * format: enum, // Optional parameter to specify the high level file format - * has_header_row: boolean, // Optional parameter to specify whether a delimited file includes the column names in its first row - * column_names: list, // Optional parameter containing a comma separated list of the column names for a delimited file - * delimiter: string, // Optional parameter to specify the delimiter character for a delimited file - must be a single character - * quote: string, // Optional parameter to specify the quote character for a delimited file - must be a single character - * should_trim_fields: boolean, // Optional parameter to specify whether the values between delimiters in a delimited file should have whitespace trimmed from them - * grok_pattern: string, // Optional parameter to specify the Grok pattern that should be used to extract fields from messages in a semi-structured text file - * ecs_compatibility: string, // Optional parameter to specify the compatibility mode with ECS Grok patterns - may be either 'v1' or 'disabled' - * timestamp_field: string, // Optional parameter to specify the timestamp field in the file - * timestamp_format: string, // Optional parameter to specify the timestamp format in the file - may be either a Joda or Java time format - * explain: boolean, // Whether to include a commentary on how the structure was derived - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. - * body: array, // (REQUIRED) The contents of the file to be analyzed + * lines_to_sample?: int, // How many lines of the file should be included in the analysis + * line_merge_size_limit?: int, // Maximum number of characters permitted in a single message when lines are merged to create messages. + * timeout?: int|string, // Timeout after which the analysis will be aborted + * charset?: string, // Optional parameter to specify the character set of the file + * format?: string, // Optional parameter to specify the high level file format + * has_header_row?: bool, // Optional parameter to specify whether a delimited file includes the column names in its first row + * column_names?: string|array, // Optional parameter containing a comma separated list of the column names for a delimited file + * delimiter?: string, // Optional parameter to specify the delimiter character for a delimited file - must be a single character + * quote?: string, // Optional parameter to specify the quote character for a delimited file - must be a single character + * should_trim_fields?: bool, // Optional parameter to specify whether the values between delimiters in a delimited file should have whitespace trimmed from them + * grok_pattern?: string, // Optional parameter to specify the Grok pattern that should be used to extract fields from messages in a semi-structured text file + * ecs_compatibility?: string, // Optional parameter to specify the compatibility mode with ECS Grok patterns - may be either 'v1' or 'disabled' + * timestamp_field?: string, // Optional parameter to specify the timestamp field in the file + * timestamp_format?: string, // Optional parameter to specify the timestamp format in the file - may be either a Joda or Java time format + * explain?: bool, // Whether to include a commentary on how the structure was derived + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. + * body: string|array, // (REQUIRED) The contents of the file to be analyzed. If body is a string must be a valid JSON. * } $params * * @throws NoNodeAvailableException if all the hosts are offline @@ -160,8 +162,9 @@ public function findMessageStructure(array $params = []) * * @return Elasticsearch|Promise */ - public function findStructure(array $params = []) + public function findStructure(?array $params = null) { + $params = $params ?? []; $this->checkRequiredParameters(['body'], $params); $url = '/_text_structure/find_structure'; $method = 'POST'; @@ -183,13 +186,13 @@ public function findStructure(array $params = []) * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/test-grok-pattern.html * * @param array{ - * ecs_compatibility: string, // Optional parameter to specify the compatibility mode with ECS Grok patterns - may be either 'v1' or 'disabled' - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. - * body: array, // (REQUIRED) The Grok pattern and text. + * ecs_compatibility?: string, // Optional parameter to specify the compatibility mode with ECS Grok patterns - may be either 'v1' or 'disabled' + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. + * body: string|array, // (REQUIRED) The Grok pattern and text.. If body is a string must be a valid JSON. * } $params * * @throws NoNodeAvailableException if all the hosts are offline @@ -198,8 +201,9 @@ public function findStructure(array $params = []) * * @return Elasticsearch|Promise */ - public function testGrokPattern(array $params = []) + public function testGrokPattern(?array $params = null) { + $params = $params ?? []; $this->checkRequiredParameters(['body'], $params); $url = '/_text_structure/test_grok_pattern'; $method = empty($params['body']) ? 'GET' : 'POST'; diff --git a/src/Endpoints/Transform.php b/src/Endpoints/Transform.php index 653a8c5a7..0c5f9f235 100644 --- a/src/Endpoints/Transform.php +++ b/src/Endpoints/Transform.php @@ -35,14 +35,14 @@ class Transform extends AbstractEndpoint * * @param array{ * transform_id: string, // (REQUIRED) The id of the transform to delete - * force: boolean, // When `true`, the transform is deleted regardless of its current state. The default value is `false`, meaning that the transform must be `stopped` before it can be deleted. - * delete_dest_index: boolean, // When `true`, the destination index is deleted together with the transform. The default value is `false`, meaning that the destination index will not be deleted. - * timeout: time, // Controls the time to wait for the transform deletion - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. + * force?: bool, // When `true`, the transform is deleted regardless of its current state. The default value is `false`, meaning that the transform must be `stopped` before it can be deleted. + * delete_dest_index?: bool, // When `true`, the destination index is deleted together with the transform. The default value is `false`, meaning that the destination index will not be deleted. + * timeout?: int|string, // Controls the time to wait for the transform deletion + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. * } $params * * @throws MissingParameterException if a required parameter is missing @@ -52,8 +52,9 @@ class Transform extends AbstractEndpoint * * @return Elasticsearch|Promise */ - public function deleteTransform(array $params = []) + public function deleteTransform(?array $params = null) { + $params = $params ?? []; $this->checkRequiredParameters(['transform_id'], $params); $url = '/_transform/' . $this->encode($params['transform_id']); $method = 'DELETE'; @@ -74,11 +75,11 @@ public function deleteTransform(array $params = []) * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/get-transform-node-stats.html * * @param array{ - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. * } $params * * @throws NoNodeAvailableException if all the hosts are offline @@ -87,8 +88,9 @@ public function deleteTransform(array $params = []) * * @return Elasticsearch|Promise */ - public function getNodeStats(array $params = []) + public function getNodeStats(?array $params = null) { + $params = $params ?? []; $url = '/_transform/_node_stats'; $method = 'GET'; @@ -108,16 +110,16 @@ public function getNodeStats(array $params = []) * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/get-transform.html * * @param array{ - * transform_id: string, // The id or comma delimited list of id expressions of the transforms to get, '_all' or '*' implies get all transforms - * from: int, // skips a number of transform configs, defaults to 0 - * size: int, // specifies a max number of transforms to get, defaults to 100 - * allow_no_match: boolean, // Whether to ignore if a wildcard expression matches no transforms. (This includes `_all` string or when no transforms have been specified) - * exclude_generated: boolean, // Omits fields that are illegal to set on transform PUT - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. + * transform_id?: string, // The id or comma delimited list of id expressions of the transforms to get, '_all' or '*' implies get all transforms + * from?: int, // skips a number of transform configs, defaults to 0 + * size?: int, // specifies a max number of transforms to get, defaults to 100 + * allow_no_match?: bool, // Whether to ignore if a wildcard expression matches no transforms. (This includes `_all` string or when no transforms have been specified) + * exclude_generated?: bool, // Omits fields that are illegal to set on transform PUT + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. * } $params * * @throws NoNodeAvailableException if all the hosts are offline @@ -126,8 +128,9 @@ public function getNodeStats(array $params = []) * * @return Elasticsearch|Promise */ - public function getTransform(array $params = []) + public function getTransform(?array $params = null) { + $params = $params ?? []; if (isset($params['transform_id'])) { $url = '/_transform/' . $this->encode($params['transform_id']); $method = 'GET'; @@ -152,15 +155,15 @@ public function getTransform(array $params = []) * * @param array{ * transform_id: string, // (REQUIRED) The id of the transform for which to get stats. '_all' or '*' implies all transforms - * from: number, // skips a number of transform stats, defaults to 0 - * size: number, // specifies a max number of transform stats to get, defaults to 100 - * timeout: time, // Controls the time to wait for the stats - * allow_no_match: boolean, // Whether to ignore if a wildcard expression matches no transforms. (This includes `_all` string or when no transforms have been specified) - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. + * from?: int, // skips a number of transform stats, defaults to 0 + * size?: int, // specifies a max number of transform stats to get, defaults to 100 + * timeout?: int|string, // Controls the time to wait for the stats + * allow_no_match?: bool, // Whether to ignore if a wildcard expression matches no transforms. (This includes `_all` string or when no transforms have been specified) + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. * } $params * * @throws MissingParameterException if a required parameter is missing @@ -170,8 +173,9 @@ public function getTransform(array $params = []) * * @return Elasticsearch|Promise */ - public function getTransformStats(array $params = []) + public function getTransformStats(?array $params = null) { + $params = $params ?? []; $this->checkRequiredParameters(['transform_id'], $params); $url = '/_transform/' . $this->encode($params['transform_id']) . '/_stats'; $method = 'GET'; @@ -192,14 +196,14 @@ public function getTransformStats(array $params = []) * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/preview-transform.html * * @param array{ - * transform_id: string, // The id of the transform to preview. - * timeout: time, // Controls the time to wait for the preview - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. - * body: array, // The definition for the transform to preview + * transform_id?: string, // The id of the transform to preview. + * timeout?: int|string, // Controls the time to wait for the preview + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. + * body?: string|array, // The definition for the transform to preview. If body is a string must be a valid JSON. * } $params * * @throws NoNodeAvailableException if all the hosts are offline @@ -208,8 +212,9 @@ public function getTransformStats(array $params = []) * * @return Elasticsearch|Promise */ - public function previewTransform(array $params = []) + public function previewTransform(?array $params = null) { + $params = $params ?? []; if (isset($params['transform_id'])) { $url = '/_transform/' . $this->encode($params['transform_id']) . '/_preview'; $method = empty($params['body']) ? 'GET' : 'POST'; @@ -235,14 +240,14 @@ public function previewTransform(array $params = []) * * @param array{ * transform_id: string, // (REQUIRED) The id of the new transform. - * defer_validation: boolean, // If validations should be deferred until transform starts, defaults to false. - * timeout: time, // Controls the time to wait for the transform to start - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. - * body: array, // (REQUIRED) The transform definition + * defer_validation?: bool, // If validations should be deferred until transform starts, defaults to false. + * timeout?: int|string, // Controls the time to wait for the transform to start + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. + * body: string|array, // (REQUIRED) The transform definition. If body is a string must be a valid JSON. * } $params * * @throws MissingParameterException if a required parameter is missing @@ -252,8 +257,9 @@ public function previewTransform(array $params = []) * * @return Elasticsearch|Promise */ - public function putTransform(array $params = []) + public function putTransform(?array $params = null) { + $params = $params ?? []; $this->checkRequiredParameters(['transform_id','body'], $params); $url = '/_transform/' . $this->encode($params['transform_id']); $method = 'PUT'; @@ -276,13 +282,13 @@ public function putTransform(array $params = []) * * @param array{ * transform_id: string, // (REQUIRED) The id of the transform to reset - * force: boolean, // When `true`, the transform is reset regardless of its current state. The default value is `false`, meaning that the transform must be `stopped` before it can be reset. - * timeout: time, // Controls the time to wait for the transform to reset - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. + * force?: bool, // When `true`, the transform is reset regardless of its current state. The default value is `false`, meaning that the transform must be `stopped` before it can be reset. + * timeout?: int|string, // Controls the time to wait for the transform to reset + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. * } $params * * @throws MissingParameterException if a required parameter is missing @@ -292,8 +298,9 @@ public function putTransform(array $params = []) * * @return Elasticsearch|Promise */ - public function resetTransform(array $params = []) + public function resetTransform(?array $params = null) { + $params = $params ?? []; $this->checkRequiredParameters(['transform_id'], $params); $url = '/_transform/' . $this->encode($params['transform_id']) . '/_reset'; $method = 'POST'; @@ -315,12 +322,12 @@ public function resetTransform(array $params = []) * * @param array{ * transform_id: string, // (REQUIRED) The id of the transform. - * timeout: time, // Controls the time to wait for the scheduling to take place - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. + * timeout?: int|string, // Controls the time to wait for the scheduling to take place + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. * } $params * * @throws MissingParameterException if a required parameter is missing @@ -330,8 +337,9 @@ public function resetTransform(array $params = []) * * @return Elasticsearch|Promise */ - public function scheduleNowTransform(array $params = []) + public function scheduleNowTransform(?array $params = null) { + $params = $params ?? []; $this->checkRequiredParameters(['transform_id'], $params); $url = '/_transform/' . $this->encode($params['transform_id']) . '/_schedule_now'; $method = 'POST'; @@ -354,13 +362,13 @@ public function scheduleNowTransform(array $params = []) * * @param array{ * transform_id: string, // (REQUIRED) The id of the transform to start - * from: string, // Restricts the set of transformed entities to those changed after this time - * timeout: time, // Controls the time to wait for the transform to start - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. + * from?: string, // Restricts the set of transformed entities to those changed after this time + * timeout?: int|string, // Controls the time to wait for the transform to start + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. * } $params * * @throws MissingParameterException if a required parameter is missing @@ -370,8 +378,9 @@ public function scheduleNowTransform(array $params = []) * * @return Elasticsearch|Promise */ - public function startTransform(array $params = []) + public function startTransform(?array $params = null) { + $params = $params ?? []; $this->checkRequiredParameters(['transform_id'], $params); $url = '/_transform/' . $this->encode($params['transform_id']) . '/_start'; $method = 'POST'; @@ -393,16 +402,16 @@ public function startTransform(array $params = []) * * @param array{ * transform_id: string, // (REQUIRED) The id of the transform to stop - * force: boolean, // Whether to force stop a failed transform or not. Default to false - * wait_for_completion: boolean, // Whether to wait for the transform to fully stop before returning or not. Default to false - * timeout: time, // Controls the time to wait until the transform has stopped. Default to 30 seconds - * allow_no_match: boolean, // Whether to ignore if a wildcard expression matches no transforms. (This includes `_all` string or when no transforms have been specified) - * wait_for_checkpoint: boolean, // Whether to wait for the transform to reach a checkpoint before stopping. Default to false - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. + * force?: bool, // Whether to force stop a failed transform or not. Default to false + * wait_for_completion?: bool, // Whether to wait for the transform to fully stop before returning or not. Default to false + * timeout?: int|string, // Controls the time to wait until the transform has stopped. Default to 30 seconds + * allow_no_match?: bool, // Whether to ignore if a wildcard expression matches no transforms. (This includes `_all` string or when no transforms have been specified) + * wait_for_checkpoint?: bool, // Whether to wait for the transform to reach a checkpoint before stopping. Default to false + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. * } $params * * @throws MissingParameterException if a required parameter is missing @@ -412,8 +421,9 @@ public function startTransform(array $params = []) * * @return Elasticsearch|Promise */ - public function stopTransform(array $params = []) + public function stopTransform(?array $params = null) { + $params = $params ?? []; $this->checkRequiredParameters(['transform_id'], $params); $url = '/_transform/' . $this->encode($params['transform_id']) . '/_stop'; $method = 'POST'; @@ -435,14 +445,14 @@ public function stopTransform(array $params = []) * * @param array{ * transform_id: string, // (REQUIRED) The id of the transform. - * defer_validation: boolean, // If validations should be deferred until transform starts, defaults to false. - * timeout: time, // Controls the time to wait for the update - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. - * body: array, // (REQUIRED) The update transform definition + * defer_validation?: bool, // If validations should be deferred until transform starts, defaults to false. + * timeout?: int|string, // Controls the time to wait for the update + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. + * body: string|array, // (REQUIRED) The update transform definition. If body is a string must be a valid JSON. * } $params * * @throws MissingParameterException if a required parameter is missing @@ -452,8 +462,9 @@ public function stopTransform(array $params = []) * * @return Elasticsearch|Promise */ - public function updateTransform(array $params = []) + public function updateTransform(?array $params = null) { + $params = $params ?? []; $this->checkRequiredParameters(['transform_id','body'], $params); $url = '/_transform/' . $this->encode($params['transform_id']) . '/_update'; $method = 'POST'; @@ -475,13 +486,13 @@ public function updateTransform(array $params = []) * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/upgrade-transforms.html * * @param array{ - * dry_run: boolean, // Whether to only check for updates but don't execute - * timeout: time, // Controls the time to wait for the upgrade - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. + * dry_run?: bool, // Whether to only check for updates but don't execute + * timeout?: int|string, // Controls the time to wait for the upgrade + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. * } $params * * @throws NoNodeAvailableException if all the hosts are offline @@ -490,8 +501,9 @@ public function updateTransform(array $params = []) * * @return Elasticsearch|Promise */ - public function upgradeTransforms(array $params = []) + public function upgradeTransforms(?array $params = null) { + $params = $params ?? []; $url = '/_transform/_upgrade'; $method = 'POST'; diff --git a/src/Endpoints/Watcher.php b/src/Endpoints/Watcher.php index 872179a64..9ff0b0a28 100644 --- a/src/Endpoints/Watcher.php +++ b/src/Endpoints/Watcher.php @@ -35,12 +35,12 @@ class Watcher extends AbstractEndpoint * * @param array{ * watch_id: string, // (REQUIRED) Watch ID - * action_id: list, // A comma-separated list of the action ids to be acked - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. + * action_id?: string|array, // A comma-separated list of the action ids to be acked + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. * } $params * * @throws MissingParameterException if a required parameter is missing @@ -50,11 +50,12 @@ class Watcher extends AbstractEndpoint * * @return Elasticsearch|Promise */ - public function ackWatch(array $params = []) + public function ackWatch(?array $params = null) { + $params = $params ?? []; $this->checkRequiredParameters(['watch_id'], $params); if (isset($params['action_id'])) { - $url = '/_watcher/watch/' . $this->encode($params['watch_id']) . '/_ack/' . $this->encode($params['action_id']); + $url = '/_watcher/watch/' . $this->encode($params['watch_id']) . '/_ack/' . $this->encode($this->convertValue($params['action_id'])); $method = 'PUT'; } else { $url = '/_watcher/watch/' . $this->encode($params['watch_id']) . '/_ack'; @@ -77,11 +78,11 @@ public function ackWatch(array $params = []) * * @param array{ * watch_id: string, // (REQUIRED) Watch ID - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. * } $params * * @throws MissingParameterException if a required parameter is missing @@ -91,8 +92,9 @@ public function ackWatch(array $params = []) * * @return Elasticsearch|Promise */ - public function activateWatch(array $params = []) + public function activateWatch(?array $params = null) { + $params = $params ?? []; $this->checkRequiredParameters(['watch_id'], $params); $url = '/_watcher/watch/' . $this->encode($params['watch_id']) . '/_activate'; $method = 'PUT'; @@ -114,11 +116,11 @@ public function activateWatch(array $params = []) * * @param array{ * watch_id: string, // (REQUIRED) Watch ID - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. * } $params * * @throws MissingParameterException if a required parameter is missing @@ -128,8 +130,9 @@ public function activateWatch(array $params = []) * * @return Elasticsearch|Promise */ - public function deactivateWatch(array $params = []) + public function deactivateWatch(?array $params = null) { + $params = $params ?? []; $this->checkRequiredParameters(['watch_id'], $params); $url = '/_watcher/watch/' . $this->encode($params['watch_id']) . '/_deactivate'; $method = 'PUT'; @@ -151,11 +154,11 @@ public function deactivateWatch(array $params = []) * * @param array{ * id: string, // (REQUIRED) Watch ID - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. * } $params * * @throws MissingParameterException if a required parameter is missing @@ -165,8 +168,9 @@ public function deactivateWatch(array $params = []) * * @return Elasticsearch|Promise */ - public function deleteWatch(array $params = []) + public function deleteWatch(?array $params = null) { + $params = $params ?? []; $this->checkRequiredParameters(['id'], $params); $url = '/_watcher/watch/' . $this->encode($params['id']); $method = 'DELETE'; @@ -187,14 +191,14 @@ public function deleteWatch(array $params = []) * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/watcher-api-execute-watch.html * * @param array{ - * id: string, // Watch ID - * debug: boolean, // indicates whether the watch should execute in debug mode - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. - * body: array, // Execution control + * id?: string, // Watch ID + * debug?: bool, // indicates whether the watch should execute in debug mode + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. + * body?: string|array, // Execution control. If body is a string must be a valid JSON. * } $params * * @throws NoNodeAvailableException if all the hosts are offline @@ -203,8 +207,9 @@ public function deleteWatch(array $params = []) * * @return Elasticsearch|Promise */ - public function executeWatch(array $params = []) + public function executeWatch(?array $params = null) { + $params = $params ?? []; if (isset($params['id'])) { $url = '/_watcher/watch/' . $this->encode($params['id']) . '/_execute'; $method = 'PUT'; @@ -229,12 +234,12 @@ public function executeWatch(array $params = []) * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/watcher-api-get-settings.html * * @param array{ - * master_timeout: time, // Specify timeout for connection to master - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. + * master_timeout?: int|string, // Specify timeout for connection to master + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. * } $params * * @throws NoNodeAvailableException if all the hosts are offline @@ -243,8 +248,9 @@ public function executeWatch(array $params = []) * * @return Elasticsearch|Promise */ - public function getSettings(array $params = []) + public function getSettings(?array $params = null) { + $params = $params ?? []; $url = '/_watcher/settings'; $method = 'GET'; @@ -266,11 +272,11 @@ public function getSettings(array $params = []) * * @param array{ * id: string, // (REQUIRED) Watch ID - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. * } $params * * @throws MissingParameterException if a required parameter is missing @@ -280,8 +286,9 @@ public function getSettings(array $params = []) * * @return Elasticsearch|Promise */ - public function getWatch(array $params = []) + public function getWatch(?array $params = null) { + $params = $params ?? []; $this->checkRequiredParameters(['id'], $params); $url = '/_watcher/watch/' . $this->encode($params['id']); $method = 'GET'; @@ -303,16 +310,16 @@ public function getWatch(array $params = []) * * @param array{ * id: string, // (REQUIRED) Watch ID - * active: boolean, // Specify whether the watch is in/active by default - * version: number, // Explicit version number for concurrency control - * if_seq_no: number, // only update the watch if the last operation that has changed the watch has the specified sequence number - * if_primary_term: number, // only update the watch if the last operation that has changed the watch has the specified primary term - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. - * body: array, // The watch + * active?: bool, // Specify whether the watch is in/active by default + * version?: int, // Explicit version number for concurrency control + * if_seq_no?: int, // only update the watch if the last operation that has changed the watch has the specified sequence number + * if_primary_term?: int, // only update the watch if the last operation that has changed the watch has the specified primary term + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. + * body?: string|array, // The watch. If body is a string must be a valid JSON. * } $params * * @throws MissingParameterException if a required parameter is missing @@ -322,8 +329,9 @@ public function getWatch(array $params = []) * * @return Elasticsearch|Promise */ - public function putWatch(array $params = []) + public function putWatch(?array $params = null) { + $params = $params ?? []; $this->checkRequiredParameters(['id'], $params); $url = '/_watcher/watch/' . $this->encode($params['id']); $method = 'PUT'; @@ -345,12 +353,12 @@ public function putWatch(array $params = []) * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/watcher-api-query-watches.html * * @param array{ - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. - * body: array, // From, size, query, sort and search_after + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. + * body?: string|array, // From, size, query, sort and search_after. If body is a string must be a valid JSON. * } $params * * @throws NoNodeAvailableException if all the hosts are offline @@ -359,8 +367,9 @@ public function putWatch(array $params = []) * * @return Elasticsearch|Promise */ - public function queryWatches(array $params = []) + public function queryWatches(?array $params = null) { + $params = $params ?? []; $url = '/_watcher/_query/watches'; $method = empty($params['body']) ? 'GET' : 'POST'; @@ -381,12 +390,12 @@ public function queryWatches(array $params = []) * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/watcher-api-start.html * * @param array{ - * master_timeout: time, // Specify timeout for connection to master - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. + * master_timeout?: int|string, // Specify timeout for connection to master + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. * } $params * * @throws NoNodeAvailableException if all the hosts are offline @@ -395,8 +404,9 @@ public function queryWatches(array $params = []) * * @return Elasticsearch|Promise */ - public function start(array $params = []) + public function start(?array $params = null) { + $params = $params ?? []; $url = '/_watcher/_start'; $method = 'POST'; @@ -416,13 +426,13 @@ public function start(array $params = []) * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/watcher-api-stats.html * * @param array{ - * metric: list, // Controls what additional stat metrics should be include in the response - * emit_stacktraces: boolean, // Emits stack traces of currently running watches - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. + * metric?: string|array, // Controls what additional stat metrics should be include in the response + * emit_stacktraces?: bool, // Emits stack traces of currently running watches + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. * } $params * * @throws NoNodeAvailableException if all the hosts are offline @@ -431,10 +441,11 @@ public function start(array $params = []) * * @return Elasticsearch|Promise */ - public function stats(array $params = []) + public function stats(?array $params = null) { + $params = $params ?? []; if (isset($params['metric'])) { - $url = '/_watcher/stats/' . $this->encode($params['metric']); + $url = '/_watcher/stats/' . $this->encode($this->convertValue($params['metric'])); $method = 'GET'; } else { $url = '/_watcher/stats'; @@ -456,12 +467,12 @@ public function stats(array $params = []) * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/watcher-api-stop.html * * @param array{ - * master_timeout: time, // Specify timeout for connection to master - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. + * master_timeout?: int|string, // Specify timeout for connection to master + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. * } $params * * @throws NoNodeAvailableException if all the hosts are offline @@ -470,8 +481,9 @@ public function stats(array $params = []) * * @return Elasticsearch|Promise */ - public function stop(array $params = []) + public function stop(?array $params = null) { + $params = $params ?? []; $url = '/_watcher/_stop'; $method = 'POST'; @@ -491,14 +503,14 @@ public function stop(array $params = []) * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/watcher-api-update-settings.html * * @param array{ - * timeout: time, // Specify timeout for waiting for acknowledgement from all nodes - * master_timeout: time, // Specify timeout for connection to master - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. - * body: array, // (REQUIRED) An object with the new index settings + * timeout?: int|string, // Specify timeout for waiting for acknowledgement from all nodes + * master_timeout?: int|string, // Specify timeout for connection to master + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. + * body: string|array, // (REQUIRED) An object with the new index settings. If body is a string must be a valid JSON. * } $params * * @throws NoNodeAvailableException if all the hosts are offline @@ -507,8 +519,9 @@ public function stop(array $params = []) * * @return Elasticsearch|Promise */ - public function updateSettings(array $params = []) + public function updateSettings(?array $params = null) { + $params = $params ?? []; $this->checkRequiredParameters(['body'], $params); $url = '/_watcher/settings'; $method = 'PUT'; diff --git a/src/Endpoints/Xpack.php b/src/Endpoints/Xpack.php index 19b17f25e..045660747 100644 --- a/src/Endpoints/Xpack.php +++ b/src/Endpoints/Xpack.php @@ -34,13 +34,14 @@ class Xpack extends AbstractEndpoint * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/info-api.html * * @param array{ - * categories: list, // Comma-separated list of info categories. Can be any of: build, license, features - * accept_enterprise: boolean, // If this param is used it must be set to true - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. + * human?: bool, // Defines whether additional human-readable information is included in the response. In particular, it adds descriptions and a tag line. The default value is true. + * categories?: string|array, // Comma-separated list of info categories. Can be any of: build, license, features + * accept_enterprise?: bool, // If this param is used it must be set to true + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. * } $params * * @throws NoNodeAvailableException if all the hosts are offline @@ -49,12 +50,13 @@ class Xpack extends AbstractEndpoint * * @return Elasticsearch|Promise */ - public function info(array $params = []) + public function info(?array $params = null) { + $params = $params ?? []; $url = '/_xpack'; $method = 'GET'; - $url = $this->addQueryString($url, $params, ['categories','accept_enterprise','pretty','human','error_trace','source','filter_path']); + $url = $this->addQueryString($url, $params, ['human','categories','accept_enterprise','pretty','human','error_trace','source','filter_path']); $headers = [ 'Accept' => 'application/json', ]; @@ -70,12 +72,12 @@ public function info(array $params = []) * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/usage-api.html * * @param array{ - * master_timeout: time, // Specify timeout for watch write operation - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. + * master_timeout?: int|string, // Specify timeout for watch write operation + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. * } $params * * @throws NoNodeAvailableException if all the hosts are offline @@ -84,8 +86,9 @@ public function info(array $params = []) * * @return Elasticsearch|Promise */ - public function usage(array $params = []) + public function usage(?array $params = null) { + $params = $params ?? []; $url = '/_xpack/usage'; $method = 'GET'; diff --git a/src/Traits/ClientEndpointsTrait.php b/src/Traits/ClientEndpointsTrait.php index e2cfe6199..8dd326472 100644 --- a/src/Traits/ClientEndpointsTrait.php +++ b/src/Traits/ClientEndpointsTrait.php @@ -34,25 +34,26 @@ trait ClientEndpointsTrait * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/docs-bulk.html * * @param array{ - * index: string, // Default index for items which don't provide one - * wait_for_active_shards: string, // Sets the number of shard copies that must be active before proceeding with the bulk operation. Defaults to 1, meaning the primary shard only. Set to `all` for all shard copies, otherwise set to any non-negative value less than or equal to the total number of copies for the shard (number of replicas + 1) - * refresh: enum, // 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. - * routing: string, // Specific routing value - * timeout: time, // Explicit operation timeout - * type: string, // Default document type for items which don't provide one - * _source: list, // True or false to return the _source field or not, or default list of fields to return, can be overridden on each sub-request - * _source_excludes: list, // Default list of fields to exclude from the returned _source field, can be overridden on each sub-request - * _source_includes: list, // Default list of fields to extract and return from the _source field, can be overridden on each sub-request - * pipeline: string, // The pipeline id to preprocess incoming documents with - * require_alias: boolean, // Sets require_alias for all incoming documents. Defaults to unset (false) - * require_data_stream: boolean, // When true, requires the destination to be a data stream (existing or to-be-created). Default is false - * list_executed_pipelines: boolean, // Sets list_executed_pipelines for all incoming documents. Defaults to unset (false) - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. - * body: array, // (REQUIRED) The operation definition and data (action-data pairs), separated by newlines + * index?: string, // Default index for items which don't provide one + * wait_for_active_shards?: string, // Sets the number of shard copies that must be active before proceeding with the bulk operation. Defaults to 1, meaning the primary shard only. Set to `all` for all shard copies, otherwise set to any non-negative value less than or equal to the total number of copies for the shard (number of replicas + 1) + * refresh?: string, // 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. + * routing?: string, // Specific routing value + * timeout?: int|string, // Explicit operation timeout + * type?: string, // Default document type for items which don't provide one + * _source?: string|array, // True or false to return the _source field or not, or default list of fields to return, can be overridden on each sub-request + * _source_excludes?: string|array, // Default list of fields to exclude from the returned _source field, can be overridden on each sub-request + * _source_includes?: string|array, // Default list of fields to extract and return from the _source field, can be overridden on each sub-request + * pipeline?: string, // The pipeline id to preprocess incoming documents with + * require_alias?: bool, // Sets require_alias for all incoming documents. Defaults to unset (false) + * require_data_stream?: bool, // When true, requires the destination to be a data stream (existing or to-be-created). Default is false + * list_executed_pipelines?: bool, // Sets list_executed_pipelines for all incoming documents. Defaults to unset (false) + * include_source_on_error?: bool, // True or false if to include the document source in the error message in case of parsing errors. Defaults to true. + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. + * body: string|array, // (REQUIRED) The operation definition and data (action-data pairs), separated by newlines. If body is a string must be a valid JSON. * } $params * * @throws NoNodeAvailableException if all the hosts are offline @@ -61,8 +62,9 @@ trait ClientEndpointsTrait * * @return Elasticsearch|Promise */ - public function bulk(array $params = []) + public function bulk(?array $params = null) { + $params = $params ?? []; $this->checkRequiredParameters(['body'], $params); if (isset($params['index'])) { $url = '/' . $this->encode($params['index']) . '/_bulk'; @@ -71,7 +73,7 @@ public function bulk(array $params = []) $url = '/_bulk'; $method = 'POST'; } - $url = $this->addQueryString($url, $params, ['wait_for_active_shards','refresh','routing','timeout','type','_source','_source_excludes','_source_includes','pipeline','require_alias','require_data_stream','list_executed_pipelines','pretty','human','error_trace','source','filter_path']); + $url = $this->addQueryString($url, $params, ['wait_for_active_shards','refresh','routing','timeout','type','_source','_source_excludes','_source_includes','pipeline','require_alias','require_data_stream','list_executed_pipelines','include_source_on_error','pretty','human','error_trace','source','filter_path']); $headers = [ 'Accept' => 'application/json', 'Content-Type' => 'application/x-ndjson', @@ -88,13 +90,13 @@ public function bulk(array $params = []) * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/clear-scroll-api.html * * @param array{ - * scroll_id: list, // A comma-separated list of scroll IDs to clear - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. - * body: array, // A comma-separated list of scroll IDs to clear if none was specified via the scroll_id parameter + * scroll_id?: string|array, // A comma-separated list of scroll IDs to clear + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. + * body?: string|array, // A comma-separated list of scroll IDs to clear if none was specified via the scroll_id parameter. If body is a string must be a valid JSON. * } $params * * @throws NoNodeAvailableException if all the hosts are offline @@ -103,10 +105,11 @@ public function bulk(array $params = []) * * @return Elasticsearch|Promise */ - public function clearScroll(array $params = []) + public function clearScroll(?array $params = null) { + $params = $params ?? []; if (isset($params['scroll_id'])) { - $url = '/_search/scroll/' . $this->encode($params['scroll_id']); + $url = '/_search/scroll/' . $this->encode($this->convertValue($params['scroll_id'])); $method = 'DELETE'; } else { $url = '/_search/scroll'; @@ -129,12 +132,12 @@ public function clearScroll(array $params = []) * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/point-in-time-api.html * * @param array{ - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. - * body: array, // a point-in-time id to close + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. + * body?: string|array, // a point-in-time id to close. If body is a string must be a valid JSON. * } $params * * @throws NoNodeAvailableException if all the hosts are offline @@ -143,8 +146,9 @@ public function clearScroll(array $params = []) * * @return Elasticsearch|Promise */ - public function closePointInTime(array $params = []) + public function closePointInTime(?array $params = null) { + $params = $params ?? []; $url = '/_pit'; $method = 'DELETE'; @@ -165,27 +169,27 @@ public function closePointInTime(array $params = []) * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/search-count.html * * @param array{ - * index: list, // A comma-separated list of indices to restrict the results - * ignore_unavailable: boolean, // Whether specified concrete indices should be ignored when unavailable (missing or closed) - * ignore_throttled: boolean, // Whether specified concrete, expanded or aliased indices should be ignored when throttled - * allow_no_indices: boolean, // Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes `_all` string or when no indices have been specified) - * expand_wildcards: enum, // Whether to expand wildcard expression to concrete indices that are open, closed or both. - * min_score: number, // Include only documents with a specific `_score` value in the result - * preference: string, // Specify the node or shard the operation should be performed on (default: random) - * routing: list, // A comma-separated list of specific routing values - * q: string, // Query in the Lucene query string syntax - * analyzer: string, // The analyzer to use for the query string - * analyze_wildcard: boolean, // Specify whether wildcard and prefix queries should be analyzed (default: false) - * default_operator: enum, // The default operator for query string query (AND or OR) - * df: string, // The field to use as default where no field prefix is given in the query string - * lenient: boolean, // Specify whether format-based query failures (such as providing text to a numeric field) should be ignored - * terminate_after: number, // The maximum count for each shard, upon reaching which the query execution will terminate early - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. - * body: array, // A query to restrict the results specified with the Query DSL (optional) + * index?: string|array, // A comma-separated list of indices to restrict the results + * ignore_unavailable?: bool, // Whether specified concrete indices should be ignored when unavailable (missing or closed) + * ignore_throttled?: bool, // Whether specified concrete, expanded or aliased indices should be ignored when throttled + * allow_no_indices?: bool, // Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes `_all` string or when no indices have been specified) + * expand_wildcards?: string, // Whether to expand wildcard expression to concrete indices that are open, closed or both. + * min_score?: int, // Include only documents with a specific `_score` value in the result + * preference?: string, // Specify the node or shard the operation should be performed on (default: random) + * routing?: string|array, // A comma-separated list of specific routing values + * q?: string, // Query in the Lucene query string syntax + * analyzer?: string, // The analyzer to use for the query string + * analyze_wildcard?: bool, // Specify whether wildcard and prefix queries should be analyzed (default: false) + * default_operator?: string, // The default operator for query string query (AND or OR) + * df?: string, // The field to use as default where no field prefix is given in the query string + * lenient?: bool, // Specify whether format-based query failures (such as providing text to a numeric field) should be ignored + * terminate_after?: int, // The maximum count for each shard, upon reaching which the query execution will terminate early + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. + * body?: string|array, // A query to restrict the results specified with the Query DSL (optional). If body is a string must be a valid JSON. * } $params * * @throws NoNodeAvailableException if all the hosts are offline @@ -194,10 +198,11 @@ public function closePointInTime(array $params = []) * * @return Elasticsearch|Promise */ - public function count(array $params = []) + public function count(?array $params = null) { + $params = $params ?? []; if (isset($params['index'])) { - $url = '/' . $this->encode($params['index']) . '/_count'; + $url = '/' . $this->encode($this->convertValue($params['index'])) . '/_count'; $method = empty($params['body']) ? 'GET' : 'POST'; } else { $url = '/_count'; @@ -224,19 +229,20 @@ public function count(array $params = []) * @param array{ * id: string, // (REQUIRED) Document ID * index: string, // (REQUIRED) The name of the index - * wait_for_active_shards: string, // Sets the number of shard copies that must be active before proceeding with the index operation. Defaults to 1, meaning the primary shard only. Set to `all` for all shard copies, otherwise set to any non-negative value less than or equal to the total number of copies for the shard (number of replicas + 1) - * refresh: enum, // 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. - * routing: string, // Specific routing value - * timeout: time, // Explicit operation timeout - * version: number, // Explicit version number for concurrency control - * version_type: enum, // Specific version type - * pipeline: string, // The pipeline id to preprocess incoming documents with - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. - * body: array, // (REQUIRED) The document + * wait_for_active_shards?: string, // Sets the number of shard copies that must be active before proceeding with the index operation. Defaults to 1, meaning the primary shard only. Set to `all` for all shard copies, otherwise set to any non-negative value less than or equal to the total number of copies for the shard (number of replicas + 1) + * refresh?: string, // 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. + * routing?: string, // Specific routing value + * timeout?: int|string, // Explicit operation timeout + * version?: int, // Explicit version number for concurrency control + * version_type?: string, // Specific version type + * pipeline?: string, // The pipeline id to preprocess incoming documents with + * include_source_on_error?: bool, // True or false if to include the document source in the error message in case of parsing errors. Defaults to true. + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. + * body: string|array, // (REQUIRED) The document. If body is a string must be a valid JSON. * } $params * * @throws MissingParameterException if a required parameter is missing @@ -246,13 +252,14 @@ public function count(array $params = []) * * @return Elasticsearch|Promise */ - public function create(array $params = []) + public function create(?array $params = null) { + $params = $params ?? []; $this->checkRequiredParameters(['id','index','body'], $params); $url = '/' . $this->encode($params['index']) . '/_create/' . $this->encode($params['id']); $method = 'PUT'; - $url = $this->addQueryString($url, $params, ['wait_for_active_shards','refresh','routing','timeout','version','version_type','pipeline','pretty','human','error_trace','source','filter_path']); + $url = $this->addQueryString($url, $params, ['wait_for_active_shards','refresh','routing','timeout','version','version_type','pipeline','include_source_on_error','pretty','human','error_trace','source','filter_path']); $headers = [ 'Accept' => 'application/json', 'Content-Type' => 'application/json', @@ -271,19 +278,19 @@ public function create(array $params = []) * @param array{ * id: string, // (REQUIRED) The document ID * index: string, // (REQUIRED) The name of the index - * wait_for_active_shards: string, // Sets the number of shard copies that must be active before proceeding with the delete operation. Defaults to 1, meaning the primary shard only. Set to `all` for all shard copies, otherwise set to any non-negative value less than or equal to the total number of copies for the shard (number of replicas + 1) - * refresh: enum, // 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. - * routing: string, // Specific routing value - * timeout: time, // Explicit operation timeout - * if_seq_no: number, // only perform the delete operation if the last operation that has changed the document has the specified sequence number - * if_primary_term: number, // only perform the delete operation if the last operation that has changed the document has the specified primary term - * version: number, // Explicit version number for concurrency control - * version_type: enum, // Specific version type - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. + * wait_for_active_shards?: string, // Sets the number of shard copies that must be active before proceeding with the delete operation. Defaults to 1, meaning the primary shard only. Set to `all` for all shard copies, otherwise set to any non-negative value less than or equal to the total number of copies for the shard (number of replicas + 1) + * refresh?: string, // 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. + * routing?: string, // Specific routing value + * timeout?: int|string, // Explicit operation timeout + * if_seq_no?: int, // only perform the delete operation if the last operation that has changed the document has the specified sequence number + * if_primary_term?: int, // only perform the delete operation if the last operation that has changed the document has the specified primary term + * version?: int, // Explicit version number for concurrency control + * version_type?: string, // Specific version type + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. * } $params * * @throws MissingParameterException if a required parameter is missing @@ -293,8 +300,9 @@ public function create(array $params = []) * * @return Elasticsearch|Promise */ - public function delete(array $params = []) + public function delete(?array $params = null) { + $params = $params ?? []; $this->checkRequiredParameters(['id','index'], $params); $url = '/' . $this->encode($params['index']) . '/_doc/' . $this->encode($params['id']); $method = 'DELETE'; @@ -315,42 +323,42 @@ public function delete(array $params = []) * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/docs-delete-by-query.html * * @param array{ - * index: list, // (REQUIRED) A comma-separated list of index names to search; use `_all` or empty string to perform the operation on all indices - * analyzer: string, // The analyzer to use for the query string - * analyze_wildcard: boolean, // Specify whether wildcard and prefix queries should be analyzed (default: false) - * default_operator: enum, // The default operator for query string query (AND or OR) - * df: string, // The field to use as default where no field prefix is given in the query string - * from: number, // Starting offset (default: 0) - * ignore_unavailable: boolean, // Whether specified concrete indices should be ignored when unavailable (missing or closed) - * allow_no_indices: boolean, // Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes `_all` string or when no indices have been specified) - * conflicts: enum, // What to do when the delete by query hits version conflicts? - * expand_wildcards: enum, // Whether to expand wildcard expression to concrete indices that are open, closed or both. - * lenient: boolean, // Specify whether format-based query failures (such as providing text to a numeric field) should be ignored - * preference: string, // Specify the node or shard the operation should be performed on (default: random) - * q: string, // Query in the Lucene query string syntax - * routing: list, // A comma-separated list of specific routing values - * scroll: time, // Specify how long a consistent view of the index should be maintained for scrolled search - * search_type: enum, // Search operation type - * search_timeout: time, // Explicit timeout for each search request. Defaults to no timeout. - * max_docs: number, // Maximum number of documents to process (default: all documents) - * sort: list, // A comma-separated list of : pairs - * terminate_after: number, // The maximum number of documents to collect for each shard, upon reaching which the query execution will terminate early. - * stats: list, // Specific 'tag' of the request for logging and statistical purposes - * version: boolean, // Specify whether to return document version as part of a hit - * request_cache: boolean, // Specify if request cache should be used for this request or not, defaults to index level setting - * refresh: boolean, // Should the affected indexes be refreshed? - * timeout: time, // Time each individual bulk request should wait for shards that are unavailable. - * wait_for_active_shards: string, // Sets the number of shard copies that must be active before proceeding with the delete by query operation. Defaults to 1, meaning the primary shard only. Set to `all` for all shard copies, otherwise set to any non-negative value less than or equal to the total number of copies for the shard (number of replicas + 1) - * scroll_size: number, // Size on the scroll request powering the delete by query - * wait_for_completion: boolean, // Should the request should block until the delete by query is complete. - * requests_per_second: number, // The throttle for this request in sub-requests per second. -1 means no throttle. - * slices: number|string, // The number of slices this task should be divided into. Defaults to 1, meaning the task isn't sliced into subtasks. Can be set to `auto`. - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. - * body: array, // (REQUIRED) The search definition using the Query DSL + * index: string|array, // (REQUIRED) A comma-separated list of index names to search; use `_all` or empty string to perform the operation on all indices + * analyzer?: string, // The analyzer to use for the query string + * analyze_wildcard?: bool, // Specify whether wildcard and prefix queries should be analyzed (default: false) + * default_operator?: string, // The default operator for query string query (AND or OR) + * df?: string, // The field to use as default where no field prefix is given in the query string + * from?: int, // Starting offset (default: 0) + * ignore_unavailable?: bool, // Whether specified concrete indices should be ignored when unavailable (missing or closed) + * allow_no_indices?: bool, // Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes `_all` string or when no indices have been specified) + * conflicts?: string, // What to do when the delete by query hits version conflicts? + * expand_wildcards?: string, // Whether to expand wildcard expression to concrete indices that are open, closed or both. + * lenient?: bool, // Specify whether format-based query failures (such as providing text to a numeric field) should be ignored + * preference?: string, // Specify the node or shard the operation should be performed on (default: random) + * q?: string, // Query in the Lucene query string syntax + * routing?: string|array, // A comma-separated list of specific routing values + * scroll?: int|string, // Specify how long a consistent view of the index should be maintained for scrolled search + * search_type?: string, // Search operation type + * search_timeout?: int|string, // Explicit timeout for each search request. Defaults to no timeout. + * max_docs?: int, // Maximum number of documents to process (default: all documents) + * sort?: string|array, // A comma-separated list of : pairs + * terminate_after?: int, // The maximum number of documents to collect for each shard, upon reaching which the query execution will terminate early. + * stats?: string|array, // Specific 'tag' of the request for logging and statistical purposes + * version?: bool, // Specify whether to return document version as part of a hit + * request_cache?: bool, // Specify if request cache should be used for this request or not, defaults to index level setting + * refresh?: bool, // Should the affected indexes be refreshed? + * timeout?: int|string, // Time each individual bulk request should wait for shards that are unavailable. + * wait_for_active_shards?: string, // Sets the number of shard copies that must be active before proceeding with the delete by query operation. Defaults to 1, meaning the primary shard only. Set to `all` for all shard copies, otherwise set to any non-negative value less than or equal to the total number of copies for the shard (number of replicas + 1) + * scroll_size?: int, // Size on the scroll request powering the delete by query + * wait_for_completion?: bool, // Should the request should block until the delete by query is complete. + * requests_per_second?: int, // The throttle for this request in sub-requests per second. -1 means no throttle. + * slices?: int|string, // The number of slices this task should be divided into. Defaults to 1, meaning the task isn't sliced into subtasks. Can be set to `auto`. + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. + * body: string|array, // (REQUIRED) The search definition using the Query DSL. If body is a string must be a valid JSON. * } $params * * @throws MissingParameterException if a required parameter is missing @@ -360,10 +368,11 @@ public function delete(array $params = []) * * @return Elasticsearch|Promise */ - public function deleteByQuery(array $params = []) + public function deleteByQuery(?array $params = null) { + $params = $params ?? []; $this->checkRequiredParameters(['index','body'], $params); - $url = '/' . $this->encode($params['index']) . '/_delete_by_query'; + $url = '/' . $this->encode($this->convertValue($params['index'])) . '/_delete_by_query'; $method = 'POST'; $url = $this->addQueryString($url, $params, ['analyzer','analyze_wildcard','default_operator','df','from','ignore_unavailable','allow_no_indices','conflicts','expand_wildcards','lenient','preference','q','routing','scroll','search_type','search_timeout','max_docs','sort','terminate_after','stats','version','request_cache','refresh','timeout','wait_for_active_shards','scroll_size','wait_for_completion','requests_per_second','slices','pretty','human','error_trace','source','filter_path']); @@ -384,12 +393,12 @@ public function deleteByQuery(array $params = []) * * @param array{ * task_id: string, // (REQUIRED) The task id to rethrottle - * requests_per_second: number, // The throttle to set on this request in floating sub-requests per second. -1 means set no throttle. - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. + * requests_per_second?: int, // The throttle to set on this request in floating sub-requests per second. -1 means set no throttle. + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. * } $params * * @throws MissingParameterException if a required parameter is missing @@ -399,8 +408,9 @@ public function deleteByQuery(array $params = []) * * @return Elasticsearch|Promise */ - public function deleteByQueryRethrottle(array $params = []) + public function deleteByQueryRethrottle(?array $params = null) { + $params = $params ?? []; $this->checkRequiredParameters(['task_id','requests_per_second'], $params); $url = '/_delete_by_query/' . $this->encode($params['task_id']) . '/_rethrottle'; $method = 'POST'; @@ -422,13 +432,13 @@ public function deleteByQueryRethrottle(array $params = []) * * @param array{ * id: string, // (REQUIRED) Script ID - * timeout: time, // Explicit operation timeout - * master_timeout: time, // Specify timeout for connection to master - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. + * timeout?: int|string, // Explicit operation timeout + * master_timeout?: int|string, // Specify timeout for connection to master + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. * } $params * * @throws MissingParameterException if a required parameter is missing @@ -438,8 +448,9 @@ public function deleteByQueryRethrottle(array $params = []) * * @return Elasticsearch|Promise */ - public function deleteScript(array $params = []) + public function deleteScript(?array $params = null) { + $params = $params ?? []; $this->checkRequiredParameters(['id'], $params); $url = '/_scripts/' . $this->encode($params['id']); $method = 'DELETE'; @@ -462,21 +473,21 @@ public function deleteScript(array $params = []) * @param array{ * id: string, // (REQUIRED) The document ID * index: string, // (REQUIRED) The name of the index - * stored_fields: list, // A comma-separated list of stored fields to return in the response - * preference: string, // Specify the node or shard the operation should be performed on (default: random) - * realtime: boolean, // Specify whether to perform the operation in realtime or search mode - * refresh: boolean, // Refresh the shard containing the document before performing the operation - * routing: string, // Specific routing value - * _source: list, // True or false to return the _source field or not, or a list of fields to return - * _source_excludes: list, // A list of fields to exclude from the returned _source field - * _source_includes: list, // A list of fields to extract and return from the _source field - * version: number, // Explicit version number for concurrency control - * version_type: enum, // Specific version type - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. + * stored_fields?: string|array, // A comma-separated list of stored fields to return in the response + * preference?: string, // Specify the node or shard the operation should be performed on (default: random) + * realtime?: bool, // Specify whether to perform the operation in realtime or search mode + * refresh?: bool, // Refresh the shard containing the document before performing the operation + * routing?: string, // Specific routing value + * _source?: string|array, // True or false to return the _source field or not, or a list of fields to return + * _source_excludes?: string|array, // A list of fields to exclude from the returned _source field + * _source_includes?: string|array, // A list of fields to extract and return from the _source field + * version?: int, // Explicit version number for concurrency control + * version_type?: string, // Specific version type + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. * } $params * * @throws MissingParameterException if a required parameter is missing @@ -486,8 +497,9 @@ public function deleteScript(array $params = []) * * @return Elasticsearch|Promise */ - public function exists(array $params = []) + public function exists(?array $params = null) { + $params = $params ?? []; $this->checkRequiredParameters(['id','index'], $params); $url = '/' . $this->encode($params['index']) . '/_doc/' . $this->encode($params['id']); $method = 'HEAD'; @@ -510,20 +522,20 @@ public function exists(array $params = []) * @param array{ * id: string, // (REQUIRED) The document ID * index: string, // (REQUIRED) The name of the index - * preference: string, // Specify the node or shard the operation should be performed on (default: random) - * realtime: boolean, // Specify whether to perform the operation in realtime or search mode - * refresh: boolean, // Refresh the shard containing the document before performing the operation - * routing: string, // Specific routing value - * _source: list, // True or false to return the _source field or not, or a list of fields to return - * _source_excludes: list, // A list of fields to exclude from the returned _source field - * _source_includes: list, // A list of fields to extract and return from the _source field - * version: number, // Explicit version number for concurrency control - * version_type: enum, // Specific version type - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. + * preference?: string, // Specify the node or shard the operation should be performed on (default: random) + * realtime?: bool, // Specify whether to perform the operation in realtime or search mode + * refresh?: bool, // Refresh the shard containing the document before performing the operation + * routing?: string, // Specific routing value + * _source?: string|array, // True or false to return the _source field or not, or a list of fields to return + * _source_excludes?: string|array, // A list of fields to exclude from the returned _source field + * _source_includes?: string|array, // A list of fields to extract and return from the _source field + * version?: int, // Explicit version number for concurrency control + * version_type?: string, // Specific version type + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. * } $params * * @throws MissingParameterException if a required parameter is missing @@ -533,8 +545,9 @@ public function exists(array $params = []) * * @return Elasticsearch|Promise */ - public function existsSource(array $params = []) + public function existsSource(?array $params = null) { + $params = $params ?? []; $this->checkRequiredParameters(['id','index'], $params); $url = '/' . $this->encode($params['index']) . '/_source/' . $this->encode($params['id']); $method = 'HEAD'; @@ -557,24 +570,24 @@ public function existsSource(array $params = []) * @param array{ * id: string, // (REQUIRED) The document ID * index: string, // (REQUIRED) The name of the index - * analyze_wildcard: boolean, // Specify whether wildcards and prefix queries in the query string query should be analyzed (default: false) - * analyzer: string, // The analyzer for the query string query - * default_operator: enum, // The default operator for query string query (AND or OR) - * df: string, // The default field for query string query (default: _all) - * stored_fields: list, // A comma-separated list of stored fields to return in the response - * lenient: boolean, // Specify whether format-based query failures (such as providing text to a numeric field) should be ignored - * preference: string, // Specify the node or shard the operation should be performed on (default: random) - * q: string, // Query in the Lucene query string syntax - * routing: string, // Specific routing value - * _source: list, // True or false to return the _source field or not, or a list of fields to return - * _source_excludes: list, // A list of fields to exclude from the returned _source field - * _source_includes: list, // A list of fields to extract and return from the _source field - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. - * body: array, // The query definition using the Query DSL + * analyze_wildcard?: bool, // Specify whether wildcards and prefix queries in the query string query should be analyzed (default: false) + * analyzer?: string, // The analyzer for the query string query + * default_operator?: string, // The default operator for query string query (AND or OR) + * df?: string, // The default field for query string query (default: _all) + * stored_fields?: string|array, // A comma-separated list of stored fields to return in the response + * lenient?: bool, // Specify whether format-based query failures (such as providing text to a numeric field) should be ignored + * preference?: string, // Specify the node or shard the operation should be performed on (default: random) + * q?: string, // Query in the Lucene query string syntax + * routing?: string, // Specific routing value + * _source?: string|array, // True or false to return the _source field or not, or a list of fields to return + * _source_excludes?: string|array, // A list of fields to exclude from the returned _source field + * _source_includes?: string|array, // A list of fields to extract and return from the _source field + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. + * body?: string|array, // The query definition using the Query DSL. If body is a string must be a valid JSON. * } $params * * @throws MissingParameterException if a required parameter is missing @@ -584,8 +597,9 @@ public function existsSource(array $params = []) * * @return Elasticsearch|Promise */ - public function explain(array $params = []) + public function explain(?array $params = null) { + $params = $params ?? []; $this->checkRequiredParameters(['id','index'], $params); $url = '/' . $this->encode($params['index']) . '/_explain/' . $this->encode($params['id']); $method = empty($params['body']) ? 'GET' : 'POST'; @@ -607,21 +621,21 @@ public function explain(array $params = []) * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/search-field-caps.html * * @param array{ - * index: list, // A comma-separated list of index names; use `_all` or empty string to perform the operation on all indices - * fields: list, // A comma-separated list of field names - * ignore_unavailable: boolean, // Whether specified concrete indices should be ignored when unavailable (missing or closed) - * allow_no_indices: boolean, // Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes `_all` string or when no indices have been specified) - * expand_wildcards: enum, // Whether to expand wildcard expression to concrete indices that are open, closed or both. - * include_unmapped: boolean, // Indicates whether unmapped fields should be included in the response. - * filters: list, // An optional set of filters: can include +metadata,-metadata,-nested,-multifield,-parent - * types: list, // Only return results for fields that have one of the types in the list - * include_empty_fields: boolean, // Include empty fields in result - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. - * body: array, // An index filter specified with the Query DSL + * index?: string|array, // A comma-separated list of index names; use `_all` or empty string to perform the operation on all indices + * fields?: string|array, // A comma-separated list of field names + * ignore_unavailable?: bool, // Whether specified concrete indices should be ignored when unavailable (missing or closed) + * allow_no_indices?: bool, // Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes `_all` string or when no indices have been specified) + * expand_wildcards?: string, // Whether to expand wildcard expression to concrete indices that are open, closed or both. + * include_unmapped?: bool, // Indicates whether unmapped fields should be included in the response. + * filters?: string|array, // An optional set of filters: can include +metadata,-metadata,-nested,-multifield,-parent + * types?: string|array, // Only return results for fields that have one of the types in the list + * include_empty_fields?: bool, // Include empty fields in result + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. + * body?: string|array, // An index filter specified with the Query DSL. If body is a string must be a valid JSON. * } $params * * @throws NoNodeAvailableException if all the hosts are offline @@ -630,10 +644,11 @@ public function explain(array $params = []) * * @return Elasticsearch|Promise */ - public function fieldCaps(array $params = []) + public function fieldCaps(?array $params = null) { + $params = $params ?? []; if (isset($params['index'])) { - $url = '/' . $this->encode($params['index']) . '/_field_caps'; + $url = '/' . $this->encode($this->convertValue($params['index'])) . '/_field_caps'; $method = empty($params['body']) ? 'GET' : 'POST'; } else { $url = '/_field_caps'; @@ -658,22 +673,22 @@ public function fieldCaps(array $params = []) * @param array{ * id: string, // (REQUIRED) The document ID * index: string, // (REQUIRED) The name of the index - * force_synthetic_source: boolean, // Should this request force synthetic _source? Use this to test if the mapping supports synthetic _source and to get a sense of the worst case performance. Fetches with this enabled will be slower the enabling synthetic source natively in the index. - * stored_fields: list, // A comma-separated list of stored fields to return in the response - * preference: string, // Specify the node or shard the operation should be performed on (default: random) - * realtime: boolean, // Specify whether to perform the operation in realtime or search mode - * refresh: boolean, // Refresh the shard containing the document before performing the operation - * routing: string, // Specific routing value - * _source: list, // True or false to return the _source field or not, or a list of fields to return - * _source_excludes: list, // A list of fields to exclude from the returned _source field - * _source_includes: list, // A list of fields to extract and return from the _source field - * version: number, // Explicit version number for concurrency control - * version_type: enum, // Specific version type - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. + * force_synthetic_source?: bool, // Should this request force synthetic _source? Use this to test if the mapping supports synthetic _source and to get a sense of the worst case performance. Fetches with this enabled will be slower the enabling synthetic source natively in the index. + * stored_fields?: string|array, // A comma-separated list of stored fields to return in the response + * preference?: string, // Specify the node or shard the operation should be performed on (default: random) + * realtime?: bool, // Specify whether to perform the operation in realtime or search mode + * refresh?: bool, // Refresh the shard containing the document before performing the operation + * routing?: string, // Specific routing value + * _source?: string|array, // True or false to return the _source field or not, or a list of fields to return + * _source_excludes?: string|array, // A list of fields to exclude from the returned _source field + * _source_includes?: string|array, // A list of fields to extract and return from the _source field + * version?: int, // Explicit version number for concurrency control + * version_type?: string, // Specific version type + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. * } $params * * @throws MissingParameterException if a required parameter is missing @@ -683,8 +698,9 @@ public function fieldCaps(array $params = []) * * @return Elasticsearch|Promise */ - public function get(array $params = []) + public function get(?array $params = null) { + $params = $params ?? []; $this->checkRequiredParameters(['id','index'], $params); $url = '/' . $this->encode($params['index']) . '/_doc/' . $this->encode($params['id']); $method = 'GET'; @@ -706,12 +722,12 @@ public function get(array $params = []) * * @param array{ * id: string, // (REQUIRED) Script ID - * master_timeout: time, // Specify timeout for connection to master - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. + * master_timeout?: int|string, // Specify timeout for connection to master + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. * } $params * * @throws MissingParameterException if a required parameter is missing @@ -721,8 +737,9 @@ public function get(array $params = []) * * @return Elasticsearch|Promise */ - public function getScript(array $params = []) + public function getScript(?array $params = null) { + $params = $params ?? []; $this->checkRequiredParameters(['id'], $params); $url = '/_scripts/' . $this->encode($params['id']); $method = 'GET'; @@ -743,11 +760,11 @@ public function getScript(array $params = []) * @see https://www.elastic.co/guide/en/elasticsearch/painless/master/painless-contexts.html * * @param array{ - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. * } $params * * @throws NoNodeAvailableException if all the hosts are offline @@ -756,8 +773,9 @@ public function getScript(array $params = []) * * @return Elasticsearch|Promise */ - public function getScriptContext(array $params = []) + public function getScriptContext(?array $params = null) { + $params = $params ?? []; $url = '/_script_context'; $method = 'GET'; @@ -777,11 +795,11 @@ public function getScriptContext(array $params = []) * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/modules-scripting.html * * @param array{ - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. * } $params * * @throws NoNodeAvailableException if all the hosts are offline @@ -790,8 +808,9 @@ public function getScriptContext(array $params = []) * * @return Elasticsearch|Promise */ - public function getScriptLanguages(array $params = []) + public function getScriptLanguages(?array $params = null) { + $params = $params ?? []; $url = '/_script_language'; $method = 'GET'; @@ -813,20 +832,20 @@ public function getScriptLanguages(array $params = []) * @param array{ * id: string, // (REQUIRED) The document ID * index: string, // (REQUIRED) The name of the index - * preference: string, // Specify the node or shard the operation should be performed on (default: random) - * realtime: boolean, // Specify whether to perform the operation in realtime or search mode - * refresh: boolean, // Refresh the shard containing the document before performing the operation - * routing: string, // Specific routing value - * _source: list, // True or false to return the _source field or not, or a list of fields to return - * _source_excludes: list, // A list of fields to exclude from the returned _source field - * _source_includes: list, // A list of fields to extract and return from the _source field - * version: number, // Explicit version number for concurrency control - * version_type: enum, // Specific version type - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. + * preference?: string, // Specify the node or shard the operation should be performed on (default: random) + * realtime?: bool, // Specify whether to perform the operation in realtime or search mode + * refresh?: bool, // Refresh the shard containing the document before performing the operation + * routing?: string, // Specific routing value + * _source?: string|array, // True or false to return the _source field or not, or a list of fields to return + * _source_excludes?: string|array, // A list of fields to exclude from the returned _source field + * _source_includes?: string|array, // A list of fields to extract and return from the _source field + * version?: int, // Explicit version number for concurrency control + * version_type?: string, // Specific version type + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. * } $params * * @throws MissingParameterException if a required parameter is missing @@ -836,8 +855,9 @@ public function getScriptLanguages(array $params = []) * * @return Elasticsearch|Promise */ - public function getSource(array $params = []) + public function getSource(?array $params = null) { + $params = $params ?? []; $this->checkRequiredParameters(['id','index'], $params); $url = '/' . $this->encode($params['index']) . '/_source/' . $this->encode($params['id']); $method = 'GET'; @@ -858,15 +878,15 @@ public function getSource(array $params = []) * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/health-api.html * * @param array{ - * feature: string, // A feature of the cluster, as returned by the top-level health API - * timeout: time, // Explicit operation timeout - * verbose: boolean, // Opt in for more information about the health of the system - * size: int, // Limit the number of affected resources the health API returns - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. + * feature?: string, // A feature of the cluster, as returned by the top-level health API + * timeout?: int|string, // Explicit operation timeout + * verbose?: bool, // Opt in for more information about the health of the system + * size?: int, // Limit the number of affected resources the health API returns + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. * } $params * * @throws NoNodeAvailableException if all the hosts are offline @@ -875,8 +895,9 @@ public function getSource(array $params = []) * * @return Elasticsearch|Promise */ - public function healthReport(array $params = []) + public function healthReport(?array $params = null) { + $params = $params ?? []; if (isset($params['feature'])) { $url = '/_health_report/' . $this->encode($params['feature']); $method = 'GET'; @@ -900,26 +921,27 @@ public function healthReport(array $params = []) * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/docs-index_.html * * @param array{ - * id: string, // Document ID + * id?: string, // Document ID * index: string, // (REQUIRED) The name of the index - * wait_for_active_shards: string, // Sets the number of shard copies that must be active before proceeding with the index operation. Defaults to 1, meaning the primary shard only. Set to `all` for all shard copies, otherwise set to any non-negative value less than or equal to the total number of copies for the shard (number of replicas + 1) - * op_type: enum, // Explicit operation type. Defaults to `index` for requests with an explicit document ID, and to `create`for requests without an explicit document ID - * refresh: enum, // 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. - * routing: string, // Specific routing value - * timeout: time, // Explicit operation timeout - * version: number, // Explicit version number for concurrency control - * version_type: enum, // Specific version type - * if_seq_no: number, // only perform the index operation if the last operation that has changed the document has the specified sequence number - * if_primary_term: number, // only perform the index operation if the last operation that has changed the document has the specified primary term - * pipeline: string, // The pipeline id to preprocess incoming documents with - * require_alias: boolean, // When true, requires destination to be an alias. Default is false - * require_data_stream: boolean, // When true, requires the destination to be a data stream (existing or to-be-created). Default is false - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. - * body: array, // (REQUIRED) The document + * wait_for_active_shards?: string, // Sets the number of shard copies that must be active before proceeding with the index operation. Defaults to 1, meaning the primary shard only. Set to `all` for all shard copies, otherwise set to any non-negative value less than or equal to the total number of copies for the shard (number of replicas + 1) + * op_type?: string, // Explicit operation type. Defaults to `index` for requests with an explicit document ID, and to `create`for requests without an explicit document ID + * refresh?: string, // 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. + * routing?: string, // Specific routing value + * timeout?: int|string, // Explicit operation timeout + * version?: int, // Explicit version number for concurrency control + * version_type?: string, // Specific version type + * if_seq_no?: int, // only perform the index operation if the last operation that has changed the document has the specified sequence number + * if_primary_term?: int, // only perform the index operation if the last operation that has changed the document has the specified primary term + * pipeline?: string, // The pipeline id to preprocess incoming documents with + * require_alias?: bool, // When true, requires destination to be an alias. Default is false + * require_data_stream?: bool, // When true, requires the destination to be a data stream (existing or to-be-created). Default is false + * include_source_on_error?: bool, // True or false if to include the document source in the error message in case of parsing errors. Defaults to true. + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. + * body: string|array, // (REQUIRED) The document. If body is a string must be a valid JSON. * } $params * * @throws MissingParameterException if a required parameter is missing @@ -929,8 +951,9 @@ public function healthReport(array $params = []) * * @return Elasticsearch|Promise */ - public function index(array $params = []) + public function index(?array $params = null) { + $params = $params ?? []; $this->checkRequiredParameters(['index','body'], $params); if (isset($params['id'])) { $url = '/' . $this->encode($params['index']) . '/_doc/' . $this->encode($params['id']); @@ -939,7 +962,7 @@ public function index(array $params = []) $url = '/' . $this->encode($params['index']) . '/_doc'; $method = 'POST'; } - $url = $this->addQueryString($url, $params, ['wait_for_active_shards','op_type','refresh','routing','timeout','version','version_type','if_seq_no','if_primary_term','pipeline','require_alias','require_data_stream','pretty','human','error_trace','source','filter_path']); + $url = $this->addQueryString($url, $params, ['wait_for_active_shards','op_type','refresh','routing','timeout','version','version_type','if_seq_no','if_primary_term','pipeline','require_alias','require_data_stream','include_source_on_error','pretty','human','error_trace','source','filter_path']); $headers = [ 'Accept' => 'application/json', 'Content-Type' => 'application/json', @@ -956,11 +979,11 @@ public function index(array $params = []) * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/index.html * * @param array{ - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. * } $params * * @throws NoNodeAvailableException if all the hosts are offline @@ -969,8 +992,9 @@ public function index(array $params = []) * * @return Elasticsearch|Promise */ - public function info(array $params = []) + public function info(?array $params = null) { + $params = $params ?? []; $url = '/'; $method = 'GET'; @@ -991,14 +1015,14 @@ public function info(array $params = []) * @internal This API is EXPERIMENTAL and may be changed or removed completely in a future release * * @param array{ - * index: list, // (REQUIRED) A comma-separated list of index names to search; use `_all` to perform the operation on all indices - * routing: list, // A comma-separated list of specific routing values - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. - * body: array, // The search definition + * index: string|array, // (REQUIRED) A comma-separated list of index names to search; use `_all` to perform the operation on all indices + * routing?: string|array, // A comma-separated list of specific routing values + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. + * body?: string|array, // The search definition. If body is a string must be a valid JSON. * } $params * * @throws MissingParameterException if a required parameter is missing @@ -1008,10 +1032,11 @@ public function info(array $params = []) * * @return Elasticsearch|Promise */ - public function knnSearch(array $params = []) + public function knnSearch(?array $params = null) { + $params = $params ?? []; $this->checkRequiredParameters(['index'], $params); - $url = '/' . $this->encode($params['index']) . '/_knn_search'; + $url = '/' . $this->encode($this->convertValue($params['index'])) . '/_knn_search'; $method = empty($params['body']) ? 'GET' : 'POST'; $url = $this->addQueryString($url, $params, ['routing','pretty','human','error_trace','source','filter_path']); @@ -1031,22 +1056,22 @@ public function knnSearch(array $params = []) * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/docs-multi-get.html * * @param array{ - * index: string, // The name of the index - * force_synthetic_source: boolean, // Should this request force synthetic _source? Use this to test if the mapping supports synthetic _source and to get a sense of the worst case performance. Fetches with this enabled will be slower the enabling synthetic source natively in the index. - * stored_fields: list, // A comma-separated list of stored fields to return in the response - * preference: string, // Specify the node or shard the operation should be performed on (default: random) - * realtime: boolean, // Specify whether to perform the operation in realtime or search mode - * refresh: boolean, // Refresh the shard containing the document before performing the operation - * routing: string, // Specific routing value - * _source: list, // True or false to return the _source field or not, or a list of fields to return - * _source_excludes: list, // A list of fields to exclude from the returned _source field - * _source_includes: list, // A list of fields to extract and return from the _source field - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. - * body: array, // (REQUIRED) Document identifiers; can be either `docs` (containing full document information) or `ids` (when index is provided in the URL. + * index?: string, // The name of the index + * force_synthetic_source?: bool, // Should this request force synthetic _source? Use this to test if the mapping supports synthetic _source and to get a sense of the worst case performance. Fetches with this enabled will be slower the enabling synthetic source natively in the index. + * stored_fields?: string|array, // A comma-separated list of stored fields to return in the response + * preference?: string, // Specify the node or shard the operation should be performed on (default: random) + * realtime?: bool, // Specify whether to perform the operation in realtime or search mode + * refresh?: bool, // Refresh the shard containing the document before performing the operation + * routing?: string, // Specific routing value + * _source?: string|array, // True or false to return the _source field or not, or a list of fields to return + * _source_excludes?: string|array, // A list of fields to exclude from the returned _source field + * _source_includes?: string|array, // A list of fields to extract and return from the _source field + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. + * body: string|array, // (REQUIRED) Document identifiers; can be either `docs` (containing full document information) or `ids` (when index is provided in the URL.. If body is a string must be a valid JSON. * } $params * * @throws NoNodeAvailableException if all the hosts are offline @@ -1055,8 +1080,9 @@ public function knnSearch(array $params = []) * * @return Elasticsearch|Promise */ - public function mget(array $params = []) + public function mget(?array $params = null) { + $params = $params ?? []; $this->checkRequiredParameters(['body'], $params); if (isset($params['index'])) { $url = '/' . $this->encode($params['index']) . '/_mget'; @@ -1082,20 +1108,20 @@ public function mget(array $params = []) * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/search-multi-search.html * * @param array{ - * index: list, // A comma-separated list of index names to use as default - * search_type: enum, // Search operation type - * max_concurrent_searches: number, // Controls the maximum number of concurrent searches the multi search api will execute - * typed_keys: boolean, // Specify whether aggregation and suggester names should be prefixed by their respective types in the response - * pre_filter_shard_size: number, // A threshold that enforces a pre-filter roundtrip to prefilter search shards based on query rewriting if the 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. - * max_concurrent_shard_requests: number, // The number of concurrent shard requests each sub search executes concurrently per node. This value should be used to limit the impact of the search on the cluster in order to limit the number of concurrent shard requests - * rest_total_hits_as_int: boolean, // Indicates whether hits.total should be rendered as an integer or an object in the rest search response - * ccs_minimize_roundtrips: boolean, // Indicates whether network round-trips should be minimized as part of cross-cluster search requests execution - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. - * body: array, // (REQUIRED) The request definitions (metadata-search request definition pairs), separated by newlines + * index?: string|array, // A comma-separated list of index names to use as default + * search_type?: string, // Search operation type + * max_concurrent_searches?: int, // Controls the maximum number of concurrent searches the multi search api will execute + * typed_keys?: bool, // Specify whether aggregation and suggester names should be prefixed by their respective types in the response + * pre_filter_shard_size?: int, // A threshold that enforces a pre-filter roundtrip to prefilter search shards based on query rewriting if the 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. + * max_concurrent_shard_requests?: int, // The number of concurrent shard requests each sub search executes concurrently per node. This value should be used to limit the impact of the search on the cluster in order to limit the number of concurrent shard requests + * rest_total_hits_as_int?: bool, // Indicates whether hits.total should be rendered as an integer or an object in the rest search response + * ccs_minimize_roundtrips?: bool, // Indicates whether network round-trips should be minimized as part of cross-cluster search requests execution + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. + * body: string|array, // (REQUIRED) The request definitions (metadata-search request definition pairs), separated by newlines. If body is a string must be a valid JSON. * } $params * * @throws NoNodeAvailableException if all the hosts are offline @@ -1104,11 +1130,12 @@ public function mget(array $params = []) * * @return Elasticsearch|Promise */ - public function msearch(array $params = []) + public function msearch(?array $params = null) { + $params = $params ?? []; $this->checkRequiredParameters(['body'], $params); if (isset($params['index'])) { - $url = '/' . $this->encode($params['index']) . '/_msearch'; + $url = '/' . $this->encode($this->convertValue($params['index'])) . '/_msearch'; $method = empty($params['body']) ? 'GET' : 'POST'; } else { $url = '/_msearch'; @@ -1131,18 +1158,18 @@ public function msearch(array $params = []) * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/search-multi-search.html * * @param array{ - * index: list, // A comma-separated list of index names to use as default - * search_type: enum, // Search operation type - * typed_keys: boolean, // Specify whether aggregation and suggester names should be prefixed by their respective types in the response - * max_concurrent_searches: number, // Controls the maximum number of concurrent searches the multi search api will execute - * rest_total_hits_as_int: boolean, // Indicates whether hits.total should be rendered as an integer or an object in the rest search response - * ccs_minimize_roundtrips: boolean, // Indicates whether network round-trips should be minimized as part of cross-cluster search requests execution - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. - * body: array, // (REQUIRED) The request definitions (metadata-search request definition pairs), separated by newlines + * index?: string|array, // A comma-separated list of index names to use as default + * search_type?: string, // Search operation type + * typed_keys?: bool, // Specify whether aggregation and suggester names should be prefixed by their respective types in the response + * max_concurrent_searches?: int, // Controls the maximum number of concurrent searches the multi search api will execute + * rest_total_hits_as_int?: bool, // Indicates whether hits.total should be rendered as an integer or an object in the rest search response + * ccs_minimize_roundtrips?: bool, // Indicates whether network round-trips should be minimized as part of cross-cluster search requests execution + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. + * body: string|array, // (REQUIRED) The request definitions (metadata-search request definition pairs), separated by newlines. If body is a string must be a valid JSON. * } $params * * @throws NoNodeAvailableException if all the hosts are offline @@ -1151,11 +1178,12 @@ public function msearch(array $params = []) * * @return Elasticsearch|Promise */ - public function msearchTemplate(array $params = []) + public function msearchTemplate(?array $params = null) { + $params = $params ?? []; $this->checkRequiredParameters(['body'], $params); if (isset($params['index'])) { - $url = '/' . $this->encode($params['index']) . '/_msearch/template'; + $url = '/' . $this->encode($this->convertValue($params['index'])) . '/_msearch/template'; $method = empty($params['body']) ? 'GET' : 'POST'; } else { $url = '/_msearch/template'; @@ -1178,25 +1206,25 @@ public function msearchTemplate(array $params = []) * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/docs-multi-termvectors.html * * @param array{ - * index: string, // The index in which the document resides. - * ids: list, // A comma-separated list of documents ids. You must define ids as parameter or set "ids" or "docs" in the request body - * term_statistics: boolean, // Specifies if total term frequency and document frequency should be returned. Applies to all returned documents unless otherwise specified in body "params" or "docs". - * field_statistics: boolean, // Specifies if document count, sum of document frequencies and sum of total term frequencies should be returned. Applies to all returned documents unless otherwise specified in body "params" or "docs". - * fields: list, // A comma-separated list of fields to return. Applies to all returned documents unless otherwise specified in body "params" or "docs". - * offsets: boolean, // Specifies if term offsets should be returned. Applies to all returned documents unless otherwise specified in body "params" or "docs". - * positions: boolean, // Specifies if term positions should be returned. Applies to all returned documents unless otherwise specified in body "params" or "docs". - * payloads: boolean, // Specifies if term payloads should be returned. Applies to all returned documents unless otherwise specified in body "params" or "docs". - * preference: string, // 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". - * routing: string, // Specific routing value. Applies to all returned documents unless otherwise specified in body "params" or "docs". - * realtime: boolean, // Specifies if requests are real-time as opposed to near-real-time (default: true). - * version: number, // Explicit version number for concurrency control - * version_type: enum, // Specific version type - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. - * body: array, // Define ids, documents, parameters or a list of parameters per document here. You must at least provide a list of document ids. See documentation. + * index?: string, // The index in which the document resides. + * ids?: string|array, // A comma-separated list of documents ids. You must define ids as parameter or set "ids" or "docs" in the request body + * term_statistics?: bool, // Specifies if total term frequency and document frequency should be returned. Applies to all returned documents unless otherwise specified in body "params" or "docs". + * field_statistics?: bool, // Specifies if document count, sum of document frequencies and sum of total term frequencies should be returned. Applies to all returned documents unless otherwise specified in body "params" or "docs". + * fields?: string|array, // A comma-separated list of fields to return. Applies to all returned documents unless otherwise specified in body "params" or "docs". + * offsets?: bool, // Specifies if term offsets should be returned. Applies to all returned documents unless otherwise specified in body "params" or "docs". + * positions?: bool, // Specifies if term positions should be returned. Applies to all returned documents unless otherwise specified in body "params" or "docs". + * payloads?: bool, // Specifies if term payloads should be returned. Applies to all returned documents unless otherwise specified in body "params" or "docs". + * preference?: string, // 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". + * routing?: string, // Specific routing value. Applies to all returned documents unless otherwise specified in body "params" or "docs". + * realtime?: bool, // Specifies if requests are real-time as opposed to near-real-time (default: true). + * version?: int, // Explicit version number for concurrency control + * version_type?: string, // Specific version type + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. + * body?: string|array, // Define ids, documents, parameters or a list of parameters per document here. You must at least provide a list of document ids. See documentation.. If body is a string must be a valid JSON. * } $params * * @throws NoNodeAvailableException if all the hosts are offline @@ -1205,8 +1233,9 @@ public function msearchTemplate(array $params = []) * * @return Elasticsearch|Promise */ - public function mtermvectors(array $params = []) + public function mtermvectors(?array $params = null) { + $params = $params ?? []; if (isset($params['index'])) { $url = '/' . $this->encode($params['index']) . '/_mtermvectors'; $method = empty($params['body']) ? 'GET' : 'POST'; @@ -1231,18 +1260,19 @@ public function mtermvectors(array $params = []) * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/point-in-time-api.html * * @param array{ - * index: list, // (REQUIRED) A comma-separated list of index names to open point in time; use `_all` or empty string to perform the operation on all indices - * preference: string, // Specify the node or shard the operation should be performed on (default: random) - * routing: string, // Specific routing value - * ignore_unavailable: boolean, // Whether specified concrete indices should be ignored when unavailable (missing or closed) - * expand_wildcards: enum, // Whether to expand wildcard expression to concrete indices that are open, closed or both. - * keep_alive: string, // Specific the time to live for the point in time - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. - * body: array, // An index_filter specified with the Query DSL + * index: string|array, // (REQUIRED) A comma-separated list of index names to open point in time; use `_all` or empty string to perform the operation on all indices + * preference?: string, // Specify the node or shard the operation should be performed on (default: random) + * routing?: string, // Specific routing value + * ignore_unavailable?: bool, // Whether specified concrete indices should be ignored when unavailable (missing or closed) + * expand_wildcards?: string, // Whether to expand wildcard expression to concrete indices that are open, closed or both. + * keep_alive?: string, // Specific the time to live for the point in time + * allow_partial_search_results?: bool, // Specify whether to tolerate shards missing when creating the point-in-time, or otherwise throw an exception. (default: false) + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. + * body?: string|array, // An index_filter specified with the Query DSL. If body is a string must be a valid JSON. * } $params * * @throws MissingParameterException if a required parameter is missing @@ -1252,13 +1282,14 @@ public function mtermvectors(array $params = []) * * @return Elasticsearch|Promise */ - public function openPointInTime(array $params = []) + public function openPointInTime(?array $params = null) { + $params = $params ?? []; $this->checkRequiredParameters(['index','keep_alive'], $params); - $url = '/' . $this->encode($params['index']) . '/_pit'; + $url = '/' . $this->encode($this->convertValue($params['index'])) . '/_pit'; $method = 'POST'; - $url = $this->addQueryString($url, $params, ['preference','routing','ignore_unavailable','expand_wildcards','keep_alive','pretty','human','error_trace','source','filter_path']); + $url = $this->addQueryString($url, $params, ['preference','routing','ignore_unavailable','expand_wildcards','keep_alive','allow_partial_search_results','pretty','human','error_trace','source','filter_path']); $headers = [ 'Accept' => 'application/json', 'Content-Type' => 'application/json', @@ -1275,11 +1306,11 @@ public function openPointInTime(array $params = []) * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/index.html * * @param array{ - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. * } $params * * @throws NoNodeAvailableException if all the hosts are offline @@ -1288,8 +1319,9 @@ public function openPointInTime(array $params = []) * * @return Elasticsearch|Promise */ - public function ping(array $params = []) + public function ping(?array $params = null) { + $params = $params ?? []; $url = '/'; $method = 'HEAD'; @@ -1310,15 +1342,15 @@ public function ping(array $params = []) * * @param array{ * id: string, // (REQUIRED) Script ID - * context: string, // Script context - * timeout: time, // Explicit operation timeout - * master_timeout: time, // Specify timeout for connection to master - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. - * body: array, // (REQUIRED) The document + * context?: string, // Script context + * timeout?: int|string, // Explicit operation timeout + * master_timeout?: int|string, // Specify timeout for connection to master + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. + * body: string|array, // (REQUIRED) The document. If body is a string must be a valid JSON. * } $params * * @throws MissingParameterException if a required parameter is missing @@ -1328,8 +1360,9 @@ public function ping(array $params = []) * * @return Elasticsearch|Promise */ - public function putScript(array $params = []) + public function putScript(?array $params = null) { + $params = $params ?? []; $this->checkRequiredParameters(['id','body'], $params); if (isset($params['context'])) { $url = '/_scripts/' . $this->encode($params['id']) . '/' . $this->encode($params['context']); @@ -1355,17 +1388,17 @@ public function putScript(array $params = []) * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/search-rank-eval.html * * @param array{ - * index: list, // A comma-separated list of index names to search; use `_all` or empty string to perform the operation on all indices - * ignore_unavailable: boolean, // Whether specified concrete indices should be ignored when unavailable (missing or closed) - * allow_no_indices: boolean, // Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes `_all` string or when no indices have been specified) - * expand_wildcards: enum, // Whether to expand wildcard expression to concrete indices that are open, closed or both. - * search_type: enum, // Search operation type - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. - * body: array, // (REQUIRED) The ranking evaluation search definition, including search requests, document ratings and ranking metric definition. + * index?: string|array, // A comma-separated list of index names to search; use `_all` or empty string to perform the operation on all indices + * ignore_unavailable?: bool, // Whether specified concrete indices should be ignored when unavailable (missing or closed) + * allow_no_indices?: bool, // Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes `_all` string or when no indices have been specified) + * expand_wildcards?: string, // Whether to expand wildcard expression to concrete indices that are open, closed or both. + * search_type?: string, // Search operation type + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. + * body: string|array, // (REQUIRED) The ranking evaluation search definition, including search requests, document ratings and ranking metric definition.. If body is a string must be a valid JSON. * } $params * * @throws NoNodeAvailableException if all the hosts are offline @@ -1374,11 +1407,12 @@ public function putScript(array $params = []) * * @return Elasticsearch|Promise */ - public function rankEval(array $params = []) + public function rankEval(?array $params = null) { + $params = $params ?? []; $this->checkRequiredParameters(['body'], $params); if (isset($params['index'])) { - $url = '/' . $this->encode($params['index']) . '/_rank_eval'; + $url = '/' . $this->encode($this->convertValue($params['index'])) . '/_rank_eval'; $method = empty($params['body']) ? 'GET' : 'POST'; } else { $url = '/_rank_eval'; @@ -1403,20 +1437,20 @@ public function rankEval(array $params = []) * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/docs-reindex.html * * @param array{ - * refresh: boolean, // Should the affected indexes be refreshed? - * timeout: time, // Time each individual bulk request should wait for shards that are unavailable. - * wait_for_active_shards: string, // Sets the number of shard copies that must be active before proceeding with the reindex operation. Defaults to 1, meaning the primary shard only. Set to `all` for all shard copies, otherwise set to any non-negative value less than or equal to the total number of copies for the shard (number of replicas + 1) - * wait_for_completion: boolean, // Should the request should block until the reindex is complete. - * requests_per_second: number, // The throttle to set on this request in sub-requests per second. -1 means no throttle. - * scroll: time, // Control how long to keep the search context alive - * slices: number|string, // The number of slices this task should be divided into. Defaults to 1, meaning the task isn't sliced into subtasks. Can be set to `auto`. - * max_docs: number, // Maximum number of documents to process (default: all documents) - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. - * body: array, // (REQUIRED) The search definition using the Query DSL and the prototype for the index request. + * refresh?: bool, // Should the affected indexes be refreshed? + * timeout?: int|string, // Time each individual bulk request should wait for shards that are unavailable. + * wait_for_active_shards?: string, // Sets the number of shard copies that must be active before proceeding with the reindex operation. Defaults to 1, meaning the primary shard only. Set to `all` for all shard copies, otherwise set to any non-negative value less than or equal to the total number of copies for the shard (number of replicas + 1) + * wait_for_completion?: bool, // Should the request should block until the reindex is complete. + * requests_per_second?: int, // The throttle to set on this request in sub-requests per second. -1 means no throttle. + * scroll?: int|string, // Control how long to keep the search context alive + * slices?: int|string, // The number of slices this task should be divided into. Defaults to 1, meaning the task isn't sliced into subtasks. Can be set to `auto`. + * max_docs?: int, // Maximum number of documents to process (default: all documents) + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. + * body: string|array, // (REQUIRED) The search definition using the Query DSL and the prototype for the index request.. If body is a string must be a valid JSON. * } $params * * @throws NoNodeAvailableException if all the hosts are offline @@ -1425,8 +1459,9 @@ public function rankEval(array $params = []) * * @return Elasticsearch|Promise */ - public function reindex(array $params = []) + public function reindex(?array $params = null) { + $params = $params ?? []; $this->checkRequiredParameters(['body'], $params); $url = '/_reindex'; $method = 'POST'; @@ -1449,12 +1484,12 @@ public function reindex(array $params = []) * * @param array{ * task_id: string, // (REQUIRED) The task id to rethrottle - * requests_per_second: number, // The throttle to set on this request in floating sub-requests per second. -1 means set no throttle. - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. + * requests_per_second?: int, // The throttle to set on this request in floating sub-requests per second. -1 means set no throttle. + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. * } $params * * @throws MissingParameterException if a required parameter is missing @@ -1464,8 +1499,9 @@ public function reindex(array $params = []) * * @return Elasticsearch|Promise */ - public function reindexRethrottle(array $params = []) + public function reindexRethrottle(?array $params = null) { + $params = $params ?? []; $this->checkRequiredParameters(['task_id','requests_per_second'], $params); $url = '/_reindex/' . $this->encode($params['task_id']) . '/_rethrottle'; $method = 'POST'; @@ -1486,13 +1522,13 @@ public function reindexRethrottle(array $params = []) * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/render-search-template-api.html * * @param array{ - * id: string, // The id of the stored search template - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. - * body: array, // The search definition template and its params + * id?: string, // The id of the stored search template + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. + * body?: string|array, // The search definition template and its params. If body is a string must be a valid JSON. * } $params * * @throws NoNodeAvailableException if all the hosts are offline @@ -1501,8 +1537,9 @@ public function reindexRethrottle(array $params = []) * * @return Elasticsearch|Promise */ - public function renderSearchTemplate(array $params = []) + public function renderSearchTemplate(?array $params = null) { + $params = $params ?? []; if (isset($params['id'])) { $url = '/_render/template/' . $this->encode($params['id']); $method = empty($params['body']) ? 'GET' : 'POST'; @@ -1528,12 +1565,12 @@ public function renderSearchTemplate(array $params = []) * @internal This API is EXPERIMENTAL and may be changed or removed completely in a future release * * @param array{ - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. - * body: array, // The script to execute + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. + * body?: string|array, // The script to execute. If body is a string must be a valid JSON. * } $params * * @throws NoNodeAvailableException if all the hosts are offline @@ -1542,8 +1579,9 @@ public function renderSearchTemplate(array $params = []) * * @return Elasticsearch|Promise */ - public function scriptsPainlessExecute(array $params = []) + public function scriptsPainlessExecute(?array $params = null) { + $params = $params ?? []; $url = '/_scripts/painless/_execute'; $method = empty($params['body']) ? 'GET' : 'POST'; @@ -1564,15 +1602,15 @@ public function scriptsPainlessExecute(array $params = []) * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/search-request-body.html#request-body-search-scroll * * @param array{ - * scroll_id: string, // The scroll ID - * scroll: time, // Specify how long a consistent view of the index should be maintained for scrolled search - * rest_total_hits_as_int: boolean, // Indicates whether hits.total should be rendered as an integer or an object in the rest search response - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. - * body: array, // The scroll ID if not passed by URL or query parameter. + * scroll_id?: string, // The scroll ID + * scroll?: int|string, // Specify how long a consistent view of the index should be maintained for scrolled search + * rest_total_hits_as_int?: bool, // Indicates whether hits.total should be rendered as an integer or an object in the rest search response + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. + * body?: string|array, // The scroll ID if not passed by URL or query parameter.. If body is a string must be a valid JSON. * } $params * * @throws NoNodeAvailableException if all the hosts are offline @@ -1581,8 +1619,9 @@ public function scriptsPainlessExecute(array $params = []) * * @return Elasticsearch|Promise */ - public function scroll(array $params = []) + public function scroll(?array $params = null) { + $params = $params ?? []; if (isset($params['scroll_id'])) { $url = '/_search/scroll/' . $this->encode($params['scroll_id']); $method = empty($params['body']) ? 'GET' : 'POST'; @@ -1607,58 +1646,58 @@ public function scroll(array $params = []) * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/search-search.html * * @param array{ - * index: list, // A comma-separated list of index names to search; use `_all` or empty string to perform the operation on all indices - * analyzer: string, // The analyzer to use for the query string - * analyze_wildcard: boolean, // Specify whether wildcard and prefix queries should be analyzed (default: false) - * ccs_minimize_roundtrips: boolean, // Indicates whether network round-trips should be minimized as part of cross-cluster search requests execution - * default_operator: enum, // The default operator for query string query (AND or OR) - * df: string, // The field to use as default where no field prefix is given in the query string - * explain: boolean, // Specify whether to return detailed information about score computation as part of a hit - * stored_fields: list, // A comma-separated list of stored fields to return as part of a hit - * docvalue_fields: list, // A comma-separated list of fields to return as the docvalue representation of a field for each hit - * from: number, // Starting offset (default: 0) - * force_synthetic_source: boolean, // Should this request force synthetic _source? Use this to test if the mapping supports synthetic _source and to get a sense of the worst case performance. Fetches with this enabled will be slower the enabling synthetic source natively in the index. - * ignore_unavailable: boolean, // Whether specified concrete indices should be ignored when unavailable (missing or closed) - * ignore_throttled: boolean, // Whether specified concrete, expanded or aliased indices should be ignored when throttled - * allow_no_indices: boolean, // Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes `_all` string or when no indices have been specified) - * expand_wildcards: enum, // Whether to expand wildcard expression to concrete indices that are open, closed or both. - * lenient: boolean, // Specify whether format-based query failures (such as providing text to a numeric field) should be ignored - * preference: string, // Specify the node or shard the operation should be performed on (default: random) - * q: string, // Query in the Lucene query string syntax - * routing: list, // A comma-separated list of specific routing values - * scroll: time, // Specify how long a consistent view of the index should be maintained for scrolled search - * search_type: enum, // Search operation type - * size: number, // Number of hits to return (default: 10) - * sort: list, // A comma-separated list of : pairs - * _source: list, // True or false to return the _source field or not, or a list of fields to return - * _source_excludes: list, // A list of fields to exclude from the returned _source field - * _source_includes: list, // A list of fields to extract and return from the _source field - * terminate_after: number, // The maximum number of documents to collect for each shard, upon reaching which the query execution will terminate early. - * stats: list, // Specific 'tag' of the request for logging and statistical purposes - * suggest_field: string, // Specify which field to use for suggestions - * suggest_mode: enum, // Specify suggest mode - * suggest_size: number, // How many suggestions to return in response - * suggest_text: string, // The source text for which the suggestions should be returned - * timeout: time, // Explicit operation timeout - * track_scores: boolean, // Whether to calculate and return scores even if they are not used for sorting - * track_total_hits: boolean|long, // Indicate if the number of documents that match the query should be tracked. A number can also be specified, to accurately track the total hit count up to the number. - * allow_partial_search_results: boolean, // Indicate if an error should be returned if there is a partial search failure or timeout - * typed_keys: boolean, // Specify whether aggregation and suggester names should be prefixed by their respective types in the response - * version: boolean, // Specify whether to return document version as part of a hit - * seq_no_primary_term: boolean, // Specify whether to return sequence number and primary term of the last modification of each hit - * request_cache: boolean, // Specify if request cache should be used for this request or not, defaults to index level setting - * batched_reduce_size: number, // The number of shard results that should be reduced at once on the coordinating node. This value should be used as a protection mechanism to reduce the memory overhead per search request if the potential number of shards in the request can be large. - * max_concurrent_shard_requests: number, // The number of concurrent shard requests per node this search executes concurrently. This value should be used to limit the impact of the search on the cluster in order to limit the number of concurrent shard requests - * pre_filter_shard_size: number, // A threshold that enforces a pre-filter roundtrip to prefilter search shards based on query rewriting if the 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. - * rest_total_hits_as_int: boolean, // Indicates whether hits.total should be rendered as an integer or an object in the rest search response - * min_compatible_shard_node: string, // The minimum compatible version that all shards involved in search should have for this request to be successful - * include_named_queries_score: boolean, // Indicates whether hit.matched_queries should be rendered as a map that includes the name of the matched query associated with its score (true) or as an array containing the name of the matched queries (false) - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. - * body: array, // The search definition using the Query DSL + * index?: string|array, // A comma-separated list of index names to search; use `_all` or empty string to perform the operation on all indices + * analyzer?: string, // The analyzer to use for the query string + * analyze_wildcard?: bool, // Specify whether wildcard and prefix queries should be analyzed (default: false) + * ccs_minimize_roundtrips?: bool, // Indicates whether network round-trips should be minimized as part of cross-cluster search requests execution + * default_operator?: string, // The default operator for query string query (AND or OR) + * df?: string, // The field to use as default where no field prefix is given in the query string + * explain?: bool, // Specify whether to return detailed information about score computation as part of a hit + * stored_fields?: string|array, // A comma-separated list of stored fields to return as part of a hit + * docvalue_fields?: string|array, // A comma-separated list of fields to return as the docvalue representation of a field for each hit + * from?: int, // Starting offset (default: 0) + * force_synthetic_source?: bool, // Should this request force synthetic _source? Use this to test if the mapping supports synthetic _source and to get a sense of the worst case performance. Fetches with this enabled will be slower the enabling synthetic source natively in the index. + * ignore_unavailable?: bool, // Whether specified concrete indices should be ignored when unavailable (missing or closed) + * ignore_throttled?: bool, // Whether specified concrete, expanded or aliased indices should be ignored when throttled + * allow_no_indices?: bool, // Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes `_all` string or when no indices have been specified) + * expand_wildcards?: string, // Whether to expand wildcard expression to concrete indices that are open, closed or both. + * lenient?: bool, // Specify whether format-based query failures (such as providing text to a numeric field) should be ignored + * preference?: string, // Specify the node or shard the operation should be performed on (default: random) + * q?: string, // Query in the Lucene query string syntax + * routing?: string|array, // A comma-separated list of specific routing values + * scroll?: int|string, // Specify how long a consistent view of the index should be maintained for scrolled search + * search_type?: string, // Search operation type + * size?: int, // Number of hits to return (default: 10) + * sort?: string|array, // A comma-separated list of : pairs + * _source?: string|array, // True or false to return the _source field or not, or a list of fields to return + * _source_excludes?: string|array, // A list of fields to exclude from the returned _source field + * _source_includes?: string|array, // A list of fields to extract and return from the _source field + * terminate_after?: int, // The maximum number of documents to collect for each shard, upon reaching which the query execution will terminate early. + * stats?: string|array, // Specific 'tag' of the request for logging and statistical purposes + * suggest_field?: string, // Specify which field to use for suggestions + * suggest_mode?: string, // Specify suggest mode + * suggest_size?: int, // How many suggestions to return in response + * suggest_text?: string, // The source text for which the suggestions should be returned + * timeout?: int|string, // Explicit operation timeout + * track_scores?: bool, // Whether to calculate and return scores even if they are not used for sorting + * track_total_hits?: bool|int, // Indicate if the number of documents that match the query should be tracked. A number can also be specified, to accurately track the total hit count up to the number. + * allow_partial_search_results?: bool, // Indicate if an error should be returned if there is a partial search failure or timeout + * typed_keys?: bool, // Specify whether aggregation and suggester names should be prefixed by their respective types in the response + * version?: bool, // Specify whether to return document version as part of a hit + * seq_no_primary_term?: bool, // Specify whether to return sequence number and primary term of the last modification of each hit + * request_cache?: bool, // Specify if request cache should be used for this request or not, defaults to index level setting + * batched_reduce_size?: int, // The number of shard results that should be reduced at once on the coordinating node. This value should be used as a protection mechanism to reduce the memory overhead per search request if the potential number of shards in the request can be large. + * max_concurrent_shard_requests?: int, // The number of concurrent shard requests per node this search executes concurrently. This value should be used to limit the impact of the search on the cluster in order to limit the number of concurrent shard requests + * pre_filter_shard_size?: int, // A threshold that enforces a pre-filter roundtrip to prefilter search shards based on query rewriting if the 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. + * rest_total_hits_as_int?: bool, // Indicates whether hits.total should be rendered as an integer or an object in the rest search response + * min_compatible_shard_node?: string, // The minimum compatible version that all shards involved in search should have for this request to be successful + * include_named_queries_score?: bool, // Indicates whether hit.matched_queries should be rendered as a map that includes the name of the matched query associated with its score (true) or as an array containing the name of the matched queries (false) + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. + * body?: string|array, // The search definition using the Query DSL. If body is a string must be a valid JSON. * } $params * * @throws NoNodeAvailableException if all the hosts are offline @@ -1667,10 +1706,11 @@ public function scroll(array $params = []) * * @return Elasticsearch|Promise */ - public function search(array $params = []) + public function search(?array $params = null) { + $params = $params ?? []; if (isset($params['index'])) { - $url = '/' . $this->encode($params['index']) . '/_search'; + $url = '/' . $this->encode($this->convertValue($params['index'])) . '/_search'; $method = empty($params['body']) ? 'GET' : 'POST'; } else { $url = '/_search'; @@ -1694,24 +1734,24 @@ public function search(array $params = []) * @internal This API is EXPERIMENTAL and may be changed or removed completely in a future release * * @param array{ - * index: list, // (REQUIRED) Comma-separated list of data streams, indices, or aliases to search + * index: string|array, // (REQUIRED) Comma-separated list of data streams, indices, or aliases to search * field: string, // (REQUIRED) Field containing geospatial data to return * zoom: int, // (REQUIRED) Zoom level for the vector tile to search * x: int, // (REQUIRED) X coordinate for the vector tile to search * y: int, // (REQUIRED) Y coordinate for the vector tile to search - * exact_bounds: boolean, // If false, the meta layer's feature is the bounding box of the tile. If true, the meta layer's feature is a bounding box resulting from a `geo_bounds` aggregation. - * extent: int, // Size, in pixels, of a side of the vector tile. - * grid_precision: int, // Additional zoom levels available through the aggs layer. Accepts 0-8. - * grid_type: enum, // Determines the geometry type for features in the aggs layer. - * size: int, // Maximum number of features to return in the hits layer. Accepts 0-10000. - * track_total_hits: boolean|long, // Indicate if the number of documents that match the query should be tracked. A number can also be specified, to accurately track the total hit count up to the number. - * with_labels: boolean, // If true, the hits and aggs layers will contain additional point features with suggested label positions for the original features. - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. - * body: array, // Search request body. + * exact_bounds?: bool, // If false, the meta layer's feature is the bounding box of the tile. If true, the meta layer's feature is a bounding box resulting from a `geo_bounds` aggregation. + * extent?: int, // Size, in pixels, of a side of the vector tile. + * grid_precision?: int, // Additional zoom levels available through the aggs layer. Accepts 0-8. + * grid_type?: string, // Determines the geometry type for features in the aggs layer. + * size?: int, // Maximum number of features to return in the hits layer. Accepts 0-10000. + * track_total_hits?: bool|int, // Indicate if the number of documents that match the query should be tracked. A number can also be specified, to accurately track the total hit count up to the number. + * with_labels?: bool, // If true, the hits and aggs layers will contain additional point features with suggested label positions for the original features. + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. + * body?: string|array, // Search request body.. If body is a string must be a valid JSON. * } $params * * @throws MissingParameterException if a required parameter is missing @@ -1721,10 +1761,11 @@ public function search(array $params = []) * * @return Elasticsearch|Promise */ - public function searchMvt(array $params = []) + public function searchMvt(?array $params = null) { + $params = $params ?? []; $this->checkRequiredParameters(['index','field','zoom','x','y'], $params); - $url = '/' . $this->encode($params['index']) . '/_mvt/' . $this->encode($params['field']) . '/' . $this->encode($params['zoom']) . '/' . $this->encode($params['x']) . '/' . $this->encode($params['y']); + $url = '/' . $this->encode($this->convertValue($params['index'])) . '/_mvt/' . $this->encode($params['field']) . '/' . $this->encode($params['zoom']) . '/' . $this->encode($params['x']) . '/' . $this->encode($params['y']); $method = empty($params['body']) ? 'GET' : 'POST'; $url = $this->addQueryString($url, $params, ['exact_bounds','extent','grid_precision','grid_type','size','track_total_hits','with_labels','pretty','human','error_trace','source','filter_path']); @@ -1744,18 +1785,19 @@ public function searchMvt(array $params = []) * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/search-shards.html * * @param array{ - * index: list, // A comma-separated list of index names to search; use `_all` or empty string to perform the operation on all indices - * preference: string, // Specify the node or shard the operation should be performed on (default: random) - * routing: string, // Specific routing value - * local: boolean, // Return local information, do not retrieve the state from master node (default: false) - * ignore_unavailable: boolean, // Whether specified concrete indices should be ignored when unavailable (missing or closed) - * allow_no_indices: boolean, // Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes `_all` string or when no indices have been specified) - * expand_wildcards: enum, // Whether to expand wildcard expression to concrete indices that are open, closed or both. - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. + * index?: string|array, // A comma-separated list of index names to search; use `_all` or empty string to perform the operation on all indices + * preference?: string, // Specify the node or shard the operation should be performed on (default: random) + * routing?: string, // Specific routing value + * local?: bool, // Return local information, do not retrieve the state from master node (default: false) + * ignore_unavailable?: bool, // Whether specified concrete indices should be ignored when unavailable (missing or closed) + * allow_no_indices?: bool, // Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes `_all` string or when no indices have been specified) + * expand_wildcards?: string, // Whether to expand wildcard expression to concrete indices that are open, closed or both. + * master_timeout?: int|string, // Explicit operation timeout for connection to master node + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. * } $params * * @throws NoNodeAvailableException if all the hosts are offline @@ -1764,16 +1806,17 @@ public function searchMvt(array $params = []) * * @return Elasticsearch|Promise */ - public function searchShards(array $params = []) + public function searchShards(?array $params = null) { + $params = $params ?? []; if (isset($params['index'])) { - $url = '/' . $this->encode($params['index']) . '/_search_shards'; - $method = empty($params['body']) ? 'GET' : 'POST'; + $url = '/' . $this->encode($this->convertValue($params['index'])) . '/_search_shards'; + $method = 'GET'; } else { $url = '/_search_shards'; - $method = empty($params['body']) ? 'GET' : 'POST'; + $method = 'GET'; } - $url = $this->addQueryString($url, $params, ['preference','routing','local','ignore_unavailable','allow_no_indices','expand_wildcards','pretty','human','error_trace','source','filter_path']); + $url = $this->addQueryString($url, $params, ['preference','routing','local','ignore_unavailable','allow_no_indices','expand_wildcards','master_timeout','pretty','human','error_trace','source','filter_path']); $headers = [ 'Accept' => 'application/json', ]; @@ -1789,26 +1832,26 @@ public function searchShards(array $params = []) * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/search-template.html * * @param array{ - * index: list, // A comma-separated list of index names to search; use `_all` or empty string to perform the operation on all indices - * ignore_unavailable: boolean, // Whether specified concrete indices should be ignored when unavailable (missing or closed) - * ignore_throttled: boolean, // Whether specified concrete, expanded or aliased indices should be ignored when throttled - * allow_no_indices: boolean, // Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes `_all` string or when no indices have been specified) - * expand_wildcards: enum, // Whether to expand wildcard expression to concrete indices that are open, closed or both. - * preference: string, // Specify the node or shard the operation should be performed on (default: random) - * routing: list, // A comma-separated list of specific routing values - * scroll: time, // Specify how long a consistent view of the index should be maintained for scrolled search - * search_type: enum, // Search operation type - * explain: boolean, // Specify whether to return detailed information about score computation as part of a hit - * profile: boolean, // Specify whether to profile the query execution - * typed_keys: boolean, // Specify whether aggregation and suggester names should be prefixed by their respective types in the response - * rest_total_hits_as_int: boolean, // Indicates whether hits.total should be rendered as an integer or an object in the rest search response - * ccs_minimize_roundtrips: boolean, // Indicates whether network round-trips should be minimized as part of cross-cluster search requests execution - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. - * body: array, // (REQUIRED) The search definition template and its params + * index?: string|array, // A comma-separated list of index names to search; use `_all` or empty string to perform the operation on all indices + * ignore_unavailable?: bool, // Whether specified concrete indices should be ignored when unavailable (missing or closed) + * ignore_throttled?: bool, // Whether specified concrete, expanded or aliased indices should be ignored when throttled + * allow_no_indices?: bool, // Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes `_all` string or when no indices have been specified) + * expand_wildcards?: string, // Whether to expand wildcard expression to concrete indices that are open, closed or both. + * preference?: string, // Specify the node or shard the operation should be performed on (default: random) + * routing?: string|array, // A comma-separated list of specific routing values + * scroll?: int|string, // Specify how long a consistent view of the index should be maintained for scrolled search + * search_type?: string, // Search operation type + * explain?: bool, // Specify whether to return detailed information about score computation as part of a hit + * profile?: bool, // Specify whether to profile the query execution + * typed_keys?: bool, // Specify whether aggregation and suggester names should be prefixed by their respective types in the response + * rest_total_hits_as_int?: bool, // Indicates whether hits.total should be rendered as an integer or an object in the rest search response + * ccs_minimize_roundtrips?: bool, // Indicates whether network round-trips should be minimized as part of cross-cluster search requests execution + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. + * body: string|array, // (REQUIRED) The search definition template and its params. If body is a string must be a valid JSON. * } $params * * @throws NoNodeAvailableException if all the hosts are offline @@ -1817,11 +1860,12 @@ public function searchShards(array $params = []) * * @return Elasticsearch|Promise */ - public function searchTemplate(array $params = []) + public function searchTemplate(?array $params = null) { + $params = $params ?? []; $this->checkRequiredParameters(['body'], $params); if (isset($params['index'])) { - $url = '/' . $this->encode($params['index']) . '/_search/template'; + $url = '/' . $this->encode($this->convertValue($params['index'])) . '/_search/template'; $method = empty($params['body']) ? 'GET' : 'POST'; } else { $url = '/_search/template'; @@ -1844,13 +1888,13 @@ public function searchTemplate(array $params = []) * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/search-terms-enum.html * * @param array{ - * index: list, // (REQUIRED) A comma-separated list of index names to search; use `_all` or empty string to perform the operation on all indices - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. - * body: array, // field name, string which is the prefix expected in matching terms, timeout and size for max number of results + * index: string|array, // (REQUIRED) A comma-separated list of index names to search; use `_all` or empty string to perform the operation on all indices + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. + * body?: string|array, // field name, string which is the prefix expected in matching terms, timeout and size for max number of results. If body is a string must be a valid JSON. * } $params * * @throws MissingParameterException if a required parameter is missing @@ -1860,10 +1904,11 @@ public function searchTemplate(array $params = []) * * @return Elasticsearch|Promise */ - public function termsEnum(array $params = []) + public function termsEnum(?array $params = null) { + $params = $params ?? []; $this->checkRequiredParameters(['index'], $params); - $url = '/' . $this->encode($params['index']) . '/_terms_enum'; + $url = '/' . $this->encode($this->convertValue($params['index'])) . '/_terms_enum'; $method = empty($params['body']) ? 'GET' : 'POST'; $url = $this->addQueryString($url, $params, ['pretty','human','error_trace','source','filter_path']); @@ -1884,24 +1929,24 @@ public function termsEnum(array $params = []) * * @param array{ * index: string, // (REQUIRED) The index in which the document resides. - * id: string, // The id of the document, when not specified a doc param should be supplied. - * term_statistics: boolean, // Specifies if total term frequency and document frequency should be returned. - * field_statistics: boolean, // Specifies if document count, sum of document frequencies and sum of total term frequencies should be returned. - * fields: list, // A comma-separated list of fields to return. - * offsets: boolean, // Specifies if term offsets should be returned. - * positions: boolean, // Specifies if term positions should be returned. - * payloads: boolean, // Specifies if term payloads should be returned. - * preference: string, // Specify the node or shard the operation should be performed on (default: random). - * routing: string, // Specific routing value. - * realtime: boolean, // Specifies if request is real-time as opposed to near-real-time (default: true). - * version: number, // Explicit version number for concurrency control - * version_type: enum, // Specific version type - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. - * body: array, // Define parameters and or supply a document to get termvectors for. See documentation. + * id?: string, // The id of the document, when not specified a doc param should be supplied. + * term_statistics?: bool, // Specifies if total term frequency and document frequency should be returned. + * field_statistics?: bool, // Specifies if document count, sum of document frequencies and sum of total term frequencies should be returned. + * fields?: string|array, // A comma-separated list of fields to return. + * offsets?: bool, // Specifies if term offsets should be returned. + * positions?: bool, // Specifies if term positions should be returned. + * payloads?: bool, // Specifies if term payloads should be returned. + * preference?: string, // Specify the node or shard the operation should be performed on (default: random). + * routing?: string, // Specific routing value. + * realtime?: bool, // Specifies if request is real-time as opposed to near-real-time (default: true). + * version?: int, // Explicit version number for concurrency control + * version_type?: string, // Specific version type + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. + * body?: string|array, // Define parameters and or supply a document to get termvectors for. See documentation.. If body is a string must be a valid JSON. * } $params * * @throws MissingParameterException if a required parameter is missing @@ -1911,8 +1956,9 @@ public function termsEnum(array $params = []) * * @return Elasticsearch|Promise */ - public function termvectors(array $params = []) + public function termvectors(?array $params = null) { + $params = $params ?? []; $this->checkRequiredParameters(['index'], $params); if (isset($params['id'])) { $url = '/' . $this->encode($params['index']) . '/_termvectors/' . $this->encode($params['id']); @@ -1940,24 +1986,25 @@ public function termvectors(array $params = []) * @param array{ * id: string, // (REQUIRED) Document ID * index: string, // (REQUIRED) The name of the index - * wait_for_active_shards: string, // Sets the number of shard copies that must be active before proceeding with the update operation. Defaults to 1, meaning the primary shard only. Set to `all` for all shard copies, otherwise set to any non-negative value less than or equal to the total number of copies for the shard (number of replicas + 1) - * _source: list, // True or false to return the _source field or not, or a list of fields to return - * _source_excludes: list, // A list of fields to exclude from the returned _source field - * _source_includes: list, // A list of fields to extract and return from the _source field - * lang: string, // The script language (default: painless) - * refresh: enum, // 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. - * retry_on_conflict: number, // Specify how many times should the operation be retried when a conflict occurs (default: 0) - * routing: string, // Specific routing value - * timeout: time, // Explicit operation timeout - * if_seq_no: number, // only perform the update operation if the last operation that has changed the document has the specified sequence number - * if_primary_term: number, // only perform the update operation if the last operation that has changed the document has the specified primary term - * require_alias: boolean, // When true, requires destination is an alias. Default is false - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. - * body: array, // (REQUIRED) The request definition requires either `script` or partial `doc` + * wait_for_active_shards?: string, // Sets the number of shard copies that must be active before proceeding with the update operation. Defaults to 1, meaning the primary shard only. Set to `all` for all shard copies, otherwise set to any non-negative value less than or equal to the total number of copies for the shard (number of replicas + 1) + * _source?: string|array, // True or false to return the _source field or not, or a list of fields to return + * _source_excludes?: string|array, // A list of fields to exclude from the returned _source field + * _source_includes?: string|array, // A list of fields to extract and return from the _source field + * lang?: string, // The script language (default: painless) + * refresh?: string, // 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. + * retry_on_conflict?: int, // Specify how many times should the operation be retried when a conflict occurs (default: 0) + * routing?: string, // Specific routing value + * timeout?: int|string, // Explicit operation timeout + * if_seq_no?: int, // only perform the update operation if the last operation that has changed the document has the specified sequence number + * if_primary_term?: int, // only perform the update operation if the last operation that has changed the document has the specified primary term + * require_alias?: bool, // When true, requires destination is an alias. Default is false + * include_source_on_error?: bool, // True or false if to include the document source in the error message in case of parsing errors. Defaults to true. + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. + * body: string|array, // (REQUIRED) The request definition requires either `script` or partial `doc`. If body is a string must be a valid JSON. * } $params * * @throws MissingParameterException if a required parameter is missing @@ -1967,13 +2014,14 @@ public function termvectors(array $params = []) * * @return Elasticsearch|Promise */ - public function update(array $params = []) + public function update(?array $params = null) { + $params = $params ?? []; $this->checkRequiredParameters(['id','index','body'], $params); $url = '/' . $this->encode($params['index']) . '/_update/' . $this->encode($params['id']); $method = 'POST'; - $url = $this->addQueryString($url, $params, ['wait_for_active_shards','_source','_source_excludes','_source_includes','lang','refresh','retry_on_conflict','routing','timeout','if_seq_no','if_primary_term','require_alias','pretty','human','error_trace','source','filter_path']); + $url = $this->addQueryString($url, $params, ['wait_for_active_shards','_source','_source_excludes','_source_includes','lang','refresh','retry_on_conflict','routing','timeout','if_seq_no','if_primary_term','require_alias','include_source_on_error','pretty','human','error_trace','source','filter_path']); $headers = [ 'Accept' => 'application/json', 'Content-Type' => 'application/json', @@ -1991,44 +2039,44 @@ public function update(array $params = []) * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/docs-update-by-query.html * * @param array{ - * index: list, // (REQUIRED) A comma-separated list of index names to search; use `_all` or empty string to perform the operation on all indices - * analyzer: string, // The analyzer to use for the query string - * analyze_wildcard: boolean, // Specify whether wildcard and prefix queries should be analyzed (default: false) - * default_operator: enum, // The default operator for query string query (AND or OR) - * df: string, // The field to use as default where no field prefix is given in the query string - * from: number, // Starting offset (default: 0) - * ignore_unavailable: boolean, // Whether specified concrete indices should be ignored when unavailable (missing or closed) - * allow_no_indices: boolean, // Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes `_all` string or when no indices have been specified) - * conflicts: enum, // What to do when the update by query hits version conflicts? - * expand_wildcards: enum, // Whether to expand wildcard expression to concrete indices that are open, closed or both. - * lenient: boolean, // Specify whether format-based query failures (such as providing text to a numeric field) should be ignored - * pipeline: string, // Ingest pipeline to set on index requests made by this action. (default: none) - * preference: string, // Specify the node or shard the operation should be performed on (default: random) - * q: string, // Query in the Lucene query string syntax - * routing: list, // A comma-separated list of specific routing values - * scroll: time, // Specify how long a consistent view of the index should be maintained for scrolled search - * search_type: enum, // Search operation type - * search_timeout: time, // Explicit timeout for each search request. Defaults to no timeout. - * max_docs: number, // Maximum number of documents to process (default: all documents) - * sort: list, // A comma-separated list of : pairs - * terminate_after: number, // The maximum number of documents to collect for each shard, upon reaching which the query execution will terminate early. - * stats: list, // Specific 'tag' of the request for logging and statistical purposes - * version: boolean, // Specify whether to return document version as part of a hit - * version_type: boolean, // Should the document increment the version number (internal) on hit or not (reindex) - * request_cache: boolean, // Specify if request cache should be used for this request or not, defaults to index level setting - * refresh: boolean, // Should the affected indexes be refreshed? - * timeout: time, // Time each individual bulk request should wait for shards that are unavailable. - * wait_for_active_shards: string, // Sets the number of shard copies that must be active before proceeding with the update by query operation. Defaults to 1, meaning the primary shard only. Set to `all` for all shard copies, otherwise set to any non-negative value less than or equal to the total number of copies for the shard (number of replicas + 1) - * scroll_size: number, // Size on the scroll request powering the update by query - * wait_for_completion: boolean, // Should the request should block until the update by query operation is complete. - * requests_per_second: number, // The throttle to set on this request in sub-requests per second. -1 means no throttle. - * slices: number|string, // The number of slices this task should be divided into. Defaults to 1, meaning the task isn't sliced into subtasks. Can be set to `auto`. - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. - * body: array, // The search definition using the Query DSL + * index: string|array, // (REQUIRED) A comma-separated list of index names to search; use `_all` or empty string to perform the operation on all indices + * analyzer?: string, // The analyzer to use for the query string + * analyze_wildcard?: bool, // Specify whether wildcard and prefix queries should be analyzed (default: false) + * default_operator?: string, // The default operator for query string query (AND or OR) + * df?: string, // The field to use as default where no field prefix is given in the query string + * from?: int, // Starting offset (default: 0) + * ignore_unavailable?: bool, // Whether specified concrete indices should be ignored when unavailable (missing or closed) + * allow_no_indices?: bool, // Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes `_all` string or when no indices have been specified) + * conflicts?: string, // What to do when the update by query hits version conflicts? + * expand_wildcards?: string, // Whether to expand wildcard expression to concrete indices that are open, closed or both. + * lenient?: bool, // Specify whether format-based query failures (such as providing text to a numeric field) should be ignored + * pipeline?: string, // Ingest pipeline to set on index requests made by this action. (default: none) + * preference?: string, // Specify the node or shard the operation should be performed on (default: random) + * q?: string, // Query in the Lucene query string syntax + * routing?: string|array, // A comma-separated list of specific routing values + * scroll?: int|string, // Specify how long a consistent view of the index should be maintained for scrolled search + * search_type?: string, // Search operation type + * search_timeout?: int|string, // Explicit timeout for each search request. Defaults to no timeout. + * max_docs?: int, // Maximum number of documents to process (default: all documents) + * sort?: string|array, // A comma-separated list of : pairs + * terminate_after?: int, // The maximum number of documents to collect for each shard, upon reaching which the query execution will terminate early. + * stats?: string|array, // Specific 'tag' of the request for logging and statistical purposes + * version?: bool, // Specify whether to return document version as part of a hit + * version_type?: bool, // Should the document increment the version number (internal) on hit or not (reindex) + * request_cache?: bool, // Specify if request cache should be used for this request or not, defaults to index level setting + * refresh?: bool, // Should the affected indexes be refreshed? + * timeout?: int|string, // Time each individual bulk request should wait for shards that are unavailable. + * wait_for_active_shards?: string, // Sets the number of shard copies that must be active before proceeding with the update by query operation. Defaults to 1, meaning the primary shard only. Set to `all` for all shard copies, otherwise set to any non-negative value less than or equal to the total number of copies for the shard (number of replicas + 1) + * scroll_size?: int, // Size on the scroll request powering the update by query + * wait_for_completion?: bool, // Should the request should block until the update by query operation is complete. + * requests_per_second?: int, // The throttle to set on this request in sub-requests per second. -1 means no throttle. + * slices?: int|string, // The number of slices this task should be divided into. Defaults to 1, meaning the task isn't sliced into subtasks. Can be set to `auto`. + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. + * body?: string|array, // The search definition using the Query DSL. If body is a string must be a valid JSON. * } $params * * @throws MissingParameterException if a required parameter is missing @@ -2038,10 +2086,11 @@ public function update(array $params = []) * * @return Elasticsearch|Promise */ - public function updateByQuery(array $params = []) + public function updateByQuery(?array $params = null) { + $params = $params ?? []; $this->checkRequiredParameters(['index'], $params); - $url = '/' . $this->encode($params['index']) . '/_update_by_query'; + $url = '/' . $this->encode($this->convertValue($params['index'])) . '/_update_by_query'; $method = 'POST'; $url = $this->addQueryString($url, $params, ['analyzer','analyze_wildcard','default_operator','df','from','ignore_unavailable','allow_no_indices','conflicts','expand_wildcards','lenient','pipeline','preference','q','routing','scroll','search_type','search_timeout','max_docs','sort','terminate_after','stats','version','version_type','request_cache','refresh','timeout','wait_for_active_shards','scroll_size','wait_for_completion','requests_per_second','slices','pretty','human','error_trace','source','filter_path']); @@ -2062,12 +2111,12 @@ public function updateByQuery(array $params = []) * * @param array{ * task_id: string, // (REQUIRED) The task id to rethrottle - * requests_per_second: number, // The throttle to set on this request in floating sub-requests per second. -1 means set no throttle. - * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) - * human: boolean, // Return human readable values for statistics. (DEFAULT: true) - * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) - * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * filter_path: list, // A comma-separated list of filters used to reduce the response. + * requests_per_second?: int, // The throttle to set on this request in floating sub-requests per second. -1 means set no throttle. + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * filter_path?: string|array, // A comma-separated list of filters used to reduce the response. * } $params * * @throws MissingParameterException if a required parameter is missing @@ -2077,8 +2126,9 @@ public function updateByQuery(array $params = []) * * @return Elasticsearch|Promise */ - public function updateByQueryRethrottle(array $params = []) + public function updateByQueryRethrottle(?array $params = null) { + $params = $params ?? []; $this->checkRequiredParameters(['task_id','requests_per_second'], $params); $url = '/_update_by_query/' . $this->encode($params['task_id']) . '/_rethrottle'; $method = 'POST'; diff --git a/src/Traits/EndpointTrait.php b/src/Traits/EndpointTrait.php index c248483f9..93a461187 100644 --- a/src/Traits/EndpointTrait.php +++ b/src/Traits/EndpointTrait.php @@ -22,7 +22,6 @@ use Elastic\Transport\Serializer\JsonSerializer; use Elastic\Transport\Serializer\NDJsonSerializer; use Http\Discovery\Psr17FactoryDiscovery; -use Psr\Http\Message\RequestInterface; use Psr\Http\Message\ServerRequestInterface; use function http_build_query; @@ -63,7 +62,7 @@ protected function isAssociativeArray(array $array): bool * * @param mixed $value */ - private function convertValue($value): string + protected function convertValue($value): string { // Convert a boolean value in 'true' or 'false' string if (is_bool($value)) { @@ -129,7 +128,7 @@ protected function bodySerialize($body, string $contentType): string * * @param array|string $body */ - protected function createRequest(string $method, string $url, array $headers, $body = null): RequestInterface + protected function createRequest(string $method, string $url, array $headers, $body = null): ServerRequestInterface { $requestFactory = Psr17FactoryDiscovery::findServerRequestFactory(); $streamFactory = Psr17FactoryDiscovery::findStreamFactory(); diff --git a/src/Traits/MessageResponseTrait.php b/src/Traits/MessageResponseTrait.php index faf0fc803..ad2f23419 100644 --- a/src/Traits/MessageResponseTrait.php +++ b/src/Traits/MessageResponseTrait.php @@ -29,6 +29,9 @@ public function getProtocolVersion(): string return $this->response->getProtocolVersion(); } + /** + * @return MessageInterface + */ public function withProtocolVersion($version): MessageInterface { return $this->response->withProtocolVersion($version); @@ -54,26 +57,41 @@ public function getHeaderLine(string $name): string return $this->response->getHeaderLine($name); } + /** + * @return MessageInterface + */ public function withHeader(string $name, $value): MessageInterface { return $this->response->withHeader($name, $value); } + /** + * @return MessageInterface + */ public function withAddedHeader(string $name, $value): MessageInterface { return $this->response->withAddedHeader($name, $value); } + /** + * @return MessageInterface + */ public function withoutHeader(string $name): MessageInterface { return $this->response->withoutHeader($name); } + /** + * @return StreamInterface + */ public function getBody(): StreamInterface { return $this->response->getBody(); } + /** + * @return MessageInterface + */ public function withBody(StreamInterface $body): MessageInterface { return $this->response->withBody($body); @@ -84,6 +102,9 @@ public function getStatusCode(): int return $this->response->getStatusCode(); } + /** + * @return ResponseInterface + */ public function withStatus(int $code, string $reasonPhrase = ''): ResponseInterface { return $this->response->withStatus($code, $reasonPhrase); diff --git a/src/Utility.php b/src/Utility.php index d54185ce5..2f27272d2 100644 --- a/src/Utility.php +++ b/src/Utility.php @@ -54,7 +54,7 @@ public static function urlencode(string $url): string public static function formatVariableName(string $var): string { // If the first character is a digit, we append the underscore - if (is_int($var[0])) { + if (is_numeric($var[0])) { $var = '_' . $var; } return preg_replace('/[^a-zA-Z0-9_]/', '', $var); diff --git a/tests/ClientBuilderTest.php b/tests/ClientBuilderTest.php index fb1bab26b..b20c61bb9 100644 --- a/tests/ClientBuilderTest.php +++ b/tests/ClientBuilderTest.php @@ -349,6 +349,9 @@ public function testClientWithSymfonyPsr18Client() $this->assertEquals($symfonyClient, $client->getTransport()->getClient()); } + /** + * @requires PHP 8.1.0 + */ public function testClientWithSymfonyHttplugClient() { $symfonyClient = new HttplugClient(); @@ -360,6 +363,9 @@ public function testClientWithSymfonyHttplugClient() $this->assertEquals($symfonyClient, $client->getTransport()->getClient()); } + /** + * @requires PHP 8.1.0 + */ public function testAsyncClientWithSymfonyHttplugClient() { $symfonyClient = new HttplugClient(); diff --git a/tests/Transport/Adapter/SymfonyTest.php b/tests/Transport/Adapter/SymfonyTest.php index 686ea11dc..805c5f2e8 100644 --- a/tests/Transport/Adapter/SymfonyTest.php +++ b/tests/Transport/Adapter/SymfonyTest.php @@ -22,6 +22,9 @@ use Symfony\Component\HttpClient\HttplugClient; use Symfony\Component\HttpClient\Psr18Client; +/** + * @requires PHP 8.1.0 + */ class SymfonyTest extends TestCase { protected Symfony $symfonyAdapter; diff --git a/tests/Utility.php b/tests/Utility.php index 45ea0a562..40f1cb402 100644 --- a/tests/Utility.php +++ b/tests/Utility.php @@ -78,6 +78,12 @@ public static function getHost(): ?string */ public static function getClient(): Client { + if (getenv('ELASTIC_API_KEY') !== false) { + return ClientBuilder::create() + ->setHosts([self::getHost()]) + ->setApiKey(getenv('ELASTIC_API_KEY')) + ->build(); + } if (getenv('TEST_SUITE') === 'free') { return ClientBuilder::create() ->setHosts([self::getHost()]) diff --git a/util/ActionTest.php b/util/ActionTest.php index 3f1c48859..c1828136a 100644 --- a/util/ActionTest.php +++ b/util/ActionTest.php @@ -99,6 +99,10 @@ private function do(array $actions): string ]; foreach ($actions as $key => $value) { if (method_exists($this, $key)) { + if (empty($value)) { + printf("Empty: %s, %s\n", $key, var_export($actions, true)); + exit(1); + } $this->$key($value, $vars); } else { // headers @@ -286,6 +290,8 @@ private function match(array $actions) ($this->phpUnitVersion > 8) ? (self::TEMPLATE_PHPUNIT9_MATCH_REGEX) : (self::TEMPLATE_MATCH_REGEX), $vars ); + } elseif (is_string($expected) && substr($expected,0,5) === '$body') { + $vars[':expected'] = $this->convertResponseField($expected); } elseif (is_array($expected)) { if ($vars[':value'] === '$response') { $vars[':value'] = '$response->asArray()'; diff --git a/util/YamlTests.php b/util/YamlTests.php index 555ec8f89..ee8a29fe5 100644 --- a/util/YamlTests.php +++ b/util/YamlTests.php @@ -52,12 +52,16 @@ class YamlTests 'Cat\Templates\_10_BasicTest::FilteredTemplates' => 'regex mismatch', 'Cat\Templates\_10_BasicTest::SelectColumns' => 'regex mismatch', 'FieldCaps\_50_Fieldtype_FilterTest::*' => 'Bool mismatch', + 'Indices\Create\_20_Synthetic_SourceTest::*' => 'Undefined array key', + 'Indices\Create\_21_Synthetic_Source_StoredTest::*' => 'Undefined array key', 'Indices\GetAlias\_10_BasicTest::GetAliasAgainstClosedIndices' => 'Failed asserting that true is false', 'Indices\GetIndexTemplate\_10_BasicTest::*' => 'Bool mismatch', 'Indices\PutTemplate\_10_BasicTest::PutTemplateCreate' => 'index_template [test] already exists', + 'Indices\Recovery\_20_Synthetic_SourceTest::TestRecoveryEmptyIndexWithUse_synthetic_source' => 'bad request', 'Indices\Refresh\_10_BasicTest::IndicesRefreshTestEmptyArray' => 'empty array?', 'Indices\ResolveCluster\_10_Basic_Resolve_ClusterTest::TestResolveClusterOptionalParamsAreAccepted' => 'Bool mismatch', 'Indices\SimulateIndexTemplate\_10_BasicTest::SimulateIndexTemplateWithIndexNotMatchingAnyTemplate' => 'Bool mismatch', + 'IngestGeoip\_20_Geoip_ProcessorTest::*' => 'Undefined array key', 'Search\Vectors\_90_Sparse_VectorTest::SparseVectorIn800X8110' => 'Undefined array key error', 'Snapshot\Create\_10_BasicTest::CreateASnapshot' => 'Invalid snapshot name [test_snapshot]', 'Snapshot\Create\_10_BasicTest::CreateASnapshotAndCleanUpRepository' => 'Invalid snapshot name [test_snapshot]',