Skip to content

Commit

Permalink
Updated API to ES 8.9
Browse files Browse the repository at this point in the history
  • Loading branch information
ezimuel committed Jul 17, 2023
1 parent 6b79336 commit 5bd0a63
Show file tree
Hide file tree
Showing 9 changed files with 605 additions and 6 deletions.
35 changes: 35 additions & 0 deletions src/Endpoints/Cluster.php
Original file line number Diff line number Diff line change
Expand Up @@ -296,6 +296,41 @@ public function health(array $params = [])
}


/**
* Returns different information about the cluster.
*
* @see https://www.elastic.co/guide/en/elasticsearch/reference/master/cluster-info.html
*
* @param array{
* target: list, // (REQUIRED) Limit the information returned to the specified target.
* pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false)
* human: boolean, // Return human readable values for statistics. (DEFAULT: true)
* error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false)
* source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests.
* filter_path: list, // A comma-separated list of filters used to reduce the response.
* } $params
*
* @throws MissingParameterException if a required parameter is missing
* @throws NoNodeAvailableException if all the hosts are offline
* @throws ClientResponseException if the status code of response is 4xx
* @throws ServerResponseException if the status code of response is 5xx
*
* @return Elasticsearch|Promise
*/
public function info(array $params = [])
{
$this->checkRequiredParameters(['target'], $params);
$url = '/_info/' . $this->encode($params['target']);
$method = 'GET';

$url = $this->addQueryString($url, $params, ['pretty','human','error_trace','source','filter_path']);
$headers = [
'Accept' => 'application/json',
];
return $this->client->sendRequest($this->createRequest($method, $url, $headers, $params['body'] ?? null));
}


/**
* Returns a list of any cluster-level changes (e.g. create index, update mapping,
* allocate or fail shard) which have not yet been executed.
Expand Down
10 changes: 5 additions & 5 deletions src/Endpoints/Indices.php
Original file line number Diff line number Diff line change
Expand Up @@ -427,7 +427,7 @@ public function deleteAlias(array $params = [])
/**
* Deletes the data lifecycle of the selected data streams.
*
* @see https://www.elastic.co/guide/en/elasticsearch/reference/master/dlm-delete-lifecycle.html
* @see https://www.elastic.co/guide/en/elasticsearch/reference/master/data-streams-delete-lifecycle.html
* @internal This API is EXPERIMENTAL and may be changed or removed completely in a future release
*
* @param array{
Expand Down Expand Up @@ -815,9 +815,9 @@ public function existsTemplate(array $params = [])


/**
* Retrieves information about the index's current DLM lifecycle, such as any potential encountered error, time since creation etc.
* Retrieves information about the index's current data stream lifecycle, such as any potential encountered error, time since creation etc.
*
* @see https://www.elastic.co/guide/en/elasticsearch/reference/current/dlm-explain-lifecycle.html
* @see https://www.elastic.co/guide/en/elasticsearch/reference/current/data-streams-explain-lifecycle.html
* @internal This API is EXPERIMENTAL and may be changed or removed completely in a future release
*
* @param array{
Expand Down Expand Up @@ -1072,7 +1072,7 @@ public function getAlias(array $params = [])
/**
* Returns the data lifecycle of the selected data streams.
*
* @see https://www.elastic.co/guide/en/elasticsearch/reference/master/dlm-get-lifecycle.html
* @see https://www.elastic.co/guide/en/elasticsearch/reference/master/data-streams-get-lifecycle.html
* @internal This API is EXPERIMENTAL and may be changed or removed completely in a future release
*
* @param array{
Expand Down Expand Up @@ -1554,7 +1554,7 @@ public function putAlias(array $params = [])
/**
* Updates the data lifecycle of the selected data streams.
*
* @see https://www.elastic.co/guide/en/elasticsearch/reference/master/dlm-put-lifecycle.html
* @see https://www.elastic.co/guide/en/elasticsearch/reference/master/data-streams-put-lifecycle.html
* @internal This API is EXPERIMENTAL and may be changed or removed completely in a future release
*
* @param array{
Expand Down
139 changes: 139 additions & 0 deletions src/Endpoints/QueryRuleset.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,139 @@
<?php

/**
* Elasticsearch PHP Client
*
* @link https://github.com/elastic/elasticsearch-php
* @copyright Copyright (c) Elasticsearch B.V (https://www.elastic.co)
* @license https://opensource.org/licenses/MIT MIT License
*
* Licensed to Elasticsearch B.V under one or more agreements.
* Elasticsearch B.V licenses this file to you under the MIT License.
* See the LICENSE file in the project root for more information.
*/

declare(strict_types=1);

namespace Elastic\Elasticsearch\Endpoints;

