Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
246 changes: 246 additions & 0 deletions src/Endpoints/Esql.php
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,86 @@ public function asyncQueryStop(?array $params = null)
}


/**
* Delete one or more ES|QL data sources. Fails with 409 if any dataset references them.
*
* @link https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-esql-data-source-delete
* @internal This API is EXPERIMENTAL and may be changed or removed completely in a future release
*
* @param array{
* name: string|array<string>, // (REQUIRED) A comma-separated list of data sources to delete
* pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false)
* human?: bool, // Return human readable values for statistics. (DEFAULT: true)
* error_trace?: bool, // 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?: string|array<string>, // 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 deleteDataSource(?array $params = null)
{
$params = $params ?? [];
$this->checkRequiredParameters(['name'], $params);
$url = '/_query/data_source/' . $this->encode($this->convertValue($params['name']));
$method = 'DELETE';

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


/**
* Delete one or more ES|QL datasets.
*
* @link https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-esql-dataset-delete
* @internal This API is EXPERIMENTAL and may be changed or removed completely in a future release
*
* @param array{
* name: string|array<string>, // (REQUIRED) A comma-separated list of datasets to delete
* pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false)
* human?: bool, // Return human readable values for statistics. (DEFAULT: true)
* error_trace?: bool, // 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?: string|array<string>, // 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 deleteDataset(?array $params = null)
{
$params = $params ?? [];
$this->checkRequiredParameters(['name'], $params);
$url = '/_query/dataset/' . $this->encode($this->convertValue($params['name']));
$method = 'DELETE';

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


/**
* Delete a non-materialized VIEW for ESQL.
*
Expand Down Expand Up @@ -230,6 +310,90 @@ public function deleteView(?array $params = null)
}


/**
* Get one or more ES|QL data sources. Secret setting values are returned masked.
*
* @link https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-esql-data-source-get
* @internal This API is EXPERIMENTAL and may be changed or removed completely in a future release
*
* @param array{
* name?: string|array<string>, // A comma-separated list of data source names or wildcard patterns
* pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false)
* human?: bool, // Return human readable values for statistics. (DEFAULT: true)
* error_trace?: bool, // 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?: string|array<string>, // A comma-separated list of filters used to reduce the response.
* } $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 getDataSource(?array $params = null)
{
$params = $params ?? [];
if (isset($params['name'])) {
$url = '/_query/data_source/' . $this->encode($this->convertValue($params['name']));
$method = 'GET';
} else {
$url = '/_query/data_source';
$method = 'GET';
}
$url = $this->addQueryString($url, $params, ['pretty','human','error_trace','source','filter_path']);
$headers = [
'Accept' => 'application/json',
'Content-Type' => 'application/json',
];
$request = $this->createRequest($method, $url, $headers, $params['body'] ?? null);
$request = $this->addOtelAttributes($params, ['name'], $request, 'esql.get_data_source');
return $this->client->sendRequest($request);
}


/**
* Get one or more ES|QL datasets.
*
* @link https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-esql-dataset-get
* @internal This API is EXPERIMENTAL and may be changed or removed completely in a future release
*
* @param array{
* name?: string|array<string>, // A comma-separated list of dataset names or wildcard patterns
* pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false)
* human?: bool, // Return human readable values for statistics. (DEFAULT: true)
* error_trace?: bool, // 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?: string|array<string>, // A comma-separated list of filters used to reduce the response.
* } $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 getDataset(?array $params = null)
{
$params = $params ?? [];
if (isset($params['name'])) {
$url = '/_query/dataset/' . $this->encode($this->convertValue($params['name']));
$method = 'GET';
} else {
$url = '/_query/dataset';
$method = 'GET';
}
$url = $this->addQueryString($url, $params, ['pretty','human','error_trace','source','filter_path']);
$headers = [
'Accept' => 'application/json',
'Content-Type' => 'application/json',
];
$request = $this->createRequest($method, $url, $headers, $params['body'] ?? null);
$request = $this->addOtelAttributes($params, ['name'], $request, 'esql.get_dataset');
return $this->client->sendRequest($request);
}


/**
* Get a specific running ES|QL query information
*
Expand Down Expand Up @@ -352,6 +516,88 @@ public function listQueries(?array $params = null)
}


/**
* Creates or replaces an ES|QL data source.
*
* @link https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-esql-data-source-put
* @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 data source to create or update
* pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false)
* human?: bool, // Return human readable values for statistics. (DEFAULT: true)
* error_trace?: bool, // 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?: string|array<string>, // A comma-separated list of filters used to reduce the response.
* body: string|array<mixed>, // (REQUIRED) Data source definition: type, optional description, and type-specific settings map.. If body is a string must be a valid JSON.
* } $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 putDataSource(?array $params = null)
{
$params = $params ?? [];
$this->checkRequiredParameters(['name','body'], $params);
$url = '/_query/data_source/' . $this->encode($params['name']);
$method = 'PUT';

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


/**
* Creates or replaces an ES|QL dataset referencing a parent data source.
*
* @link https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-esql-dataset-put
* @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 dataset to create or update
* pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false)
* human?: bool, // Return human readable values for statistics. (DEFAULT: true)
* error_trace?: bool, // 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?: string|array<string>, // A comma-separated list of filters used to reduce the response.
* body: string|array<mixed>, // (REQUIRED) Dataset definition: parent data_source name, resource path, optional description, and type-specific settings.. If body is a string must be a valid JSON.
* } $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 putDataset(?array $params = null)
{
$params = $params ?? [];
$this->checkRequiredParameters(['name','body'], $params);
$url = '/_query/dataset/' . $this->encode($params['name']);
$method = 'PUT';

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


/**
* Creates a non-materialized VIEW for ESQL.
*
Expand Down
2 changes: 1 addition & 1 deletion src/Endpoints/Snapshot.php
Original file line number Diff line number Diff line change
Expand Up @@ -392,7 +392,7 @@ public function getRepository(?array $params = null)
* timeout?: int|string, // The period of time to wait for the test to complete. If no response is received before the timeout expires, the test is cancelled and returns an error. For realistic experiments, set this parameter sufficiently long to allow the test to complete. (DEFAULT: 30s)
* detailed?: bool, // Indicates whether to return detailed results, including timing information for every operation performed during the analysis. If false, it returns only a summary of the analysis.
* rarely_abort_writes?: bool, // Indicates whether to rarely cancel writes before they complete. For realistic experiments, leave this parameter unset. (DEFAULT: 1)
* check_overwrite_protection?: bool, // Whether to run the overwrite protection check. Defaults to 'true'. (DEFAULT: 1)
* check_overwrite_protection?: bool, // Whether to run the overwrite protection check. For realistic experiments, leave this parameter unset. (DEFAULT: 1)
* pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false)
* human?: bool, // Return human readable values for statistics. (DEFAULT: true)
* error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false)
Expand Down
Loading