From 830a6f6fdb4a6b7005ff914fe761e1a92ebb5cb8 Mon Sep 17 00:00:00 2001 From: Enrico Zimuel Date: Tue, 19 Nov 2019 16:10:44 +0100 Subject: [PATCH] Updated the Client version to 7.4.0 + updated docs --- BREAKING_CHANGES.md | 2 - CHANGELOG.md | 15 ++- README.md | 2 + docs/breaking-changes.asciidoc | 7 ++ docs/experimental-beta-apis.asciidoc | 51 ++++++++ docs/index.asciidoc | 2 + src/Elasticsearch/Client.php | 176 ++++++++++++++++----------- 7 files changed, 182 insertions(+), 73 deletions(-) create mode 100644 docs/experimental-beta-apis.asciidoc diff --git a/BREAKING_CHANGES.md b/BREAKING_CHANGES.md index 9c9eeb03a..52a3baa20 100644 --- a/BREAKING_CHANGES.md +++ b/BREAKING_CHANGES.md @@ -6,8 +6,6 @@ - When `delete` with an empty `id` an `Elasticsearch\Common\Exceptions\RuntimeException\Missing404Exception` exception is thrown. Previously it was a `Elasticsearch\Common\Exceptions\RuntimeException\InvalidArgumentException`. - - # 7.0 - Requirement of PHP 7.1 instead of 7.0 that is not supported since 1 Jan 2019. diff --git a/CHANGELOG.md b/CHANGELOG.md index 216b8925d..f99fbd2e4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,19 @@ ## Release 7.4.0 - +- Added the code generation for endpoints and namespaces based on + the [REST API specification](https://github.com/elastic/elasticsearch/tree/v7.4.2/rest-api-spec/src/main/resources/rest-api-spec/api) + of Elasticsearch. This tool is available in `util/GenerateEndpoints.php`. + [#966](https://github.com/elastic/elasticsearch-php/pull/966) +- Fixed the asciidoc [endpoints documentation](https://www.elastic.co/guide/en/elasticsearch/client/php-api/current/ElasticsearchPHP_Endpoints.html) based on the code generation + using [Sami](https://github.com/FriendsOfPHP/Sami) project + [#966](https://github.com/elastic/elasticsearch-php/pull/966) +- All the `experimental` and `beta` APIs are now signed with + a `@note` tag in the phpdoc section (e.g. [$client->rankEval()](https://github.com/elastic/elasticsearch-php/blob/master/src/Elasticsearch/Client.php)). For more information read the [experimental and beta APIs](docs/experimental-beta-apis.asciidoc) + section in the documentation. + [#966](https://github.com/elastic/elasticsearch-php/pull/966) +- Removed `AlreadyExpiredException` since it has been removed + from Elasticsearch with https://github.com/elastic/elasticsearch/pull/24857 + [#954](https://github.com/elastic/elasticsearch-php/pull/954) ## Release 7.3.0 diff --git a/README.md b/README.md index 58fc2a2f4..d90327260 100755 --- a/README.md +++ b/README.md @@ -10,6 +10,8 @@ To maintain consistency across all the low-level clients (Ruby, Python, etc.), c Starting from version 7.4.0, all the endpoints (and namespaces) are autogenerated using the [util/GenerateEndpoints.php](https://github.com/elastic/elasticsearch-php/blob/master/util/GenerateEndpoints.php) script. This script reads the [Elasticsearch API specs](https://github.com/elastic/elasticsearch/tree/master/rest-api-spec/src/main/resources/rest-api-spec/api) and generated the PHP classes for all the endpoints. +Moreover from version 7.4.0, we added a `E_USER_DEPRECATED` notice if you use deprecated parameters for Elasticsearch. + Features -------- diff --git a/docs/breaking-changes.asciidoc b/docs/breaking-changes.asciidoc index 6d0a74985..ea694a855 100644 --- a/docs/breaking-changes.asciidoc +++ b/docs/breaking-changes.asciidoc @@ -1,6 +1,13 @@ [[breaking_changes]] == Breaking changes from 6.x +### E_USER_DEPRECATED notice when using deprecated parameters + +Starting from elasticsearch-php 7.4.0, we generate a PHP [E_USER_DEPRECATED](https://www.php.net/manual/en/errorfunc.constants.php) +notice every time you use a deprecated parameters for Elasticsearch. +We decided to add this notice to facilitate the code refactoring with the +new API specification of Elasticsearch (e.g. the usage of typeless APIs, see below). + ### Moving from types to typeless APIs in Elasticsearch 7.0 Elasticsearch 7.0 deprecated APIs that accept types, introduced new typeless diff --git a/docs/experimental-beta-apis.asciidoc b/docs/experimental-beta-apis.asciidoc new file mode 100644 index 000000000..eef0c1226 --- /dev/null +++ b/docs/experimental-beta-apis.asciidoc @@ -0,0 +1,51 @@ +[[experimental_and_beta_apis]] +== Experimental and beta APIs + +The PHP client offers also `experimental` and `beta` APIs for Elasticsearch. + +The Elasticsearch API are marked using the following convention: + +- **Stable** APIs should be safe to use extensively in production. + Any breaking changes to these APIs should only occur in major versions and + will be clearly documented in the breaking changes documentation for that + release. +- **Beta** APIs are on track to become stable and permanent features. + Caution should be exercised in their use since it is possible we’d have to make + a breaking change to these APIs in a minor version, but we’ll avoid this + wherever possible. +- **Experimental** APIs are just that - an experiment. An experimental API might + have breaking changes in any future version, or it might even be removed + entirely. + +All the `experimental` and `beta` APIs are marked with a `@note` tag in the +phpdoc section of the code. + +=== Experimental + +The experimental APIs included in the current version of `elasticsearch-php` are: + +- [Ranking Evaluation](https://www.elastic.co/guide/en/elasticsearch/reference/7.4/search-rank-eval.html) + +[source,php] +---- +$client = ClientBuilder::create()->build(); +$params = [ + // ... +]; +$result = $client->rankEval($params); +---- + +- [Painless Execute](https://www.elastic.co/guide/en/elasticsearch/painless/7.4/painless-execute-api.html) + +[source,php] +---- +$client = ClientBuilder::create()->build(); +$params = [ + // ... +]; +$result = $client->scriptsPainlessExecute($params); +---- + +=== Beta + +There are no beta APIs in the current version of `elasticsearch-php`. \ No newline at end of file diff --git a/docs/index.asciidoc b/docs/index.asciidoc index 4403e2e2d..70263a674 100644 --- a/docs/index.asciidoc +++ b/docs/index.asciidoc @@ -37,4 +37,6 @@ include::breaking-changes.asciidoc[] include::community.asciidoc[] +include::experimental-beta-apis.asciidoc[] + include::build/classes.asciidoc[] diff --git a/src/Elasticsearch/Client.php b/src/Elasticsearch/Client.php index 019cb8fae..e89c01cdf 100644 --- a/src/Elasticsearch/Client.php +++ b/src/Elasticsearch/Client.php @@ -32,7 +32,7 @@ */ class Client { - const VERSION = '7.4.2'; + const VERSION = '7.4.0'; /** * @var Transport @@ -123,7 +123,6 @@ public function __construct(Transport $transport, callable $endpoint, array $reg * @return array * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/docs-bulk.html */ - public function bulk(array $params = []) { $index = $this->extractArgument($params, 'index'); @@ -138,7 +137,9 @@ public function bulk(array $params = []) $endpoint->setBody($body); return $this->performRequest($endpoint); - } /** + } + + /** * $params['scroll_id'] = DEPRECATED (list) A comma-separated list of scroll IDs to clear * $params['body'] = (array) A comma-separated list of scroll IDs to clear if none was specified via the scroll_id parameter * @@ -146,7 +147,6 @@ public function bulk(array $params = []) * @return array * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/search-request-body.html#_clear_scroll_api */ - public function clearScroll(array $params = []) { $scroll_id = $this->extractArgument($params, 'scroll_id'); @@ -159,7 +159,9 @@ public function clearScroll(array $params = []) $endpoint->setBody($body); return $this->performRequest($endpoint); - } /** + } + + /** * $params['index'] = (list) A comma-separated list of indices to restrict the results * $params['type'] = DEPRECATED (list) A comma-separated list of types to restrict the results * $params['ignore_unavailable'] = (boolean) Whether specified concrete indices should be ignored when unavailable (missing or closed) @@ -182,7 +184,6 @@ public function clearScroll(array $params = []) * @return array * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/search-count.html */ - public function count(array $params = []) { $index = $this->extractArgument($params, 'index'); @@ -197,7 +198,9 @@ public function count(array $params = []) $endpoint->setBody($body); return $this->performRequest($endpoint); - } /** + } + + /** * $params['id'] = (string) Document ID (Required) * $params['index'] = (string) The name of the index (Required) * $params['type'] = DEPRECATED (string) The type of the document @@ -214,7 +217,6 @@ public function count(array $params = []) * @return array * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/docs-index_.html */ - public function create(array $params = []) { $id = $this->extractArgument($params, 'id'); @@ -231,7 +233,9 @@ public function create(array $params = []) $endpoint->setBody($body); return $this->performRequest($endpoint); - } /** + } + + /** * $params['id'] = (string) The document ID (Required) * $params['index'] = (string) The name of the index (Required) * $params['type'] = DEPRECATED (string) The type of the document @@ -248,7 +252,6 @@ public function create(array $params = []) * @return array * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/docs-delete.html */ - public function delete(array $params = []) { $id = $this->extractArgument($params, 'id'); @@ -263,7 +266,9 @@ public function delete(array $params = []) $endpoint->setType($type); return $this->performRequest($endpoint); - } /** + } + + /** * $params['index'] = (list) A comma-separated list of index names to search; use `_all` or empty string to perform the operation on all indices (Required) * $params['type'] = DEPRECATED (list) A comma-separated list of document types to search; leave empty to perform the operation on all types * $params['analyze_wildcard'] = (boolean) Specify whether wildcard and prefix queries should be analyzed (default: false) @@ -304,7 +309,6 @@ public function delete(array $params = []) * @return array * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/docs-delete-by-query.html */ - public function deleteByQuery(array $params = []) { $index = $this->extractArgument($params, 'index'); @@ -319,7 +323,9 @@ public function deleteByQuery(array $params = []) $endpoint->setBody($body); return $this->performRequest($endpoint); - } /** + } + + /** * $params['task_id'] = (string) The task id to rethrottle * $params['requests_per_second'] = (number) The throttle to set on this request in floating sub-requests per second. -1 means set no throttle. (Required) * @@ -327,7 +333,6 @@ public function deleteByQuery(array $params = []) * @return array * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-delete-by-query.html */ - public function deleteByQueryRethrottle(array $params = []) { $task_id = $this->extractArgument($params, 'task_id'); @@ -338,7 +343,9 @@ public function deleteByQueryRethrottle(array $params = []) $endpoint->setTaskId($task_id); return $this->performRequest($endpoint); - } /** + } + + /** * $params['id'] = (string) Script ID * $params['timeout'] = (time) Explicit operation timeout * $params['master_timeout'] = (time) Specify timeout for connection to master @@ -347,7 +354,6 @@ public function deleteByQueryRethrottle(array $params = []) * @return array * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/modules-scripting.html */ - public function deleteScript(array $params = []) { $id = $this->extractArgument($params, 'id'); @@ -358,7 +364,9 @@ public function deleteScript(array $params = []) $endpoint->setId($id); return $this->performRequest($endpoint); - } /** + } + + /** * $params['id'] = (string) The document ID (Required) * $params['index'] = (string) The name of the index (Required) * $params['type'] = DEPRECATED (string) The type of the document (use `_all` to fetch the first document matching the ID across all types) @@ -377,7 +385,6 @@ public function deleteScript(array $params = []) * @return bool * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/docs-get.html */ - public function exists(array $params = []): bool { $id = $this->extractArgument($params, 'id'); @@ -396,6 +403,7 @@ public function exists(array $params = []): bool return BooleanRequestWrapper::performRequest($endpoint, $this->transport); } + /** * $params['id'] = (string) The document ID (Required) * $params['index'] = (string) The name of the index (Required) @@ -414,7 +422,6 @@ public function exists(array $params = []): bool * @return bool * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/docs-get.html */ - public function existsSource(array $params = []): bool { $id = $this->extractArgument($params, 'id'); @@ -433,6 +440,7 @@ public function existsSource(array $params = []): bool return BooleanRequestWrapper::performRequest($endpoint, $this->transport); } + /** * $params['id'] = (string) The document ID (Required) * $params['index'] = (string) The name of the index (Required) @@ -455,7 +463,6 @@ public function existsSource(array $params = []): bool * @return array * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/search-explain.html */ - public function explain(array $params = []) { $id = $this->extractArgument($params, 'id'); @@ -472,7 +479,9 @@ public function explain(array $params = []) $endpoint->setBody($body); return $this->performRequest($endpoint); - } /** + } + + /** * $params['index'] = (list) A comma-separated list of index names; use `_all` or empty string to perform the operation on all indices * $params['fields'] = (list) A comma-separated list of field names * $params['ignore_unavailable'] = (boolean) Whether specified concrete indices should be ignored when unavailable (missing or closed) @@ -484,7 +493,6 @@ public function explain(array $params = []) * @return array * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/search-field-caps.html */ - public function fieldCaps(array $params = []) { $index = $this->extractArgument($params, 'index'); @@ -495,7 +503,9 @@ public function fieldCaps(array $params = []) $endpoint->setIndex($index); return $this->performRequest($endpoint); - } /** + } + + /** * $params['id'] = (string) The document ID (Required) * $params['index'] = (string) The name of the index (Required) * $params['type'] = DEPRECATED (string) The type of the document (use `_all` to fetch the first document matching the ID across all types) @@ -514,7 +524,6 @@ public function fieldCaps(array $params = []) * @return array * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/docs-get.html */ - public function get(array $params = []) { $id = $this->extractArgument($params, 'id'); @@ -529,7 +538,9 @@ public function get(array $params = []) $endpoint->setType($type); return $this->performRequest($endpoint); - } /** + } + + /** * $params['id'] = (string) Script ID * $params['master_timeout'] = (time) Specify timeout for connection to master * @@ -537,7 +548,6 @@ public function get(array $params = []) * @return array * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/modules-scripting.html */ - public function getScript(array $params = []) { $id = $this->extractArgument($params, 'id'); @@ -548,7 +558,9 @@ public function getScript(array $params = []) $endpoint->setId($id); return $this->performRequest($endpoint); - } /** + } + + /** * $params['id'] = (string) The document ID (Required) * $params['index'] = (string) The name of the index (Required) * $params['type'] = DEPRECATED (string) The type of the document; deprecated and optional starting with 7.0 @@ -566,7 +578,6 @@ public function getScript(array $params = []) * @return array * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/docs-get.html */ - public function getSource(array $params = []) { $id = $this->extractArgument($params, 'id'); @@ -581,7 +592,9 @@ public function getSource(array $params = []) $endpoint->setType($type); return $this->performRequest($endpoint); - } /** + } + + /** * $params['id'] = (string) Document ID * $params['index'] = (string) The name of the index (Required) * $params['type'] = DEPRECATED (string) The type of the document @@ -601,7 +614,6 @@ public function getSource(array $params = []) * @return array * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/docs-index_.html */ - public function index(array $params = []) { $id = $this->extractArgument($params, 'id'); @@ -618,13 +630,14 @@ public function index(array $params = []) $endpoint->setBody($body); return $this->performRequest($endpoint); - } /** + } + + /** * * @param array $params Associative array of parameters * @return array * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/index.html */ - public function info(array $params = []) { @@ -633,7 +646,9 @@ public function info(array $params = []) $endpoint->setParams($params); return $this->performRequest($endpoint); - } /** + } + + /** * $params['index'] = (string) The name of the index * $params['type'] = DEPRECATED (string) The type of the document * $params['stored_fields'] = (list) A comma-separated list of stored fields to return in the response @@ -650,7 +665,6 @@ public function info(array $params = []) * @return array * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/docs-multi-get.html */ - public function mget(array $params = []) { $index = $this->extractArgument($params, 'index'); @@ -665,7 +679,9 @@ public function mget(array $params = []) $endpoint->setBody($body); return $this->performRequest($endpoint); - } /** + } + + /** * $params['index'] = (list) A comma-separated list of index names to use as default * $params['type'] = DEPRECATED (list) A comma-separated list of document types to use as default * $params['search_type'] = (enum) Search operation type (Options = query_then_fetch,query_and_fetch,dfs_query_then_fetch,dfs_query_and_fetch) @@ -681,7 +697,6 @@ public function mget(array $params = []) * @return array * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/search-multi-search.html */ - public function msearch(array $params = []) { $index = $this->extractArgument($params, 'index'); @@ -696,7 +711,9 @@ public function msearch(array $params = []) $endpoint->setBody($body); return $this->performRequest($endpoint); - } /** + } + + /** * $params['index'] = (list) A comma-separated list of index names to use as default * $params['type'] = DEPRECATED (list) A comma-separated list of document types to use as default * $params['search_type'] = (enum) Search operation type (Options = query_then_fetch,query_and_fetch,dfs_query_then_fetch,dfs_query_and_fetch) @@ -709,7 +726,6 @@ public function msearch(array $params = []) * @return array * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/search-multi-search.html */ - public function msearchTemplate(array $params = []) { $index = $this->extractArgument($params, 'index'); @@ -724,7 +740,9 @@ public function msearchTemplate(array $params = []) $endpoint->setBody($body); return $this->performRequest($endpoint); - } /** + } + + /** * $params['index'] = (string) The index in which the document resides. * $params['type'] = DEPRECATED (string) The type of the document. * $params['ids'] = (list) A comma-separated list of documents ids. You must define ids as parameter or set "ids" or "docs" in the request body @@ -745,7 +763,6 @@ public function msearchTemplate(array $params = []) * @return array * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/docs-multi-termvectors.html */ - public function mtermvectors(array $params = []) { $index = $this->extractArgument($params, 'index'); @@ -760,13 +777,14 @@ public function mtermvectors(array $params = []) $endpoint->setBody($body); return $this->performRequest($endpoint); - } /** + } + + /** * * @param array $params Associative array of parameters * @return bool * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/index.html */ - public function ping(array $params = []): bool { @@ -779,6 +797,7 @@ public function ping(array $params = []): bool return BooleanRequestWrapper::performRequest($endpoint, $this->transport); } + /** * $params['id'] = (string) Script ID (Required) * $params['context'] = (string) Script context @@ -790,7 +809,6 @@ public function ping(array $params = []): bool * @return array * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/modules-scripting.html */ - public function putScript(array $params = []) { $id = $this->extractArgument($params, 'id'); @@ -805,7 +823,9 @@ public function putScript(array $params = []) $endpoint->setBody($body); return $this->performRequest($endpoint); - } /** + } + + /** * $params['index'] = (list) A comma-separated list of index names to search; use `_all` or empty string to perform the operation on all indices * $params['ignore_unavailable'] = (boolean) Whether specified concrete indices should be ignored when unavailable (missing or closed) * $params['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) @@ -819,7 +839,6 @@ public function putScript(array $params = []) * @note This API is EXPERIMENTAL and may be changed or removed completely in a future release * */ - public function rankEval(array $params = []) { $index = $this->extractArgument($params, 'index'); @@ -832,7 +851,9 @@ public function rankEval(array $params = []) $endpoint->setBody($body); return $this->performRequest($endpoint); - } /** + } + + /** * $params['refresh'] = (boolean) Should the effected indexes be refreshed? * $params['timeout'] = (time) Time each individual bulk request should wait for shards that are unavailable. (Default = 1m) * $params['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) @@ -847,7 +868,6 @@ public function rankEval(array $params = []) * @return array * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/docs-reindex.html */ - public function reindex(array $params = []) { $body = $this->extractArgument($params, 'body'); @@ -858,7 +878,9 @@ public function reindex(array $params = []) $endpoint->setBody($body); return $this->performRequest($endpoint); - } /** + } + + /** * $params['task_id'] = (string) The task id to rethrottle * $params['requests_per_second'] = (number) The throttle to set on this request in floating sub-requests per second. -1 means set no throttle. (Required) * @@ -866,7 +888,6 @@ public function reindex(array $params = []) * @return array * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/docs-reindex.html */ - public function reindexRethrottle(array $params = []) { $task_id = $this->extractArgument($params, 'task_id'); @@ -877,7 +898,9 @@ public function reindexRethrottle(array $params = []) $endpoint->setTaskId($task_id); return $this->performRequest($endpoint); - } /** + } + + /** * $params['id'] = (string) The id of the stored search template * $params['body'] = (array) The search definition template and its params * @@ -885,7 +908,6 @@ public function reindexRethrottle(array $params = []) * @return array * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/search-template.html#_validating_templates */ - public function renderSearchTemplate(array $params = []) { $id = $this->extractArgument($params, 'id'); @@ -898,7 +920,9 @@ public function renderSearchTemplate(array $params = []) $endpoint->setBody($body); return $this->performRequest($endpoint); - } /** + } + + /** * $params['body'] = (array) The script to execute * * @param array $params Associative array of parameters @@ -908,7 +932,6 @@ public function renderSearchTemplate(array $params = []) * @note This API is EXPERIMENTAL and may be changed or removed completely in a future release * */ - public function scriptsPainlessExecute(array $params = []) { $body = $this->extractArgument($params, 'body'); @@ -919,7 +942,9 @@ public function scriptsPainlessExecute(array $params = []) $endpoint->setBody($body); return $this->performRequest($endpoint); - } /** + } + + /** * $params['scroll_id'] = DEPRECATED (string) The scroll ID * $params['scroll'] = (time) Specify how long a consistent view of the index should be maintained for scrolled search * $params['rest_total_hits_as_int'] = (boolean) Indicates whether hits.total should be rendered as an integer or an object in the rest search response (Default = false) @@ -929,7 +954,6 @@ public function scriptsPainlessExecute(array $params = []) * @return array * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/search-request-body.html#request-body-search-scroll */ - public function scroll(array $params = []) { $scroll_id = $this->extractArgument($params, 'scroll_id'); @@ -942,7 +966,9 @@ public function scroll(array $params = []) $endpoint->setBody($body); return $this->performRequest($endpoint); - } /** + } + + /** * $params['index'] = (list) A comma-separated list of index names to search; use `_all` or empty string to perform the operation on all indices * $params['type'] = DEPRECATED (list) A comma-separated list of document types to search; leave empty to perform the operation on all types * $params['analyzer'] = (string) The analyzer to use for the query string @@ -993,7 +1019,6 @@ public function scroll(array $params = []) * @return array * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/search-search.html */ - public function search(array $params = []) { $index = $this->extractArgument($params, 'index'); @@ -1008,7 +1033,9 @@ public function search(array $params = []) $endpoint->setBody($body); return $this->performRequest($endpoint); - } /** + } + + /** * $params['index'] = (list) A comma-separated list of index names to search; use `_all` or empty string to perform the operation on all indices * $params['preference'] = (string) Specify the node or shard the operation should be performed on (default: random) * $params['routing'] = (string) Specific routing value @@ -1021,7 +1048,6 @@ public function search(array $params = []) * @return array * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/search-shards.html */ - public function searchShards(array $params = []) { $index = $this->extractArgument($params, 'index'); @@ -1032,7 +1058,9 @@ public function searchShards(array $params = []) $endpoint->setIndex($index); return $this->performRequest($endpoint); - } /** + } + + /** * $params['index'] = (list) A comma-separated list of index names to search; use `_all` or empty string to perform the operation on all indices * $params['type'] = DEPRECATED (list) A comma-separated list of document types to search; leave empty to perform the operation on all types * $params['ignore_unavailable'] = (boolean) Whether specified concrete indices should be ignored when unavailable (missing or closed) @@ -1053,7 +1081,6 @@ public function searchShards(array $params = []) * @return array * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/search-template.html */ - public function searchTemplate(array $params = []) { $index = $this->extractArgument($params, 'index'); @@ -1068,7 +1095,9 @@ public function searchTemplate(array $params = []) $endpoint->setBody($body); return $this->performRequest($endpoint); - } /** + } + + /** * $params['index'] = (string) The index in which the document resides. (Required) * $params['id'] = (string) The id of the document, when not specified a doc param should be supplied. * $params['type'] = DEPRECATED (string) The type of the document. @@ -1089,7 +1118,6 @@ public function searchTemplate(array $params = []) * @return array * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/docs-termvectors.html */ - public function termvectors(array $params = []) { $index = $this->extractArgument($params, 'index'); @@ -1106,7 +1134,9 @@ public function termvectors(array $params = []) $endpoint->setBody($body); return $this->performRequest($endpoint); - } /** + } + + /** * $params['id'] = (string) Document ID (Required) * $params['index'] = (string) The name of the index (Required) * $params['type'] = DEPRECATED (string) The type of the document @@ -1127,7 +1157,6 @@ public function termvectors(array $params = []) * @return array * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/docs-update.html */ - public function update(array $params = []) { $id = $this->extractArgument($params, 'id'); @@ -1144,7 +1173,9 @@ public function update(array $params = []) $endpoint->setBody($body); return $this->performRequest($endpoint); - } /** + } + + /** * $params['index'] = (list) A comma-separated list of index names to search; use `_all` or empty string to perform the operation on all indices (Required) * $params['type'] = DEPRECATED (list) A comma-separated list of document types to search; leave empty to perform the operation on all types * $params['analyzer'] = (string) The analyzer to use for the query string @@ -1188,7 +1219,6 @@ public function update(array $params = []) * @return array * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/docs-update-by-query.html */ - public function updateByQuery(array $params = []) { $index = $this->extractArgument($params, 'index'); @@ -1203,7 +1233,9 @@ public function updateByQuery(array $params = []) $endpoint->setBody($body); return $this->performRequest($endpoint); - } /** + } + + /** * $params['task_id'] = (string) The task id to rethrottle * $params['requests_per_second'] = (number) The throttle to set on this request in floating sub-requests per second. -1 means set no throttle. (Required) * @@ -1211,7 +1243,6 @@ public function updateByQuery(array $params = []) * @return array * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-update-by-query.html */ - public function updateByQueryRethrottle(array $params = []) { $task_id = $this->extractArgument($params, 'task_id'); @@ -1228,32 +1259,37 @@ public function cat(): CatNamespace { return $this->cat; } + public function cluster(): ClusterNamespace { return $this->cluster; } + public function indices(): IndicesNamespace { return $this->indices; } + public function ingest(): IngestNamespace { return $this->ingest; } + public function nodes(): NodesNamespace { return $this->nodes; } + public function snapshot(): SnapshotNamespace { return $this->snapshot; } + public function tasks(): TasksNamespace { return $this->tasks; } - /** * Catchall for registered namespaces *