Skip to content

Commit 5bd0a63

Browse files
committed
Updated API to ES 8.9
1 parent 6b79336 commit 5bd0a63

File tree

9 files changed

+605
-6
lines changed

9 files changed

+605
-6
lines changed

src/Endpoints/Cluster.php

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -296,6 +296,41 @@ public function health(array $params = [])
296296
}
297297

298298

299+
/**
300+
* Returns different information about the cluster.
301+
*
302+
* @see https://www.elastic.co/guide/en/elasticsearch/reference/master/cluster-info.html
303+
*
304+
* @param array{
305+
* target: list, // (REQUIRED) Limit the information returned to the specified target.
306+
* pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false)
307+
* human: boolean, // Return human readable values for statistics. (DEFAULT: true)
308+
* error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false)
309+
* source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests.
310+
* filter_path: list, // A comma-separated list of filters used to reduce the response.
311+
* } $params
312+
*
313+
* @throws MissingParameterException if a required parameter is missing
314+
* @throws NoNodeAvailableException if all the hosts are offline
315+
* @throws ClientResponseException if the status code of response is 4xx
316+
* @throws ServerResponseException if the status code of response is 5xx
317+
*
318+
* @return Elasticsearch|Promise
319+
*/
320+
public function info(array $params = [])
321+
{
322+
$this->checkRequiredParameters(['target'], $params);
323+
$url = '/_info/' . $this->encode($params['target']);
324+
$method = 'GET';
325+
326+
$url = $this->addQueryString($url, $params, ['pretty','human','error_trace','source','filter_path']);
327+
$headers = [
328+
'Accept' => 'application/json',
329+
];
330+
return $this->client->sendRequest($this->createRequest($method, $url, $headers, $params['body'] ?? null));
331+
}
332+
333+
299334
/**
300335
* Returns a list of any cluster-level changes (e.g. create index, update mapping,
301336
* allocate or fail shard) which have not yet been executed.

src/Endpoints/Indices.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -427,7 +427,7 @@ public function deleteAlias(array $params = [])
427427
/**
428428
* Deletes the data lifecycle of the selected data streams.
429429
*
430-
* @see https://www.elastic.co/guide/en/elasticsearch/reference/master/dlm-delete-lifecycle.html
430+
* @see https://www.elastic.co/guide/en/elasticsearch/reference/master/data-streams-delete-lifecycle.html
431431
* @internal This API is EXPERIMENTAL and may be changed or removed completely in a future release
432432
*
433433
* @param array{
@@ -815,9 +815,9 @@ public function existsTemplate(array $params = [])
815815

816816

817817
/**
818-
* Retrieves information about the index's current DLM lifecycle, such as any potential encountered error, time since creation etc.
818+
* Retrieves information about the index's current data stream lifecycle, such as any potential encountered error, time since creation etc.
819819
*
820-
* @see https://www.elastic.co/guide/en/elasticsearch/reference/current/dlm-explain-lifecycle.html
820+
* @see https://www.elastic.co/guide/en/elasticsearch/reference/current/data-streams-explain-lifecycle.html
821821
* @internal This API is EXPERIMENTAL and may be changed or removed completely in a future release
822822
*
823823
* @param array{
@@ -1072,7 +1072,7 @@ public function getAlias(array $params = [])
10721072
/**
10731073
* Returns the data lifecycle of the selected data streams.
10741074
*
1075-
* @see https://www.elastic.co/guide/en/elasticsearch/reference/master/dlm-get-lifecycle.html
1075+
* @see https://www.elastic.co/guide/en/elasticsearch/reference/master/data-streams-get-lifecycle.html
10761076
* @internal This API is EXPERIMENTAL and may be changed or removed completely in a future release
10771077
*
10781078
* @param array{
@@ -1554,7 +1554,7 @@ public function putAlias(array $params = [])
15541554
/**
15551555
* Updates the data lifecycle of the selected data streams.
15561556
*
1557-
* @see https://www.elastic.co/guide/en/elasticsearch/reference/master/dlm-put-lifecycle.html
1557+
* @see https://www.elastic.co/guide/en/elasticsearch/reference/master/data-streams-put-lifecycle.html
15581558
* @internal This API is EXPERIMENTAL and may be changed or removed completely in a future release
15591559
*
15601560
* @param array{

src/Endpoints/QueryRuleset.php

Lines changed: 139 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,139 @@
1+
<?php
2+
3+
/**
4+
* Elasticsearch PHP Client
5+
*
6+
* @link https://github.com/elastic/elasticsearch-php
7+
* @copyright Copyright (c) Elasticsearch B.V (https://www.elastic.co)
8+
* @license https://opensource.org/licenses/MIT MIT License
9+
*
10+
* Licensed to Elasticsearch B.V under one or more agreements.
11+
* Elasticsearch B.V licenses this file to you under the MIT License.
12+
* See the LICENSE file in the project root for more information.
13+
*/
14+
15+
declare(strict_types=1);
16+
17+
namespace Elastic\Elasticsearch\Endpoints;
18+
19+
use Elastic\Elasticsearch\Exception\ClientResponseException;
20+
use Elastic\Elasticsearch\Exception\MissingParameterException;
21+
use Elastic\Elasticsearch\Exception\ServerResponseException;
22+
use Elastic\Elasticsearch\Response\Elasticsearch;
23+
use Elastic\Transport\Exception\NoNodeAvailableException;
24+
use Http\Promise\Promise;
25+
26+
/**
27+
* @generated This file is generated, please do not edit
28+
*/
29+
class QueryRuleset extends AbstractEndpoint
30+
{
31+
/**
32+
* Deletes a query ruleset.
33+
*
34+
* @see https://www.elastic.co/guide/en/elasticsearch/reference/master/delete-query-ruleset.html
35+
* @internal This API is EXPERIMENTAL and may be changed or removed completely in a future release
36+
*
37+
* @param array{
38+
* ruleset_id: string, // (REQUIRED) The unique identifier of the query ruleset to delete
39+
* pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false)
40+
* human: boolean, // Return human readable values for statistics. (DEFAULT: true)
41+
* error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false)
42+
* source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests.
43+
* filter_path: list, // A comma-separated list of filters used to reduce the response.
44+
* } $params
45+
*
46+
* @throws MissingParameterException if a required parameter is missing
47+
* @throws NoNodeAvailableException if all the hosts are offline
48+
* @throws ClientResponseException if the status code of response is 4xx
49+
* @throws ServerResponseException if the status code of response is 5xx
50+
*
51+
* @return Elasticsearch|Promise
52+
*/
53+
public function delete(array $params = [])
54+
{
55+
$this->checkRequiredParameters(['ruleset_id'], $params);
56+
$url = '/_query_rules/' . $this->encode($params['ruleset_id']);
57+
$method = 'DELETE';
58+
59+
$url = $this->addQueryString($url, $params, ['pretty','human','error_trace','source','filter_path']);
60+
$headers = [
61+
'Accept' => 'application/json',
62+
];
63+
return $this->client->sendRequest($this->createRequest($method, $url, $headers, $params['body'] ?? null));
64+
}
65+
66+
67+
/**
68+
* Returns the details about a query ruleset.
69+
*
70+
* @see https://www.elastic.co/guide/en/elasticsearch/reference/master/get-query-ruleset.html
71+
* @internal This API is EXPERIMENTAL and may be changed or removed completely in a future release
72+
*
73+
* @param array{
74+
* ruleset_id: string, // (REQUIRED) The unique identifier of the query ruleset
75+
* pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false)
76+
* human: boolean, // Return human readable values for statistics. (DEFAULT: true)
77+
* error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false)
78+
* source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests.
79+
* filter_path: list, // A comma-separated list of filters used to reduce the response.
80+
* } $params
81+
*
82+
* @throws MissingParameterException if a required parameter is missing
83+
* @throws NoNodeAvailableException if all the hosts are offline
84+
* @throws ClientResponseException if the status code of response is 4xx
85+
* @throws ServerResponseException if the status code of response is 5xx
86+
*
87+
* @return Elasticsearch|Promise
88+
*/
89+
public function get(array $params = [])
90+
{
91+
$this->checkRequiredParameters(['ruleset_id'], $params);
92+
$url = '/_query_rules/' . $this->encode($params['ruleset_id']);
93+
$method = 'GET';
94+
95+
$url = $this->addQueryString($url, $params, ['pretty','human','error_trace','source','filter_path']);
96+
$headers = [
97+
'Accept' => 'application/json',
98+
];
99+
return $this->client->sendRequest($this->createRequest($method, $url, $headers, $params['body'] ?? null));
100+
}
101+
102+
103+
/**
104+
* Creates or updates a query ruleset.
105+
*
106+
* @see https://www.elastic.co/guide/en/elasticsearch/reference/master/put-query-ruleset.html
107+
* @internal This API is EXPERIMENTAL and may be changed or removed completely in a future release
108+
*
109+
* @param array{
110+
* ruleset_id: string, // (REQUIRED) The unique identifier of the ruleset to be created or updated.
111+
* pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false)
112+
* human: boolean, // Return human readable values for statistics. (DEFAULT: true)
113+
* error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false)
114+
* source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests.
115+
* filter_path: list, // A comma-separated list of filters used to reduce the response.
116+
* body: array, // (REQUIRED) The query ruleset configuration, including `rules`
117+
* } $params
118+
*
119+
* @throws MissingParameterException if a required parameter is missing
120+
* @throws NoNodeAvailableException if all the hosts are offline
121+
* @throws ClientResponseException if the status code of response is 4xx
122+
* @throws ServerResponseException if the status code of response is 5xx
123+
*
124+
* @return Elasticsearch|Promise
125+
*/
126+
public function put(array $params = [])
127+
{
128+
$this->checkRequiredParameters(['ruleset_id','body'], $params);
129+
$url = '/_query_rules/' . $this->encode($params['ruleset_id']);
130+
$method = 'PUT';
131+
132+
$url = $this->addQueryString($url, $params, ['pretty','human','error_trace','source','filter_path']);
133+
$headers = [
134+
'Accept' => 'application/json',
135+
'Content-Type' => 'application/json',
136+
];
137+
return $this->client->sendRequest($this->createRequest($method, $url, $headers, $params['body'] ?? null));
138+
}
139+
}

