Skip to content

Commit

Permalink
Merge branch 'main' into 8.13
Browse files Browse the repository at this point in the history
  • Loading branch information
ezimuel committed Mar 27, 2024
2 parents ebc997b + 221723e commit 1fcd26a
Show file tree
Hide file tree
Showing 17 changed files with 625 additions and 51 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
83 changes: 83 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,86 @@
## Release 8.13.0

- Added the `mapTo($class)` function to Elasticsearch response for mapping the result
of [ES|QL](https://www.elastic.co/guide/en/elasticsearch/reference/current/esql.html)
query to an object of stdClass or of a specific class
[#1398](https://github.com/elastic/elasticsearch-php/issues/1398)

This release introduces 6 new APIs and 6 EXPERIMENTAL APIs.

- Specific changes per endpoints
- `AsyncSearch.status`
- Added the `keep_alive` parameter (time), specify the time interval in which the results (partial or final) for this search will be available.
- `Connector.list`
- Added the following parameters:
- `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;
- `Connector.updateApiKeyId` (new EXPERIMENTAL API)
- API: https://github.com/elastic/elasticsearch/blob/main/rest-api-spec/src/main/resources/rest-api-spec/api/connector.update_api_key_id.json
- Documentation: https://www.elastic.co/guide/en/elasticsearch/reference/master/update-connector-api-key-id-api.html
- `Connector.updateIndexName` (new EXPERIMENTAL API)
- API: https://github.com/elastic/elasticsearch/blob/main/rest-api-spec/src/main/resources/rest-api-spec/api/connector.update_index_name.json
- Documentation: https://www.elastic.co/guide/en/elasticsearch/reference/master/update-connector-index-name-api.html
- `Connector.updateNative` (new EXPERIMENTAL API)
- API: https://github.com/elastic/elasticsearch/blob/main/rest-api-spec/src/main/resources/rest-api-spec/api/connector.update_native.json
- Documentation: https://www.elastic.co/guide/en/elasticsearch/reference/master/connector-apis.html
- `Connector.updateServiceType` (new EXPERIMENTAL API)
- API: https://github.com/elastic/elasticsearch/blob/main/rest-api-spec/src/main/resources/rest-api-spec/api/connector.update_service_type.json
- Documentation: https://www.elastic.co/guide/en/elasticsearch/reference/master/update-connector-service-type-api.html
- `Connector.updateStatus` (new EXPERIMENTAL API)
- API: https://github.com/elastic/elasticsearch/blob/main/rest-api-spec/src/main/resources/rest-api-spec/api/connector.update_status.json
- Documentation: https://www.elastic.co/guide/en/elasticsearch/reference/master/update-connector-status-api.html
- `ConnectorSyncJob.list`
- Added the `job_type` parameter (list), a comma-separated list of job types.
- `Esql.asyncQuery` (new EXPERIMENTAL API)
- API: https://github.com/elastic/elasticsearch/blob/main/rest-api-spec/src/main/resources/rest-api-spec/api/esql.async_query.json
- Documentation: https://www.elastic.co/guide/en/elasticsearch/reference/master/esql-async-query-api.html
- `Esql.asyncQueryGet` (new API)
- API: https://github.com/elastic/elasticsearch/blob/main/rest-api-spec/src/main/resources/rest-api-spec/api/esql.async_query_get.json
- Documentation: https://www.elastic.co/guide/en/elasticsearch/reference/master/esql-async-query-get-api.html
- `Esql.query`
- Added the `drop_null_columns` parameter (boolean) to sepcify if null columns should be removed from the results. If yes, their name and type will be returned in a new `all_columns` section.
- `Indices.resolveCluster` (new API)
- API: https://github.com/elastic/elasticsearch/blob/main/rest-api-spec/src/main/resources/rest-api-spec/api/get_script.json
- Documentation: https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-resolve-cluster-api.html
- `Indices.rollover`
- Added the `lazy` parameter (boolean), if set to true, the rollover action will only mark a data stream to signal that it needs to be rolled over at the next write. Only allowed on data streams.
- `Inference.deleteModel`
- The `model_id` parameter has been renamed to `inference_id`.
- `Inference.getModel`
- The `model_id` parameter has been renamed in `inference_id`.
- `Inference.inference`
- The `model_id` parameter has been renamed in `inference_id`.
- `Inference.putModel`
- The `model_id` parameter has been renamed in `inference_id`.
- `Profiling.flamegraph` (new API)
- API: https://github.com/elastic/elasticsearch/blob/main/rest-api-spec/src/main/resources/rest-api-spec/api/profiling.flamegraph.json
- Documentation: https://www.elastic.co/guide/en/observability/current/universal-profiling.html
- `Profiling.stacktraces` (new API)
- API: https://github.com/elastic/elasticsearch/blob/main/rest-api-spec/src/main/resources/rest-api-spec/api/profiling.stacktraces.json
- Documentation: https://www.elastic.co/guide/en/observability/current/universal-profiling.html
- `Security.queryUser` (new API)
- API: https://github.com/elastic/elasticsearch/blob/main/rest-api-spec/src/main/resources/rest-api-spec/api/security.query_user.json
- Documentation: https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-query-user.html
- `Synonyms.deleteSynonym`
- This API is now stable.
- `Synonyms.deleteSynonymRule`
- This API is now stable.
- `Synonyms.getSynonym`
- This API is now stable.
- `Synonyms.getSynonymRule`
- This API is now stable.
- `Synonyms.getSynonymsSets`
- This API is now stable.
- `Synonyms.putSynonym`
- This API is now stable.
- `Synonyms.putSynonymRule`
- This API is now stable.
- `TextStructure.testGrokPattern` (new API)
- API: https://github.com/elastic/elasticsearch/blob/main/rest-api-spec/src/main/resources/rest-api-spec/api/text_structure.test_grok_pattern.json
- Documentation: https://www.elastic.co/guide/en/elasticsearch/reference/master/test-grok-pattern.html

## Release 8.12.0

- Added 22 new EXPERIMENTAL APIs and 1 new stable API:
Expand Down
14 changes: 12 additions & 2 deletions docs/release-notes.asciidoc
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
[[release-notes]]
== Release notes

* <<rn-8-11-0>>
* <<rn-8-13-0>>
* <<rn-8-12-0>>
* <<rn-8-11-0>>
* <<rn-8-10-0>>
* <<rn-8-9-0>>
Expand Down Expand Up @@ -44,11 +45,20 @@
* <<rn-7-0-1>>
* <<rn-7-0-0>>

[discrete]
[[rn-8-13-0]]
=== 8.13.0

* Updated the API endpoints to Elasticserach 8.13.0
* Added the Added the mapTo($class) function to Elasticsearch response for mapping the result
of https://www.elastic.co/guide/en/elasticsearch/reference/current/esql.html[ES|QL]
query to an object of stdClass or a specific class https://github.com/elastic/elasticsearch-php/issues/1398[#1398]

[discrete]
[[rn-8-12-0]]
=== 8.12.0

* Updated the API endpoints to Elasticserach 8.11.0
* Updated the API endpoints to Elasticserach 8.12.0
* Tested the library with PHP 8.3

[discrete]
Expand Down
2 changes: 1 addition & 1 deletion src/Client.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
final class Client implements ClientInterface
{
const CLIENT_NAME = 'es';
const VERSION = '8.12.0';
const VERSION = '8.13.0';
const API_COMPATIBILITY_HEADER = '%s/vnd.elasticsearch+%s; compatible-with=8';

use ClientEndpointsTrait;
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));
}
}

0 comments on commit 1fcd26a

Please sign in to comment.