Skip to content

Commit

Permalink
Updated endpoints to 8.16.0
Browse files Browse the repository at this point in the history
  • Loading branch information
ezimuel committed Nov 14, 2024
1 parent 7440931 commit c132519
Show file tree
Hide file tree
Showing 8 changed files with 232 additions and 18 deletions.
2 changes: 1 addition & 1 deletion src/Client.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
final class Client implements ClientInterface
{
const CLIENT_NAME = 'es';
const VERSION = '8.15.0';
const VERSION = '8.16.0';
const API_COMPATIBILITY_HEADER = '%s/vnd.elasticsearch+%s; compatible-with=8';

const SEARCH_ENDPOINTS = [
Expand Down
4 changes: 2 additions & 2 deletions src/Endpoints/Cluster.php
Original file line number Diff line number Diff line change
Expand Up @@ -639,7 +639,7 @@ public function state(array $params = [])
*
* @param array{
* 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
* flat_settings: boolean, // Return settings in flat format (default: false)
* include_remotes: boolean, // Include remote cluster data into the response (default: false)
* timeout: time, // Explicit operation timeout
* pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false)
* human: boolean, // Return human readable values for statistics. (DEFAULT: true)
Expand All @@ -663,7 +663,7 @@ public function stats(array $params = [])
$url = '/_cluster/stats';
$method = 'GET';
}
$url = $this->addQueryString($url, $params, ['flat_settings','timeout','pretty','human','error_trace','source','filter_path']);
$url = $this->addQueryString($url, $params, ['include_remotes','timeout','pretty','human','error_trace','source','filter_path']);
$headers = [
'Accept' => 'application/json',
];
Expand Down
29 changes: 18 additions & 11 deletions src/Endpoints/Indices.php
Original file line number Diff line number Diff line change
Expand Up @@ -293,6 +293,8 @@ public function create(array $params = [])
*
* @param array{
* name: string, // (REQUIRED) The name of the data stream
* timeout: time, // Specify timeout for acknowledging the cluster state update
* master_timeout: time, // Specify timeout for connection to master
* 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)
Expand All @@ -313,7 +315,7 @@ public function createDataStream(array $params = [])
$url = '/_data_stream/' . $this->encode($params['name']);
$method = 'PUT';

$url = $this->addQueryString($url, $params, ['pretty','human','error_trace','source','filter_path']);
$url = $this->addQueryString($url, $params, ['timeout','master_timeout','pretty','human','error_trace','source','filter_path']);
$headers = [
'Accept' => 'application/json',
];
Expand Down Expand Up @@ -448,7 +450,6 @@ public function deleteAlias(array $params = [])
* Deletes the data stream lifecycle of the selected data streams.
*
* @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{
* name: list, // (REQUIRED) A comma-separated list of data streams of which the data stream lifecycle will be deleted; use `*` to get all data streams
Expand Down Expand Up @@ -493,6 +494,7 @@ public function deleteDataLifecycle(array $params = [])
* @param array{
* name: list, // (REQUIRED) A comma-separated list of data streams to delete; use `*` to delete all data streams
* expand_wildcards: enum, // Whether wildcard expressions should get expanded to open or closed indices (default: open)
* master_timeout: time, // Specify timeout for connection to master
* 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)
Expand All @@ -513,7 +515,7 @@ public function deleteDataStream(array $params = [])
$url = '/_data_stream/' . $this->encode($params['name']);
$method = 'DELETE';

$url = $this->addQueryString($url, $params, ['expand_wildcards','pretty','human','error_trace','source','filter_path']);
$url = $this->addQueryString($url, $params, ['expand_wildcards','master_timeout','pretty','human','error_trace','source','filter_path']);
$headers = [
'Accept' => 'application/json',
];
Expand Down Expand Up @@ -858,7 +860,6 @@ public function existsTemplate(array $params = [])
* 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/data-streams-explain-lifecycle.html
* @internal This API is EXPERIMENTAL and may be changed or removed completely in a future release
*
* @param array{
* index: string, // (REQUIRED) The name of the index to explain
Expand Down Expand Up @@ -1125,12 +1126,12 @@ public function getAlias(array $params = [])
* Returns the data stream lifecycle of the selected data streams.
*
* @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{
* name: list, // (REQUIRED) A comma-separated list of data streams to get; use `*` to get all data streams
* expand_wildcards: enum, // Whether wildcard expressions should get expanded to open or closed indices (default: open)
* include_defaults: boolean, // Return all relevant default configurations for the data stream (default: false)
* master_timeout: time, // Specify timeout for connection to master
* 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)
Expand All @@ -1151,7 +1152,7 @@ public function getDataLifecycle(array $params = [])
$url = '/_data_stream/' . $this->encode($params['name']) . '/_lifecycle';
$method = 'GET';

$url = $this->addQueryString($url, $params, ['expand_wildcards','include_defaults','pretty','human','error_trace','source','filter_path']);
$url = $this->addQueryString($url, $params, ['expand_wildcards','include_defaults','master_timeout','pretty','human','error_trace','source','filter_path']);
$headers = [
'Accept' => 'application/json',
];
Expand All @@ -1170,6 +1171,8 @@ public function getDataLifecycle(array $params = [])
* name: list, // A comma-separated list of data streams to get; use `*` to get all data streams
* expand_wildcards: enum, // Whether wildcard expressions should get expanded to open or closed indices (default: open)
* include_defaults: boolean, // Return all relevant default configurations for the data stream (default: false)
* master_timeout: time, // Specify timeout for connection to master
* verbose: boolean, // Whether the maximum timestamp for each data stream should be calculated and returned (default: false)
* 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)
Expand All @@ -1192,7 +1195,7 @@ public function getDataStream(array $params = [])
$url = '/_data_stream';
$method = 'GET';
}
$url = $this->addQueryString($url, $params, ['expand_wildcards','include_defaults','pretty','human','error_trace','source','filter_path']);
$url = $this->addQueryString($url, $params, ['expand_wildcards','include_defaults','master_timeout','verbose','pretty','human','error_trace','source','filter_path']);
$headers = [
'Accept' => 'application/json',
];
Expand Down Expand Up @@ -1438,6 +1441,8 @@ public function getTemplate(array $params = [])
*
* @param array{
* name: string, // (REQUIRED) The name of the alias to migrate
* timeout: time, // Specify timeout for acknowledging the cluster state update
* master_timeout: time, // Specify timeout for connection to master
* 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)
Expand All @@ -1458,7 +1463,7 @@ public function migrateToDataStream(array $params = [])
$url = '/_data_stream/_migrate/' . $this->encode($params['name']);
$method = 'POST';

$url = $this->addQueryString($url, $params, ['pretty','human','error_trace','source','filter_path']);
$url = $this->addQueryString($url, $params, ['timeout','master_timeout','pretty','human','error_trace','source','filter_path']);
$headers = [
'Accept' => 'application/json',
];
Expand Down Expand Up @@ -1555,6 +1560,7 @@ public function open(array $params = [])
*
* @param array{
* name: string, // (REQUIRED) The name of the data stream
* master_timeout: time, // Specify timeout for connection to master
* 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)
Expand All @@ -1575,7 +1581,7 @@ public function promoteDataStream(array $params = [])
$url = '/_data_stream/_promote/' . $this->encode($params['name']);
$method = 'POST';

$url = $this->addQueryString($url, $params, ['pretty','human','error_trace','source','filter_path']);
$url = $this->addQueryString($url, $params, ['master_timeout','pretty','human','error_trace','source','filter_path']);
$headers = [
'Accept' => 'application/json',
];
Expand Down Expand Up @@ -1631,7 +1637,6 @@ public function putAlias(array $params = [])
* Updates the data stream lifecycle of the selected data streams.
*
* @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{
* name: list, // (REQUIRED) A comma-separated list of data streams whose lifecycle will be updated; use `*` to set the lifecycle to all data streams
Expand Down Expand Up @@ -2021,6 +2026,8 @@ public function resolveCluster(array $params = [])
* @param array{
* name: list, // (REQUIRED) A comma-separated list of names or wildcard expressions
* expand_wildcards: enum, // Whether wildcard expressions should get expanded to open or closed indices (default: open)
* ignore_unavailable: boolean, // Whether specified concrete indices should be ignored when unavailable (missing or closed)
* 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)
* 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)
Expand All @@ -2041,7 +2048,7 @@ public function resolveIndex(array $params = [])
$url = '/_resolve/index/' . $this->encode($params['name']);
$method = 'GET';

$url = $this->addQueryString($url, $params, ['expand_wildcards','pretty','human','error_trace','source','filter_path']);
$url = $this->addQueryString($url, $params, ['expand_wildcards','ignore_unavailable','allow_no_indices','pretty','human','error_trace','source','filter_path']);
$headers = [
'Accept' => 'application/json',
];
Expand Down
45 changes: 45 additions & 0 deletions src/Endpoints/Inference.php
Original file line number Diff line number Diff line change
Expand Up @@ -205,4 +205,49 @@ public function put(array $params = [])
$request = $this->addOtelAttributes($params, ['inference_id', 'task_type'], $request, 'inference.put');
return $this->client->sendRequest($request);
}


/**
* Perform streaming inference
*
* @see https://www.elastic.co/guide/en/elasticsearch/reference/master/post-stream-inference-api.html
* @internal This API is EXPERIMENTAL and may be changed or removed completely in a future release
*
* @param array{
* inference_id: string, // (REQUIRED) The inference Id
* task_type: string, // The task type
* 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, // The inference payload
* } $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 streamInference(array $params = [])
{
$this->checkRequiredParameters(['inference_id'], $params);
if (isset($params['task_type'])) {
$url = '/_inference/' . $this->encode($params['task_type']) . '/' . $this->encode($params['inference_id']) . '/_stream';
$method = 'POST';
} else {
$url = '/_inference/' . $this->encode($params['inference_id']) . '/_stream';
$method = 'POST';
}
$url = $this->addQueryString($url, $params, ['pretty','human','error_trace','source','filter_path']);
$headers = [
'Accept' => 'text/event-stream',
'Content-Type' => 'application/json',
];
$request = $this->createRequest($method, $url, $headers, $params['body'] ?? null);
$request = $this->addOtelAttributes($params, ['inference_id', 'task_type'], $request, 'inference.stream_inference');
return $this->client->sendRequest($request);
}
}
Loading

0 comments on commit c132519

Please sign in to comment.