use Elastic\Elasticsearch\Exception\ClientResponseException;
use Elastic\Elasticsearch\Exception\MissingParameterException;
use Elastic\Elasticsearch\Exception\ServerResponseException;
use Elastic\Elasticsearch\Response\Elasticsearch;
use Elastic\Transport\Exception\NoNodeAvailableException;
use Http\Promise\Promise;

/**
* @generated This file is generated, please do not edit
*/
class QueryRuleset extends AbstractEndpoint
{
/**
* Deletes a query ruleset.
*
* @see https://www.elastic.co/guide/en/elasticsearch/reference/master/delete-query-ruleset.html
* @internal This API is EXPERIMENTAL and may be changed or removed completely in a future release
*
* @param array{
* ruleset_id: string, // (REQUIRED) The unique identifier of the query ruleset to delete
* pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false)
* human: boolean, // Return human readable values for statistics. (DEFAULT: true)
* error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false)
* source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests.
* filter_path: list, // A comma-separated list of filters used to reduce the response.
* } $params
*
* @throws MissingParameterException if a required parameter is missing
* @throws NoNodeAvailableException if all the hosts are offline
* @throws ClientResponseException if the status code of response is 4xx
* @throws ServerResponseException if the status code of response is 5xx
*
* @return Elasticsearch|Promise
*/
public function delete(array $params = [])
{
$this->checkRequiredParameters(['ruleset_id'], $params);
$url = '/_query_rules/' . $this->encode($params['ruleset_id']);
$method = 'DELETE';

$url = $this->addQueryString($url, $params, ['pretty','human','error_trace','source','filter_path']);
$headers = [
'Accept' => 'application/json',
];
return $this->client->sendRequest($this->createRequest($method, $url, $headers, $params['body'] ?? null));
}


/**
* Returns the details about a query ruleset.
*
* @see https://www.elastic.co/guide/en/elasticsearch/reference/master/get-query-ruleset.html
* @internal This API is EXPERIMENTAL and may be changed or removed completely in a future release
*
* @param array{
* ruleset_id: string, // (REQUIRED) The unique identifier of the query ruleset
* pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false)
* human: boolean, // Return human readable values for statistics. (DEFAULT: true)
* error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false)
* source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests.
* filter_path: list, // A comma-separated list of filters used to reduce the response.
* } $params
*
* @throws MissingParameterException if a required parameter is missing
* @throws NoNodeAvailableException if all the hosts are offline
* @throws ClientResponseException if the status code of response is 4xx
* @throws ServerResponseException if the status code of response is 5xx
*
* @return Elasticsearch|Promise
*/
public function get(array $params = [])
{
$this->checkRequiredParameters(['ruleset_id'], $params);
$url = '/_query_rules/' . $this->encode($params['ruleset_id']);
$method = 'GET';

$url = $this->addQueryString($url, $params, ['pretty','human','error_trace','source','filter_path']);
$headers = [
'Accept' => 'application/json',
];
return $this->client->sendRequest($this->createRequest($method, $url, $headers, $params['body'] ?? null));
}


/**
* Creates or updates a query ruleset.
*
* @see https://www.elastic.co/guide/en/elasticsearch/reference/master/put-query-ruleset.html
* @internal This API is EXPERIMENTAL and may be changed or removed completely in a future release
*
* @param array{
* ruleset_id: string, // (REQUIRED) The unique identifier of the ruleset to be created or updated.
* pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false)
* human: boolean, // Return human readable values for statistics. (DEFAULT: true)
* error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false)
* source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests.
* filter_path: list, // A comma-separated list of filters used to reduce the response.
* body: array, // (REQUIRED) The query ruleset configuration, including `rules`
* } $params
*
* @throws MissingParameterException if a required parameter is missing
* @throws NoNodeAvailableException if all the hosts are offline
* @throws ClientResponseException if the status code of response is 4xx
* @throws ServerResponseException if the status code of response is 5xx
*
* @return Elasticsearch|Promise
*/
public function put(array $params = [])
{
$this->checkRequiredParameters(['ruleset_id','body'], $params);
$url = '/_query_rules/' . $this->encode($params['ruleset_id']);
$method = 'PUT';

$url = $this->addQueryString($url, $params, ['pretty','human','error_trace','source','filter_path']);
$headers = [
'Accept' => 'application/json',
'Content-Type' => 'application/json',
];
return $this->client->sendRequest($this->createRequest($method, $url, $headers, $params['body'] ?? null));
}
}
40 changes: 39 additions & 1 deletion src/Endpoints/SearchApplication.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ class SearchApplication extends AbstractEndpoint
/**
* Deletes a search application.
*
* @see https://www.elastic.co/guide/en/elasticsearch/reference/master/put-search-application.html
* @see https://www.elastic.co/guide/en/elasticsearch/reference/master/delete-search-application.html
* @internal This API is EXPERIMENTAL and may be changed or removed completely in a future release
*
* @param array{
Expand Down Expand Up @@ -324,6 +324,44 @@ public function putBehavioralAnalytics(array $params = [])
}


/**
* Renders a query for given search application search parameters
*
* @see https://www.elastic.co/guide/en/elasticsearch/reference/master/search-application-render-query.html
* @internal This API is EXPERIMENTAL and may be changed or removed completely in a future release
*
* @param array{
* name: string, // (REQUIRED) The name of the search application to render the query for
* pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false)
* human: boolean, // Return human readable values for statistics. (DEFAULT: true)
* error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false)
* source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests.
* filter_path: list, // A comma-separated list of filters used to reduce the response.
* body: array, // Search parameters, which will override any default search parameters defined in the search application template
* } $params
*
* @throws MissingParameterException if a required parameter is missing
* @throws NoNodeAvailableException if all the hosts are offline
* @throws ClientResponseException if the status code of response is 4xx
* @throws ServerResponseException if the status code of response is 5xx
*
* @return Elasticsearch|Promise
*/
public function renderQuery(array $params = [])
{
$this->checkRequiredParameters(['name'], $params);
$url = '/_application/search_application/' . $this->encode($params['name']) . '/_render_query';
$method = 'POST';

$url = $this->addQueryString($url, $params, ['pretty','human','error_trace','source','filter_path']);
$headers = [
'Accept' => 'application/json',
'Content-Type' => 'application/json',
];
return $this->client->sendRequest($this->createRequest($method, $url, $headers, $params['body'] ?? null));
}


