Skip to content

Commit 439a83e

Browse files
committed
Updated APIs to 8.7
1 parent 015bca9 commit 439a83e

File tree

3 files changed

+124
-5
lines changed

3 files changed

+124
-5
lines changed

src/Endpoints/Ml.php

Lines changed: 43 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -411,6 +411,7 @@ public function deleteForecast(array $params = [])
411411
* job_id: string, // (REQUIRED) The ID of the job to delete
412412
* force: boolean, // True if the job should be forcefully deleted
413413
* wait_for_completion: boolean, // Should this request wait until the operation has completed before returning
414+
* delete_user_annotations: boolean, // Should annotations added by the user be deleted
414415
* pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false)
415416
* human: boolean, // Return human readable values for statistics. (DEFAULT: true)
416417
* error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false)
@@ -431,7 +432,7 @@ public function deleteJob(array $params = [])
431432
$url = '/_ml/anomaly_detectors/' . $this->encode($params['job_id']);
432433
$method = 'DELETE';
433434

434-
$url = $this->addQueryString($url, $params, ['force','wait_for_completion','pretty','human','error_trace','source','filter_path']);
435+
$url = $this->addQueryString($url, $params, ['force','wait_for_completion','delete_user_annotations','pretty','human','error_trace','source','filter_path']);
435436
$headers = [
436437
'Accept' => 'application/json',
437438
];
@@ -2186,6 +2187,7 @@ public function putTrainedModelVocabulary(array $params = [])
21862187
* @param array{
21872188
* job_id: string, // (REQUIRED) The ID of the job to reset
21882189
* wait_for_completion: boolean, // Should this request wait until the operation has completed before returning
2190+
* delete_user_annotations: boolean, // Should annotations added by the user be deleted
21892191
* pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false)
21902192
* human: boolean, // Return human readable values for statistics. (DEFAULT: true)
21912193
* error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false)
@@ -2206,7 +2208,7 @@ public function resetJob(array $params = [])
22062208
$url = '/_ml/anomaly_detectors/' . $this->encode($params['job_id']) . '/_reset';
22072209
$method = 'POST';
22082210

2209-
$url = $this->addQueryString($url, $params, ['wait_for_completion','pretty','human','error_trace','source','filter_path']);
2211+
$url = $this->addQueryString($url, $params, ['wait_for_completion','delete_user_annotations','pretty','human','error_trace','source','filter_path']);
22102212
$headers = [
22112213
'Accept' => 'application/json',
22122214
];
@@ -2375,6 +2377,7 @@ public function startDatafeed(array $params = [])
23752377
* cache_size: string, // A byte-size value for configuring the inference cache size. For example, 20mb.
23762378
* number_of_allocations: int, // The total number of allocations this model is assigned across machine learning nodes.
23772379
* threads_per_allocation: int, // The number of threads used by each model allocation during inference.
2380+
* priority: string, // The deployment priority.
23782381
* queue_capacity: int, // Controls how many inference requests are allowed in the queue at a time.
23792382
* timeout: time, // Controls the amount of time to wait for the model to deploy.
23802383
* wait_for: string, // The allocation status for which to wait
@@ -2398,7 +2401,7 @@ public function startTrainedModelDeployment(array $params = [])
23982401
$url = '/_ml/trained_models/' . $this->encode($params['model_id']) . '/deployment/_start';
23992402
$method = 'POST';
24002403

2401-
$url = $this->addQueryString($url, $params, ['cache_size','number_of_allocations','threads_per_allocation','queue_capacity','timeout','wait_for','pretty','human','error_trace','source','filter_path']);
2404+
$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']);
24022405
$headers = [
24032406
'Accept' => 'application/json',
24042407
'Content-Type' => 'application/json',
@@ -2717,6 +2720,43 @@ public function updateModelSnapshot(array $params = [])
27172720
}
27182721

27192722