src/Endpoints/SearchApplication.php

Lines changed: 39 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ class SearchApplication extends AbstractEndpoint
3131
/**
3232
* Deletes a search application.
3333
*
34-
* @see https://www.elastic.co/guide/en/elasticsearch/reference/master/put-search-application.html
34+
* @see https://www.elastic.co/guide/en/elasticsearch/reference/master/delete-search-application.html
3535
* @internal This API is EXPERIMENTAL and may be changed or removed completely in a future release
3636
*
3737
* @param array{
@@ -324,6 +324,44 @@ public function putBehavioralAnalytics(array $params = [])
324324
}
325325

326326

327+
/**
328+
* Renders a query for given search application search parameters
329+
*
330+
* @see https://www.elastic.co/guide/en/elasticsearch/reference/master/search-application-render-query.html
331+
* @internal This API is EXPERIMENTAL and may be changed or removed completely in a future release
332+
*
333+
* @param array{
334+
* name: string, // (REQUIRED) The name of the search application to render the query for
335+
* pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false)
336+
* human: boolean, // Return human readable values for statistics. (DEFAULT: true)
337+
* error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false)
338+
* source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests.
339+
* filter_path: list, // A comma-separated list of filters used to reduce the response.
340+
* body: array, // Search parameters, which will override any default search parameters defined in the search application template
341+
* } $params
342+
*
343+
* @throws MissingParameterException if a required parameter is missing
344+
* @throws NoNodeAvailableException if all the hosts are offline
345+
* @throws ClientResponseException if the status code of response is 4xx
346+
* @throws ServerResponseException if the status code of response is 5xx
347+
*
348+
* @return Elasticsearch|Promise
349+
*/
350+
public function renderQuery(array $params = [])
351+
{
352+
$this->checkRequiredParameters(['name'], $params);
353+
$url = '/_application/search_application/' . $this->encode($params['name']) . '/_render_query';
354+
$method = 'POST';
355+
356+
$url = $this->addQueryString($url, $params, ['pretty','human','error_trace','source','filter_path']);
357+
$headers = [
358+
'Accept' => 'application/json',
359+
'Content-Type' => 'application/json',
360+
];
361+
return $this->client->sendRequest($this->createRequest($method, $url, $headers, $params['body'] ?? null));
362+
}
363+
364+
327365
/**
328366
* Perform a search against a search application
329367
*

src/Endpoints/Security.php

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -385,6 +385,42 @@ public function createApiKey(array $params = [])
385385
}
386386

387387

388+
/**
389+
* Creates a cross-cluster API key for API key based remote cluster access.
390+
*
391+
* @see https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-create-cross-cluster-api-key.html
392+
* @internal This API is EXPERIMENTAL and may be changed or removed completely in a future release
393+
*
394+
* @param array{
395+
* pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false)
396+
* human: boolean, // Return human readable values for statistics. (DEFAULT: true)
397+
* error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false)
398+
* source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests.
399+
* filter_path: list, // A comma-separated list of filters used to reduce the response.
400+
* body: array, // (REQUIRED) The request to create a cross-cluster API key
401+
* } $params
402+
*
403+
* @throws NoNodeAvailableException if all the hosts are offline
404+
* @throws ClientResponseException if the status code of response is 4xx
405+
* @throws ServerResponseException if the status code of response is 5xx
406+
*
407+
* @return Elasticsearch|Promise
408+
*/
409+
public function createCrossClusterApiKey(array $params = [])
410+
{
411+
$this->checkRequiredParameters(['body'], $params);
412+
$url = '/_security/cross_cluster/api_key';
413+
$method = 'POST';
414+
415+
$url = $this->addQueryString($url, $params, ['pretty','human','error_trace','source','filter_path']);
416+
$headers = [
417+
'Accept' => 'application/json',
418+
'Content-Type' => 'application/json',
419+
];
420+
return $this->client->sendRequest($this->createRequest($method, $url, $headers, $params['body'] ?? null));
421+
}
422+
423+
388424
/**
389425
* Creates a service account token for access without requiring basic authentication.
390426
*
@@ -1977,6 +2013,44 @@ public function updateApiKey(array $params = [])
19772013
}
19782014

19792015

2016+
/**
2017+
* Updates attributes of an existing cross-cluster API key.
2018+
*
2019+
* @see https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-update-cross-cluster-api-key.html
2020+
* @internal This API is EXPERIMENTAL and may be changed or removed completely in a future release
2021+
*
2022+
* @param array{
2023+
* id: string, // (REQUIRED) The ID of the cross-cluster API key to update
2024+
* pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false)
2025+
* human: boolean, // Return human readable values for statistics. (DEFAULT: true)
2026+
* error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false)
2027+
* source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests.
2028+
* filter_path: list, // A comma-separated list of filters used to reduce the response.
2029+
* body: array, // (REQUIRED) The request to update attributes of a cross-cluster API key.
2030+
* } $params
2031+
*
2032+
* @throws MissingParameterException if a required parameter is missing
2033+
* @throws NoNodeAvailableException if all the hosts are offline
2034+
* @throws ClientResponseException if the status code of response is 4xx
2035+
* @throws ServerResponseException if the status code of response is 5xx
2036+
*
2037+
* @return Elasticsearch|Promise
2038+
*/
2039+
public function updateCrossClusterApiKey(array $params = [])
2040+
{
2041+
$this->checkRequiredParameters(['id','body'], $params);
2042+
$url = '/_security/cross_cluster/api_key/' . $this->encode($params['id']);
2043+
$method = 'PUT';
2044+
2045+
$url = $this->addQueryString($url, $params, ['pretty','human','error_trace','source','filter_path']);
2046+
$headers = [
2047+
'Accept' => 'application/json',
2048+
'Content-Type' => 'application/json',
2049+
];
2050+
return $this->client->sendRequest($this->createRequest($method, $url, $headers, $params['body'] ?? null));
2051+
}
2052+
2053+
19802054
/**
19812055
* Update application specific data for the user profile of the given unique ID.
19822056
*

0 commit comments

Comments
 (0)