1<?php
2/**
3 * Elasticsearch PHP client
4 *
5 * @link      https://github.com/elastic/elasticsearch-php/
6 * @copyright Copyright (c) Elasticsearch B.V (https://www.elastic.co)
7 * @license   http://www.apache.org/licenses/LICENSE-2.0 Apache License, Version 2.0
8 * @license   https://www.gnu.org/licenses/lgpl-2.1.html GNU Lesser General Public License, Version 2.1
9 *
10 * Licensed to Elasticsearch B.V under one or more agreements.
11 * Elasticsearch B.V licenses this file to you under the Apache 2.0 License or
12 * the GNU Lesser General Public License, Version 2.1, at your option.
13 * See the LICENSE file in the project root for more information.
14 */
15
16/**
17 * File required since elasticsearch-php 7.4.1 for aliasing
18 * to the previous endpoint class names.
19 *
20 * @see https://github.com/elastic/elasticsearch-php/issues/967
21 *
22 * NOTE: This file will be removed with elasticsearch-php 8.0.0
23 */
24
25$classesToAlias = [
26    '\Elasticsearch\Endpoints\Nodes\HotThreads' => '\Elasticsearch\Endpoints\Cluster\Nodes\HotThreads',
27    '\Elasticsearch\Endpoints\Nodes\Info' => '\Elasticsearch\Endpoints\Cluster\Nodes\Info',
28    '\Elasticsearch\Endpoints\Nodes\ReloadSecureSettings' => '\Elasticsearch\Endpoints\Cluster\Nodes\ReloadSecureSettings',
29    '\Elasticsearch\Endpoints\Nodes\Stats' => '\Elasticsearch\Endpoints\Cluster\Nodes\Stats',
30    '\Elasticsearch\Endpoints\Nodes\Usage' => '\Elasticsearch\Endpoints\Cluster\Nodes\Usage',
31    '\Elasticsearch\Endpoints\Cluster\GetSettings' => '\Elasticsearch\Endpoints\Cluster\Settings\Get',
32    '\Elasticsearch\Endpoints\Cluster\PutSettings' => '\Elasticsearch\Endpoints\Cluster\Settings\Put',
33    '\Elasticsearch\Endpoints\Indices\DeleteAlias' => '\Elasticsearch\Endpoints\Indices\Alias\Delete',
34    '\Elasticsearch\Endpoints\Indices\ExistsAlias' => '\Elasticsearch\Endpoints\Indices\Alias\Exists',
35    '\Elasticsearch\Endpoints\Indices\GetAlias' => '\Elasticsearch\Endpoints\Indices\Alias\Get',
36    '\Elasticsearch\Endpoints\Indices\PutAlias' => '\Elasticsearch\Endpoints\Indices\Alias\Put',
37    '\Elasticsearch\Endpoints\Indices\UpdateAliases' => '\Elasticsearch\Endpoints\Indices\Aliases\Update',
38    '\Elasticsearch\Endpoints\Indices\ClearCache' => '\Elasticsearch\Endpoints\Indices\Cache\Clear',
39    '\Elasticsearch\Endpoints\Indices\GetMapping' => '\Elasticsearch\Endpoints\Indices\Mapping\Get',
40    '\Elasticsearch\Endpoints\Indices\GetFieldMapping' => '\Elasticsearch\Endpoints\Indices\Mapping\GetField',
41    '\Elasticsearch\Endpoints\Indices\PutMapping' => '\Elasticsearch\Endpoints\Indices\Mapping\Put',
42    '\Elasticsearch\Endpoints\Indices\GetSettings' => '\Elasticsearch\Endpoints\Indices\Settings\Get',
43    '\Elasticsearch\Endpoints\Indices\PutSettings' => '\Elasticsearch\Endpoints\Indices\Settings\Put',
44    '\Elasticsearch\Endpoints\Indices\GetTemplate' => '\Elasticsearch\Endpoints\Indices\Template\Get',
45    '\Elasticsearch\Endpoints\Indices\PutTemplate' => '\Elasticsearch\Endpoints\Indices\Template\Put',
46    '\Elasticsearch\Endpoints\Indices\ExistsTemplate' => '\Elasticsearch\Endpoints\Indices\Template\Exists',
47    '\Elasticsearch\Endpoints\Indices\DeleteTemplate' => '\Elasticsearch\Endpoints\Indices\Template\Delete',
48    '\Elasticsearch\Endpoints\Indices\ExistsType' => '\Elasticsearch\Endpoints\Indices\Type\Exists',
49    '\Elasticsearch\Endpoints\Indices\GetUpgrade' => '\Elasticsearch\Endpoints\Indices\Upgrade\Get',
50    '\Elasticsearch\Endpoints\Indices\Upgrade' => '\Elasticsearch\Endpoints\Indices\Upgrade\Post',
51    '\Elasticsearch\Endpoints\Indices\ValidateQuery' => '\Elasticsearch\Endpoints\Indices\Validate\Query',
52    '\Elasticsearch\Endpoints\Ingest\DeletePipeline' => '\Elasticsearch\Endpoints\Ingest\Pipeline\Delete',
53    '\Elasticsearch\Endpoints\Ingest\GetPipeline' => '\Elasticsearch\Endpoints\Ingest\Pipeline\Get',
54    '\Elasticsearch\Endpoints\Ingest\PutPipeline' => '\Elasticsearch\Endpoints\Ingest\Pipeline\Put',
55    '\Elasticsearch\Endpoints\Ingest\ProcessorGrok' => '\Elasticsearch\Endpoints\Ingest\Pipeline\ProcessorGrok',
56    '\Elasticsearch\Endpoints\GetScript' => '\Elasticsearch\Endpoints\Script\Get',
57    '\Elasticsearch\Endpoints\PutScript' => '\Elasticsearch\Endpoints\Script\Put',
58    '\Elasticsearch\Endpoints\DeleteScript' => '\Elasticsearch\Endpoints\Script\Delete',
59    '\Elasticsearch\Endpoints\Snapshot\CreateRepository' => '\Elasticsearch\Endpoints\Snapshot\Repository\Create',
60    '\Elasticsearch\Endpoints\Snapshot\DeleteRepository' => '\Elasticsearch\Endpoints\Snapshot\Repository\Delete',
61    '\Elasticsearch\Endpoints\Snapshot\GetRepository' => '\Elasticsearch\Endpoints\Snapshot\Repository\Get',
62    '\Elasticsearch\Endpoints\Snapshot\VerifyRepository' => '\Elasticsearch\Endpoints\Snapshot\Repository\Verify',
63    '\Elasticsearch\Endpoints\GetSource' => '\Elasticsearch\Endpoints\Source\Get',
64    '\Elasticsearch\Endpoints\ExistsSource' => '\Elasticsearch\Endpoints\Source\Exists',
65    '\Elasticsearch\Endpoints\Tasks\ListTasks' => '\Elasticsearch\Endpoints\Tasks\TasksList',
66];
67
68foreach ($classesToAlias as $original => $alias) {
69    if (!class_exists($alias, false)) {
70        class_alias($original, $alias);
71    }
72}
73