Skip to content

Commit

Permalink
Updated APIs to ES 8.13
Browse files Browse the repository at this point in the history
  • Loading branch information
ezimuel committed Mar 26, 2024
1 parent e68f81d commit c8f32a2
Show file tree
Hide file tree
Showing 12 changed files with 507 additions and 42 deletions.
2 changes: 1 addition & 1 deletion .buildkite/pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ steps:
env:
PHP_VERSION: "{{ matrix.php }}"
TEST_SUITE: "{{ matrix.suite }}"
STACK_VERSION: 8.12-SNAPSHOT
STACK_VERSION: 8.13.0-SNAPSHOT
matrix:
setup:
suite:
Expand Down
3 changes: 2 additions & 1 deletion src/Endpoints/AsyncSearch.php
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ public function get(array $params = [])
*
* @param array{
* id: string, // (REQUIRED) The async search ID
* keep_alive: time, // Specify the time interval in which the results (partial or final) for this search will be available
* 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 @@ -128,7 +129,7 @@ public function status(array $params = [])
$url = '/_async_search/status/' . $this->encode($params['id']);
$method = 'GET';

$url = $this->addQueryString($url, $params, ['pretty','human','error_trace','source','filter_path']);
$url = $this->addQueryString($url, $params, ['keep_alive','pretty','human','error_trace','source','filter_path']);
$headers = [
'Accept' => 'application/json',
];
Expand Down
198 changes: 196 additions & 2 deletions src/Endpoints/Connector.php
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,11 @@ public function lastSync(array $params = [])
*
* @param array{
* from: int, // Starting offset (default: 0)
* size: int, // specifies a max number of results to get (default: 100)
* size: int, // Specifies a max number of results to get (default: 100)
* index_name: list, // A comma-separated list of connector index names to fetch connector documents for
* connector_name: list, // A comma-separated list of connector names to fetch connector documents for
* service_type: list, // A comma-separated list of connector service types to fetch connector documents for
* query: string, // A search string for querying connectors, filtering results by matching against connector names, descriptions, and index names
* 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 @@ -201,7 +205,7 @@ public function list(array $params = [])
$url = '/_connector';
$method = 'GET';

$url = $this->addQueryString($url, $params, ['from','size','pretty','human','error_trace','source','filter_path']);
$url = $this->addQueryString($url, $params, ['from','size','index_name','connector_name','service_type','query','pretty','human','error_trace','source','filter_path']);
$headers = [
'Accept' => 'application/json',
];
Expand Down Expand Up @@ -283,6 +287,44 @@ public function put(array $params = [])
}


/**
* Updates the API key id and/or API key secret id fields in the connector document.
*
* @see https://www.elastic.co/guide/en/elasticsearch/reference/master/update-connector-api-key-id-api.html
* @internal This API is EXPERIMENTAL and may be changed or removed completely in a future release
*
* @param array{
* connector_id: string, // (REQUIRED) The unique identifier of the connector to be updated.
* 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) An object containing the connector's API key id and/or Connector Secret document id for that API key.
* } $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 updateApiKeyId(array $params = [])
{
$this->checkRequiredParameters(['connector_id','body'], $params);
$url = '/_connector/' . $this->encode($params['connector_id']) . '/_api_key_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));
}


/**
* Updates the connector configuration.
*
Expand Down Expand Up @@ -397,6 +439,44 @@ public function updateFiltering(array $params = [])
}


/**
* Updates the index name of the connector.
*
* @see https://www.elastic.co/guide/en/elasticsearch/reference/master/update-connector-index-name-api.html
* @internal This API is EXPERIMENTAL and may be changed or removed completely in a future release
*
* @param array{
* connector_id: string, // (REQUIRED) The unique identifier of the connector to be updated.
* 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) An object containing the connector's index name.
* } $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 updateIndexName(array $params = [])
{
$this->checkRequiredParameters(['connector_id','body'], $params);
$url = '/_connector/' . $this->encode($params['connector_id']) . '/_index_name';
$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));
}


/**
* Updates the name and/or description fields in the connector document.
*
Expand Down Expand Up @@ -435,6 +515,44 @@ public function updateName(array $params = [])
}


/**
* Updates the is_native flag of the connector.
*
* @see https://www.elastic.co/guide/en/elasticsearch/reference/master/connector-apis.html
* @internal This API is EXPERIMENTAL and may be changed or removed completely in a future release
*
* @param array{
* connector_id: string, // (REQUIRED) The unique identifier of the connector to be updated.
* 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) An object containing the connector's is_native flag
* } $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 updateNative(array $params = [])
{
$this->checkRequiredParameters(['connector_id','body'], $params);
$url = '/_connector/' . $this->encode($params['connector_id']) . '/_native';
$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));
}


/**
* Updates the pipeline field in the connector document.
*
Expand Down Expand Up @@ -509,4 +627,80 @@ public function updateScheduling(array $params = [])
];
return $this->client->sendRequest($this->createRequest($method, $url, $headers, $params['body'] ?? null));
}


/**
* Updates the service type of the connector.
*
* @see https://www.elastic.co/guide/en/elasticsearch/reference/master/update-connector-service-type-api.html
* @internal This API is EXPERIMENTAL and may be changed or removed completely in a future release
*
* @param array{
* connector_id: string, // (REQUIRED) The unique identifier of the connector to be updated.
* 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) An object containing the connector's service type.
* } $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 updateServiceType(array $params = [])
{
$this->checkRequiredParameters(['connector_id','body'], $params);
$url = '/_connector/' . $this->encode($params['connector_id']) . '/_service_type';
$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));
}


/**
* Updates the status of the connector.
*
* @see https://www.elastic.co/guide/en/elasticsearch/reference/master/update-connector-status-api.html
* @internal This API is EXPERIMENTAL and may be changed or removed completely in a future release
*
* @param array{
* connector_id: string, // (REQUIRED) The unique identifier of the connector to be updated.
* 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) An object containing the connector's status.
* } $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 updateStatus(array $params = [])
{
$this->checkRequiredParameters(['connector_id','body'], $params);
$url = '/_connector/' . $this->encode($params['connector_id']) . '/_status';
$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));
}
}
3 changes: 2 additions & 1 deletion src/Endpoints/ConnectorSyncJob.php
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,7 @@ public function get(array $params = [])
* size: int, // specifies a max number of results to get (default: 100)
* status: string, // Sync job status, which sync jobs are fetched for
* connector_id: string, // Id of the connector to fetch the sync jobs for
* job_type: list, // A comma-separated list of job types
* 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 @@ -239,7 +240,7 @@ public function list(array $params = [])
$url = '/_connector/_sync_job';
$method = 'GET';

$url = $this->addQueryString($url, $params, ['from','size','status','connector_id','pretty','human','error_trace','source','filter_path']);
$url = $this->addQueryString($url, $params, ['from','size','status','connector_id','job_type','pretty','human','error_trace','source','filter_path']);
$headers = [
'Accept' => 'application/json',
];
Expand Down
82 changes: 80 additions & 2 deletions src/Endpoints/Esql.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,83 @@
*/
class Esql extends AbstractEndpoint
{
/**
* Executes an ESQL request asynchronously
*
* @see https://www.elastic.co/guide/en/elasticsearch/reference/master/esql-async-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.
* drop_null_columns: boolean, // Should entirely null columns be removed from the results? Their name and type will be returning in a new `all_columns` section.
* 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 `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 asyncQuery(array $params = [])
{
$this->checkRequiredParameters(['body'], $params);
$url = '/_query/async';
$method = 'POST';

$url = $this->addQueryString($url, $params, ['format','delimiter','drop_null_columns','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));
}


/**
* Retrieves the results of a previously submitted async query request given its ID.
*
* @see https://www.elastic.co/guide/en/elasticsearch/reference/master/esql-async-query-get-api.html
*
* @param array{
* id: string, // (REQUIRED) The async query ID
* wait_for_completion_timeout: time, // Specify the time that the request should block waiting for the final response
* keep_alive: time, // Specify the time interval in which the results (partial or final) for this search will be available
* drop_null_columns: boolean, // Should entirely null columns be removed from the results? Their name and type will be returning in a new `all_columns` section.
* 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 asyncQueryGet(array $params = [])
{
$this->checkRequiredParameters(['id'], $params);
$url = '/_query/async/' . $this->encode($params['id']);
$method = 'GET';

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


/**
* Executes an ESQL request
*
Expand All @@ -37,12 +114,13 @@ class Esql extends AbstractEndpoint
* @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.
* drop_null_columns: boolean, // Should entirely null columns be removed from the results? Their name and type will be returning in a new `all_columns` section.
* 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.
* body: array, // (REQUIRED) Use the `query` element to start a query. Use `columnar` to format the answer.
* } $params
*
* @throws NoNodeAvailableException if all the hosts are offline
Expand All @@ -57,7 +135,7 @@ public function query(array $params = [])
$url = '/_query';
$method = 'POST';

$url = $this->addQueryString($url, $params, ['format','delimiter','pretty','human','error_trace','source','filter_path']);
$url = $this->addQueryString($url, $params, ['format','delimiter','drop_null_columns','pretty','human','error_trace','source','filter_path']);
$headers = [
'Accept' => 'application/json',
'Content-Type' => 'application/json',
Expand Down

0 comments on commit c8f32a2

Please sign in to comment.