/**
* Perform a search against a search application
*
Expand Down
74 changes: 74 additions & 0 deletions src/Endpoints/Security.php
Original file line number Diff line number Diff line change
Expand Up @@ -385,6 +385,42 @@ public function createApiKey(array $params = [])
}


/**
* Creates a cross-cluster API key for API key based remote cluster access.
*
* @see https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-create-cross-cluster-api-key.html
* @internal This API is EXPERIMENTAL and may be changed or removed completely in a future release
*
* @param array{
* pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false)
* human: boolean, // Return human readable values for statistics. (DEFAULT: true)
* error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false)
* source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests.
* filter_path: list, // A comma-separated list of filters used to reduce the response.
* body: array, // (REQUIRED) The request to create a cross-cluster API key
* } $params
*
* @throws NoNodeAvailableException if all the hosts are offline
* @throws ClientResponseException if the status code of response is 4xx
* @throws ServerResponseException if the status code of response is 5xx
*
* @return Elasticsearch|Promise
*/
public function createCrossClusterApiKey(array $params = [])
{
$this->checkRequiredParameters(['body'], $params);
$url = '/_security/cross_cluster/api_key';
$method = 'POST';

$url = $this->addQueryString($url, $params, ['pretty','human','error_trace','source','filter_path']);
$headers = [
'Accept' => 'application/json',
'Content-Type' => 'application/json',
];
return $this->client->sendRequest($this->createRequest($method, $url, $headers, $params['body'] ?? null));
}


/**
* Creates a service account token for access without requiring basic authentication.
*
Expand Down Expand Up @@ -1977,6 +2013,44 @@ public function updateApiKey(array $params = [])
}


/**
* Updates attributes of an existing cross-cluster API key.
*
* @see https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-update-cross-cluster-api-key.html
* @internal This API is EXPERIMENTAL and may be changed or removed completely in a future release
*
* @param array{
* id: string, // (REQUIRED) The ID of the cross-cluster API key to update
* pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false)
* human: boolean, // Return human readable values for statistics. (DEFAULT: true)
* error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false)
* source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests.
* filter_path: list, // A comma-separated list of filters used to reduce the response.
* body: array, // (REQUIRED) The request to update attributes of a cross-cluster API key.
* } $params
*
* @throws MissingParameterException if a required parameter is missing
* @throws NoNodeAvailableException if all the hosts are offline
* @throws ClientResponseException if the status code of response is 4xx
* @throws ServerResponseException if the status code of response is 5xx
*
* @return Elasticsearch|Promise
*/
public function updateCrossClusterApiKey(array $params = [])
{
$this->checkRequiredParameters(['id','body'], $params);
$url = '/_security/cross_cluster/api_key/' . $this->encode($params['id']);
$method = 'PUT';

$url = $this->addQueryString($url, $params, ['pretty','human','error_trace','source','filter_path']);
$headers = [
'Accept' => 'application/json',
'Content-Type' => 'application/json',
];
return $this->client->sendRequest($this->createRequest($method, $url, $headers, $params['body'] ?? null));
}


/**
* Update application specific data for the user profile of the given unique ID.
*
Expand Down
Loading

0 comments on commit 5bd0a63

Please sign in to comment.