From adba49c7199e17f26b8181230f744f2b64caf556 Mon Sep 17 00:00:00 2001 From: Enrico Zimuel Date: Wed, 20 Nov 2019 15:51:30 +0100 Subject: [PATCH 1/5] Fix pre 7.2 endpoint class name with aliases + reapply fix #947 --- composer.json | 3 + .../Namespaces/IndicesNamespace.php | 16 +- src/autoload.php | 52 ++++++ .../Elasticsearch/BackwardCompatibleTest.php | 154 ++++++++++++++++++ 4 files changed, 223 insertions(+), 2 deletions(-) create mode 100644 src/autoload.php create mode 100644 tests/Elasticsearch/BackwardCompatibleTest.php diff --git a/composer.json b/composer.json index 79f7d7364..8646605ec 100644 --- a/composer.json +++ b/composer.json @@ -33,6 +33,9 @@ "monolog/monolog": "Allows for client-level logging and tracing" }, "autoload": { + "files": [ + "src/autoload.php" + ], "psr-4": { "Elasticsearch\\": "src/Elasticsearch/" } diff --git a/src/Elasticsearch/Namespaces/IndicesNamespace.php b/src/Elasticsearch/Namespaces/IndicesNamespace.php index 578e44aad..8c46e59cc 100644 --- a/src/Elasticsearch/Namespaces/IndicesNamespace.php +++ b/src/Elasticsearch/Namespaces/IndicesNamespace.php @@ -435,7 +435,20 @@ public function getAlias(array $params = []) $endpoint->setIndex($index); return $this->performRequest($endpoint); - } /** + } + + /** + * Alias function to getAlias() + * + * @deprecated added to prevent BC break introduced in 7.2.0 + * @see https://github.com/elastic/elasticsearch-php/issues/940 + */ + public function getAliases(array $params = []) + { + return $this->getAlias($params); + } + + /** * $params['fields'] = (list) A comma-separated list of fields (Required) * $params['index'] = (list) A comma-separated list of index names * $params['type'] = DEPRECATED (list) A comma-separated list of document types @@ -450,7 +463,6 @@ public function getAlias(array $params = []) * @return array * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-get-field-mapping.html */ - public function getFieldMapping(array $params = []) { $fields = $this->extractArgument($params, 'fields'); diff --git a/src/autoload.php b/src/autoload.php new file mode 100644 index 000000000..68550fea2 --- /dev/null +++ b/src/autoload.php @@ -0,0 +1,52 @@ + + * @license http://www.apache.org/licenses/LICENSE-2.0 Apache2 + * @link http://elasticsearch.org + */ +class BackwardCompatibleTest extends \PHPUnit\Framework\TestCase +{ + /** + * List of endpoints in elasticsearch-php 7.2 branch + */ + public function getClasses() + { + return [ + ['Elasticsearch\Endpoints\MTermVectors'], + ['Elasticsearch\Endpoints\Tasks\Get'], + ['Elasticsearch\Endpoints\Tasks\Cancel'], + ['Elasticsearch\Endpoints\Tasks\TasksList'], + ['Elasticsearch\Endpoints\Ping'], + ['Elasticsearch\Endpoints\ScriptsPainlessExecute'], + ['Elasticsearch\Endpoints\DeleteByQuery'], + ['Elasticsearch\Endpoints\Scroll'], + ['Elasticsearch\Endpoints\Explain'], + ['Elasticsearch\Endpoints\Get'], + ['Elasticsearch\Endpoints\UpdateByQueryRethrottle'], + ['Elasticsearch\Endpoints\Delete'], + ['Elasticsearch\Endpoints\SearchShards'], + ['Elasticsearch\Endpoints\Mget'], + ['Elasticsearch\Endpoints\Source\Get'], + ['Elasticsearch\Endpoints\Source\Exists'], + ['Elasticsearch\Endpoints\Bulk'], + ['Elasticsearch\Endpoints\Cluster\PendingTasks'], + ['Elasticsearch\Endpoints\Cluster\Health'], + ['Elasticsearch\Endpoints\Cluster\Settings\Get'], + ['Elasticsearch\Endpoints\Cluster\Settings\Put'], + ['Elasticsearch\Endpoints\Cluster\Reroute'], + ['Elasticsearch\Endpoints\Cluster\State'], + ['Elasticsearch\Endpoints\Cluster\RemoteInfo'], + ['Elasticsearch\Endpoints\Cluster\Stats'], + ['Elasticsearch\Endpoints\Cluster\AllocationExplain'], + ['Elasticsearch\Endpoints\ClearScroll'], + ['Elasticsearch\Endpoints\Script\Get'], + ['Elasticsearch\Endpoints\Script\Delete'], + ['Elasticsearch\Endpoints\Script\Put'], + ['Elasticsearch\Endpoints\Exists'], + ['Elasticsearch\Endpoints\Index'], + ['Elasticsearch\Endpoints\UpdateByQuery'], + ['Elasticsearch\Endpoints\Ingest\Pipeline\Get'], + ['Elasticsearch\Endpoints\Ingest\Pipeline\Delete'], + ['Elasticsearch\Endpoints\Ingest\Pipeline\Put'], + ['Elasticsearch\Endpoints\Ingest\Pipeline\ProcessorGrok'], + ['Elasticsearch\Endpoints\Ingest\Simulate'], + ['Elasticsearch\Endpoints\SearchTemplate'], + ['Elasticsearch\Endpoints\FieldCaps'], + ['Elasticsearch\Endpoints\Snapshot\Get'], + ['Elasticsearch\Endpoints\Snapshot\Delete'], + ['Elasticsearch\Endpoints\Snapshot\Restore'], + ['Elasticsearch\Endpoints\Snapshot\Create'], + ['Elasticsearch\Endpoints\Snapshot\Status'], + ['Elasticsearch\Endpoints\Snapshot\Repository\Verify'], + ['Elasticsearch\Endpoints\Snapshot\Repository\Get'], + ['Elasticsearch\Endpoints\Snapshot\Repository\Delete'], + ['Elasticsearch\Endpoints\Snapshot\Repository\Create'], + ['Elasticsearch\Endpoints\Count'], + ['Elasticsearch\Endpoints\Create'], + ['Elasticsearch\Endpoints\Info'], + ['Elasticsearch\Endpoints\Indices\Type\Exists'], + ['Elasticsearch\Endpoints\Indices\ForceMerge'], + ['Elasticsearch\Endpoints\Indices\Flush'], + ['Elasticsearch\Endpoints\Indices\Analyze'], + ['Elasticsearch\Endpoints\Indices\Rollover'], + ['Elasticsearch\Endpoints\Indices\Get'], + ['Elasticsearch\Endpoints\Indices\Template\Get'], + ['Elasticsearch\Endpoints\Indices\Template\Delete'], + ['Elasticsearch\Endpoints\Indices\Template\Exists'], + ['Elasticsearch\Endpoints\Indices\Template\Put'], + ['Elasticsearch\Endpoints\Indices\Delete'], + ['Elasticsearch\Endpoints\Indices\FlushSynced'], + ['Elasticsearch\Endpoints\Indices\Refresh'], + ['Elasticsearch\Endpoints\Indices\Exists'], + ['Elasticsearch\Endpoints\Indices\Cache\Clear'], + ['Elasticsearch\Endpoints\Indices\Settings\Get'], + ['Elasticsearch\Endpoints\Indices\Settings\Put'], + ['Elasticsearch\Endpoints\Indices\Create'], + ['Elasticsearch\Endpoints\Indices\Close'], + ['Elasticsearch\Endpoints\Indices\ShardStores'], + ['Elasticsearch\Endpoints\Indices\Stats'], + ['Elasticsearch\Endpoints\Indices\Validate\Query'], + ['Elasticsearch\Endpoints\Indices\Alias\Get'], + ['Elasticsearch\Endpoints\Indices\Alias\Delete'], + ['Elasticsearch\Endpoints\Indices\Alias\Exists'], + ['Elasticsearch\Endpoints\Indices\Alias\Put'], + ['Elasticsearch\Endpoints\Indices\Open'], + ['Elasticsearch\Endpoints\Indices\Segments'], + ['Elasticsearch\Endpoints\Indices\Upgrade\Get'], + ['Elasticsearch\Endpoints\Indices\Upgrade\Post'], + ['Elasticsearch\Endpoints\Indices\Aliases\Update'], + ['Elasticsearch\Endpoints\Indices\Recovery'], + ['Elasticsearch\Endpoints\Indices\Shrink'], + ['Elasticsearch\Endpoints\Indices\Split'], + ['Elasticsearch\Endpoints\Indices\Mapping\Get'], + ['Elasticsearch\Endpoints\Indices\Mapping\Put'], + ['Elasticsearch\Endpoints\Indices\Mapping\GetField'], + ['Elasticsearch\Endpoints\Reindex'], + ['Elasticsearch\Endpoints\DeleteByQueryRethrottle'], + ['Elasticsearch\Endpoints\MsearchTemplate'], + ['Elasticsearch\Endpoints\TermVectors'], + ['Elasticsearch\Endpoints\AbstractEndpoint'], + ['Elasticsearch\Endpoints\RenderSearchTemplate'], + ['Elasticsearch\Endpoints\Update'], + ['Elasticsearch\Endpoints\Search'], + ['Elasticsearch\Endpoints\ReindexRethrottle'], + ['Elasticsearch\Endpoints\RankEval'], + ['Elasticsearch\Endpoints\Msearch'], + ['Elasticsearch\Endpoints\Cat\ThreadPool'], + ['Elasticsearch\Endpoints\Cat\Fielddata'], + ['Elasticsearch\Endpoints\Cat\Master'], + ['Elasticsearch\Endpoints\Cat\NodeAttrs'], + ['Elasticsearch\Endpoints\Cat\Aliases'], + ['Elasticsearch\Endpoints\Cat\PendingTasks'], + ['Elasticsearch\Endpoints\Cat\Templates'], + ['Elasticsearch\Endpoints\Cat\Allocation'], + ['Elasticsearch\Endpoints\Cat\Plugins'], + ['Elasticsearch\Endpoints\Cat\Health'], + ['Elasticsearch\Endpoints\Cat\Count'], + ['Elasticsearch\Endpoints\Cat\Shards'], + ['Elasticsearch\Endpoints\Cat\Repositories'], + ['Elasticsearch\Endpoints\Cat\Nodes'], + ['Elasticsearch\Endpoints\Cat\Tasks'], + ['Elasticsearch\Endpoints\Cat\Segments'], + ['Elasticsearch\Endpoints\Cat\Help'], + ['Elasticsearch\Endpoints\Cat\Recovery'], + ['Elasticsearch\Endpoints\Cat\Snapshots'], + ['Elasticsearch\Endpoints\Cat\Indices'] + ]; + } + + /** + * @dataProvider getClasses + */ + public function testOldClassNamespacesPreviousTo72($class) + { + $this->assertTrue(class_exists($class), sprintf("Class %s does not exist", $class)); + } +} \ No newline at end of file From 441dcdc9d6e2cc37713b9a0bd31b1853085c61ad Mon Sep 17 00:00:00 2001 From: Enrico Zimuel Date: Wed, 20 Nov 2019 16:26:17 +0100 Subject: [PATCH 2/5] Converted the class alias into strings --- src/autoload.php | 81 +++++++++++++++++++++++------------------------- 1 file changed, 39 insertions(+), 42 deletions(-) diff --git a/src/autoload.php b/src/autoload.php index 68550fea2..6db696d99 100644 --- a/src/autoload.php +++ b/src/autoload.php @@ -7,46 +7,43 @@ * * NOTE: This file will be removed with elasticsearch-php 8.0.0 */ -declare(strict_types = 1); -use Elasticsearch\Endpoints; - -class_alias(Endpoints\Cat\Nodeattrs::class, '\Elasticsearch\Endpoints\Cat\NodeAttrs'); -class_alias(Endpoints\Cluster\GetSettings::class, '\Elasticsearch\Endpoints\Cluster\Settings\Get'); -class_alias(Endpoints\Cluster\PutSettings::class, '\Elasticsearch\Endpoints\Cluster\Settings\Put'); -class_alias(Endpoints\Indices\DeleteAlias::class, '\Elasticsearch\Endpoints\Indices\Alias\Delete'); -class_alias(Endpoints\Indices\ExistsAlias::class, '\Elasticsearch\Endpoints\Indices\Alias\Exists'); -class_alias(Endpoints\Indices\GetAlias::class, '\Elasticsearch\Endpoints\Indices\Alias\Get'); -class_alias(Endpoints\Indices\PutAlias::class, '\Elasticsearch\Endpoints\Indices\Alias\Put'); -class_alias(Endpoints\Indices\UpdateAliases::class, '\Elasticsearch\Endpoints\Indices\Aliases\Update'); -class_alias(Endpoints\Indices\ClearCache::class, '\Elasticsearch\Endpoints\Indices\Cache\Clear'); -class_alias(Endpoints\Indices\Forcemerge::class, '\Elasticsearch\Endpoints\Indices\ForceMerge'); -class_alias(Endpoints\Indices\GetMapping::class, '\Elasticsearch\Endpoints\Indices\Mapping\Get'); -class_alias(Endpoints\Indices\GetFieldMapping::class, '\Elasticsearch\Endpoints\Indices\Mapping\GetField'); -class_alias(Endpoints\Indices\PutMapping::class, '\Elasticsearch\Endpoints\Indices\Mapping\Put'); -class_alias(Endpoints\Indices\GetSettings::class, '\Elasticsearch\Endpoints\Indices\Settings\Get'); -class_alias(Endpoints\Indices\PutSettings::class, '\Elasticsearch\Endpoints\Indices\Settings\Put'); -class_alias(Endpoints\Indices\GetTemplate::class, '\Elasticsearch\Endpoints\Indices\Template\Get'); -class_alias(Endpoints\Indices\PutTemplate::class, '\Elasticsearch\Endpoints\Indices\Template\Put'); -class_alias(Endpoints\Indices\ExistsTemplate::class, '\Elasticsearch\Endpoints\Indices\Template\Exists'); -class_alias(Endpoints\Indices\DeleteTemplate::class, '\Elasticsearch\Endpoints\Indices\Template\Delete'); -class_alias(Endpoints\Indices\ExistsType::class, '\Elasticsearch\Endpoints\Indices\Type\Exists'); -class_alias(Endpoints\Indices\GetUpgrade::class, '\Elasticsearch\Endpoints\Indices\Upgrade\Get'); -class_alias(Endpoints\Indices\Upgrade::class, '\Elasticsearch\Endpoints\Indices\Upgrade\Post'); -class_alias(Endpoints\Indices\ValidateQuery::class, '\Elasticsearch\Endpoints\Indices\Validate\Query'); -class_alias(Endpoints\Ingest\DeletePipeline::class, '\Elasticsearch\Endpoints\Ingest\Pipeline\Delete'); -class_alias(Endpoints\Ingest\GetPipeline::class, '\Elasticsearch\Endpoints\Ingest\Pipeline\Get'); -class_alias(Endpoints\Ingest\PutPipeline::class, '\Elasticsearch\Endpoints\Ingest\Pipeline\Put'); -class_alias(Endpoints\Ingest\ProcessorGrok::class, '\Elasticsearch\Endpoints\Ingest\Pipeline\ProcessorGrok'); -class_alias(Endpoints\Mtermvectors::class, '\Elasticsearch\Endpoints\MTermVectors'); -class_alias(Endpoints\GetScript::class, '\Elasticsearch\Endpoints\Script\Get'); -class_alias(Endpoints\PutScript::class, '\Elasticsearch\Endpoints\Script\Put'); -class_alias(Endpoints\DeleteScript::class, '\Elasticsearch\Endpoints\Script\Delete'); -class_alias(Endpoints\Snapshot\CreateRepository::class, '\Elasticsearch\Endpoints\Snapshot\Repository\Create'); -class_alias(Endpoints\Snapshot\DeleteRepository::class, '\Elasticsearch\Endpoints\Snapshot\Repository\Delete'); -class_alias(Endpoints\Snapshot\GetRepository::class, '\Elasticsearch\Endpoints\Snapshot\Repository\Get'); -class_alias(Endpoints\Snapshot\VerifyRepository::class, '\Elasticsearch\Endpoints\Snapshot\Repository\Verify'); -class_alias(Endpoints\GetSource::class, '\Elasticsearch\Endpoints\Source\Get'); -class_alias(Endpoints\ExistsSource::class, '\Elasticsearch\Endpoints\Source\Exists'); -class_alias(Endpoints\Tasks\ListTasks::class, '\Elasticsearch\Endpoints\Tasks\TasksList'); -class_alias(Endpoints\Termvectors::class, '\Elasticsearch\Endpoints\TermVectors'); +class_alias('\Elasticsearch\Endpoints\Cat\Nodeattrs', '\Elasticsearch\Endpoints\Cat\NodeAttrs'); +class_alias('\Elasticsearch\Endpoints\Cluster\GetSettings', '\Elasticsearch\Endpoints\Cluster\Settings\Get'); +class_alias('\Elasticsearch\Endpoints\Cluster\PutSettings', '\Elasticsearch\Endpoints\Cluster\Settings\Put'); +class_alias('\Elasticsearch\Endpoints\Indices\DeleteAlias', '\Elasticsearch\Endpoints\Indices\Alias\Delete'); +class_alias('\Elasticsearch\Endpoints\Indices\ExistsAlias', '\Elasticsearch\Endpoints\Indices\Alias\Exists'); +class_alias('\Elasticsearch\Endpoints\Indices\GetAlias', '\Elasticsearch\Endpoints\Indices\Alias\Get'); +class_alias('\Elasticsearch\Endpoints\Indices\PutAlias', '\Elasticsearch\Endpoints\Indices\Alias\Put'); +class_alias('\Elasticsearch\Endpoints\Indices\UpdateAliases', '\Elasticsearch\Endpoints\Indices\Aliases\Update'); +class_alias('\Elasticsearch\Endpoints\Indices\ClearCache', '\Elasticsearch\Endpoints\Indices\Cache\Clear'); +class_alias('\Elasticsearch\Endpoints\Indices\Forcemerge', '\Elasticsearch\Endpoints\Indices\ForceMerge'); +class_alias('\Elasticsearch\Endpoints\Indices\GetMapping', '\Elasticsearch\Endpoints\Indices\Mapping\Get'); +class_alias('\Elasticsearch\Endpoints\Indices\GetFieldMapping', '\Elasticsearch\Endpoints\Indices\Mapping\GetField'); +class_alias('\Elasticsearch\Endpoints\Indices\PutMapping', '\Elasticsearch\Endpoints\Indices\Mapping\Put'); +class_alias('\Elasticsearch\Endpoints\Indices\GetSettings', '\Elasticsearch\Endpoints\Indices\Settings\Get'); +class_alias('\Elasticsearch\Endpoints\Indices\PutSettings', '\Elasticsearch\Endpoints\Indices\Settings\Put'); +class_alias('\Elasticsearch\Endpoints\Indices\GetTemplate', '\Elasticsearch\Endpoints\Indices\Template\Get'); +class_alias('\Elasticsearch\Endpoints\Indices\PutTemplate', '\Elasticsearch\Endpoints\Indices\Template\Put'); +class_alias('\Elasticsearch\Endpoints\Indices\ExistsTemplate', '\Elasticsearch\Endpoints\Indices\Template\Exists'); +class_alias('\Elasticsearch\Endpoints\Indices\DeleteTemplate', '\Elasticsearch\Endpoints\Indices\Template\Delete'); +class_alias('\Elasticsearch\Endpoints\Indices\ExistsType', '\Elasticsearch\Endpoints\Indices\Type\Exists'); +class_alias('\Elasticsearch\Endpoints\Indices\GetUpgrade', '\Elasticsearch\Endpoints\Indices\Upgrade\Get'); +class_alias('\Elasticsearch\Endpoints\Indices\Upgrade', '\Elasticsearch\Endpoints\Indices\Upgrade\Post'); +class_alias('\Elasticsearch\Endpoints\Indices\ValidateQuery', '\Elasticsearch\Endpoints\Indices\Validate\Query'); +class_alias('\Elasticsearch\Endpoints\Ingest\DeletePipeline', '\Elasticsearch\Endpoints\Ingest\Pipeline\Delete'); +class_alias('\Elasticsearch\Endpoints\Ingest\GetPipeline', '\Elasticsearch\Endpoints\Ingest\Pipeline\Get'); +class_alias('\Elasticsearch\Endpoints\Ingest\PutPipeline', '\Elasticsearch\Endpoints\Ingest\Pipeline\Put'); +class_alias('\Elasticsearch\Endpoints\Ingest\ProcessorGrok', '\Elasticsearch\Endpoints\Ingest\Pipeline\ProcessorGrok'); +class_alias('\Elasticsearch\Endpoints\Mtermvectors', '\Elasticsearch\Endpoints\MTermVectors'); +class_alias('\Elasticsearch\Endpoints\GetScript', '\Elasticsearch\Endpoints\Script\Get'); +class_alias('\Elasticsearch\Endpoints\PutScript', '\Elasticsearch\Endpoints\Script\Put'); +class_alias('\Elasticsearch\Endpoints\DeleteScript', '\Elasticsearch\Endpoints\Script\Delete'); +class_alias('\Elasticsearch\Endpoints\Snapshot\CreateRepository', '\Elasticsearch\Endpoints\Snapshot\Repository\Create'); +class_alias('\Elasticsearch\Endpoints\Snapshot\DeleteRepository', '\Elasticsearch\Endpoints\Snapshot\Repository\Delete'); +class_alias('\Elasticsearch\Endpoints\Snapshot\GetRepository', '\Elasticsearch\Endpoints\Snapshot\Repository\Get'); +class_alias('\Elasticsearch\Endpoints\Snapshot\VerifyRepository', '\Elasticsearch\Endpoints\Snapshot\Repository\Verify'); +class_alias('\Elasticsearch\Endpoints\GetSource', '\Elasticsearch\Endpoints\Source\Get'); +class_alias('\Elasticsearch\Endpoints\ExistsSource', '\Elasticsearch\Endpoints\Source\Exists'); +class_alias('\Elasticsearch\Endpoints\Tasks\ListTasks', '\Elasticsearch\Endpoints\Tasks\TasksList'); +class_alias('\Elasticsearch\Endpoints\Termvectors', '\Elasticsearch\Endpoints\TermVectors'); From 0c177699da139db03ae03faa48ea85a4609452f4 Mon Sep 17 00:00:00 2001 From: Enrico Zimuel Date: Fri, 22 Nov 2019 15:32:14 +0100 Subject: [PATCH 3/5] Fixed alias issue + code generation with BC break fixes --- src/Elasticsearch/Client.php | 56 +--- .../Cat/{Nodeattrs.php => NodeAttrs.php} | 4 +- .../{Forcemerge.php => ForceMerge.php} | 4 +- .../Endpoints/Indices/PutMapping.php | 2 +- .../{Mtermvectors.php => MTermVectors.php} | 6 +- .../{Termvectors.php => TermVectors.php} | 8 +- src/Elasticsearch/Namespaces/CatNamespace.php | 80 +++--- .../Namespaces/ClusterNamespace.php | 34 +-- .../Namespaces/IndicesNamespace.php | 158 ++++++----- .../Namespaces/IngestNamespace.php | 18 +- .../Namespaces/NodesNamespace.php | 18 +- .../Namespaces/SnapshotNamespace.php | 38 +-- .../Namespaces/TasksNamespace.php | 17 +- src/autoload.php | 4 - .../Elasticsearch/BackwardCompatibleTest.php | 247 +++++++++--------- util/ClientEndpoint.php | 2 +- util/Endpoint.php | 21 +- util/NamespaceEndpoint.php | 63 ++++- util/template/client-class | 4 - util/template/endpoint-function-bool | 2 +- util/template/namespace-property | 1 + 21 files changed, 404 insertions(+), 383 deletions(-) rename src/Elasticsearch/Endpoints/Cat/{Nodeattrs.php => NodeAttrs.php} (93%) rename src/Elasticsearch/Endpoints/Indices/{Forcemerge.php => ForceMerge.php} (94%) rename src/Elasticsearch/Endpoints/{Mtermvectors.php => MTermVectors.php} (93%) rename src/Elasticsearch/Endpoints/{Termvectors.php => TermVectors.php} (92%) diff --git a/src/Elasticsearch/Client.php b/src/Elasticsearch/Client.php index e89c01cdf..01e1c7758 100644 --- a/src/Elasticsearch/Client.php +++ b/src/Elasticsearch/Client.php @@ -32,7 +32,7 @@ */ class Client { - const VERSION = '7.4.0'; + const VERSION = '7.4.1'; /** * @var Transport @@ -58,31 +58,37 @@ class Client * @var CatNamespace */ protected $cat; + /** * @var ClusterNamespace */ protected $cluster; + /** * @var IndicesNamespace */ protected $indices; + /** * @var IngestNamespace */ protected $ingest; + /** * @var NodesNamespace */ protected $nodes; + /** * @var SnapshotNamespace */ protected $snapshot; + /** * @var TasksNamespace */ protected $tasks; - + /** * Client constructor @@ -138,7 +144,6 @@ public function bulk(array $params = []) 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 @@ -160,7 +165,6 @@ public function clearScroll(array $params = []) 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 @@ -199,7 +203,6 @@ public function count(array $params = []) return $this->performRequest($endpoint); } - /** * $params['id'] = (string) Document ID (Required) * $params['index'] = (string) The name of the index (Required) @@ -234,7 +237,6 @@ public function create(array $params = []) return $this->performRequest($endpoint); } - /** * $params['id'] = (string) The document ID (Required) * $params['index'] = (string) The name of the index (Required) @@ -267,7 +269,6 @@ public function delete(array $params = []) 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 @@ -324,7 +325,6 @@ public function deleteByQuery(array $params = []) 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) @@ -344,7 +344,6 @@ public function deleteByQueryRethrottle(array $params = []) return $this->performRequest($endpoint); } - /** * $params['id'] = (string) Script ID * $params['timeout'] = (time) Explicit operation timeout @@ -365,7 +364,6 @@ public function deleteScript(array $params = []) return $this->performRequest($endpoint); } - /** * $params['id'] = (string) The document ID (Required) * $params['index'] = (string) The name of the index (Required) @@ -403,7 +401,6 @@ 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) @@ -440,7 +437,6 @@ 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) @@ -480,7 +476,6 @@ public function explain(array $params = []) 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 @@ -504,7 +499,6 @@ public function fieldCaps(array $params = []) return $this->performRequest($endpoint); } - /** * $params['id'] = (string) The document ID (Required) * $params['index'] = (string) The name of the index (Required) @@ -539,7 +533,6 @@ public function get(array $params = []) return $this->performRequest($endpoint); } - /** * $params['id'] = (string) Script ID * $params['master_timeout'] = (time) Specify timeout for connection to master @@ -559,7 +552,6 @@ public function getScript(array $params = []) return $this->performRequest($endpoint); } - /** * $params['id'] = (string) The document ID (Required) * $params['index'] = (string) The name of the index (Required) @@ -593,7 +585,6 @@ public function getSource(array $params = []) return $this->performRequest($endpoint); } - /** * $params['id'] = (string) Document ID * $params['index'] = (string) The name of the index (Required) @@ -631,7 +622,6 @@ public function index(array $params = []) return $this->performRequest($endpoint); } - /** * * @param array $params Associative array of parameters @@ -647,7 +637,6 @@ public function info(array $params = []) return $this->performRequest($endpoint); } - /** * $params['index'] = (string) The name of the index * $params['type'] = DEPRECATED (string) The type of the document @@ -680,7 +669,6 @@ public function mget(array $params = []) 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 @@ -712,7 +700,6 @@ public function msearch(array $params = []) 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 @@ -741,7 +728,6 @@ public function msearchTemplate(array $params = []) return $this->performRequest($endpoint); } - /** * $params['index'] = (string) The index in which the document resides. * $params['type'] = DEPRECATED (string) The type of the document. @@ -770,7 +756,7 @@ public function mtermvectors(array $params = []) $body = $this->extractArgument($params, 'body'); $endpointBuilder = $this->endpoints; - $endpoint = $endpointBuilder('Mtermvectors'); + $endpoint = $endpointBuilder('MTermVectors'); $endpoint->setParams($params); $endpoint->setIndex($index); $endpoint->setType($type); @@ -778,7 +764,6 @@ public function mtermvectors(array $params = []) return $this->performRequest($endpoint); } - /** * * @param array $params Associative array of parameters @@ -797,7 +782,6 @@ public function ping(array $params = []): bool return BooleanRequestWrapper::performRequest($endpoint, $this->transport); } - /** * $params['id'] = (string) Script ID (Required) * $params['context'] = (string) Script context @@ -824,7 +808,6 @@ public function putScript(array $params = []) 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) @@ -852,7 +835,6 @@ public function rankEval(array $params = []) 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) @@ -879,7 +861,6 @@ public function reindex(array $params = []) 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) @@ -899,7 +880,6 @@ public function reindexRethrottle(array $params = []) return $this->performRequest($endpoint); } - /** * $params['id'] = (string) The id of the stored search template * $params['body'] = (array) The search definition template and its params @@ -921,7 +901,6 @@ public function renderSearchTemplate(array $params = []) return $this->performRequest($endpoint); } - /** * $params['body'] = (array) The script to execute * @@ -943,7 +922,6 @@ public function scriptsPainlessExecute(array $params = []) 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 @@ -967,7 +945,6 @@ public function scroll(array $params = []) 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 @@ -1034,7 +1011,6 @@ public function search(array $params = []) 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) @@ -1059,7 +1035,6 @@ public function searchShards(array $params = []) 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 @@ -1096,7 +1071,6 @@ public function searchTemplate(array $params = []) 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. @@ -1126,7 +1100,7 @@ public function termvectors(array $params = []) $body = $this->extractArgument($params, 'body'); $endpointBuilder = $this->endpoints; - $endpoint = $endpointBuilder('Termvectors'); + $endpoint = $endpointBuilder('TermVectors'); $endpoint->setParams($params); $endpoint->setIndex($index); $endpoint->setId($id); @@ -1135,7 +1109,6 @@ public function termvectors(array $params = []) return $this->performRequest($endpoint); } - /** * $params['id'] = (string) Document ID (Required) * $params['index'] = (string) The name of the index (Required) @@ -1174,7 +1147,6 @@ public function update(array $params = []) 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 @@ -1234,7 +1206,6 @@ public function updateByQuery(array $params = []) 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) @@ -1254,37 +1225,30 @@ public function updateByQueryRethrottle(array $params = []) return $this->performRequest($endpoint); } - 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; diff --git a/src/Elasticsearch/Endpoints/Cat/Nodeattrs.php b/src/Elasticsearch/Endpoints/Cat/NodeAttrs.php similarity index 93% rename from src/Elasticsearch/Endpoints/Cat/Nodeattrs.php rename to src/Elasticsearch/Endpoints/Cat/NodeAttrs.php index 80e26742e..8fb35e08e 100644 --- a/src/Elasticsearch/Endpoints/Cat/Nodeattrs.php +++ b/src/Elasticsearch/Endpoints/Cat/NodeAttrs.php @@ -6,7 +6,7 @@ use Elasticsearch\Endpoints\AbstractEndpoint; /** - * Class Nodeattrs + * Class NodeAttrs * Elasticsearch API name cat.nodeattrs * Generated running $ php util/GenerateEndpoints.php 7.4.2 * @@ -16,7 +16,7 @@ * @license http://www.apache.org/licenses/LICENSE-2.0 Apache2 * @link http://elastic.co */ -class Nodeattrs extends AbstractEndpoint +class NodeAttrs extends AbstractEndpoint { public function getURI(): string diff --git a/src/Elasticsearch/Endpoints/Indices/Forcemerge.php b/src/Elasticsearch/Endpoints/Indices/ForceMerge.php similarity index 94% rename from src/Elasticsearch/Endpoints/Indices/Forcemerge.php rename to src/Elasticsearch/Endpoints/Indices/ForceMerge.php index 01da500cd..5608a7a62 100644 --- a/src/Elasticsearch/Endpoints/Indices/Forcemerge.php +++ b/src/Elasticsearch/Endpoints/Indices/ForceMerge.php @@ -6,7 +6,7 @@ use Elasticsearch\Endpoints\AbstractEndpoint; /** - * Class Forcemerge + * Class ForceMerge * Elasticsearch API name indices.forcemerge * Generated running $ php util/GenerateEndpoints.php 7.4.2 * @@ -16,7 +16,7 @@ * @license http://www.apache.org/licenses/LICENSE-2.0 Apache2 * @link http://elastic.co */ -class Forcemerge extends AbstractEndpoint +class ForceMerge extends AbstractEndpoint { public function getURI(): string diff --git a/src/Elasticsearch/Endpoints/Indices/PutMapping.php b/src/Elasticsearch/Endpoints/Indices/PutMapping.php index 0ef517460..91188b1c0 100644 --- a/src/Elasticsearch/Endpoints/Indices/PutMapping.php +++ b/src/Elasticsearch/Endpoints/Indices/PutMapping.php @@ -35,7 +35,7 @@ public function getURI(): string return "/_mappings/$type"; } if (isset($index)) { - return "$index/_mapping"; + return "/$index/_mapping"; } throw new RuntimeException('Missing parameter for the endpoint indices.put_mapping'); } diff --git a/src/Elasticsearch/Endpoints/Mtermvectors.php b/src/Elasticsearch/Endpoints/MTermVectors.php similarity index 93% rename from src/Elasticsearch/Endpoints/Mtermvectors.php rename to src/Elasticsearch/Endpoints/MTermVectors.php index 8ed34b1f4..a26a991ac 100644 --- a/src/Elasticsearch/Endpoints/Mtermvectors.php +++ b/src/Elasticsearch/Endpoints/MTermVectors.php @@ -6,7 +6,7 @@ use Elasticsearch\Endpoints\AbstractEndpoint; /** - * Class Mtermvectors + * Class MTermVectors * Elasticsearch API name mtermvectors * Generated running $ php util/GenerateEndpoints.php 7.4.2 * @@ -16,7 +16,7 @@ * @license http://www.apache.org/licenses/LICENSE-2.0 Apache2 * @link http://elastic.co */ -class Mtermvectors extends AbstractEndpoint +class MTermVectors extends AbstractEndpoint { public function getURI(): string @@ -59,7 +59,7 @@ public function getMethod(): string return isset($this->body) ? 'POST' : 'GET'; } - public function setBody($body): Mtermvectors + public function setBody($body): MTermVectors { if (isset($body) !== true) { return $this; diff --git a/src/Elasticsearch/Endpoints/Termvectors.php b/src/Elasticsearch/Endpoints/TermVectors.php similarity index 92% rename from src/Elasticsearch/Endpoints/Termvectors.php rename to src/Elasticsearch/Endpoints/TermVectors.php index 5ec66f060..3bcc0d67d 100644 --- a/src/Elasticsearch/Endpoints/Termvectors.php +++ b/src/Elasticsearch/Endpoints/TermVectors.php @@ -7,7 +7,7 @@ use Elasticsearch\Endpoints\AbstractEndpoint; /** - * Class Termvectors + * Class TermVectors * Elasticsearch API name termvectors * Generated running $ php util/GenerateEndpoints.php 7.4.2 * @@ -17,7 +17,7 @@ * @license http://www.apache.org/licenses/LICENSE-2.0 Apache2 * @link http://elastic.co */ -class Termvectors extends AbstractEndpoint +class TermVectors extends AbstractEndpoint { public function getURI(): string @@ -68,7 +68,7 @@ public function getMethod(): string return isset($this->body) ? 'POST' : 'GET'; } - public function setBody($body): Termvectors + public function setBody($body): TermVectors { if (isset($body) !== true) { return $this; @@ -78,7 +78,7 @@ public function setBody($body): Termvectors return $this; } - public function setId($id): Termvectors + public function setId($id): TermVectors { if (isset($id) !== true) { return $this; diff --git a/src/Elasticsearch/Namespaces/CatNamespace.php b/src/Elasticsearch/Namespaces/CatNamespace.php index 1a56f4ace..c844e8e93 100644 --- a/src/Elasticsearch/Namespaces/CatNamespace.php +++ b/src/Elasticsearch/Namespaces/CatNamespace.php @@ -17,6 +17,7 @@ */ class CatNamespace extends AbstractNamespace { + /** * $params['name'] = (list) A comma-separated list of alias names to return * $params['format'] = (string) a short version of the Accept header, e.g. json, yaml @@ -30,7 +31,6 @@ class CatNamespace extends AbstractNamespace * @return array * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/cat-alias.html */ - public function aliases(array $params = []) { $name = $this->extractArgument($params, 'name'); @@ -41,7 +41,8 @@ public function aliases(array $params = []) $endpoint->setName($name); return $this->performRequest($endpoint); - } /** + } + /** * $params['node_id'] = (list) A comma-separated list of node IDs or names to limit the returned information * $params['format'] = (string) a short version of the Accept header, e.g. json, yaml * $params['bytes'] = (enum) The unit in which to display byte values (Options = b,k,kb,m,mb,g,gb,t,tb,p,pb) @@ -56,7 +57,6 @@ public function aliases(array $params = []) * @return array * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/cat-allocation.html */ - public function allocation(array $params = []) { $node_id = $this->extractArgument($params, 'node_id'); @@ -67,7 +67,8 @@ public function allocation(array $params = []) $endpoint->setNodeId($node_id); return $this->performRequest($endpoint); - } /** + } + /** * $params['index'] = (list) A comma-separated list of index names to limit the returned information * $params['format'] = (string) a short version of the Accept header, e.g. json, yaml * $params['h'] = (list) Comma-separated list of column names to display @@ -79,7 +80,6 @@ public function allocation(array $params = []) * @return array * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/cat-count.html */ - public function count(array $params = []) { $index = $this->extractArgument($params, 'index'); @@ -90,7 +90,8 @@ public function count(array $params = []) $endpoint->setIndex($index); return $this->performRequest($endpoint); - } /** + } + /** * $params['fields'] = (list) A comma-separated list of fields to return the fielddata size * $params['format'] = (string) a short version of the Accept header, e.g. json, yaml * $params['bytes'] = (enum) The unit in which to display byte values (Options = b,k,kb,m,mb,g,gb,t,tb,p,pb) @@ -103,7 +104,6 @@ public function count(array $params = []) * @return array * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/cat-fielddata.html */ - public function fielddata(array $params = []) { $fields = $this->extractArgument($params, 'fields'); @@ -114,7 +114,8 @@ public function fielddata(array $params = []) $endpoint->setFields($fields); return $this->performRequest($endpoint); - } /** + } + /** * $params['format'] = (string) a short version of the Accept header, e.g. json, yaml * $params['h'] = (list) Comma-separated list of column names to display * $params['help'] = (boolean) Return help information (Default = false) @@ -127,7 +128,6 @@ public function fielddata(array $params = []) * @return array * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/cat-health.html */ - public function health(array $params = []) { @@ -136,7 +136,8 @@ public function health(array $params = []) $endpoint->setParams($params); return $this->performRequest($endpoint); - } /** + } + /** * $params['help'] = (boolean) Return help information (Default = false) * $params['s'] = (list) Comma-separated list of column names or column aliases to sort by * @@ -144,7 +145,6 @@ public function health(array $params = []) * @return array * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/cat.html */ - public function help(array $params = []) { @@ -153,7 +153,8 @@ public function help(array $params = []) $endpoint->setParams($params); return $this->performRequest($endpoint); - } /** + } + /** * $params['index'] = (list) A comma-separated list of index names to limit the returned information * $params['format'] = (string) a short version of the Accept header, e.g. json, yaml * $params['bytes'] = (enum) The unit in which to display byte values (Options = b,k,m,g) @@ -172,7 +173,6 @@ public function help(array $params = []) * @return array * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/cat-indices.html */ - public function indices(array $params = []) { $index = $this->extractArgument($params, 'index'); @@ -183,7 +183,8 @@ public function indices(array $params = []) $endpoint->setIndex($index); return $this->performRequest($endpoint); - } /** + } + /** * $params['format'] = (string) a short version of the Accept header, e.g. json, yaml * $params['local'] = (boolean) Return local information, do not retrieve the state from master node (default: false) * $params['master_timeout'] = (time) Explicit operation timeout for connection to master node @@ -196,7 +197,6 @@ public function indices(array $params = []) * @return array * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/cat-master.html */ - public function master(array $params = []) { @@ -205,7 +205,8 @@ public function master(array $params = []) $endpoint->setParams($params); return $this->performRequest($endpoint); - } /** + } + /** * $params['format'] = (string) a short version of the Accept header, e.g. json, yaml * $params['local'] = (boolean) Return local information, do not retrieve the state from master node (default: false) * $params['master_timeout'] = (time) Explicit operation timeout for connection to master node @@ -218,16 +219,16 @@ public function master(array $params = []) * @return array * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/cat-nodeattrs.html */ - public function nodeattrs(array $params = []) { $endpointBuilder = $this->endpoints; - $endpoint = $endpointBuilder('Cat\Nodeattrs'); + $endpoint = $endpointBuilder('Cat\NodeAttrs'); $endpoint->setParams($params); return $this->performRequest($endpoint); - } /** + } + /** * $params['bytes'] = (enum) The unit in which to display byte values (Options = b,k,kb,m,mb,g,gb,t,tb,p,pb) * $params['format'] = (string) a short version of the Accept header, e.g. json, yaml * $params['full_id'] = (boolean) Return the full node ID instead of the shortened version (default: false) @@ -243,7 +244,6 @@ public function nodeattrs(array $params = []) * @return array * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/cat-nodes.html */ - public function nodes(array $params = []) { @@ -252,7 +252,8 @@ public function nodes(array $params = []) $endpoint->setParams($params); return $this->performRequest($endpoint); - } /** + } + /** * $params['format'] = (string) a short version of the Accept header, e.g. json, yaml * $params['local'] = (boolean) Return local information, do not retrieve the state from master node (default: false) * $params['master_timeout'] = (time) Explicit operation timeout for connection to master node @@ -266,7 +267,6 @@ public function nodes(array $params = []) * @return array * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/cat-pending-tasks.html */ - public function pendingTasks(array $params = []) { @@ -275,7 +275,8 @@ public function pendingTasks(array $params = []) $endpoint->setParams($params); return $this->performRequest($endpoint); - } /** + } + /** * $params['format'] = (string) a short version of the Accept header, e.g. json, yaml * $params['local'] = (boolean) Return local information, do not retrieve the state from master node (default: false) * $params['master_timeout'] = (time) Explicit operation timeout for connection to master node @@ -288,7 +289,6 @@ public function pendingTasks(array $params = []) * @return array * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/cat-plugins.html */ - public function plugins(array $params = []) { @@ -297,7 +297,8 @@ public function plugins(array $params = []) $endpoint->setParams($params); return $this->performRequest($endpoint); - } /** + } + /** * $params['index'] = (list) Comma-separated list or wildcard expression of index names to limit the returned information * $params['format'] = (string) a short version of the Accept header, e.g. json, yaml * $params['active_only'] = (boolean) If `true`, the response only includes ongoing shard recoveries (Default = false) @@ -313,7 +314,6 @@ public function plugins(array $params = []) * @return array * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/cat-recovery.html */ - public function recovery(array $params = []) { $index = $this->extractArgument($params, 'index'); @@ -324,7 +324,8 @@ public function recovery(array $params = []) $endpoint->setIndex($index); return $this->performRequest($endpoint); - } /** + } + /** * $params['format'] = (string) a short version of the Accept header, e.g. json, yaml * $params['local'] = (boolean) Return local information, do not retrieve the state from master node (Default = false) * $params['master_timeout'] = (time) Explicit operation timeout for connection to master node @@ -337,7 +338,6 @@ public function recovery(array $params = []) * @return array * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/cat-repositories.html */ - public function repositories(array $params = []) { @@ -346,7 +346,8 @@ public function repositories(array $params = []) $endpoint->setParams($params); return $this->performRequest($endpoint); - } /** + } + /** * $params['index'] = (list) A comma-separated list of index names to limit the returned information * $params['format'] = (string) a short version of the Accept header, e.g. json, yaml * $params['bytes'] = (enum) The unit in which to display byte values (Options = b,k,kb,m,mb,g,gb,t,tb,p,pb) @@ -359,7 +360,6 @@ public function repositories(array $params = []) * @return array * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/cat-segments.html */ - public function segments(array $params = []) { $index = $this->extractArgument($params, 'index'); @@ -370,7 +370,8 @@ public function segments(array $params = []) $endpoint->setIndex($index); return $this->performRequest($endpoint); - } /** + } + /** * $params['index'] = (list) A comma-separated list of index names to limit the returned information * $params['format'] = (string) a short version of the Accept header, e.g. json, yaml * $params['bytes'] = (enum) The unit in which to display byte values (Options = b,k,kb,m,mb,g,gb,t,tb,p,pb) @@ -386,7 +387,6 @@ public function segments(array $params = []) * @return array * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/cat-shards.html */ - public function shards(array $params = []) { $index = $this->extractArgument($params, 'index'); @@ -397,7 +397,8 @@ public function shards(array $params = []) $endpoint->setIndex($index); return $this->performRequest($endpoint); - } /** + } + /** * $params['repository'] = (list) Name of repository from which to fetch the snapshot information * $params['format'] = (string) a short version of the Accept header, e.g. json, yaml * $params['ignore_unavailable'] = (boolean) Set to true to ignore unavailable snapshots (Default = false) @@ -412,7 +413,6 @@ public function shards(array $params = []) * @return array * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/cat-snapshots.html */ - public function snapshots(array $params = []) { $repository = $this->extractArgument($params, 'repository'); @@ -423,7 +423,8 @@ public function snapshots(array $params = []) $endpoint->setRepository($repository); return $this->performRequest($endpoint); - } /** + } + /** * $params['format'] = (string) a short version of the Accept header, e.g. json, yaml * $params['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 * $params['actions'] = (list) A comma-separated list of actions that should be returned. Leave empty to return all. @@ -439,7 +440,6 @@ public function snapshots(array $params = []) * @return array * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/tasks.html */ - public function tasks(array $params = []) { @@ -448,7 +448,8 @@ public function tasks(array $params = []) $endpoint->setParams($params); return $this->performRequest($endpoint); - } /** + } + /** * $params['name'] = (string) A pattern that returned template names must match * $params['format'] = (string) a short version of the Accept header, e.g. json, yaml * $params['local'] = (boolean) Return local information, do not retrieve the state from master node (default: false) @@ -462,7 +463,6 @@ public function tasks(array $params = []) * @return array * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/cat-templates.html */ - public function templates(array $params = []) { $name = $this->extractArgument($params, 'name'); @@ -473,7 +473,8 @@ public function templates(array $params = []) $endpoint->setName($name); return $this->performRequest($endpoint); - } /** + } + /** * $params['thread_pool_patterns'] = (list) A comma-separated list of regular-expressions to filter the thread pools in the output * $params['format'] = (string) a short version of the Accept header, e.g. json, yaml * $params['size'] = (enum) The multiplier in which to display values (Options = ,k,m,g,t,p) @@ -488,7 +489,6 @@ public function templates(array $params = []) * @return array * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/cat-thread-pool.html */ - public function threadPool(array $params = []) { $thread_pool_patterns = $this->extractArgument($params, 'thread_pool_patterns'); diff --git a/src/Elasticsearch/Namespaces/ClusterNamespace.php b/src/Elasticsearch/Namespaces/ClusterNamespace.php index a14787e40..8e8d3dbe5 100644 --- a/src/Elasticsearch/Namespaces/ClusterNamespace.php +++ b/src/Elasticsearch/Namespaces/ClusterNamespace.php @@ -17,6 +17,7 @@ */ class ClusterNamespace extends AbstractNamespace { + /** * $params['include_yes_decisions'] = (boolean) Return 'YES' decisions in explanation (default: false) * $params['include_disk_info'] = (boolean) Return information about disk usage and shard sizes (default: false) @@ -26,7 +27,6 @@ class ClusterNamespace extends AbstractNamespace * @return array * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/cluster-allocation-explain.html */ - public function allocationExplain(array $params = []) { $body = $this->extractArgument($params, 'body'); @@ -37,7 +37,8 @@ public function allocationExplain(array $params = []) $endpoint->setBody($body); return $this->performRequest($endpoint); - } /** + } + /** * $params['flat_settings'] = (boolean) Return settings in flat format (default: false) * $params['master_timeout'] = (time) Explicit operation timeout for connection to master node * $params['timeout'] = (time) Explicit operation timeout @@ -47,7 +48,6 @@ public function allocationExplain(array $params = []) * @return array * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/cluster-update-settings.html */ - public function getSettings(array $params = []) { @@ -56,7 +56,8 @@ public function getSettings(array $params = []) $endpoint->setParams($params); return $this->performRequest($endpoint); - } /** + } + /** * $params['index'] = (list) Limit the information returned to a specific index * $params['expand_wildcards'] = (enum) Whether to expand wildcard expression to concrete indices that are open, closed or both. (Options = open,closed,none,all) (Default = all) * $params['level'] = (enum) Specify the level of detail for returned information (Options = cluster,indices,shards) (Default = cluster) @@ -74,7 +75,6 @@ public function getSettings(array $params = []) * @return array * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/cluster-health.html */ - public function health(array $params = []) { $index = $this->extractArgument($params, 'index'); @@ -85,7 +85,8 @@ public function health(array $params = []) $endpoint->setIndex($index); return $this->performRequest($endpoint); - } /** + } + /** * $params['local'] = (boolean) Return local information, do not retrieve the state from master node (default: false) * $params['master_timeout'] = (time) Specify timeout for connection to master * @@ -93,7 +94,6 @@ public function health(array $params = []) * @return array * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/cluster-pending.html */ - public function pendingTasks(array $params = []) { @@ -102,7 +102,8 @@ public function pendingTasks(array $params = []) $endpoint->setParams($params); return $this->performRequest($endpoint); - } /** + } + /** * $params['flat_settings'] = (boolean) Return settings in flat format (default: false) * $params['master_timeout'] = (time) Explicit operation timeout for connection to master node * $params['timeout'] = (time) Explicit operation timeout @@ -112,7 +113,6 @@ public function pendingTasks(array $params = []) * @return array * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/cluster-update-settings.html */ - public function putSettings(array $params = []) { $body = $this->extractArgument($params, 'body'); @@ -123,13 +123,13 @@ public function putSettings(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/master/cluster-remote-info.html */ - public function remoteInfo(array $params = []) { @@ -138,7 +138,8 @@ public function remoteInfo(array $params = []) $endpoint->setParams($params); return $this->performRequest($endpoint); - } /** + } + /** * $params['dry_run'] = (boolean) Simulate the operation only and return the resulting state * $params['explain'] = (boolean) Return an explanation of why the commands can or cannot be executed * $params['retry_failed'] = (boolean) Retries allocation of shards that are blocked due to too many subsequent allocation failures @@ -151,7 +152,6 @@ public function remoteInfo(array $params = []) * @return array * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/cluster-reroute.html */ - public function reroute(array $params = []) { $body = $this->extractArgument($params, 'body'); @@ -162,7 +162,8 @@ public function reroute(array $params = []) $endpoint->setBody($body); return $this->performRequest($endpoint); - } /** + } + /** * $params['metric'] = (list) Limit the information returned to the specified metrics * $params['index'] = (list) A comma-separated list of index names; use `_all` or empty string to perform the operation on all indices * $params['local'] = (boolean) Return local information, do not retrieve the state from master node (default: false) @@ -178,7 +179,6 @@ public function reroute(array $params = []) * @return array * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/cluster-state.html */ - public function state(array $params = []) { $metric = $this->extractArgument($params, 'metric'); @@ -191,7 +191,8 @@ public function state(array $params = []) $endpoint->setIndex($index); return $this->performRequest($endpoint); - } /** + } + /** * $params['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 * $params['flat_settings'] = (boolean) Return settings in flat format (default: false) * $params['timeout'] = (time) Explicit operation timeout @@ -200,7 +201,6 @@ public function state(array $params = []) * @return array * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/cluster-stats.html */ - public function stats(array $params = []) { $node_id = $this->extractArgument($params, 'node_id'); diff --git a/src/Elasticsearch/Namespaces/IndicesNamespace.php b/src/Elasticsearch/Namespaces/IndicesNamespace.php index 8c46e59cc..88ed99a03 100644 --- a/src/Elasticsearch/Namespaces/IndicesNamespace.php +++ b/src/Elasticsearch/Namespaces/IndicesNamespace.php @@ -17,6 +17,7 @@ */ class IndicesNamespace extends AbstractNamespace { + /** * $params['index'] = (string) The name of the index to scope the operation * $params['body'] = (array) Define analyzer/tokenizer parameters and the text on which the analysis should be performed @@ -25,7 +26,6 @@ class IndicesNamespace extends AbstractNamespace * @return array * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-analyze.html */ - public function analyze(array $params = []) { $index = $this->extractArgument($params, 'index'); @@ -38,7 +38,8 @@ public function analyze(array $params = []) $endpoint->setBody($body); return $this->performRequest($endpoint); - } /** + } + /** * $params['index'] = (list) A comma-separated list of index name to limit the operation * $params['fielddata'] = (boolean) Clear field data * $params['fields'] = (list) A comma-separated list of fields to clear when using the `fielddata` parameter (default: all) @@ -52,7 +53,6 @@ public function analyze(array $params = []) * @return array * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-clearcache.html */ - public function clearCache(array $params = []) { $index = $this->extractArgument($params, 'index'); @@ -63,7 +63,8 @@ public function clearCache(array $params = []) $endpoint->setIndex($index); return $this->performRequest($endpoint); - } /** + } + /** * $params['index'] = (string) The name of the source index to clone * $params['target'] = (string) The name of the target index to clone into * $params['timeout'] = (time) Explicit operation timeout @@ -75,7 +76,6 @@ public function clearCache(array $params = []) * @return array * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-clone-index.html */ - public function clone(array $params = []) { $index = $this->extractArgument($params, 'index'); @@ -90,7 +90,8 @@ public function clone(array $params = []) $endpoint->setBody($body); return $this->performRequest($endpoint); - } /** + } + /** * $params['index'] = (list) A comma separated list of indices to close * $params['timeout'] = (time) Explicit operation timeout * $params['master_timeout'] = (time) Specify timeout for connection to master @@ -103,7 +104,6 @@ public function clone(array $params = []) * @return array * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-open-close.html */ - public function close(array $params = []) { $index = $this->extractArgument($params, 'index'); @@ -114,7 +114,8 @@ public function close(array $params = []) $endpoint->setIndex($index); return $this->performRequest($endpoint); - } /** + } + /** * $params['index'] = (string) The name of the index * $params['include_type_name'] = (boolean) Whether a type should be expected in the body of the mappings. * $params['wait_for_active_shards'] = (string) Set the number of active shards to wait for before the operation returns. @@ -126,7 +127,6 @@ public function close(array $params = []) * @return array * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-create-index.html */ - public function create(array $params = []) { $index = $this->extractArgument($params, 'index'); @@ -139,7 +139,8 @@ public function create(array $params = []) $endpoint->setBody($body); return $this->performRequest($endpoint); - } /** + } + /** * $params['index'] = (list) A comma-separated list of indices to delete; use `_all` or `*` string to delete all indices * $params['timeout'] = (time) Explicit operation timeout * $params['master_timeout'] = (time) Specify timeout for connection to master @@ -151,7 +152,6 @@ public function create(array $params = []) * @return array * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-delete-index.html */ - public function delete(array $params = []) { $index = $this->extractArgument($params, 'index'); @@ -162,7 +162,8 @@ public function delete(array $params = []) $endpoint->setIndex($index); return $this->performRequest($endpoint); - } /** + } + /** * $params['index'] = (list) A comma-separated list of index names (supports wildcards); use `_all` for all indices (Required) * $params['name'] = (list) A comma-separated list of aliases to delete (supports wildcards); use `_all` to delete all aliases for the specified indices. (Required) * $params['timeout'] = (time) Explicit timestamp for the document @@ -172,7 +173,6 @@ public function delete(array $params = []) * @return array * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-aliases.html */ - public function deleteAlias(array $params = []) { $index = $this->extractArgument($params, 'index'); @@ -185,7 +185,8 @@ public function deleteAlias(array $params = []) $endpoint->setName($name); return $this->performRequest($endpoint); - } /** + } + /** * $params['name'] = (string) The name of the template * $params['timeout'] = (time) Explicit operation timeout * $params['master_timeout'] = (time) Specify timeout for connection to master @@ -194,7 +195,6 @@ public function deleteAlias(array $params = []) * @return array * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-templates.html */ - public function deleteTemplate(array $params = []) { $name = $this->extractArgument($params, 'name'); @@ -205,7 +205,8 @@ public function deleteTemplate(array $params = []) $endpoint->setName($name); return $this->performRequest($endpoint); - } /** + } + /** * $params['index'] = (list) A comma-separated list of index names * $params['local'] = (boolean) Return local information, do not retrieve the state from master node (default: false) * $params['ignore_unavailable'] = (boolean) Ignore unavailable indexes (default: false) @@ -218,7 +219,6 @@ public function deleteTemplate(array $params = []) * @return bool * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-exists.html */ - public function exists(array $params = []): bool { $index = $this->extractArgument($params, 'index'); @@ -245,7 +245,6 @@ public function exists(array $params = []): bool * @return bool * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-aliases.html */ - public function existsAlias(array $params = []): bool { $name = $this->extractArgument($params, 'name'); @@ -272,7 +271,6 @@ public function existsAlias(array $params = []): bool * @return bool * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-templates.html */ - public function existsTemplate(array $params = []): bool { $name = $this->extractArgument($params, 'name'); @@ -299,7 +297,6 @@ public function existsTemplate(array $params = []): bool * @return bool * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-types-exists.html */ - public function existsType(array $params = []): bool { $index = $this->extractArgument($params, 'index'); @@ -328,7 +325,6 @@ public function existsType(array $params = []): bool * @return array * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-flush.html */ - public function flush(array $params = []) { $index = $this->extractArgument($params, 'index'); @@ -339,7 +335,8 @@ public function flush(array $params = []) $endpoint->setIndex($index); return $this->performRequest($endpoint); - } /** + } + /** * $params['index'] = (list) A comma-separated list of index names; use `_all` or empty string for 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) @@ -349,7 +346,6 @@ public function flush(array $params = []) * @return array * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-synced-flush-api.html */ - public function flushSynced(array $params = []) { $index = $this->extractArgument($params, 'index'); @@ -360,7 +356,8 @@ public function flushSynced(array $params = []) $endpoint->setIndex($index); 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['flush'] = (boolean) Specify whether the index should be flushed after performing the operation (default: true) * $params['ignore_unavailable'] = (boolean) Whether specified concrete indices should be ignored when unavailable (missing or closed) @@ -373,18 +370,18 @@ public function flushSynced(array $params = []) * @return array * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-forcemerge.html */ - public function forcemerge(array $params = []) { $index = $this->extractArgument($params, 'index'); $endpointBuilder = $this->endpoints; - $endpoint = $endpointBuilder('Indices\Forcemerge'); + $endpoint = $endpointBuilder('Indices\ForceMerge'); $endpoint->setParams($params); $endpoint->setIndex($index); return $this->performRequest($endpoint); - } /** + } + /** * $params['index'] = (list) A comma-separated list of index names * $params['include_type_name'] = (boolean) Whether to add the type name to the response (default: false) * $params['local'] = (boolean) Return local information, do not retrieve the state from master node (default: false) @@ -399,7 +396,6 @@ public function forcemerge(array $params = []) * @return array * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-get-index.html */ - public function get(array $params = []) { $index = $this->extractArgument($params, 'index'); @@ -410,7 +406,8 @@ public function get(array $params = []) $endpoint->setIndex($index); return $this->performRequest($endpoint); - } /** + } + /** * $params['name'] = (list) A comma-separated list of alias names to return * $params['index'] = (list) A comma-separated list of index names to filter aliases * $params['ignore_unavailable'] = (boolean) Whether specified concrete indices should be ignored when unavailable (missing or closed) @@ -422,7 +419,6 @@ public function get(array $params = []) * @return array * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-aliases.html */ - public function getAlias(array $params = []) { $name = $this->extractArgument($params, 'name'); @@ -436,18 +432,6 @@ public function getAlias(array $params = []) return $this->performRequest($endpoint); } - - /** - * Alias function to getAlias() - * - * @deprecated added to prevent BC break introduced in 7.2.0 - * @see https://github.com/elastic/elasticsearch-php/issues/940 - */ - public function getAliases(array $params = []) - { - return $this->getAlias($params); - } - /** * $params['fields'] = (list) A comma-separated list of fields (Required) * $params['index'] = (list) A comma-separated list of index names @@ -477,7 +461,8 @@ public function getFieldMapping(array $params = []) $endpoint->setType($type); return $this->performRequest($endpoint); - } /** + } + /** * $params['index'] = (list) A comma-separated list of index names * $params['type'] = DEPRECATED (list) A comma-separated list of document types * $params['include_type_name'] = (boolean) Whether to add the type name to the response (default: false) @@ -491,7 +476,6 @@ public function getFieldMapping(array $params = []) * @return array * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-get-mapping.html */ - public function getMapping(array $params = []) { $index = $this->extractArgument($params, 'index'); @@ -504,7 +488,8 @@ public function getMapping(array $params = []) $endpoint->setType($type); 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['name'] = (list) The name of the settings that should be included * $params['master_timeout'] = (time) Specify timeout for connection to master @@ -519,7 +504,6 @@ public function getMapping(array $params = []) * @return array * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-get-settings.html */ - public function getSettings(array $params = []) { $index = $this->extractArgument($params, 'index'); @@ -532,7 +516,8 @@ public function getSettings(array $params = []) $endpoint->setName($name); return $this->performRequest($endpoint); - } /** + } + /** * $params['name'] = (list) The comma separated names of the index templates * $params['include_type_name'] = (boolean) Whether a type should be returned in the body of the mappings. * $params['flat_settings'] = (boolean) Return settings in flat format (default: false) @@ -543,7 +528,6 @@ public function getSettings(array $params = []) * @return array * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-templates.html */ - public function getTemplate(array $params = []) { $name = $this->extractArgument($params, 'name'); @@ -554,7 +538,8 @@ public function getTemplate(array $params = []) $endpoint->setName($name); 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['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) @@ -564,7 +549,6 @@ public function getTemplate(array $params = []) * @return array * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-upgrade.html */ - public function getUpgrade(array $params = []) { $index = $this->extractArgument($params, 'index'); @@ -575,7 +559,8 @@ public function getUpgrade(array $params = []) $endpoint->setIndex($index); return $this->performRequest($endpoint); - } /** + } + /** * $params['index'] = (list) A comma separated list of indices to open * $params['timeout'] = (time) Explicit operation timeout * $params['master_timeout'] = (time) Specify timeout for connection to master @@ -588,7 +573,6 @@ public function getUpgrade(array $params = []) * @return array * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-open-close.html */ - public function open(array $params = []) { $index = $this->extractArgument($params, 'index'); @@ -599,7 +583,8 @@ public function open(array $params = []) $endpoint->setIndex($index); return $this->performRequest($endpoint); - } /** + } + /** * $params['index'] = (list) A comma-separated list of index names the alias should point to (supports wildcards); use `_all` to perform the operation on all indices. (Required) * $params['name'] = (string) The name of the alias to be created or updated (Required) * $params['timeout'] = (time) Explicit timestamp for the document @@ -610,7 +595,6 @@ public function open(array $params = []) * @return array * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-aliases.html */ - public function putAlias(array $params = []) { $index = $this->extractArgument($params, 'index'); @@ -625,7 +609,8 @@ public function putAlias(array $params = []) $endpoint->setBody($body); return $this->performRequest($endpoint); - } /** + } + /** * $params['index'] = (list) 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. * $params['type'] = DEPRECATED (string) The name of the document type * $params['include_type_name'] = (boolean) Whether a type should be expected in the body of the mappings. @@ -640,7 +625,6 @@ public function putAlias(array $params = []) * @return array * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-put-mapping.html */ - public function putMapping(array $params = []) { $index = $this->extractArgument($params, 'index'); @@ -655,7 +639,8 @@ public function putMapping(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['master_timeout'] = (time) Specify timeout for connection to master * $params['timeout'] = (time) Explicit operation timeout @@ -670,7 +655,6 @@ public function putMapping(array $params = []) * @return array * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-update-settings.html */ - public function putSettings(array $params = []) { $index = $this->extractArgument($params, 'index'); @@ -683,7 +667,8 @@ public function putSettings(array $params = []) $endpoint->setBody($body); return $this->performRequest($endpoint); - } /** + } + /** * $params['name'] = (string) The name of the template * $params['include_type_name'] = (boolean) Whether a type should be returned in the body of the mappings. * $params['order'] = (number) The order for this template when merging multiple matching ones (higher numbers are merged later, overriding the lower numbers) @@ -697,7 +682,6 @@ public function putSettings(array $params = []) * @return array * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-templates.html */ - public function putTemplate(array $params = []) { $name = $this->extractArgument($params, 'name'); @@ -710,7 +694,8 @@ public function putTemplate(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['detailed'] = (boolean) Whether to display detailed information about shard recovery (Default = false) * $params['active_only'] = (boolean) Display only those recoveries that are currently on-going (Default = false) @@ -719,7 +704,6 @@ public function putTemplate(array $params = []) * @return array * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-recovery.html */ - public function recovery(array $params = []) { $index = $this->extractArgument($params, 'index'); @@ -730,7 +714,8 @@ public function recovery(array $params = []) $endpoint->setIndex($index); 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['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) @@ -740,7 +725,6 @@ public function recovery(array $params = []) * @return array * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-refresh.html */ - public function refresh(array $params = []) { $index = $this->extractArgument($params, 'index'); @@ -751,7 +735,8 @@ public function refresh(array $params = []) $endpoint->setIndex($index); return $this->performRequest($endpoint); - } /** + } + /** * $params['alias'] = (string) The name of the alias to rollover (Required) * $params['new_index'] = (string) The name of the rollover index * $params['include_type_name'] = (boolean) Whether a type should be included in the body of the mappings. @@ -765,7 +750,6 @@ public function refresh(array $params = []) * @return array * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-rollover-index.html */ - public function rollover(array $params = []) { $alias = $this->extractArgument($params, 'alias'); @@ -780,7 +764,8 @@ public function rollover(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['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) @@ -791,7 +776,6 @@ public function rollover(array $params = []) * @return array * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-segments.html */ - public function segments(array $params = []) { $index = $this->extractArgument($params, 'index'); @@ -802,7 +786,8 @@ public function segments(array $params = []) $endpoint->setIndex($index); 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['status'] = (list) A comma-separated list of statuses used to filter on shards to get store information for (Options = green,yellow,red,all) * $params['ignore_unavailable'] = (boolean) Whether specified concrete indices should be ignored when unavailable (missing or closed) @@ -813,7 +798,6 @@ public function segments(array $params = []) * @return array * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-shards-stores.html */ - public function shardStores(array $params = []) { $index = $this->extractArgument($params, 'index'); @@ -824,7 +808,8 @@ public function shardStores(array $params = []) $endpoint->setIndex($index); return $this->performRequest($endpoint); - } /** + } + /** * $params['index'] = (string) The name of the source index to shrink * $params['target'] = (string) The name of the target index to shrink into * $params['copy_settings'] = (boolean) whether or not to copy settings from the source index (defaults to false) @@ -837,7 +822,6 @@ public function shardStores(array $params = []) * @return array * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-shrink-index.html */ - public function shrink(array $params = []) { $index = $this->extractArgument($params, 'index'); @@ -852,7 +836,8 @@ public function shrink(array $params = []) $endpoint->setBody($body); return $this->performRequest($endpoint); - } /** + } + /** * $params['index'] = (string) The name of the source index to split * $params['target'] = (string) The name of the target index to split into * $params['copy_settings'] = (boolean) whether or not to copy settings from the source index (defaults to false) @@ -865,7 +850,6 @@ public function shrink(array $params = []) * @return array * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-split-index.html */ - public function split(array $params = []) { $index = $this->extractArgument($params, 'index'); @@ -880,7 +864,8 @@ public function split(array $params = []) $endpoint->setBody($body); return $this->performRequest($endpoint); - } /** + } + /** * $params['metric'] = (list) Limit the information returned the specific metrics. * $params['index'] = (list) A comma-separated list of index names; use `_all` or empty string to perform the operation on all indices * $params['completion_fields'] = (list) A comma-separated list of fields for `fielddata` and `suggest` index metric (supports wildcards) @@ -898,7 +883,6 @@ public function split(array $params = []) * @return array * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-stats.html */ - public function stats(array $params = []) { $metric = $this->extractArgument($params, 'metric'); @@ -911,7 +895,8 @@ public function stats(array $params = []) $endpoint->setIndex($index); return $this->performRequest($endpoint); - } /** + } + /** * $params['timeout'] = (time) Request timeout * $params['master_timeout'] = (time) Specify timeout for connection to master * $params['body'] = (array) The definition of `actions` to perform (Required) @@ -920,7 +905,6 @@ public function stats(array $params = []) * @return array * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-aliases.html */ - public function updateAliases(array $params = []) { $body = $this->extractArgument($params, 'body'); @@ -931,7 +915,8 @@ public function updateAliases(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['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) * $params['expand_wildcards'] = (enum) Whether to expand wildcard expression to concrete indices that are open, closed or both. (Options = open,closed,none,all) (Default = open) @@ -943,7 +928,6 @@ public function updateAliases(array $params = []) * @return array * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-upgrade.html */ - public function upgrade(array $params = []) { $index = $this->extractArgument($params, 'index'); @@ -954,7 +938,8 @@ public function upgrade(array $params = []) $endpoint->setIndex($index); return $this->performRequest($endpoint); - } /** + } + /** * $params['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 * $params['type'] = DEPRECATED (list) A comma-separated list of document types to restrict the operation; leave empty to perform the operation on all types * $params['explain'] = (boolean) Return detailed information about the error @@ -975,7 +960,6 @@ public function upgrade(array $params = []) * @return array * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/search-validate.html */ - public function validateQuery(array $params = []) { $index = $this->extractArgument($params, 'index'); @@ -991,4 +975,14 @@ public function validateQuery(array $params = []) return $this->performRequest($endpoint); } + /** + * Alias function to getAlias() + * + * @deprecated added to prevent BC break introduced in 7.2.0 + * @see https://github.com/elastic/elasticsearch-php/issues/940 + */ + public function getAliases(array $params = []) + { + return $this->getAlias($params); + } } diff --git a/src/Elasticsearch/Namespaces/IngestNamespace.php b/src/Elasticsearch/Namespaces/IngestNamespace.php index b81d090e8..26171531e 100644 --- a/src/Elasticsearch/Namespaces/IngestNamespace.php +++ b/src/Elasticsearch/Namespaces/IngestNamespace.php @@ -17,6 +17,7 @@ */ class IngestNamespace extends AbstractNamespace { + /** * $params['id'] = (string) Pipeline ID * $params['master_timeout'] = (time) Explicit operation timeout for connection to master node @@ -26,7 +27,6 @@ class IngestNamespace extends AbstractNamespace * @return array * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/delete-pipeline-api.html */ - public function deletePipeline(array $params = []) { $id = $this->extractArgument($params, 'id'); @@ -37,7 +37,8 @@ public function deletePipeline(array $params = []) $endpoint->setId($id); return $this->performRequest($endpoint); - } /** + } + /** * $params['id'] = (string) Comma separated list of pipeline ids. Wildcards supported * $params['master_timeout'] = (time) Explicit operation timeout for connection to master node * @@ -45,7 +46,6 @@ public function deletePipeline(array $params = []) * @return array * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/get-pipeline-api.html */ - public function getPipeline(array $params = []) { $id = $this->extractArgument($params, 'id'); @@ -56,13 +56,13 @@ public function getPipeline(array $params = []) $endpoint->setId($id); return $this->performRequest($endpoint); - } /** + } + /** * * @param array $params Associative array of parameters * @return array * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/grok-processor.html#grok-processor-rest-get */ - public function processorGrok(array $params = []) { @@ -71,7 +71,8 @@ public function processorGrok(array $params = []) $endpoint->setParams($params); return $this->performRequest($endpoint); - } /** + } + /** * $params['id'] = (string) Pipeline ID * $params['master_timeout'] = (time) Explicit operation timeout for connection to master node * $params['timeout'] = (time) Explicit operation timeout @@ -81,7 +82,6 @@ public function processorGrok(array $params = []) * @return array * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/put-pipeline-api.html */ - public function putPipeline(array $params = []) { $id = $this->extractArgument($params, 'id'); @@ -94,7 +94,8 @@ public function putPipeline(array $params = []) $endpoint->setBody($body); return $this->performRequest($endpoint); - } /** + } + /** * $params['id'] = (string) Pipeline ID * $params['verbose'] = (boolean) Verbose mode. Display data output for each processor in executed pipeline (Default = false) * $params['body'] = (array) The simulate definition (Required) @@ -103,7 +104,6 @@ public function putPipeline(array $params = []) * @return array * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/simulate-pipeline-api.html */ - public function simulate(array $params = []) { $id = $this->extractArgument($params, 'id'); diff --git a/src/Elasticsearch/Namespaces/NodesNamespace.php b/src/Elasticsearch/Namespaces/NodesNamespace.php index cf6081b97..40c4801d4 100644 --- a/src/Elasticsearch/Namespaces/NodesNamespace.php +++ b/src/Elasticsearch/Namespaces/NodesNamespace.php @@ -17,6 +17,7 @@ */ class NodesNamespace extends AbstractNamespace { + /** * $params['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 * $params['interval'] = (time) The interval for the second sampling of threads @@ -30,7 +31,6 @@ class NodesNamespace extends AbstractNamespace * @return array * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/cluster-nodes-hot-threads.html */ - public function hotThreads(array $params = []) { $node_id = $this->extractArgument($params, 'node_id'); @@ -41,7 +41,8 @@ public function hotThreads(array $params = []) $endpoint->setNodeId($node_id); return $this->performRequest($endpoint); - } /** + } + /** * $params['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 * $params['metric'] = (list) A comma-separated list of metrics you wish returned. Leave empty to return all. * $params['flat_settings'] = (boolean) Return settings in flat format (default: false) @@ -51,7 +52,6 @@ public function hotThreads(array $params = []) * @return array * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/cluster-nodes-info.html */ - public function info(array $params = []) { $node_id = $this->extractArgument($params, 'node_id'); @@ -64,7 +64,8 @@ public function info(array $params = []) $endpoint->setMetric($metric); return $this->performRequest($endpoint); - } /** + } + /** * $params['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. * $params['timeout'] = (time) Explicit operation timeout * @@ -72,7 +73,6 @@ public function info(array $params = []) * @return array * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/secure-settings.html#reloadable-secure-settings */ - public function reloadSecureSettings(array $params = []) { $node_id = $this->extractArgument($params, 'node_id'); @@ -83,7 +83,8 @@ public function reloadSecureSettings(array $params = []) $endpoint->setNodeId($node_id); return $this->performRequest($endpoint); - } /** + } + /** * $params['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 * $params['metric'] = (list) Limit the information returned to the specified metrics * $params['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. @@ -100,7 +101,6 @@ public function reloadSecureSettings(array $params = []) * @return array * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/cluster-nodes-stats.html */ - public function stats(array $params = []) { $node_id = $this->extractArgument($params, 'node_id'); @@ -115,7 +115,8 @@ public function stats(array $params = []) $endpoint->setIndexMetric($index_metric); return $this->performRequest($endpoint); - } /** + } + /** * $params['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 * $params['metric'] = (list) Limit the information returned to the specified metrics * $params['timeout'] = (time) Explicit operation timeout @@ -124,7 +125,6 @@ public function stats(array $params = []) * @return array * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/cluster-nodes-usage.html */ - public function usage(array $params = []) { $node_id = $this->extractArgument($params, 'node_id'); diff --git a/src/Elasticsearch/Namespaces/SnapshotNamespace.php b/src/Elasticsearch/Namespaces/SnapshotNamespace.php index 7730de91a..5b56a26ca 100644 --- a/src/Elasticsearch/Namespaces/SnapshotNamespace.php +++ b/src/Elasticsearch/Namespaces/SnapshotNamespace.php @@ -17,6 +17,7 @@ */ class SnapshotNamespace extends AbstractNamespace { + /** * $params['repository'] = (string) A repository name * $params['master_timeout'] = (time) Explicit operation timeout for connection to master node @@ -26,7 +27,6 @@ class SnapshotNamespace extends AbstractNamespace * @return array * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/modules-snapshots.html */ - public function cleanupRepository(array $params = []) { $repository = $this->extractArgument($params, 'repository'); @@ -37,7 +37,8 @@ public function cleanupRepository(array $params = []) $endpoint->setRepository($repository); return $this->performRequest($endpoint); - } /** + } + /** * $params['repository'] = (string) A repository name * $params['snapshot'] = (string) A snapshot name * $params['master_timeout'] = (time) Explicit operation timeout for connection to master node @@ -48,7 +49,6 @@ public function cleanupRepository(array $params = []) * @return array * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/modules-snapshots.html */ - public function create(array $params = []) { $repository = $this->extractArgument($params, 'repository'); @@ -63,7 +63,8 @@ public function create(array $params = []) $endpoint->setBody($body); return $this->performRequest($endpoint); - } /** + } + /** * $params['repository'] = (string) A repository name * $params['master_timeout'] = (time) Explicit operation timeout for connection to master node * $params['timeout'] = (time) Explicit operation timeout @@ -74,7 +75,6 @@ public function create(array $params = []) * @return array * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/modules-snapshots.html */ - public function createRepository(array $params = []) { $repository = $this->extractArgument($params, 'repository'); @@ -87,7 +87,8 @@ public function createRepository(array $params = []) $endpoint->setBody($body); return $this->performRequest($endpoint); - } /** + } + /** * $params['repository'] = (string) A repository name * $params['snapshot'] = (string) A snapshot name * $params['master_timeout'] = (time) Explicit operation timeout for connection to master node @@ -96,7 +97,6 @@ public function createRepository(array $params = []) * @return array * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/modules-snapshots.html */ - public function delete(array $params = []) { $repository = $this->extractArgument($params, 'repository'); @@ -109,7 +109,8 @@ public function delete(array $params = []) $endpoint->setSnapshot($snapshot); return $this->performRequest($endpoint); - } /** + } + /** * $params['repository'] = (list) A comma-separated list of repository names * $params['master_timeout'] = (time) Explicit operation timeout for connection to master node * $params['timeout'] = (time) Explicit operation timeout @@ -118,7 +119,6 @@ public function delete(array $params = []) * @return array * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/modules-snapshots.html */ - public function deleteRepository(array $params = []) { $repository = $this->extractArgument($params, 'repository'); @@ -129,7 +129,8 @@ public function deleteRepository(array $params = []) $endpoint->setRepository($repository); return $this->performRequest($endpoint); - } /** + } + /** * $params['repository'] = (string) A repository name * $params['snapshot'] = (list) A comma-separated list of snapshot names * $params['master_timeout'] = (time) Explicit operation timeout for connection to master node @@ -140,7 +141,6 @@ public function deleteRepository(array $params = []) * @return array * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/modules-snapshots.html */ - public function get(array $params = []) { $repository = $this->extractArgument($params, 'repository'); @@ -153,7 +153,8 @@ public function get(array $params = []) $endpoint->setSnapshot($snapshot); return $this->performRequest($endpoint); - } /** + } + /** * $params['repository'] = (list) A comma-separated list of repository names * $params['master_timeout'] = (time) Explicit operation timeout for connection to master node * $params['local'] = (boolean) Return local information, do not retrieve the state from master node (default: false) @@ -162,7 +163,6 @@ public function get(array $params = []) * @return array * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/modules-snapshots.html */ - public function getRepository(array $params = []) { $repository = $this->extractArgument($params, 'repository'); @@ -173,7 +173,8 @@ public function getRepository(array $params = []) $endpoint->setRepository($repository); return $this->performRequest($endpoint); - } /** + } + /** * $params['repository'] = (string) A repository name * $params['snapshot'] = (string) A snapshot name * $params['master_timeout'] = (time) Explicit operation timeout for connection to master node @@ -184,7 +185,6 @@ public function getRepository(array $params = []) * @return array * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/modules-snapshots.html */ - public function restore(array $params = []) { $repository = $this->extractArgument($params, 'repository'); @@ -199,7 +199,8 @@ public function restore(array $params = []) $endpoint->setBody($body); return $this->performRequest($endpoint); - } /** + } + /** * $params['repository'] = (string) A repository name * $params['snapshot'] = (list) A comma-separated list of snapshot names * $params['master_timeout'] = (time) Explicit operation timeout for connection to master node @@ -209,7 +210,6 @@ public function restore(array $params = []) * @return array * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/modules-snapshots.html */ - public function status(array $params = []) { $repository = $this->extractArgument($params, 'repository'); @@ -222,7 +222,8 @@ public function status(array $params = []) $endpoint->setSnapshot($snapshot); return $this->performRequest($endpoint); - } /** + } + /** * $params['repository'] = (string) A repository name * $params['master_timeout'] = (time) Explicit operation timeout for connection to master node * $params['timeout'] = (time) Explicit operation timeout @@ -231,7 +232,6 @@ public function status(array $params = []) * @return array * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/modules-snapshots.html */ - public function verifyRepository(array $params = []) { $repository = $this->extractArgument($params, 'repository'); diff --git a/src/Elasticsearch/Namespaces/TasksNamespace.php b/src/Elasticsearch/Namespaces/TasksNamespace.php index db1a6a2c2..6b9535fa5 100644 --- a/src/Elasticsearch/Namespaces/TasksNamespace.php +++ b/src/Elasticsearch/Namespaces/TasksNamespace.php @@ -17,6 +17,7 @@ */ class TasksNamespace extends AbstractNamespace { + /** * $params['task_id'] = (string) Cancel the task with specified task id (node_id:task_number) * $params['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 @@ -27,7 +28,6 @@ class TasksNamespace extends AbstractNamespace * @return array * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/tasks.html */ - public function cancel(array $params = []) { $task_id = $this->extractArgument($params, 'task_id'); @@ -38,7 +38,8 @@ public function cancel(array $params = []) $endpoint->setTaskId($task_id); return $this->performRequest($endpoint); - } /** + } + /** * $params['task_id'] = (string) Return the task with specified id (node_id:task_number) * $params['wait_for_completion'] = (boolean) Wait for the matching tasks to complete (default: false) * $params['timeout'] = (time) Explicit operation timeout @@ -47,7 +48,6 @@ public function cancel(array $params = []) * @return array * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/tasks.html */ - public function get(array $params = []) { $task_id = $this->extractArgument($params, 'task_id'); @@ -58,7 +58,8 @@ public function get(array $params = []) $endpoint->setTaskId($task_id); return $this->performRequest($endpoint); - } /** + } + /** * $params['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 * $params['actions'] = (list) A comma-separated list of actions that should be returned. Leave empty to return all. * $params['detailed'] = (boolean) Return detailed task information (default: false) @@ -71,7 +72,6 @@ public function get(array $params = []) * @return array * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/tasks.html */ - public function list(array $params = []) { @@ -81,4 +81,11 @@ public function list(array $params = []) return $this->performRequest($endpoint); } + /** + * Proxy function to list() to prevent BC break since 7.4.0 + */ + public function tasksList(array $params = []) + { + return $this->list($params); + } } diff --git a/src/autoload.php b/src/autoload.php index 6db696d99..0e9a80c6e 100644 --- a/src/autoload.php +++ b/src/autoload.php @@ -8,7 +8,6 @@ * NOTE: This file will be removed with elasticsearch-php 8.0.0 */ -class_alias('\Elasticsearch\Endpoints\Cat\Nodeattrs', '\Elasticsearch\Endpoints\Cat\NodeAttrs'); class_alias('\Elasticsearch\Endpoints\Cluster\GetSettings', '\Elasticsearch\Endpoints\Cluster\Settings\Get'); class_alias('\Elasticsearch\Endpoints\Cluster\PutSettings', '\Elasticsearch\Endpoints\Cluster\Settings\Put'); class_alias('\Elasticsearch\Endpoints\Indices\DeleteAlias', '\Elasticsearch\Endpoints\Indices\Alias\Delete'); @@ -17,7 +16,6 @@ class_alias('\Elasticsearch\Endpoints\Indices\GetAlias', '\Elasticsearch\Endpoin class_alias('\Elasticsearch\Endpoints\Indices\PutAlias', '\Elasticsearch\Endpoints\Indices\Alias\Put'); class_alias('\Elasticsearch\Endpoints\Indices\UpdateAliases', '\Elasticsearch\Endpoints\Indices\Aliases\Update'); class_alias('\Elasticsearch\Endpoints\Indices\ClearCache', '\Elasticsearch\Endpoints\Indices\Cache\Clear'); -class_alias('\Elasticsearch\Endpoints\Indices\Forcemerge', '\Elasticsearch\Endpoints\Indices\ForceMerge'); class_alias('\Elasticsearch\Endpoints\Indices\GetMapping', '\Elasticsearch\Endpoints\Indices\Mapping\Get'); class_alias('\Elasticsearch\Endpoints\Indices\GetFieldMapping', '\Elasticsearch\Endpoints\Indices\Mapping\GetField'); class_alias('\Elasticsearch\Endpoints\Indices\PutMapping', '\Elasticsearch\Endpoints\Indices\Mapping\Put'); @@ -35,7 +33,6 @@ class_alias('\Elasticsearch\Endpoints\Ingest\DeletePipeline', '\Elasticsearch\En class_alias('\Elasticsearch\Endpoints\Ingest\GetPipeline', '\Elasticsearch\Endpoints\Ingest\Pipeline\Get'); class_alias('\Elasticsearch\Endpoints\Ingest\PutPipeline', '\Elasticsearch\Endpoints\Ingest\Pipeline\Put'); class_alias('\Elasticsearch\Endpoints\Ingest\ProcessorGrok', '\Elasticsearch\Endpoints\Ingest\Pipeline\ProcessorGrok'); -class_alias('\Elasticsearch\Endpoints\Mtermvectors', '\Elasticsearch\Endpoints\MTermVectors'); class_alias('\Elasticsearch\Endpoints\GetScript', '\Elasticsearch\Endpoints\Script\Get'); class_alias('\Elasticsearch\Endpoints\PutScript', '\Elasticsearch\Endpoints\Script\Put'); class_alias('\Elasticsearch\Endpoints\DeleteScript', '\Elasticsearch\Endpoints\Script\Delete'); @@ -46,4 +43,3 @@ class_alias('\Elasticsearch\Endpoints\Snapshot\VerifyRepository', '\Elasticsearc class_alias('\Elasticsearch\Endpoints\GetSource', '\Elasticsearch\Endpoints\Source\Get'); class_alias('\Elasticsearch\Endpoints\ExistsSource', '\Elasticsearch\Endpoints\Source\Exists'); class_alias('\Elasticsearch\Endpoints\Tasks\ListTasks', '\Elasticsearch\Endpoints\Tasks\TasksList'); -class_alias('\Elasticsearch\Endpoints\Termvectors', '\Elasticsearch\Endpoints\TermVectors'); diff --git a/tests/Elasticsearch/BackwardCompatibleTest.php b/tests/Elasticsearch/BackwardCompatibleTest.php index 546ebc7fb..116ddc8ac 100644 --- a/tests/Elasticsearch/BackwardCompatibleTest.php +++ b/tests/Elasticsearch/BackwardCompatibleTest.php @@ -3,6 +3,9 @@ namespace Elasticsearch\Tests; +use Elasticsearch\Endpoints\AbstractEndpoint; +use Throwable; + /** * Class BackwardCompatibleTest * @@ -21,134 +24,134 @@ class BackwardCompatibleTest extends \PHPUnit\Framework\TestCase public function getClasses() { return [ - ['Elasticsearch\Endpoints\MTermVectors'], - ['Elasticsearch\Endpoints\Tasks\Get'], - ['Elasticsearch\Endpoints\Tasks\Cancel'], - ['Elasticsearch\Endpoints\Tasks\TasksList'], - ['Elasticsearch\Endpoints\Ping'], - ['Elasticsearch\Endpoints\ScriptsPainlessExecute'], - ['Elasticsearch\Endpoints\DeleteByQuery'], - ['Elasticsearch\Endpoints\Scroll'], - ['Elasticsearch\Endpoints\Explain'], - ['Elasticsearch\Endpoints\Get'], - ['Elasticsearch\Endpoints\UpdateByQueryRethrottle'], - ['Elasticsearch\Endpoints\Delete'], - ['Elasticsearch\Endpoints\SearchShards'], - ['Elasticsearch\Endpoints\Mget'], - ['Elasticsearch\Endpoints\Source\Get'], - ['Elasticsearch\Endpoints\Source\Exists'], - ['Elasticsearch\Endpoints\Bulk'], - ['Elasticsearch\Endpoints\Cluster\PendingTasks'], - ['Elasticsearch\Endpoints\Cluster\Health'], - ['Elasticsearch\Endpoints\Cluster\Settings\Get'], - ['Elasticsearch\Endpoints\Cluster\Settings\Put'], - ['Elasticsearch\Endpoints\Cluster\Reroute'], - ['Elasticsearch\Endpoints\Cluster\State'], - ['Elasticsearch\Endpoints\Cluster\RemoteInfo'], - ['Elasticsearch\Endpoints\Cluster\Stats'], - ['Elasticsearch\Endpoints\Cluster\AllocationExplain'], - ['Elasticsearch\Endpoints\ClearScroll'], - ['Elasticsearch\Endpoints\Script\Get'], - ['Elasticsearch\Endpoints\Script\Delete'], - ['Elasticsearch\Endpoints\Script\Put'], - ['Elasticsearch\Endpoints\Exists'], - ['Elasticsearch\Endpoints\Index'], - ['Elasticsearch\Endpoints\UpdateByQuery'], - ['Elasticsearch\Endpoints\Ingest\Pipeline\Get'], - ['Elasticsearch\Endpoints\Ingest\Pipeline\Delete'], - ['Elasticsearch\Endpoints\Ingest\Pipeline\Put'], - ['Elasticsearch\Endpoints\Ingest\Pipeline\ProcessorGrok'], - ['Elasticsearch\Endpoints\Ingest\Simulate'], - ['Elasticsearch\Endpoints\SearchTemplate'], - ['Elasticsearch\Endpoints\FieldCaps'], - ['Elasticsearch\Endpoints\Snapshot\Get'], - ['Elasticsearch\Endpoints\Snapshot\Delete'], - ['Elasticsearch\Endpoints\Snapshot\Restore'], - ['Elasticsearch\Endpoints\Snapshot\Create'], - ['Elasticsearch\Endpoints\Snapshot\Status'], - ['Elasticsearch\Endpoints\Snapshot\Repository\Verify'], - ['Elasticsearch\Endpoints\Snapshot\Repository\Get'], - ['Elasticsearch\Endpoints\Snapshot\Repository\Delete'], - ['Elasticsearch\Endpoints\Snapshot\Repository\Create'], - ['Elasticsearch\Endpoints\Count'], - ['Elasticsearch\Endpoints\Create'], - ['Elasticsearch\Endpoints\Info'], - ['Elasticsearch\Endpoints\Indices\Type\Exists'], - ['Elasticsearch\Endpoints\Indices\ForceMerge'], - ['Elasticsearch\Endpoints\Indices\Flush'], - ['Elasticsearch\Endpoints\Indices\Analyze'], - ['Elasticsearch\Endpoints\Indices\Rollover'], - ['Elasticsearch\Endpoints\Indices\Get'], - ['Elasticsearch\Endpoints\Indices\Template\Get'], - ['Elasticsearch\Endpoints\Indices\Template\Delete'], - ['Elasticsearch\Endpoints\Indices\Template\Exists'], - ['Elasticsearch\Endpoints\Indices\Template\Put'], - ['Elasticsearch\Endpoints\Indices\Delete'], - ['Elasticsearch\Endpoints\Indices\FlushSynced'], - ['Elasticsearch\Endpoints\Indices\Refresh'], - ['Elasticsearch\Endpoints\Indices\Exists'], - ['Elasticsearch\Endpoints\Indices\Cache\Clear'], - ['Elasticsearch\Endpoints\Indices\Settings\Get'], - ['Elasticsearch\Endpoints\Indices\Settings\Put'], - ['Elasticsearch\Endpoints\Indices\Create'], - ['Elasticsearch\Endpoints\Indices\Close'], - ['Elasticsearch\Endpoints\Indices\ShardStores'], - ['Elasticsearch\Endpoints\Indices\Stats'], - ['Elasticsearch\Endpoints\Indices\Validate\Query'], - ['Elasticsearch\Endpoints\Indices\Alias\Get'], - ['Elasticsearch\Endpoints\Indices\Alias\Delete'], - ['Elasticsearch\Endpoints\Indices\Alias\Exists'], - ['Elasticsearch\Endpoints\Indices\Alias\Put'], - ['Elasticsearch\Endpoints\Indices\Open'], - ['Elasticsearch\Endpoints\Indices\Segments'], - ['Elasticsearch\Endpoints\Indices\Upgrade\Get'], - ['Elasticsearch\Endpoints\Indices\Upgrade\Post'], - ['Elasticsearch\Endpoints\Indices\Aliases\Update'], - ['Elasticsearch\Endpoints\Indices\Recovery'], - ['Elasticsearch\Endpoints\Indices\Shrink'], - ['Elasticsearch\Endpoints\Indices\Split'], - ['Elasticsearch\Endpoints\Indices\Mapping\Get'], - ['Elasticsearch\Endpoints\Indices\Mapping\Put'], - ['Elasticsearch\Endpoints\Indices\Mapping\GetField'], - ['Elasticsearch\Endpoints\Reindex'], - ['Elasticsearch\Endpoints\DeleteByQueryRethrottle'], - ['Elasticsearch\Endpoints\MsearchTemplate'], - ['Elasticsearch\Endpoints\TermVectors'], - ['Elasticsearch\Endpoints\AbstractEndpoint'], - ['Elasticsearch\Endpoints\RenderSearchTemplate'], - ['Elasticsearch\Endpoints\Update'], - ['Elasticsearch\Endpoints\Search'], - ['Elasticsearch\Endpoints\ReindexRethrottle'], - ['Elasticsearch\Endpoints\RankEval'], - ['Elasticsearch\Endpoints\Msearch'], - ['Elasticsearch\Endpoints\Cat\ThreadPool'], - ['Elasticsearch\Endpoints\Cat\Fielddata'], - ['Elasticsearch\Endpoints\Cat\Master'], - ['Elasticsearch\Endpoints\Cat\NodeAttrs'], - ['Elasticsearch\Endpoints\Cat\Aliases'], - ['Elasticsearch\Endpoints\Cat\PendingTasks'], - ['Elasticsearch\Endpoints\Cat\Templates'], - ['Elasticsearch\Endpoints\Cat\Allocation'], - ['Elasticsearch\Endpoints\Cat\Plugins'], - ['Elasticsearch\Endpoints\Cat\Health'], - ['Elasticsearch\Endpoints\Cat\Count'], - ['Elasticsearch\Endpoints\Cat\Shards'], - ['Elasticsearch\Endpoints\Cat\Repositories'], - ['Elasticsearch\Endpoints\Cat\Nodes'], - ['Elasticsearch\Endpoints\Cat\Tasks'], - ['Elasticsearch\Endpoints\Cat\Segments'], - ['Elasticsearch\Endpoints\Cat\Help'], - ['Elasticsearch\Endpoints\Cat\Recovery'], - ['Elasticsearch\Endpoints\Cat\Snapshots'], - ['Elasticsearch\Endpoints\Cat\Indices'] + ['\Elasticsearch\Endpoints\MTermVectors'], + ['\Elasticsearch\Endpoints\Tasks\Get'], + ['\Elasticsearch\Endpoints\Tasks\Cancel'], + ['\Elasticsearch\Endpoints\Tasks\TasksList'], + ['\Elasticsearch\Endpoints\Ping'], + ['\Elasticsearch\Endpoints\ScriptsPainlessExecute'], + ['\Elasticsearch\Endpoints\DeleteByQuery'], + ['\Elasticsearch\Endpoints\Scroll'], + ['\Elasticsearch\Endpoints\Explain'], + ['\Elasticsearch\Endpoints\Get'], + ['\Elasticsearch\Endpoints\UpdateByQueryRethrottle'], + ['\Elasticsearch\Endpoints\Delete'], + ['\Elasticsearch\Endpoints\SearchShards'], + ['\Elasticsearch\Endpoints\Mget'], + ['\Elasticsearch\Endpoints\Source\Get'], + ['\Elasticsearch\Endpoints\Source\Exists'], + ['\Elasticsearch\Endpoints\Bulk'], + ['\Elasticsearch\Endpoints\Cluster\PendingTasks'], + ['\Elasticsearch\Endpoints\Cluster\Health'], + ['\Elasticsearch\Endpoints\Cluster\Settings\Get'], + ['\Elasticsearch\Endpoints\Cluster\Settings\Put'], + ['\Elasticsearch\Endpoints\Cluster\Reroute'], + ['\Elasticsearch\Endpoints\Cluster\State'], + ['\Elasticsearch\Endpoints\Cluster\RemoteInfo'], + ['\Elasticsearch\Endpoints\Cluster\Stats'], + ['\Elasticsearch\Endpoints\Cluster\AllocationExplain'], + ['\Elasticsearch\Endpoints\ClearScroll'], + ['\Elasticsearch\Endpoints\Script\Get'], + ['\Elasticsearch\Endpoints\Script\Delete'], + ['\Elasticsearch\Endpoints\Script\Put'], + ['\Elasticsearch\Endpoints\Exists'], + ['\Elasticsearch\Endpoints\Index'], + ['\Elasticsearch\Endpoints\UpdateByQuery'], + ['\Elasticsearch\Endpoints\Ingest\Pipeline\Get'], + ['\Elasticsearch\Endpoints\Ingest\Pipeline\Delete'], + ['\Elasticsearch\Endpoints\Ingest\Pipeline\Put'], + ['\Elasticsearch\Endpoints\Ingest\Pipeline\ProcessorGrok'], + ['\Elasticsearch\Endpoints\Ingest\Simulate'], + ['\Elasticsearch\Endpoints\SearchTemplate'], + ['\Elasticsearch\Endpoints\FieldCaps'], + ['\Elasticsearch\Endpoints\Snapshot\Get'], + ['\Elasticsearch\Endpoints\Snapshot\Delete'], + ['\Elasticsearch\Endpoints\Snapshot\Restore'], + ['\Elasticsearch\Endpoints\Snapshot\Create'], + ['\Elasticsearch\Endpoints\Snapshot\Status'], + ['\Elasticsearch\Endpoints\Snapshot\Repository\Verify'], + ['\Elasticsearch\Endpoints\Snapshot\Repository\Get'], + ['\Elasticsearch\Endpoints\Snapshot\Repository\Delete'], + ['\Elasticsearch\Endpoints\Snapshot\Repository\Create'], + ['\Elasticsearch\Endpoints\Count'], + ['\Elasticsearch\Endpoints\Create'], + ['\Elasticsearch\Endpoints\Info'], + ['\Elasticsearch\Endpoints\Indices\Type\Exists'], + ['\Elasticsearch\Endpoints\Indices\ForceMerge'], + ['\Elasticsearch\Endpoints\Indices\Flush'], + ['\Elasticsearch\Endpoints\Indices\Analyze'], + ['\Elasticsearch\Endpoints\Indices\Rollover'], + ['\Elasticsearch\Endpoints\Indices\Get'], + ['\Elasticsearch\Endpoints\Indices\Template\Get'], + ['\Elasticsearch\Endpoints\Indices\Template\Delete'], + ['\Elasticsearch\Endpoints\Indices\Template\Exists'], + ['\Elasticsearch\Endpoints\Indices\Template\Put'], + ['\Elasticsearch\Endpoints\Indices\Delete'], + ['\Elasticsearch\Endpoints\Indices\FlushSynced'], + ['\Elasticsearch\Endpoints\Indices\Refresh'], + ['\Elasticsearch\Endpoints\Indices\Exists'], + ['\Elasticsearch\Endpoints\Indices\Cache\Clear'], + ['\Elasticsearch\Endpoints\Indices\Settings\Get'], + ['\Elasticsearch\Endpoints\Indices\Settings\Put'], + ['\Elasticsearch\Endpoints\Indices\Create'], + ['\Elasticsearch\Endpoints\Indices\Close'], + ['\Elasticsearch\Endpoints\Indices\ShardStores'], + ['\Elasticsearch\Endpoints\Indices\Stats'], + ['\Elasticsearch\Endpoints\Indices\Validate\Query'], + ['\Elasticsearch\Endpoints\Indices\Alias\Get'], + ['\Elasticsearch\Endpoints\Indices\Alias\Delete'], + ['\Elasticsearch\Endpoints\Indices\Alias\Exists'], + ['\Elasticsearch\Endpoints\Indices\Alias\Put'], + ['\Elasticsearch\Endpoints\Indices\Open'], + ['\Elasticsearch\Endpoints\Indices\Segments'], + ['\Elasticsearch\Endpoints\Indices\Upgrade\Get'], + ['\Elasticsearch\Endpoints\Indices\Upgrade\Post'], + ['\Elasticsearch\Endpoints\Indices\Aliases\Update'], + ['\Elasticsearch\Endpoints\Indices\Recovery'], + ['\Elasticsearch\Endpoints\Indices\Shrink'], + ['\Elasticsearch\Endpoints\Indices\Split'], + ['\Elasticsearch\Endpoints\Indices\Mapping\Get'], + ['\Elasticsearch\Endpoints\Indices\Mapping\Put'], + ['\Elasticsearch\Endpoints\Indices\Mapping\GetField'], + ['\Elasticsearch\Endpoints\Reindex'], + ['\Elasticsearch\Endpoints\DeleteByQueryRethrottle'], + ['\Elasticsearch\Endpoints\MsearchTemplate'], + ['\Elasticsearch\Endpoints\TermVectors'], + ['\Elasticsearch\Endpoints\AbstractEndpoint'], + ['\Elasticsearch\Endpoints\RenderSearchTemplate'], + ['\Elasticsearch\Endpoints\Update'], + ['\Elasticsearch\Endpoints\Search'], + ['\Elasticsearch\Endpoints\ReindexRethrottle'], + ['\Elasticsearch\Endpoints\RankEval'], + ['\Elasticsearch\Endpoints\Msearch'], + ['\Elasticsearch\Endpoints\Cat\ThreadPool'], + ['\Elasticsearch\Endpoints\Cat\Fielddata'], + ['\Elasticsearch\Endpoints\Cat\Master'], + ['\Elasticsearch\Endpoints\Cat\NodeAttrs'], + ['\Elasticsearch\Endpoints\Cat\Aliases'], + ['\Elasticsearch\Endpoints\Cat\PendingTasks'], + ['\Elasticsearch\Endpoints\Cat\Templates'], + ['\Elasticsearch\Endpoints\Cat\Allocation'], + ['\Elasticsearch\Endpoints\Cat\Plugins'], + ['\Elasticsearch\Endpoints\Cat\Health'], + ['\Elasticsearch\Endpoints\Cat\Count'], + ['\Elasticsearch\Endpoints\Cat\Shards'], + ['\Elasticsearch\Endpoints\Cat\Repositories'], + ['\Elasticsearch\Endpoints\Cat\Nodes'], + ['\Elasticsearch\Endpoints\Cat\Tasks'], + ['\Elasticsearch\Endpoints\Cat\Segments'], + ['\Elasticsearch\Endpoints\Cat\Help'], + ['\Elasticsearch\Endpoints\Cat\Recovery'], + ['\Elasticsearch\Endpoints\Cat\Snapshots'], + ['\Elasticsearch\Endpoints\Cat\Indices'] ]; } /** * @dataProvider getClasses */ - public function testOldClassNamespacesPreviousTo72($class) + public function testOldClassNamespacesPreviousTo74($class) { $this->assertTrue(class_exists($class), sprintf("Class %s does not exist", $class)); } -} \ No newline at end of file +} diff --git a/util/ClientEndpoint.php b/util/ClientEndpoint.php index a97cb9426..507bcb4df 100644 --- a/util/ClientEndpoint.php +++ b/util/ClientEndpoint.php @@ -66,7 +66,7 @@ public function renderClass(): string $prop = file_get_contents(self::PROPERTY_CLASS_TEMPLATE); $prop = str_replace(':namespace', ucfirst($name), $prop); $prop = str_replace(':var_namespace', $name, $prop); - $properties .= $prop; + $properties .= $prop . "\n"; } $class = str_replace(':namespace_properties', $properties, $class); diff --git a/util/Endpoint.php b/util/Endpoint.php index 4ad3428bf..a0bf96713 100644 --- a/util/Endpoint.php +++ b/util/Endpoint.php @@ -31,6 +31,13 @@ class Endpoint 'protected', 'public', 'require', 'require_once', 'return', 'static', 'switch', 'throw', 'trait', 'try', 'unset', 'use', 'var', 'while', 'xor' ]; + // this is for backward compatibility with elasticsearch-php 7.x + const BC_CLASS_NAME = [ + 'Cat\Nodeattrs' => 'NodeAttrs', + 'Indices\Forcemerge' => 'ForceMerge', + 'Mtermvectors' => 'MTermVectors', + 'Termvectors' => 'TermVectors' + ]; public $namespace; public $name; @@ -270,6 +277,11 @@ private function extractUrl(array $paths): string } $check .= sprintf("%sisset(\$%s)", empty($check) ? '' : ' && ', $parts[$i]); } + // Fix for missing / at the beginning of URL + // @see https://github.com/elastic/elasticsearch-php/pull/970 + if ($url[0] !== '/') { + $url = '/' . $url; + } if (empty($check)) { $urls .= sprintf("\n%sreturn \"%s\";", $tab8, $url); $lastUrlReturn = true; @@ -394,7 +406,10 @@ public function getClassName(): string if (in_array(strtolower($this->name), static::PHP_RESERVED_WORDS)) { return $this->normalizeName($this->name . ucwords($this->namespace)); } - return $this->normalizeName($this->name); + $normalizedName = $this->normalizeName($this->name); + $normalizedFullName = empty($this->namespace) ? $normalizedName : ucwords($this->namespace) . '\\' . $normalizedName; + + return static::BC_CLASS_NAME[$normalizedFullName] ?? $normalizedName; } public function renderDocParams(): string @@ -404,7 +419,7 @@ public function renderDocParams(): string } $space = $this->getMaxLengthBodyPartsParams(); - $result = " /**\n"; + $result = "\n /**\n"; $result .= $this->extractPartsDescription($space); $result .= $this->extractParamsDescription($space); $result .= $this->extractBodyDescription($space); @@ -428,7 +443,7 @@ public function renderDocParams(): string $result .= sprintf(" *\n * @note %s\n *\n", $note); } } - $result .= " */\n"; + $result .= " */"; return $result; } diff --git a/util/NamespaceEndpoint.php b/util/NamespaceEndpoint.php index 6ec35f4df..373e13fce 100644 --- a/util/NamespaceEndpoint.php +++ b/util/NamespaceEndpoint.php @@ -38,9 +38,18 @@ public function renderClass(): string $class = str_replace(':namespace', ucfirst($this->name) . 'Namespace', $class); $endpoints = ''; - foreach($this->endpoints as $endpoint) { + foreach ($this->endpoints as $endpoint) { $endpoints .= $this->renderEndpoint($endpoint); } + // Fix for BC in 7.2.0 + switch ($this->name) { + case 'indices': + $endpoints .= $this->getAliasesProxy(); + break; + case 'tasks': + $endpoints .= $this->tasksListProxy(); + break; + } $class = str_replace(':endpoints', $endpoints, $class); return str_replace(':version', $this->version, $class); @@ -69,14 +78,8 @@ protected function renderEndpoint(Endpoint $endpoint): string ); $code = str_replace(':apidoc', $endpoint->renderDocParams(), $code); - $lowerCamelCase = preg_replace_callback( - '/_(.?)/', - function($matches){ - return strtoupper($matches[1]); - }, - $endpoint->name - ); - $code = str_replace(':endpoint', $lowerCamelCase, $code); + $code = str_replace(':endpoint', $this->getEndpointName($endpoint->name), $code); + $extract = ''; $setParams = ''; foreach ($endpoint->getParts() as $part => $value) { @@ -107,4 +110,46 @@ protected function normalizeName(string $name): string { return str_replace('_', '', ucwords($name, '_')); } + + protected function getEndpointName(string $name): string + { + return preg_replace_callback( + '/_(.?)/', + function ($matches) { + return strtoupper($matches[1]); + }, + $name + ); + } + + protected function getAliasesProxy(): string + { + return <<<'EOD' + + /** + * Alias function to getAlias() + * + * @deprecated added to prevent BC break introduced in 7.2.0 + * @see https://github.com/elastic/elasticsearch-php/issues/940 + */ + public function getAliases(array $params = []) + { + return $this->getAlias($params); + } +EOD; + } + + protected function tasksListProxy(): string + { + return <<<'EOD' + + /** + * Proxy function to list() to prevent BC break since 7.4.0 + */ + public function tasksList(array $params = []) + { + return $this->list($params); + } +EOD; + } } diff --git a/util/template/client-class b/util/template/client-class index ba3cab016..9e43e632e 100644 --- a/util/template/client-class +++ b/util/template/client-class @@ -48,7 +48,6 @@ class Client protected $registeredNamespaces = []; :namespace_properties - /** * Client constructor * @@ -63,11 +62,8 @@ class Client :new-namespaces $this->registeredNamespaces = $registeredNamespaces; } - :endpoints - :functions - /** * Catchall for registered namespaces * diff --git a/util/template/endpoint-function-bool b/util/template/endpoint-function-bool index d7785a85a..d4e6945d9 100644 --- a/util/template/endpoint-function-bool +++ b/util/template/endpoint-function-bool @@ -10,4 +10,4 @@ $endpoint->setParams($params); :setparam return BooleanRequestWrapper::performRequest($endpoint, $this->transport); - } + } \ No newline at end of file diff --git a/util/template/namespace-property b/util/template/namespace-property index c7ae3a274..7b88dd7fe 100644 --- a/util/template/namespace-property +++ b/util/template/namespace-property @@ -2,3 +2,4 @@ * @var :namespaceNamespace */ protected $:var_namespace; + \ No newline at end of file From e11c6b98dd697d13b21df25a7ca1e05c5c35aa0c Mon Sep 17 00:00:00 2001 From: Enrico Zimuel Date: Mon, 25 Nov 2019 17:40:03 +0100 Subject: [PATCH 4/5] Added the Cluster\Nodes\Info and Stats classes for BC support --- src/autoload.php | 2 ++ tests/Elasticsearch/BackwardCompatibleTest.php | 2 ++ 2 files changed, 4 insertions(+) diff --git a/src/autoload.php b/src/autoload.php index 0e9a80c6e..92652b5b6 100644 --- a/src/autoload.php +++ b/src/autoload.php @@ -8,6 +8,8 @@ * NOTE: This file will be removed with elasticsearch-php 8.0.0 */ +class_alias('\Elasticsearch\Endpoints\Nodes\Info', '\Elasticsearch\Endpoints\Cluster\Nodes\Info'); +class_alias('\Elasticsearch\Endpoints\Nodes\Stats', '\Elasticsearch\Endpoints\Cluster\Nodes\Stats'); class_alias('\Elasticsearch\Endpoints\Cluster\GetSettings', '\Elasticsearch\Endpoints\Cluster\Settings\Get'); class_alias('\Elasticsearch\Endpoints\Cluster\PutSettings', '\Elasticsearch\Endpoints\Cluster\Settings\Put'); class_alias('\Elasticsearch\Endpoints\Indices\DeleteAlias', '\Elasticsearch\Endpoints\Indices\Alias\Delete'); diff --git a/tests/Elasticsearch/BackwardCompatibleTest.php b/tests/Elasticsearch/BackwardCompatibleTest.php index 116ddc8ac..df864a927 100644 --- a/tests/Elasticsearch/BackwardCompatibleTest.php +++ b/tests/Elasticsearch/BackwardCompatibleTest.php @@ -50,6 +50,8 @@ public function getClasses() ['\Elasticsearch\Endpoints\Cluster\RemoteInfo'], ['\Elasticsearch\Endpoints\Cluster\Stats'], ['\Elasticsearch\Endpoints\Cluster\AllocationExplain'], + ['\Elasticsearch\Endpoints\Cluster\Nodes\Info'], + ['Elasticsearch\Endpoints\Cluster\Nodes\Stats'], ['\Elasticsearch\Endpoints\ClearScroll'], ['\Elasticsearch\Endpoints\Script\Get'], ['\Elasticsearch\Endpoints\Script\Delete'], From ec07a44d83a67cd22c412d5d20f77f6024ad7545 Mon Sep 17 00:00:00 2001 From: Enrico Zimuel Date: Mon, 25 Nov 2019 18:19:22 +0100 Subject: [PATCH 5/5] Added the missing Cluster\Nodes BC classes --- src/autoload.php | 3 +++ tests/Elasticsearch/BackwardCompatibleTest.php | 5 ++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/autoload.php b/src/autoload.php index 92652b5b6..da1f7163e 100644 --- a/src/autoload.php +++ b/src/autoload.php @@ -8,8 +8,11 @@ * NOTE: This file will be removed with elasticsearch-php 8.0.0 */ +class_alias('\Elasticsearch\Endpoints\Nodes\HotThreads', '\Elasticsearch\Endpoints\Cluster\Nodes\HotThreads'); class_alias('\Elasticsearch\Endpoints\Nodes\Info', '\Elasticsearch\Endpoints\Cluster\Nodes\Info'); +class_alias('\Elasticsearch\Endpoints\Nodes\ReloadSecureSettings', '\Elasticsearch\Endpoints\Cluster\Nodes\ReloadSecureSettings'); class_alias('\Elasticsearch\Endpoints\Nodes\Stats', '\Elasticsearch\Endpoints\Cluster\Nodes\Stats'); +class_alias('\Elasticsearch\Endpoints\Nodes\Usage', '\Elasticsearch\Endpoints\Cluster\Nodes\Usage'); class_alias('\Elasticsearch\Endpoints\Cluster\GetSettings', '\Elasticsearch\Endpoints\Cluster\Settings\Get'); class_alias('\Elasticsearch\Endpoints\Cluster\PutSettings', '\Elasticsearch\Endpoints\Cluster\Settings\Put'); class_alias('\Elasticsearch\Endpoints\Indices\DeleteAlias', '\Elasticsearch\Endpoints\Indices\Alias\Delete'); diff --git a/tests/Elasticsearch/BackwardCompatibleTest.php b/tests/Elasticsearch/BackwardCompatibleTest.php index df864a927..8a5295c75 100644 --- a/tests/Elasticsearch/BackwardCompatibleTest.php +++ b/tests/Elasticsearch/BackwardCompatibleTest.php @@ -50,8 +50,11 @@ public function getClasses() ['\Elasticsearch\Endpoints\Cluster\RemoteInfo'], ['\Elasticsearch\Endpoints\Cluster\Stats'], ['\Elasticsearch\Endpoints\Cluster\AllocationExplain'], + ['\Elasticsearch\Endpoints\Cluster\Nodes\HotThreads'], ['\Elasticsearch\Endpoints\Cluster\Nodes\Info'], - ['Elasticsearch\Endpoints\Cluster\Nodes\Stats'], + ['\Elasticsearch\Endpoints\Cluster\Nodes\ReloadSecureSettings'], + ['\Elasticsearch\Endpoints\Cluster\Nodes\Stats'], + ['\Elasticsearch\Endpoints\Cluster\Nodes\Usage'], ['\Elasticsearch\Endpoints\ClearScroll'], ['\Elasticsearch\Endpoints\Script\Get'], ['\Elasticsearch\Endpoints\Script\Delete'],