Skip to content

Commit

Permalink
Added 8.8 endpoints
Browse files Browse the repository at this point in the history
  • Loading branch information
ezimuel committed May 23, 2023
1 parent 6bd60df commit 53663e7
Show file tree
Hide file tree
Showing 10 changed files with 623 additions and 16 deletions.
2 changes: 1 addition & 1 deletion src/Endpoints/Cat.php
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ public function allocation(array $params = [])
/**
* Returns information about existing component_templates templates.
*
* @see https://www.elastic.co/guide/en/elasticsearch/reference/master/cat-compoentn-templates.html
* @see https://www.elastic.co/guide/en/elasticsearch/reference/master/cat-component-templates.html
*
* @param array{
* name: string, // A pattern that returned component template names must match
Expand Down
3 changes: 2 additions & 1 deletion src/Endpoints/Cluster.php
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,7 @@ public function existsComponentTemplate(array $params = [])
* name: list, // The comma separated names of the component templates
* master_timeout: time, // Explicit operation timeout for connection to master node
* local: boolean, // Return local information, do not retrieve the state from master node (default: false)
* include_defaults: boolean, // Return all default configurations for the component template (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 @@ -203,7 +204,7 @@ public function getComponentTemplate(array $params = [])
$url = '/_component_template';
$method = 'GET';
}
$url = $this->addQueryString($url, $params, ['master_timeout','local','pretty','human','error_trace','source','filter_path']);
$url = $this->addQueryString($url, $params, ['master_timeout','local','include_defaults','pretty','human','error_trace','source','filter_path']);
$headers = [
'Accept' => 'application/json',
];
Expand Down
167 changes: 163 additions & 4 deletions src/Endpoints/Indices.php
Original file line number Diff line number Diff line change
Expand Up @@ -424,6 +424,45 @@ 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
* @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 lifecycle will be deleted; use `*` to get all data streams
* expand_wildcards: enum, // Whether wildcard expressions should get expanded to open or closed indices (default: open)
* timeout: time, // Explicit timestamp for the document
* 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)
* 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 deleteDataLifecycle(array $params = [])
{
$this->checkRequiredParameters(['name'], $params);
$url = '/_data_stream/' . $this->encode($params['name']) . '/_lifecycle';
$method = 'DELETE';

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


/**
* Deletes a data stream.
*
Expand Down Expand Up @@ -775,6 +814,44 @@ public function existsTemplate(array $params = [])
}


/**
* Retrieves information about the index's current DLM 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
* @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
* include_defaults: boolean, // indicates if the API should return the default values the system uses for the index's lifecycle
* 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)
* 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 explainDataLifecycle(array $params = [])
{
$this->checkRequiredParameters(['index'], $params);
$url = '/' . $this->encode($params['index']) . '/_lifecycle/explain';
$method = 'GET';

$url = $this->addQueryString($url, $params, ['include_defaults','master_timeout','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 field usage stats for each field of an index
*
Expand Down Expand Up @@ -992,6 +1069,44 @@ 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
* @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)
* 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 getDataLifecycle(array $params = [])
{
$this->checkRequiredParameters(['name'], $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']);
$headers = [
'Accept' => 'application/json',
];
return $this->client->sendRequest($this->createRequest($method, $url, $headers, $params['body'] ?? null));
}


/**
* Returns data streams.
*
Expand All @@ -1000,6 +1115,7 @@ public function getAlias(array $params = [])
* @param array{
* 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)
* 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 @@ -1022,7 +1138,7 @@ public function getDataStream(array $params = [])
$url = '/_data_stream';
$method = 'GET';
}
$url = $this->addQueryString($url, $params, ['expand_wildcards','pretty','human','error_trace','source','filter_path']);
$url = $this->addQueryString($url, $params, ['expand_wildcards','include_defaults','pretty','human','error_trace','source','filter_path']);
$headers = [
'Accept' => 'application/json',
];
Expand Down Expand Up @@ -1085,6 +1201,7 @@ public function getFieldMapping(array $params = [])
* flat_settings: boolean, // Return settings in flat format (default: false)
* master_timeout: time, // Explicit operation timeout for connection to master node
* local: boolean, // Return local information, do not retrieve the state from master node (default: false)
* include_defaults: boolean, // Return all relevant default configurations for the index template (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 @@ -1107,7 +1224,7 @@ public function getIndexTemplate(array $params = [])
$url = '/_index_template';
$method = 'GET';
}
$url = $this->addQueryString($url, $params, ['flat_settings','master_timeout','local','pretty','human','error_trace','source','filter_path']);
$url = $this->addQueryString($url, $params, ['flat_settings','master_timeout','local','include_defaults','pretty','human','error_trace','source','filter_path']);
$headers = [
'Accept' => 'application/json',
];
Expand Down Expand Up @@ -1434,6 +1551,46 @@ 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
* @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_wildcards: enum, // Whether wildcard expressions should get expanded to open or closed indices (default: open)
* timeout: time, // Explicit timestamp for the document
* 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)
* 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 data lifecycle configuration that consist of the data retention
* } $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 putDataLifecycle(array $params = [])
{
$this->checkRequiredParameters(['name'], $params);
$url = '/_data_stream/' . $this->encode($params['name']) . '/_lifecycle';
$method = 'PUT';

$url = $this->addQueryString($url, $params, ['expand_wildcards','timeout','master_timeout','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 an index template.
*
Expand Down Expand Up @@ -1937,6 +2094,7 @@ public function shrink(array $params = [])
* create: boolean, // Whether the index template we optionally defined in the body should only be dry-run added if new or can also replace an existing one
* cause: string, // User defined reason for dry-run creating the new template for simulation purposes
* master_timeout: time, // Specify timeout for connection to master
* include_defaults: boolean, // Return all relevant default configurations for this index template simulation (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 @@ -1958,7 +2116,7 @@ public function simulateIndexTemplate(array $params = [])
$url = '/_index_template/_simulate_index/' . $this->encode($params['name']);
$method = 'POST';

$url = $this->addQueryString($url, $params, ['create','cause','master_timeout','pretty','human','error_trace','source','filter_path']);
$url = $this->addQueryString($url, $params, ['create','cause','master_timeout','include_defaults','pretty','human','error_trace','source','filter_path']);
$headers = [
'Accept' => 'application/json',
'Content-Type' => 'application/json',
Expand All @@ -1977,6 +2135,7 @@ public function simulateIndexTemplate(array $params = [])
* create: boolean, // Whether the index template we optionally defined in the body should only be dry-run added if new or can also replace an existing one
* cause: string, // User defined reason for dry-run creating the new template for simulation purposes
* master_timeout: time, // Specify timeout for connection to master
* include_defaults: boolean, // Return all relevant default configurations for this template simulation (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 @@ -2000,7 +2159,7 @@ public function simulateTemplate(array $params = [])
$url = '/_index_template/_simulate';
$method = 'POST';
}
$url = $this->addQueryString($url, $params, ['create','cause','master_timeout','pretty','human','error_trace','source','filter_path']);
$url = $this->addQueryString($url, $params, ['create','cause','master_timeout','include_defaults','pretty','human','error_trace','source','filter_path']);
$headers = [
'Accept' => 'application/json',
'Content-Type' => 'application/json',
Expand Down
14 changes: 8 additions & 6 deletions src/Endpoints/Logstash.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,15 +69,14 @@ public function deletePipeline(array $params = [])
* @see https://www.elastic.co/guide/en/elasticsearch/reference/current/logstash-api-get-pipeline.html
*
* @param array{
* id: string, // (REQUIRED) A comma-separated list of Pipeline IDs
* id: string, // A comma-separated list of Pipeline IDs
* 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
Expand All @@ -86,10 +85,13 @@ public function deletePipeline(array $params = [])
*/
public function getPipeline(array $params = [])
{
$this->checkRequiredParameters(['id'], $params);
$url = '/_logstash/pipeline/' . $this->encode($params['id']);
$method = 'GET';

if (isset($params['id'])) {
$url = '/_logstash/pipeline/' . $this->encode($params['id']);
$method = 'GET';
} else {
$url = '/_logstash/pipeline';
$method = 'GET';
}
$url = $this->addQueryString($url, $params, ['pretty','human','error_trace','source','filter_path']);
$headers = [
'Accept' => 'application/json',
Expand Down
6 changes: 4 additions & 2 deletions src/Endpoints/Ml.php
Original file line number Diff line number Diff line change
Expand Up @@ -2036,6 +2036,7 @@ public function putJob(array $params = [])
* @param array{
* model_id: string, // (REQUIRED) The ID of the trained models to store
* defer_definition_decompression: boolean, // If set to `true` and a `compressed_definition` is provided, the request defers definition decompression and skips relevant validations.
* wait_for_completion: boolean, // Whether to wait for all child operations(e.g. model download) to complete, before returning or not. Default to 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 @@ -2057,7 +2058,7 @@ public function putTrainedModel(array $params = [])
$url = '/_ml/trained_models/' . $this->encode($params['model_id']);
$method = 'PUT';

$url = $this->addQueryString($url, $params, ['defer_definition_decompression','pretty','human','error_trace','source','filter_path']);
$url = $this->addQueryString($url, $params, ['defer_definition_decompression','wait_for_completion','pretty','human','error_trace','source','filter_path']);
$headers = [
'Accept' => 'application/json',
'Content-Type' => 'application/json',
Expand Down Expand Up @@ -2375,6 +2376,7 @@ public function startDatafeed(array $params = [])
* @param array{
* model_id: string, // (REQUIRED) The unique identifier of the trained model.
* cache_size: string, // A byte-size value for configuring the inference cache size. For example, 20mb.
* deployment_id: string, // The Id of the new deployment. Defaults to the model_id if not set.
* number_of_allocations: int, // The total number of allocations this model is assigned across machine learning nodes.
* threads_per_allocation: int, // The number of threads used by each model allocation during inference.
* priority: string, // The deployment priority.
Expand All @@ -2401,7 +2403,7 @@ public function startTrainedModelDeployment(array $params = [])
$url = '/_ml/trained_models/' . $this->encode($params['model_id']) . '/deployment/_start';
$method = 'POST';

$url = $this->addQueryString($url, $params, ['cache_size','number_of_allocations','threads_per_allocation','priority','queue_capacity','timeout','wait_for','pretty','human','error_trace','source','filter_path']);
$url = $this->addQueryString($url, $params, ['cache_size','deployment_id','number_of_allocations','threads_per_allocation','priority','queue_capacity','timeout','wait_for','pretty','human','error_trace','source','filter_path']);
$headers = [
'Accept' => 'application/json',
'Content-Type' => 'application/json',
Expand Down
Loading

0 comments on commit 53663e7

Please sign in to comment.