-
Notifications
You must be signed in to change notification settings - Fork 973
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
319 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
<?php | ||
|
||
/** | ||
* Elasticsearch PHP Client | ||
* | ||
* @link https://github.com/elastic/elasticsearch-php | ||
* @copyright Copyright (c) Elasticsearch B.V (https://www.elastic.co) | ||
* @license https://opensource.org/licenses/MIT MIT License | ||
* | ||
* Licensed to Elasticsearch B.V under one or more agreements. | ||
* Elasticsearch B.V licenses this file to you under the MIT License. | ||
* See the LICENSE file in the project root for more information. | ||
*/ | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Elastic\Elasticsearch\Endpoints; | ||
|
||
use Elastic\Elasticsearch\Exception\ClientResponseException; | ||
use Elastic\Elasticsearch\Exception\MissingParameterException; | ||
use Elastic\Elasticsearch\Exception\ServerResponseException; | ||
use Elastic\Elasticsearch\Response\Elasticsearch; | ||
use Elastic\Transport\Exception\NoNodeAvailableException; | ||
use Http\Promise\Promise; | ||
|
||
/** | ||
* @generated This file is generated, please do not edit | ||
*/ | ||
class Esql extends AbstractEndpoint | ||
{ | ||
/** | ||
* Executes an ESQL request | ||
* | ||
* @see https://www.elastic.co/guide/en/elasticsearch/reference/current/esql-query-api.html | ||
* @internal This API is EXPERIMENTAL and may be changed or removed completely in a future release | ||
* | ||
* @param array{ | ||
* format: string, // a short version of the Accept header, e.g. json, yaml | ||
* delimiter: string, // The character to use between values within a CSV row. Only valid for the csv format. | ||
* 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) Use the `query` element to start a query. Use `time_zone` to specify an execution time zone and `columnar` to format the answer. | ||
* } $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 query(array $params = []) | ||
{ | ||
$this->checkRequiredParameters(['body'], $params); | ||
$url = '/_query'; | ||
$method = 'POST'; | ||
|
||
$url = $this->addQueryString($url, $params, ['format','delimiter','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)); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,181 @@ | ||
<?php | ||
|
||
/** | ||
* Elasticsearch PHP Client | ||
* | ||
* @link https://github.com/elastic/elasticsearch-php | ||
* @copyright Copyright (c) Elasticsearch B.V (https://www.elastic.co) | ||
* @license https://opensource.org/licenses/MIT MIT License | ||
* | ||
* Licensed to Elasticsearch B.V under one or more agreements. | ||
* Elasticsearch B.V licenses this file to you under the MIT License. | ||
* See the LICENSE file in the project root for more information. | ||
*/ | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Elastic\Elasticsearch\Endpoints; | ||
|
||
use Elastic\Elasticsearch\Exception\ClientResponseException; | ||
use Elastic\Elasticsearch\Exception\MissingParameterException; | ||
use Elastic\Elasticsearch\Exception\ServerResponseException; | ||
use Elastic\Elasticsearch\Response\Elasticsearch; | ||
use Elastic\Transport\Exception\NoNodeAvailableException; | ||
use Http\Promise\Promise; | ||
|
||
/** | ||
* @generated This file is generated, please do not edit | ||
*/ | ||
class Inference extends AbstractEndpoint | ||
{ | ||
/** | ||
* Delete model in the Inference API | ||
* | ||
* @see https://www.elastic.co/guide/en/elasticsearch/reference/master/delete-inference-api.html | ||
* @internal This API is EXPERIMENTAL and may be changed or removed completely in a future release | ||
* | ||
* @param array{ | ||
* task_type: string, // (REQUIRED) The model task type | ||
* model_id: string, // (REQUIRED) The model Id | ||
* 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 deleteModel(array $params = []) | ||
{ | ||
$this->checkRequiredParameters(['task_type','model_id'], $params); | ||
$url = '/_inference/' . $this->encode($params['task_type']) . '/' . $this->encode($params['model_id']); | ||
$method = 'DELETE'; | ||
|
||
$url = $this->addQueryString($url, $params, ['pretty','human','error_trace','source','filter_path']); | ||
$headers = [ | ||
'Accept' => 'application/json', | ||
]; | ||
return $this->client->sendRequest($this->createRequest($method, $url, $headers, $params['body'] ?? null)); | ||
} | ||
|
||
|
||
/** | ||
* Get a model in the Inference API | ||
* | ||
* @see https://www.elastic.co/guide/en/elasticsearch/reference/master/get-inference-api.html | ||
* @internal This API is EXPERIMENTAL and may be changed or removed completely in a future release | ||
* | ||
* @param array{ | ||
* task_type: string, // (REQUIRED) The model task type | ||
* model_id: string, // (REQUIRED) The model Id | ||
* 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 getModel(array $params = []) | ||
{ | ||
$this->checkRequiredParameters(['task_type','model_id'], $params); | ||
$url = '/_inference/' . $this->encode($params['task_type']) . '/' . $this->encode($params['model_id']); | ||
$method = 'GET'; | ||
|
||
$url = $this->addQueryString($url, $params, ['pretty','human','error_trace','source','filter_path']); | ||
$headers = [ | ||
'Accept' => 'application/json', | ||
]; | ||
return $this->client->sendRequest($this->createRequest($method, $url, $headers, $params['body'] ?? null)); | ||
} | ||
|
||
|
||
/** | ||
* Perform inference on a model | ||
* | ||
* @see https://www.elastic.co/guide/en/elasticsearch/reference/master/post-inference-api.html | ||
* @internal This API is EXPERIMENTAL and may be changed or removed completely in a future release | ||
* | ||
* @param array{ | ||
* task_type: string, // (REQUIRED) The model task type | ||
* model_id: string, // (REQUIRED) The model Id | ||
* 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 inference(array $params = []) | ||
{ | ||
$this->checkRequiredParameters(['task_type','model_id'], $params); | ||
$url = '/_inference/' . $this->encode($params['task_type']) . '/' . $this->encode($params['model_id']); | ||
$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)); | ||
} | ||
|
||
|
||
/** | ||
* Configure a model for use in the Inference API | ||
* | ||
* @see https://www.elastic.co/guide/en/elasticsearch/reference/master/put-inference-api.html | ||
* @internal This API is EXPERIMENTAL and may be changed or removed completely in a future release | ||
* | ||
* @param array{ | ||
* task_type: string, // (REQUIRED) The model task type | ||
* model_id: string, // (REQUIRED) The model Id | ||
* 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 model's task and service 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 putModel(array $params = []) | ||
{ | ||
$this->checkRequiredParameters(['task_type','model_id'], $params); | ||
$url = '/_inference/' . $this->encode($params['task_type']) . '/' . $this->encode($params['model_id']); | ||
$method = 'PUT'; | ||
|
||
$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)); | ||
} | ||
} |
Oops, something went wrong.