diff --git a/src/Endpoints/Ml.php b/src/Endpoints/Ml.php index eeee93988..e8c35d551 100644 --- a/src/Endpoints/Ml.php +++ b/src/Endpoints/Ml.php @@ -2375,6 +2375,7 @@ public function startDatafeed(array $params = []) * cache_size: string, // A byte-size value for configuring the inference cache size. For example, 20mb. * 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. * queue_capacity: int, // Controls how many inference requests are allowed in the queue at a time. * timeout: time, // Controls the amount of time to wait for the model to deploy. * wait_for: string, // The allocation status for which to wait @@ -2398,7 +2399,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','queue_capacity','timeout','wait_for','pretty','human','error_trace','source','filter_path']); + $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']); $headers = [ 'Accept' => 'application/json', 'Content-Type' => 'application/json', @@ -2717,6 +2718,43 @@ public function updateModelSnapshot(array $params = []) } + /** + * Updates certain properties of trained model deployment. + * + * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/ml-update-trained-model-deployment.html + * + * @param array{ + * model_id: string, // (REQUIRED) The unique identifier of the trained model. + * 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 updated trained model deployment settings + * } $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 updateTrainedModelDeployment(array $params = []) + { + $this->checkRequiredParameters(['model_id','body'], $params); + $url = '/_ml/trained_models/' . $this->encode($params['model_id']) . '/deployment/_update'; + $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)); + } + + /** * Upgrades a given job snapshot to the current major version. *