2723+
/**
2724+
* Updates certain properties of trained model deployment.
2725+
*
2726+
* @see https://www.elastic.co/guide/en/elasticsearch/reference/current/update-trained-model-deployment.html
2727+
*
2728+
* @param array{
2729+
* model_id: string, // (REQUIRED) The unique identifier of the trained model.
2730+
* pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false)
2731+
* human: boolean, // Return human readable values for statistics. (DEFAULT: true)
2732+
* error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false)
2733+
* source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests.
2734+
* filter_path: list, // A comma-separated list of filters used to reduce the response.
2735+
* body: array, // (REQUIRED) The updated trained model deployment settings
2736+
* } $params
2737+
*
2738+
* @throws MissingParameterException if a required parameter is missing
2739+
* @throws NoNodeAvailableException if all the hosts are offline
2740+
* @throws ClientResponseException if the status code of response is 4xx
2741+
* @throws ServerResponseException if the status code of response is 5xx
2742+
*
2743+
* @return Elasticsearch|Promise
2744+
*/
2745+
public function updateTrainedModelDeployment(array $params = [])
2746+
{
2747+
$this->checkRequiredParameters(['model_id','body'], $params);
2748+
$url = '/_ml/trained_models/' . $this->encode($params['model_id']) . '/deployment/_update';
2749+
$method = 'POST';
2750+
2751+
$url = $this->addQueryString($url, $params, ['pretty','human','error_trace','source','filter_path']);
2752+
$headers = [
2753+
'Accept' => 'application/json',
2754+
'Content-Type' => 'application/json',
2755+
];
2756+
return $this->client->sendRequest($this->createRequest($method, $url, $headers, $params['body'] ?? null));
2757+
}
2758+
2759+
27202760
/**
27212761
* Upgrades a given job snapshot to the current major version.
27222762
*

src/Endpoints/Transform.php

Lines changed: 41 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,7 @@ public function getTransform(array $params = [])
115115
* transform_id: string, // (REQUIRED) The id of the transform for which to get stats. '_all' or '*' implies all transforms
116116
* from: number, // skips a number of transform stats, defaults to 0
117117
* size: number, // specifies a max number of transform stats to get, defaults to 100
118+
* timeout: time, // Controls the time to wait for the stats
118119
* allow_no_match: boolean, // Whether to ignore if a wildcard expression matches no transforms. (This includes `_all` string or when no transforms have been specified)
119120
* pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false)
120121
* human: boolean, // Return human readable values for statistics. (DEFAULT: true)
@@ -136,7 +137,7 @@ public function getTransformStats(array $params = [])
136137
$url = '/_transform/' . $this->encode($params['transform_id']) . '/_stats';
137138
$method = 'GET';
138139

139-
$url = $this->addQueryString($url, $params, ['from','size','allow_no_match','pretty','human','error_trace','source','filter_path']);
140+
$url = $this->addQueryString($url, $params, ['from','size','timeout','allow_no_match','pretty','human','error_trace','source','filter_path']);
140141
$headers = [
141142
'Accept' => 'application/json',
142143
];
@@ -260,13 +261,51 @@ public function resetTransform(array $params = [])
260261
}
261262

262263

264+
/**
265+
* Schedules now a transform.
266+
*
267+
* @see https://www.elastic.co/guide/en/elasticsearch/reference/current/schedule-now-transform.html
268+
*
269+
* @param array{
270+
* transform_id: string, // (REQUIRED) The id of the transform.
271+
* timeout: time, // Controls the time to wait for the scheduling to take place
272+
* pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false)
273+
* human: boolean, // Return human readable values for statistics. (DEFAULT: true)
274+
* error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false)
275+
* source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests.
276+
* filter_path: list, // A comma-separated list of filters used to reduce the response.
277+
* } $params
278+
*
279+
* @throws MissingParameterException if a required parameter is missing
280+
* @throws NoNodeAvailableException if all the hosts are offline
281+
* @throws ClientResponseException if the status code of response is 4xx
282+
* @throws ServerResponseException if the status code of response is 5xx
283+
*
284+
* @return Elasticsearch|Promise
285+
*/
286+
public function scheduleNowTransform(array $params = [])
287+
{
288+
$this->checkRequiredParameters(['transform_id'], $params);
289+
$url = '/_transform/' . $this->encode($params['transform_id']) . '/_schedule_now';
290+
$method = 'POST';
291+
292+
$url = $this->addQueryString($url, $params, ['timeout','pretty','human','error_trace','source','filter_path']);
293+
$headers = [
294+
'Accept' => 'application/json',
295+
'Content-Type' => 'application/json',
296+
];
297+
return $this->client->sendRequest($this->createRequest($method, $url, $headers, $params['body'] ?? null));
298+
}
299+
300+
263301
/**
264302
* Starts one or more transforms.
265303
*
266304
* @see https://www.elastic.co/guide/en/elasticsearch/reference/current/start-transform.html
267305
*
268306
* @param array{
269307
* transform_id: string, // (REQUIRED) The id of the transform to start
308+
* from: string, // Restricts the set of transformed entities to those changed after this time
270309
* timeout: time, // Controls the time to wait for the transform to start
271310
* pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false)
272311
* human: boolean, // Return human readable values for statistics. (DEFAULT: true)
@@ -288,7 +327,7 @@ public function startTransform(array $params = [])
288327
$url = '/_transform/' . $this->encode($params['transform_id']) . '/_start';
289328
$method = 'POST';
290329

291-
$url = $this->addQueryString($url, $params, ['timeout','pretty','human','error_trace','source','filter_path']);
330+
$url = $this->addQueryString($url, $params, ['from','timeout','pretty','human','error_trace','source','filter_path']);
292331
$headers = [
293332
'Accept' => 'application/json',
294333
];

src/Traits/ClientEndpointsTrait.php

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -813,6 +813,46 @@ public function getSource(array $params = [])
813813
}
814814

815815

816+
/**
817+
* Returns the health of the cluster.
818+
*
819+
* @see https://www.elastic.co/guide/en/elasticsearch/reference/current/health-api.html
820+
*
821+
* @param array{
822+
* feature: string, // A feature of the cluster, as returned by the top-level health API
823+
* timeout: time, // Explicit operation timeout
824+
* verbose: boolean, // Opt in for more information about the health of the system
825+
* size: int, // Limit the number of affected resources the health API returns
826+
* pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false)
827+
* human: boolean, // Return human readable values for statistics. (DEFAULT: true)
828+
* error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false)
829+
* source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests.
830+
* filter_path: list, // A comma-separated list of filters used to reduce the response.
831+
* } $params
832+
*
833+
* @throws NoNodeAvailableException if all the hosts are offline
834+
* @throws ClientResponseException if the status code of response is 4xx
835+
* @throws ServerResponseException if the status code of response is 5xx
836+
*
837+
* @return Elasticsearch|Promise
838+
*/
839+
public function healthReport(array $params = [])
840+
{
841+
if (isset($params['feature'])) {
842+
$url = '/_health_report/' . $this->encode($params['feature']);
843+
$method = 'GET';
844+
} else {
845+
$url = '/_health_report';
846+
$method = 'GET';
847+
}
848+
$url = $this->addQueryString($url, $params, ['timeout','verbose','size','pretty','human','error_trace','source','filter_path']);
849+
$headers = [
850+
'Accept' => 'application/json',
851+
];
852+
return $this->sendRequest($this->createRequest($method, $url, $headers, $params['body'] ?? null));
853+
}
854+
855+
816856
/**
817857
* Creates or updates a document in an index.
818858
*

0 commit comments

Comments
 (0)