diff --git a/.buildkite/pipeline.yml b/.buildkite/pipeline.yml
index 606ddc502..f2d924f2a 100644
--- a/.buildkite/pipeline.yml
+++ b/.buildkite/pipeline.yml
@@ -5,13 +5,14 @@ steps:
env:
PHP_VERSION: "{{ matrix.php }}"
TEST_SUITE: "{{ matrix.suite }}"
- STACK_VERSION: 8.10-SNAPSHOT
+ STACK_VERSION: 8.14.0-SNAPSHOT
matrix:
setup:
suite:
- "free"
- "platinum"
php:
+ - "8.3-cli"
- "8.2-cli"
- "8.1-cli"
- "8.0-cli"
diff --git a/.github/workflows/license.yml b/.github/workflows/license.yml
index 8583ee456..89bccb01d 100644
--- a/.github/workflows/license.yml
+++ b/.github/workflows/license.yml
@@ -8,7 +8,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- - uses: actions/checkout@v2
+ - uses: actions/checkout@v4
- name: Check license headers
run: |
diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml
index 4c96f214d..822de1841 100644
--- a/.github/workflows/test.yml
+++ b/.github/workflows/test.yml
@@ -9,13 +9,13 @@ jobs:
strategy:
matrix:
- php-version: [7.4, 8.0, 8.1, 8.2]
+ php-version: [7.4, 8.0, 8.1, 8.2, 8.3]
os: [ubuntu-latest]
- es-version: [8.9-SNAPSHOT]
+ es-version: [8.14-SNAPSHOT]
steps:
- name: Checkout
- uses: actions/checkout@v3
+ uses: actions/checkout@v4
- name: Use PHP ${{ matrix.php-version }}
uses: shivammathur/setup-php@v2
@@ -30,7 +30,7 @@ jobs:
id: composercache
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
- name: Cache dependencies
- uses: actions/cache@v3
+ uses: actions/cache@v4
with:
path: ${{ steps.composercache.outputs.dir }}
key: ${{ runner.os }}-php-${{ matrix.php-version }}-${{ hashFiles('**/composer.json') }}
diff --git a/.github/workflows/unified-release.yml b/.github/workflows/unified-release.yml
deleted file mode 100644
index 84bba694b..000000000
--- a/.github/workflows/unified-release.yml
+++ /dev/null
@@ -1,29 +0,0 @@
-name: Unified Release Manager Checks
-
-on:
- pull_request:
- paths-ignore:
- - 'README.md'
- push:
- paths-ignore:
- - 'README.md'
- branches:
- - main
- - master
- - '[0-9]+.[0-9]+'
- - '[0-9]+.x'
-
-jobs:
- assemble:
- name: Assemble
- runs-on: ubuntu-latest
- strategy:
- fail-fast: false
- matrix:
- stack_version: ['8.9-SNAPSHOT']
-
- steps:
- - name: Checkout
- uses: actions/checkout@v2
- - run: "./.ci/make.sh assemble ${{ matrix.stack_version }}"
- name: Assemble ${{ matrix.stack_version }}
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 97f0dbfdb..9369eb872 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,3 +1,279 @@
+## release 8.14.0
+
+This release introduces 3 new APIs and 10 EXPERIMENTAL APIs.
+
+- Specific changes per endpoints
+ - `Ccr.deleteAutoFollowPattern`
+ - Added the `master_timeout` parameter (time), explicit operation timeout for connection to master node.
+ - `Ccr.follow`
+ - Added the `master_timeout` parameter (time), explicit operation timeout for connection to master node.
+ - `Ccr.followInfo`
+ - Added the `master_timeout` parameter (time), explicit operation timeout for connection to master node.
+ - `Ccr.followStats`
+ - Added the `timeout` parameter (time), explicit operation timeout.
+ - `Ccr.forgetFollower`
+ - Added the `timeout` parameter (time), explicit operation timeout.
+ - `Ccr.getAutoFollowPattern`
+ - Added the `master_timeout` parameter (time), explicit operation timeout for connection to master node.
+ - `Ccr.pauseFollow`
+ - Added the `master_timeout` parameter (time), explicit operation timeout for connection to master node.
+ - `Ccr.putAutoFollowPattern`
+ - Added the `master_timeout` parameter (time), explicit operation timeout for connection to master node.
+ - `Ccr.resumeAutoFollowPattern`
+ - Added the `master_timeout` parameter (time), explicit operation timeout for connection to master node.
+ - `Ccr.resumeFollow`
+ - Added the `master_timeout` parameter (time), explicit operation timeout for connection to master node.
+ - `Ccr.stats`
+ - Added the `timeout` parameter (time), explicit operation timeout.
+ - Added the `master_timeout` parameter (time), explicit operation timeout for connection to master node.
+ - `Ccr.unfollow`
+ - Added the `master_timeout` parameter (time), explicit operation timeout for connection to master node.
+ - `ConnectorSyncJob`
+ - The APIs of `ConnectorSyncJob` has been removed and merged in `Connector` namespace.
+ - `Connector.delete`
+ - Added the `delete_sync_jobs` parameter (boolean), determines whether associated sync jobs are also deleted.
+ - `Connector.syncJobCancel` (new EXPERIMENTAL API)
+ - API: https://github.com/elastic/elasticsearch/blob/main/rest-api-spec/src/main/resources/rest-api-spec/api/connector.sync_job_cancel.json
+ - Documentation: https://www.elastic.co/guide/en/elasticsearch/reference/master/cancel-connector-sync-job-api.html
+ - `Connector.syncJobCheckIn` (new EXPERIMENTAL API)
+ - API: https://github.com/elastic/elasticsearch/blob/main/rest-api-spec/src/main/resources/rest-api-spec/api/connector.sync_job_check_in.json
+ - Documentation: https://www.elastic.co/guide/en/elasticsearch/reference/master/check-in-connector-sync-job-api.html
+ - `Connector.syncJobDelete` (new EXPERIMENTAL API)
+ - API: https://github.com/elastic/elasticsearch/blob/main/rest-api-spec/src/main/resources/rest-api-spec/api/connector.sync_job_delete.json
+ - Documentation: https://www.elastic.co/guide/en/elasticsearch/reference/master/delete-connector-sync-job-api.html
+ - `Connector.syncJobError` (new EXPERIMENTAL API)
+ - API: https://github.com/elastic/elasticsearch/blob/main/rest-api-spec/src/main/resources/rest-api-spec/api/connector.sync_job_error.json
+ - Documentation: https://www.elastic.co/guide/en/elasticsearch/reference/master/set-connector-sync-job-error-api.html
+ - `Connector.syncJobGet` (new EXPERIMENTAL API)
+ - API: https://github.com/elastic/elasticsearch/blob/main/rest-api-spec/src/main/resources/rest-api-spec/api/connector.sync_job_get.json
+ - Documentation: https://www.elastic.co/guide/en/elasticsearch/reference/master/get-connector-sync-job-api.html
+ - `Connector.syncJobList` (new EXPERIMENTAL API)
+ - API: https://github.com/elastic/elasticsearch/blob/main/rest-api-spec/src/main/resources/rest-api-spec/api/connector.sync_job_list.json
+ - Documentation: https://www.elastic.co/guide/en/elasticsearch/reference/master/list-connector-sync-jobs-api.html
+ - `Connector.syncJobPost` (new EXPERIMENTAL API)
+ - API: https://github.com/elastic/elasticsearch/blob/main/rest-api-spec/src/main/resources/rest-api-spec/api/connector.sync_job_post.json
+ - Documentation: https://www.elastic.co/guide/en/elasticsearch/reference/master/create-connector-sync-job-api.html
+ - `Connector.syncJobUpdateStats` (new EXPERIMENTAL API)
+ - API: https://github.com/elastic/elasticsearch/blob/main/rest-api-spec/src/main/resources/rest-api-spec/api/connector.sync_job_update_stats.json
+ - Documentation: https://www.elastic.co/guide/en/elasticsearch/reference/master/set-connector-sync-job-stats-api.html
+ - `Connector.updateActiveFiltering` (new EXPERIMENTAL API)
+ - API: https://github.com/elastic/elasticsearch/blob/main/rest-api-spec/src/main/resources/rest-api-spec/api/connector.update_active_filtering.json
+ - Documentation: https://www.elastic.co/guide/en/elasticsearch/reference/master/update-connector-filtering-api.html
+ - `Connector.updateFilteringValidation` (new EXPERIMENTAL API)
+ - API: https://github.com/elastic/elasticsearch/blob/main/rest-api-spec/src/main/resources/rest-api-spec/api/connector.update_filtering_validation.json
+ - Documentation: https://www.elastic.co/guide/en/elasticsearch/reference/master/update-connector-filtering-api.html
+ - `Esql.asyncQuery`
+ - This API is now stable.
+ - `Esql.query`
+ - This API is now stable.
+ - `Indices.rollover`
+ - Added the `target_failure_store` parameter (boolean), if set to true, the rollover action will be applied on the failure store of the data stream.
+ - `Inference.getModel`
+ - The `inference_id` is not anymore a required parameter.
+ - `Profiling.topnFunctions` (new API)
+ - API: https://github.com/elastic/elasticsearch/blob/main/rest-api-spec/src/main/resources/rest-api-spec/api/profiling.topn_functions.json
+ - Documentation: https://www.elastic.co/guide/en/observability/current/universal-profiling.html
+ - `SearchApplication.search`
+ - Added the `typed_keys` parameter (boolean), specify whether aggregation and suggester names should be prefixed by their respective types in the response.
+ - `Security.getApiKey`
+ - Added the `with_profile_uid` parameter (boolean), flag to also retrieve the API Key's owner profile uid, if it exists.
+ - `Security.queryApiKeys`
+ - Added the `with_profile_uid` parameter (boolean), flag to also retrieve the API Key's owner profile uid, if it exists.
+ - Added the `typed_keys` paremeter (boolean), flag to prefix aggregation names by their respective types in the response.
+ - `TextStructure.findFieldStructure` (new API)
+ - API: https://github.com/elastic/elasticsearch/blob/main/rest-api-spec/src/main/resources/rest-api-spec/api/text_structure.find_field_structure.json
+ - Documentation: https://www.elastic.co/guide/en/elasticsearch/reference/current/find-field-structure.html
+ - `TextStructure.findMessageStructure` (new API)
+ - API: https://github.com/elastic/elasticsearch/blob/main/rest-api-spec/src/main/resources/rest-api-spec/api/text_structure.find_message_structure.json
+ - Documentation: https://www.elastic.co/guide/en/elasticsearch/reference/current/find-message-structure.html
+
+## 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:
+ - `bulk`
+ - Adds `list_executed_pipelines` boolean parameter. Sets `list_executed_pipelines` for all incoming documents. Defaults to unset (false).
+ - `indices.put_settings`
+ - Adds `reopen` boolean parameter. Whether to close and reopen the index to apply non-dynamic settings. If set to `true` the indices to which the settings are being applied will be closed temporarily and then reopened in order to apply the changes. The default is `false`.
+ - `open_point_in_time`
+ - Adds `body` object/Hash parameter. An index_filter specified with the Query DSL.
+ - `security.get_api_key`
+ - Adds `active_only` boolean parameter. Flag to limit response to only active (not invalidated or expired) API keys.
+ - `profiling.status` (new API)
+ - Returns basic information about the status of Universal Profiling.
+ - API: https://github.com/elastic/elasticsearch/blob/8.12/rest-api-spec/src/main/resources/rest-api-spec/api/profiling.status.json
+ - Documentation: https://www.elastic.co/guide/en/observability/current/universal-profiling.html
+ - `simulate.ingest` (new EXPERIMENTAL API)
+ - Simulates running ingest with example documents.
+ - Documentation: https://www.elastic.co/guide/en/elasticsearch/reference/8.12/simulate-ingest-api.html
+ - API: https://github.com/elastic/elasticsearch/blob/8.12/rest-api-spec/src/main/resources/rest-api-spec/api/simulate.ingest.json
+ - `connector.post` (new EXPERIMENTAL API)
+ - Creates a connector.
+ - Documentation: https://www.elastic.co/guide/en/elasticsearch/reference/8.12/create-connector-api.html
+ - API: https://github.com/elastic/elasticsearch/blob/8.12/rest-api-spec/src/main/resources/rest-api-spec/api/connector.post.json
+ - `connector.put` (new EXPERIMENTAL API)
+ - Creates or updates a connector.
+ - Documentation: https://www.elastic.co/guide/en/elasticsearch/reference/8.12/create-connector-api.html
+ - API: https://github.com/elastic/elasticsearch/blob/8.12/rest-api-spec/src/main/resources/rest-api-spec/api/connector.put.json
+ - `connector.delete` (new EXPERIMENTAL API)
+ - Deletes a connector.
+ - Documentation: https://www.elastic.co/guide/en/elasticsearch/reference/8.12/delete-connector-api.html
+ - API: https://github.com/elastic/elasticsearch/blob/8.12/rest-api-spec/src/main/resources/rest-api-spec/api/connector.delete.json
+ - `connector.get` (new EXPERIMENTAL API)
+ - Returns the details about a connector.
+ - Documentation: https://www.elastic.co/guide/en/elasticsearch/reference/8.12/get-connector-api.html
+ - API: https://github.com/elastic/elasticsearch/blob/8.12/rest-api-spec/src/main/resources/rest-api-spec/api/connector.get.json
+ - `connector.list` (new EXPERIMENTAL API)
+ - Lists all connectors.
+ - Documentation: https://www.elastic.co/guide/en/elasticsearch/reference/8.12/list-connector-api.html
+ - API: https://github.com/elastic/elasticsearch/blob/8.12/rest-api-spec/src/main/resources/rest-api-spec/api/connector.list.json
+ - `connector.check_in` (new EXPERIMENTAL API)
+ - Updates the last_seen timestamp in the connector document.
+ - Documentation: https://www.elastic.co/guide/en/elasticsearch/reference/8.12/check-in-connector-api.html
+ - API: https://github.com/elastic/elasticsearch/blob/8.12/rest-api-spec/src/main/resources/rest-api-spec/api/connector.check_in.json
+ - `connector.update_configuration` (new EXPERIMENTAL API)
+ - Updates the connector configuration.
+ - Documentation: https://www.elastic.co/guide/en/elasticsearch/reference/8.12/update-connector-configuration-api.html
+ - API: https://github.com/elastic/elasticsearch/blob/8.12/rest-api-spec/src/main/resources/rest-api-spec/api/connector.update_configuration.json
+ - `connector.update_error` (new EXPERIMENTAL API)
+ - Updates the error field in the connector document.
+ - Documentation: https://www.elastic.co/guide/en/elasticsearch/reference/8.12/update-connector-error-api.html
+ - API: https://github.com/elastic/elasticsearch/blob/8.12/rest-api-spec/src/main/resources/rest-api-spec/api/connector.update_error.json
+ - `connector.update_filtering` (new EXPERIMENTAL API)
+ - Updates the filtering field in the connector document.
+ - Documentation: https://www.elastic.co/guide/en/elasticsearch/reference/8.12/update-connector-filtering-api.html
+ - API: https://github.com/elastic/elasticsearch/blob/8.12/rest-api-spec/src/main/resources/rest-api-spec/api/connector.update_filtering.json
+ - `connector.last_sync` (new EXPERIMENTAL API)
+ - Updates the stats of last sync in the connector document.
+ - Documentation: https://www.elastic.co/guide/en/elasticsearch/reference/8.12/update-connector-last-sync-api.html
+ - API: https://github.com/elastic/elasticsearch/blob/8.12/rest-api-spec/src/main/resources/rest-api-spec/api/connector.last_sync.json
+ - `connector.update_name` (new EXPERIMENTAL API)
+ - Updates the name and/or description fields in the connector document.
+ - Documentation: https://www.elastic.co/guide/en/elasticsearch/reference/8.12/update-connector-name-description-api.html
+ - API: https://github.com/elastic/elasticsearch/blob/8.12/rest-api-spec/src/main/resources/rest-api-spec/api/connector.update_name.json
+ - `connector.update_pipeline` (new EXPERIMENTAL API)
+ - Updates the pipeline field in the connector document.
+ - Documentation: https://www.elastic.co/guide/en/elasticsearch/reference/8.12/update-connector-pipeline-api.html
+ - API: https://github.com/elastic/elasticsearch/blob/8.12/rest-api-spec/src/main/resources/rest-api-spec/api/connector.update_pipeline.json
+ - `connector.update_scheduling` (new EXPERIMENTAL API)
+ - Updates the scheduling field in the connector document.
+ - Documentation: https://www.elastic.co/guide/en/elasticsearch/reference/8.12/update-connector-scheduling-api.html
+ - API: https://github.com/elastic/elasticsearch/blob/8.12/rest-api-spec/src/main/resources/rest-api-spec/api/connector.update_scheduling.json
+ - `connector_sync_job.cancel` (new EXPERIMENTAL API)
+ - Cancels a connector sync job.
+ - Documentation: https://www.elastic.co/guide/en/elasticsearch/reference/8.12/cancel-connector-sync-job-api.html
+ - API: https://github.com/elastic/elasticsearch/blob/8.12/rest-api-spec/src/main/resources/rest-api-spec/api/connector_sync_job.cancel.json
+ - `connector_sync_job.check_in` (new EXPERIMENTAL API)
+ - Checks in a connector sync job (refreshes 'last_seen').
+ - Documentation: https://www.elastic.co/guide/en/elasticsearch/reference/8.12/check-in-connector-sync-job-api.html
+ - API: https://github.com/elastic/elasticsearch/blob/8.12/rest-api-spec/src/main/resources/rest-api-spec/api/connector_sync_job.check_in.json
+ - `connector_sync_job.delete` (new EXPERIMENTAL API)
+ - Deletes a connector sync job.
+ - Documentation: https://www.elastic.co/guide/en/elasticsearch/reference/8.12/delete-connector-sync-job-api.html
+ - API: https://github.com/elastic/elasticsearch/blob/8.12/rest-api-spec/src/main/resources/rest-api-spec/api/connector_sync_job.delete.json
+ - `connector_sync_job.error` (new EXPERIMENTAL API)
+ - Sets an error for a connector sync job.
+ - Documentation: https://www.elastic.co/guide/en/elasticsearch/reference/8.12/set-connector-sync-job-error-api.html
+ - API: https://github.com/elastic/elasticsearch/blob/8.12/rest-api-spec/src/main/resources/rest-api-spec/api/connector_sync_job.error.json
+ - `connector_sync_job.get` (new EXPERIMENTAL API)
+ - Returns the details about a connector sync job.
+ - Documentation: https://www.elastic.co/guide/en/elasticsearch/reference/8.12/get-connector-sync-job-api.html
+ - API: https://github.com/elastic/elasticsearch/blob/8.12/rest-api-spec/src/main/resources/rest-api-spec/api/connector_sync_job.get.json
+ - `connector_sync_job.list` (new EXPERIMENTAL API)
+ - Lists all connector sync jobs.
+ - Documentation: https://www.elastic.co/guide/en/elasticsearch/reference/8.12/list-connector-sync-jobs-api.html
+ - API: https://github.com/elastic/elasticsearch/blob/8.12/rest-api-spec/src/main/resources/rest-api-spec/api/connector_sync_job.list.json
+ - `connector_sync_job.post` (new EXPERIMENTAL API)
+ - Creates a connector sync job.
+ - Documentation: https://www.elastic.co/guide/en/elasticsearch/reference/8.12/create-connector-sync-job-api.html
+ - API: https://github.com/elastic/elasticsearch/blob/8.12/rest-api-spec/src/main/resources/rest-api-spec/api/connector_sync_job.post.json
+ - `connector_sync_job.update_stats` (new EXPERIMENTAL API)
+ - Updates the stats fields in the connector sync job document.
+ - Documentation: https://www.elastic.co/guide/en/elasticsearch/reference/8.12/set-connector-sync-job-stats-api.html
+ - API: https://github.com/elastic/elasticsearch/blob/8.12/rest-api-spec/src/main/resources/rest-api-spec/api/connector_sync_job.update_stats.json
+
## Release 8.11.0
- Added 5 new EXPERIMENTAL APIs:
diff --git a/README.md b/README.md
index c50cf5dae..117239386 100644
--- a/README.md
+++ b/README.md
@@ -1,13 +1,17 @@
-Elasticsearch PHP client
-========================
+# Elasticsearch PHP client
[![Build status](https://github.com/elastic/elasticsearch-php/workflows/PHP%20test/badge.svg)](https://github.com/elastic/elasticsearch-php/actions) [![Latest Stable Version](https://poser.pugx.org/elasticsearch/elasticsearch/v/stable)](https://packagist.org/packages/elasticsearch/elasticsearch) [![Total Downloads](https://poser.pugx.org/elasticsearch/elasticsearch/downloads)](https://packagist.org/packages/elasticsearch/elasticsearch)
-This is the official PHP client for
+This is the official PHP client for
[Elasticsearch](https://www.elastic.co/elasticsearch/).
+**[Download the latest version of Elasticsearch](https://www.elastic.co/downloads/elasticsearch)**
+or
+**[sign-up](https://cloud.elastic.co/registration?elektra=en-ess-sign-up-page)**
+**for a free trial of Elastic Cloud**.
+
## Contents
- [Installation](#installation)
@@ -27,65 +31,84 @@ This is the official PHP client for
Refer to the [Installation section](https://www.elastic.co/guide/en/elasticsearch/client/php-api/current/getting-started-php.html#_installation)
of the getting started documentation.
-## Connecting
+## Connecting
Refer to the [Connecting section](https://www.elastic.co/guide/en/elasticsearch/client/php-api/current/getting-started-php.html#_connecting)
of the getting started documentation.
## Usage
-The `elasticsearch-php` client offers 400+ endpoints for interacting with
-Elasticsearch. A list of all these endpoints is available in the
+The `elasticsearch-php` client offers 400+ endpoints for interacting with
+Elasticsearch. A list of all these endpoints is available in the
[official documentation](https://www.elastic.co/guide/en/elasticsearch/reference/current/rest-apis.html)
of Elasticsearch APIs.
-Here we reported the basic operation that you can perform with the client:
+Here we reported the basic operation that you can perform with the client:
index, search and delete.
-* [Creating an index](https://www.elastic.co/guide/en/elasticsearch/client/php-api/current/getting-started-php.html#_creating_an_index)
-* [Indexing a document](https://www.elastic.co/guide/en/elasticsearch/client/php-api/current/getting-started-php.html#_indexing_documents)
-* [Getting documents](https://www.elastic.co/guide/en/elasticsearch/client/php-api/current/getting-started-php.html#_getting_documents)
-* [Searching documents](https://www.elastic.co/guide/en/elasticsearch/client/php-api/current/getting-started-php.html#_searching_documents)
-* [Updating documents](https://www.elastic.co/guide/en/elasticsearch/client/php-api/current/getting-started-php.html#_updating_documents)
-* [Deleting documents](https://www.elastic.co/guide/en/elasticsearch/client/php-api/current/getting-started-php.html#_deleting_documents)
-* [Deleting an index](https://www.elastic.co/guide/en/elasticsearch/client/php-api/current/getting-started-php.html#_deleting_an_index)
+- [Creating an index](https://www.elastic.co/guide/en/elasticsearch/client/php-api/current/getting-started-php.html#_creating_an_index)
+- [Indexing a document](https://www.elastic.co/guide/en/elasticsearch/client/php-api/current/getting-started-php.html#_indexing_documents)
+- [Getting documents](https://www.elastic.co/guide/en/elasticsearch/client/php-api/current/getting-started-php.html#_getting_documents)
+- [Searching documents](https://www.elastic.co/guide/en/elasticsearch/client/php-api/current/getting-started-php.html#_searching_documents)
+- [Updating documents](https://www.elastic.co/guide/en/elasticsearch/client/php-api/current/getting-started-php.html#_updating_documents)
+- [Deleting documents](https://www.elastic.co/guide/en/elasticsearch/client/php-api/current/getting-started-php.html#_deleting_documents)
+- [Deleting an index](https://www.elastic.co/guide/en/elasticsearch/client/php-api/current/getting-started-php.html#_deleting_an_index)
### Versioning
This client is versioned and released alongside Elasticsearch server.
-To guarantee compatibility, use the most recent version of this library within
+To guarantee compatibility, use the most recent version of this library within
the major version of the corresponding Enterprise Search implementation.
-For example, for Elasticsearch `7.16`, use `7.16` of this library or above, but
+For example, for Elasticsearch `7.16`, use `7.16` of this library or above, but
not `8.0`.
+## Compatibility
+
+The Elasticsearch client is compatible with currently maintained PHP versions.
+
+Language clients are forward compatible; meaning that clients support
+communicating with greater or equal minor versions of Elasticsearch without
+breaking. It does not mean that the client automatically supports new features
+of newer Elasticsearch versions; it is only possible after a release of a new
+client version. For example, a 8.12 client version won't automatically support
+the new features of the 8.13 version of Elasticsearch, the 8.13 client version
+is required for that. Elasticsearch language clients are only backwards
+compatible with default distributions and without guarantees made.
+
+| Elasticsearch Version | Elasticsearch-PHP Branch | Supported |
+| --------------------- | ------------------------ | --------- |
+| main | main | |
+| 8.x | 8.x | 8.x |
+| 7.x | 7.x | 7.17 |
+
## Backward Incompatible Changes :boom:
-The 8.0.0 version of `elasticsearch-php` contains a new implementation compared
-with 7.x. It supports [PSR-7](https://www.php-fig.org/psr/psr-7/) for HTTP
-messages and [PSR-18](https://www.php-fig.org/psr/psr-18/) for HTTP client
-communications.
+The 8.0.0 version of `elasticsearch-php` contains a new implementation compared
+with 7.x. It supports [PSR-7](https://www.php-fig.org/psr/psr-7/) for HTTP
+messages and [PSR-18](https://www.php-fig.org/psr/psr-18/) for HTTP client
+communications.
-We tried to reduce the BC breaks as much as possible with `7.x` but there are
+We tried to reduce the BC breaks as much as possible with `7.x` but there are
some (big) differences:
- we changed the namespace, now everything is under `Elastic\Elasticsearch`
-- we used the
- [elastic-transport-php](https://github.com/elastic/elastic-transport-php)
+- we used the
+ [elastic-transport-php](https://github.com/elastic/elastic-transport-php)
library for HTTP communications;
-- we changed the `Exception` model, using the namespace
- `Elastic\Elasticsearch\Exception`. All the exceptions extends the
+- we changed the `Exception` model, using the namespace
+ `Elastic\Elasticsearch\Exception`. All the exceptions extends the
`ElasticsearchException` interface, as in 7.x
-- we changed the response type of each endpoints using an
- [Elasticsearch](src/Response/Elasticsearch.php) response class. This class
- wraps a a [PSR-7](https://www.php-fig.org/psr/psr-7/) response allowing the
- access of the body response as array or object. This means you can access the
+- we changed the response type of each endpoints using an
+ [Elasticsearch](src/Response/Elasticsearch.php) response class. This class
+ wraps a a [PSR-7](https://www.php-fig.org/psr/psr-7/) response allowing the
+ access of the body response as array or object. This means you can access the
API response as in 7.x, no BC break here! :angel:
-- we changed the `ConnectionPool` in `NodePool`. The `connection` naming was
+- we changed the `ConnectionPool` in `NodePool`. The `connection` naming was
ambigous since the objects are nodes (hosts)
-You can have a look at the [BREAKING_CHANGES](BREAKING_CHANGES.md) file for more
+You can have a look at the [BREAKING_CHANGES](BREAKING_CHANGES.md) file for more
information.
## Mock the Elasticsearch client
@@ -93,7 +116,7 @@ information.
If you need to mock the Elasticsearch client you just need to mock a
[PSR-18](https://www.php-fig.org/psr/psr-18/) HTTP Client.
-For instance, you can use the
+For instance, you can use the
[php-http/mock-client](https://github.com/php-http/mock-client) as follows:
```php
@@ -122,52 +145,52 @@ echo $result->asString(); // This is the body!
```
We are using the `ClientBuilder::setHttpClient()` to set the mock client.
-You can specify the response that you want to have using the
-`addResponse($response)` function. As you can see the `$response` is a PSR-7
-response object. In this example we used the `Nyholm\Psr7\Response` object from
-the [nyholm/psr7](https://github.com/Nyholm/psr7) project. If you are using
-[PHPUnit](https://phpunit.de/) you can even mock the `ResponseInterface` as
+You can specify the response that you want to have using the
+`addResponse($response)` function. As you can see the `$response` is a PSR-7
+response object. In this example we used the `Nyholm\Psr7\Response` object from
+the [nyholm/psr7](https://github.com/Nyholm/psr7) project. If you are using
+[PHPUnit](https://phpunit.de/) you can even mock the `ResponseInterface` as
follows:
```php
$response = $this->createMock('Psr\Http\Message\ResponseInterface');
```
-**Notice**: we added a special header in the HTTP response. This is the product
-check header, and it is required for guarantee that `elasticsearch-php` is
+**Notice**: we added a special header in the HTTP response. This is the product
+check header, and it is required for guarantee that `elasticsearch-php` is
communicating with an Elasticsearch server 8.0+.
-For more information you can read the
-[Mock client](https://docs.php-http.org/en/latest/clients/mock-client.html)
+For more information you can read the
+[Mock client](https://docs.php-http.org/en/latest/clients/mock-client.html)
section of PHP-HTTP documentation.
## FAQ 🔮
### Where do I report issues with the client?
-If something is not working as expected, please open an
+If something is not working as expected, please open an
[issue](https://github.com/elastic/elasticsearch-php/issues/new).
### Where else can I go to get help?
-You can checkout the
+You can checkout the
[Elastic community discuss forums](https://discuss.elastic.co/).
## Contribute 🚀
We welcome contributors to the project. Before you begin, some useful info...
-+ If you want to contribute to this project you need to subscribe to a
+- If you want to contribute to this project you need to subscribe to a
[Contributor Agreement](https://www.elastic.co/contributor-agreement).
-+ Before opening a pull request, please create an issue to
+- Before opening a pull request, please create an issue to
[discuss the scope of your proposal](https://github.com/elastic/elasticsearch-php/issues).
-+ If you want to send a PR for version `8.0` please use the `8.0` branch, for
- `8.1` use the `8.1` branch and so on.
-+ Never send PR to `master` unless you want to contribute to the development
+- If you want to send a PR for version `8.0` please use the `8.0` branch, for
+ `8.1` use the `8.1` branch and so on.
+- Never send PR to `master` unless you want to contribute to the development
version of the client (`master` represents the next major version).
-+ Each PR should include a **unit test** using [PHPUnit](https://phpunit.de/).
- If you are not familiar with PHPUnit you can have a look at the
- [reference](https://phpunit.readthedocs.io/en/9.5/).
+- Each PR should include a **unit test** using [PHPUnit](https://phpunit.de/).
+ If you are not familiar with PHPUnit you can have a look at the
+ [reference](https://phpunit.readthedocs.io/en/9.5/).
Thanks in advance for your contribution! :heart:
diff --git a/composer.json b/composer.json
index 0318be226..50c5c1838 100644
--- a/composer.json
+++ b/composer.json
@@ -26,8 +26,9 @@
"symfony/finder": "~4.0",
"nyholm/psr7": "^1.5",
"php-http/mock-client": "^1.5",
- "symfony/http-client": "^5.0|^6.0",
- "php-http/message-factory": "^1.1"
+ "symfony/http-client": "^5.0|^6.0|^7.0",
+ "psr/http-factory" : "^1.0",
+ "php-http/message-factory" : "^1.0"
},
"autoload": {
"psr-4": {
@@ -51,7 +52,7 @@
"vendor/bin/phpunit --testdox -c phpunit-integration-cloud-tests.xml"
],
"phpstan": [
- "phpstan analyse src --level 2 --no-progress"
+ "phpstan analyse src --level 2 --no-progress --memory-limit 256M"
]
},
"config": {
diff --git a/docs/breaking-changes.asciidoc b/docs/breaking-changes.asciidoc
index 3544b92ad..7bbd4f8d9 100644
--- a/docs/breaking-changes.asciidoc
+++ b/docs/breaking-changes.asciidoc
@@ -36,7 +36,7 @@ The following functions has been removed:
- `ClientBuilder::setTracer()`, you can only set a Logger using `ClientBuilder::setLogger()`
- `ClientBuilder::setSerializer()`
- `ClientBuilder::setConnectionParams()`, you can use `ClientBuilder::setHttpClientOptions()` instead
-- `ClientBuilder::setSelector()`, you can set a `Selector` using the `setNodePool`, see [here](https://github.com/elastic/elastic-transport-php/blob/8.x/README.md#use-a-custom-selector) for more information
+- `ClientBuilder::setSelector()`, you can set a `Selector` using the `setNodePool`, see https://github.com/elastic/elastic-transport-php/blob/8.x/README.md#use-a-custom-selector[here] for more information
- `ClientBuilder::setSniffOnStart()`
- `ClientBuilder::includePortInHostHeader()`
diff --git a/docs/connecting.asciidoc b/docs/connecting.asciidoc
index f8208514f..5c67cd43d 100644
--- a/docs/connecting.asciidoc
+++ b/docs/connecting.asciidoc
@@ -79,7 +79,7 @@ docker run --name es01 --net elastic -p 9200:9200 -p 9300:9300 -it docker.elasti
This command creates an `elastic` Docker network and start {es}
using the port `9200` (default).
-When you run the docker imnage a password is generated for the `elastic` user
+When you run the docker image a password is generated for the `elastic` user
and it's printed to the terminal (you might need to scroll back a bit in the terminal
to view it). You have to copy it since we will need to connect to {es}.
diff --git a/docs/helpers/esql.asciidoc b/docs/helpers/esql.asciidoc
new file mode 100644
index 000000000..7e1d0ee64
--- /dev/null
+++ b/docs/helpers/esql.asciidoc
@@ -0,0 +1,221 @@
+[[esql]]
+=== ES|QL in the PHP client
+++++
+ES|QL
+++++
+
+This page helps you understand and use {ref}/esql.html[ES|QL] in the
+PHP client.
+
+There are two ways to use ES|QL in the PHP client:
+
+* Use the Elasticsearch {es-docs}/esql-apis.html[ES|QL API] directly: This
+is the most flexible approach, but it's also the most complex because you must handle
+results in their raw form. You can choose the precise format of results,
+such as JSON, CSV, or text.
+* Use ES|QL `mapTo($class)` helper. This mapper takes care of parsing the raw
+response and converting into an array of objects. If you don't specify the class
+using the `$class` parameter, the mapper uses https://www.php.net/manual/en/class.stdclass.php[stdClass].
+
+[discrete]
+[[esql-how-to]]
+==== How to use the ES|QL API
+
+The {es-docs}/esql-query-api.html[ES|QL query API] allows you to specify how
+results should be returned. You can choose a
+{es-docs}/esql-rest.html#esql-rest-format[response format] such as CSV, text, or
+JSON, then fine-tune it with parameters like column separators
+and locale.
+
+The default response from Elasticsearch is a table in JSON, where `columns`
+is an array of descriptions and `values` is an array of rows containing the values.
+
+[[query-script]]
+Here's an example query and PHP script:
+
+```php
+$query = <<esql()->query([
+ 'body' => ['query' => $query]
+]);
+
+foreach ($result['values'] as $value) {
+ $i=0;
+ foreach ($result['columns'] as $col) {
+ printf("%s : %s\n", $col['name'], $value[$i++]);
+ }
+ print("---\n");
+}
+```
+
+Here's the JSON response from Elasticsearch:
+
+```json
+{
+ "columns": [
+ { "name": "author", "type": "text" },
+ { "name": "description", "type": "text" },
+ { "name": "publisher", "type": "keyword" },
+ { "name": "rating", "type": "double" },
+ { "name": "title", "type": "text" },
+ { "name": "year", "type": "integer" }
+ ],
+ "values": [
+ [
+ "Stephen King",
+ "The author ...",
+ "Turtleback",
+ 5.0,
+ "How writers write",
+ 2002
+ ],
+ [
+ "Stephen King",
+ "In Blockade Billy, a retired coach...",
+ "Simon and Schuster",
+ 5.0,
+ "Blockade",
+ 2010
+ ],
+ [
+ "Stephen King",
+ "A chilling collection of twenty horror stories.",
+ "Signet Book",
+ 4.55859375,
+ "Night Shift (Signet)",
+ 1979
+ ],
+ ...
+ ]
+}
+```
+
+Using this response, the PHP script (provided <>) produces the following output:
+
+```php
+author : Stephen King
+description : The author ...
+publisher : Turtleback
+rating : 5.0
+title : How writers write
+year : 2002
+---
+author : Stephen King
+description : In Blockade Billy, a retired coach...
+publisher : Simon and Schuster
+rating : 5.0
+title : Blockade
+year : 2010
+---
+author : Stephen King
+description : A chilling collection of twenty horror stories.
+publisher : Signet Book
+rating : 4.55859375
+title : Night Shift (Signet)
+year : 1979
+---
+```
+
+The following example gets ES|QL results as CSV and parses them:
+
+```php
+$result = $client->esql()->query([
+ 'format' => 'csv',
+ 'body' => ['query' => $query]
+]);
+
+var_dump($result->asArray());
+```
+
+The response looks something like this:
+
+```json
+array(12) {
+ [0]=>
+ array(6) {
+ [0]=>
+ string(6) "author"
+ [1]=>
+ string(11) "description"
+ [2]=>
+ string(9) "publisher"
+ [3]=>
+ string(6) "rating"
+ [4]=>
+ string(5) "title"
+ [5]=>
+ string(4) "year"
+ }
+ [1]=>
+ array(6) {
+ [0]=>
+ string(12) "Stephen King"
+ [1]=>
+ string(249) "The author ..."
+ [2]=>
+ string(18) "Turtleback"
+ [3]=>
+ string(3) "5.0"
+ [4]=>
+ string(8) "How writers write"
+ [5]=>
+ string(4) "2002"
+ }
+```
+In the response, the first row contains the column descriptions and the other rows contain
+the values, using a plain PHP array.
+
+
+[discrete]
+[[esql-custom-mapping]]
+==== Define your own mapping
+
+Although the `esql()->query()` API covers many use cases, your application
+might require a custom mapping.
+
+You can map the ES|QL result into an array of objects, using the `mapTo()`
+function. Here's an example:
+
+```php
+$result = $client->esql()->query([
+ 'body' => ['query' => $query]
+]);
+
+$books = $result->mapTo(); // Array of stdClass
+foreach ($books as $book) {
+ printf(
+ "%s, %s, %d, Rating: %.2f\n",
+ $book->author,
+ $book->title,
+ $book->year,
+ $book->rating
+ );
+}
+```
+
+You can also specify a class name for the mapping.
+All the values will be assigned to the properties of the class.
+
+Here's an example mapper that returns an array of `Book` objects:
+
+```php
+class Book
+{
+ public string $author;
+ public string $title;
+ public string $description;
+ public int $year;
+ public float $rating;
+}
+
+$result = $client->esql()->query([
+ 'body' => ['query' => $query]
+]);
+$books = $result->mapTo(Book::class); // Array of Book
+```
\ No newline at end of file
diff --git a/docs/helpers/index.asciidoc b/docs/helpers/index.asciidoc
new file mode 100644
index 000000000..53b06b77c
--- /dev/null
+++ b/docs/helpers/index.asciidoc
@@ -0,0 +1,10 @@
+[[client-helpers]]
+== Client helpers
+
+The PHP client comes with the following helpers:
+
+* <>
+* <>
+
+include::iterators.asciidoc[]
+include::esql.asciidoc[]
\ No newline at end of file
diff --git a/docs/helpers.asciidoc b/docs/helpers/iterators.asciidoc
similarity index 85%
rename from docs/helpers.asciidoc
rename to docs/helpers/iterators.asciidoc
index 3f308e7f9..1af6ee902 100644
--- a/docs/helpers.asciidoc
+++ b/docs/helpers/iterators.asciidoc
@@ -1,24 +1,16 @@
-[[client-helpers]]
-== Client helpers
-
-The client comes with helpers to give you a more comfortable experience with
-some APIs.
-
-
-[discrete]
[[iterators]]
=== Iterators
+The PHP client includes helpers for iterating through results by page or by hits.
-[discrete]
[[search-response-iterator]]
==== Search response iterator
-The `SearchResponseIterator` can be used to iterate page by page in a search
+Use the `SearchResponseIterator` to iterate page by page in a search
result using
https://www.elastic.co/guide/en/elasticsearch/reference/current/paginate-search-results.html#paginate-search-results[pagination].
-An example as follows:
+Here's an example:
[source,php]
----
@@ -50,11 +42,11 @@ foreach($pages as $page) {
[[search-hit-iterator]]
==== Search hit iterator
-The `SearchHitIterator` can be used to iterate in a `SearchResponseIterator`
+Use the `SearchHitIterator` to iterate in a `SearchResponseIterator`
without worrying about
https://www.elastic.co/guide/en/elasticsearch/reference/current/paginate-search-results.html#paginate-search-results[pagination].
-An example as follows:
+Here's an example:
[source,php]
----
@@ -81,4 +73,4 @@ foreach($hits as $hit) {
// e.g. prints the document id
echo $hit['_id'], PHP_EOL;
}
-----
\ No newline at end of file
+----
diff --git a/docs/index.asciidoc b/docs/index.asciidoc
index bc65a2baf..63dbe4551 100644
--- a/docs/index.asciidoc
+++ b/docs/index.asciidoc
@@ -6,6 +6,8 @@
include::{docs-root}/shared/versions/stack/{source_branch}.asciidoc[]
include::{asciidoc-dir}/../../shared/attributes.asciidoc[]
+:es-docs: https://www.elastic.co/guide/en/elasticsearch/reference/{branch}
+
include::overview.asciidoc[]
include::getting-started.asciidoc[]
@@ -20,7 +22,7 @@ include::configuration.asciidoc[]
include::operations.asciidoc[]
-include::helpers.asciidoc[]
+include::helpers/index.asciidoc[]
include::release-notes.asciidoc[]
diff --git a/docs/overview.asciidoc b/docs/overview.asciidoc
index 9d1881170..cc03742c0 100644
--- a/docs/overview.asciidoc
+++ b/docs/overview.asciidoc
@@ -24,6 +24,31 @@ standard is a community effort that contains a set of interfaces defined by the
PHP Framework Interop Group. For more information, refer to the
https://www.php-fig.org/psr/psr-7/[PSR 7 standard documentation].
+
+[discrete]
+[[version-compatibility]]
+=== {es} and PHP version Compatibility
+
+The {es} client is compatible with currently maintained PHP versions.
+
+Language clients are forward compatible; meaning that clients support
+communicating with greater or equal minor versions of {es} without breaking. It
+does not mean that the client automatically supports new features of newer {es}
+versions; it is only possible after a release of a new client version. For
+example, a 8.12 client version won't automatically support the new features of
+the 8.13 version of {es}, the 8.13 client version is required for that.
+{es} language clients are only backwards compatible with default distributions
+and without guarantees made.
+
+|===
+| Elasticsearch Version | Elasticsearch-PHP Branch | Supported
+
+| main | main |
+| 8.x | 8.x | 8.x
+| 7.x | 7.x | 7.17
+|===
+
+
* <>
include::breaking-changes.asciidoc[]
\ No newline at end of file
diff --git a/docs/release-notes.asciidoc b/docs/release-notes.asciidoc
index 565469310..7a3716ad5 100644
--- a/docs/release-notes.asciidoc
+++ b/docs/release-notes.asciidoc
@@ -1,6 +1,9 @@
[[release-notes]]
== Release notes
+* <>
+* <>
+* <>
* <>
* <>
* <>
@@ -43,6 +46,28 @@
* <>
* <>
+[discrete]
+[[rn-8-14-0]]
+=== 8.14.0
+
+* Updated the API endpoints to Elasticserach 8.14.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.12.0
+* Tested the library with PHP 8.3
+
[discrete]
[[rn-8-11-0]]
=== 8.11.0
diff --git a/src/Client.php b/src/Client.php
index c4acf3cff..50e7dcf72 100644
--- a/src/Client.php
+++ b/src/Client.php
@@ -28,7 +28,7 @@
final class Client implements ClientInterface
{
const CLIENT_NAME = 'es';
- const VERSION = '8.11.0';
+ const VERSION = '8.14.0';
const API_COMPATIBILITY_HEADER = '%s/vnd.elasticsearch+%s; compatible-with=8';
use ClientEndpointsTrait;
diff --git a/src/Endpoints/AsyncSearch.php b/src/Endpoints/AsyncSearch.php
index b11a52059..46cb8bf22 100644
--- a/src/Endpoints/AsyncSearch.php
+++ b/src/Endpoints/AsyncSearch.php
@@ -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)
@@ -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',
];
diff --git a/src/Endpoints/Ccr.php b/src/Endpoints/Ccr.php
index 454df7b4b..81bca3bc2 100644
--- a/src/Endpoints/Ccr.php
+++ b/src/Endpoints/Ccr.php
@@ -35,6 +35,7 @@ class Ccr extends AbstractEndpoint
*
* @param array{
* name: string, // (REQUIRED) The name of the auto follow pattern.
+ * master_timeout: time, // Explicit operation timeout for connection to master node
* 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)
@@ -55,7 +56,7 @@ public function deleteAutoFollowPattern(array $params = [])
$url = '/_ccr/auto_follow/' . $this->encode($params['name']);
$method = 'DELETE';
- $url = $this->addQueryString($url, $params, ['pretty','human','error_trace','source','filter_path']);
+ $url = $this->addQueryString($url, $params, ['master_timeout','pretty','human','error_trace','source','filter_path']);
$headers = [
'Accept' => 'application/json',
];
@@ -71,6 +72,7 @@ public function deleteAutoFollowPattern(array $params = [])
* @param array{
* index: string, // (REQUIRED) The name of the follower index
* wait_for_active_shards: string, // Sets the number of shard copies that must be active before returning. Defaults to 0. Set to `all` for all shard copies, otherwise set to any non-negative value less than or equal to the total number of copies for the shard (number of replicas + 1)
+ * master_timeout: time, // Explicit operation timeout for connection to master node
* 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)
@@ -92,7 +94,7 @@ public function follow(array $params = [])
$url = '/' . $this->encode($params['index']) . '/_ccr/follow';
$method = 'PUT';
- $url = $this->addQueryString($url, $params, ['wait_for_active_shards','pretty','human','error_trace','source','filter_path']);
+ $url = $this->addQueryString($url, $params, ['wait_for_active_shards','master_timeout','pretty','human','error_trace','source','filter_path']);
$headers = [
'Accept' => 'application/json',
'Content-Type' => 'application/json',
@@ -108,6 +110,7 @@ public function follow(array $params = [])
*
* @param array{
* index: list, // (REQUIRED) A comma-separated list of index patterns; use `_all` to perform the operation on all indices
+ * master_timeout: time, // Explicit operation timeout for connection to master node
* 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)
@@ -128,7 +131,7 @@ public function followInfo(array $params = [])
$url = '/' . $this->encode($params['index']) . '/_ccr/info';
$method = 'GET';
- $url = $this->addQueryString($url, $params, ['pretty','human','error_trace','source','filter_path']);
+ $url = $this->addQueryString($url, $params, ['master_timeout','pretty','human','error_trace','source','filter_path']);
$headers = [
'Accept' => 'application/json',
];
@@ -143,6 +146,7 @@ public function followInfo(array $params = [])
*
* @param array{
* index: list, // (REQUIRED) A comma-separated list of index patterns; use `_all` to perform the operation on all indices
+ * timeout: time, // Explicit operation timeout
* 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)
@@ -163,7 +167,7 @@ public function followStats(array $params = [])
$url = '/' . $this->encode($params['index']) . '/_ccr/stats';
$method = 'GET';
- $url = $this->addQueryString($url, $params, ['pretty','human','error_trace','source','filter_path']);
+ $url = $this->addQueryString($url, $params, ['timeout','pretty','human','error_trace','source','filter_path']);
$headers = [
'Accept' => 'application/json',
];
@@ -178,6 +182,7 @@ public function followStats(array $params = [])
*
* @param array{
* index: string, // (REQUIRED) the name of the leader index for which specified follower retention leases should be removed
+ * timeout: time, // Explicit operation timeout
* 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)
@@ -199,7 +204,7 @@ public function forgetFollower(array $params = [])
$url = '/' . $this->encode($params['index']) . '/_ccr/forget_follower';
$method = 'POST';
- $url = $this->addQueryString($url, $params, ['pretty','human','error_trace','source','filter_path']);
+ $url = $this->addQueryString($url, $params, ['timeout','pretty','human','error_trace','source','filter_path']);
$headers = [
'Accept' => 'application/json',
'Content-Type' => 'application/json',
@@ -215,6 +220,7 @@ public function forgetFollower(array $params = [])
*
* @param array{
* name: string, // The name of the auto follow pattern.
+ * master_timeout: time, // Explicit operation timeout for connection to master node
* 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)
@@ -237,7 +243,7 @@ public function getAutoFollowPattern(array $params = [])
$url = '/_ccr/auto_follow';
$method = 'GET';
}
- $url = $this->addQueryString($url, $params, ['pretty','human','error_trace','source','filter_path']);
+ $url = $this->addQueryString($url, $params, ['master_timeout','pretty','human','error_trace','source','filter_path']);
$headers = [
'Accept' => 'application/json',
];
@@ -252,6 +258,7 @@ public function getAutoFollowPattern(array $params = [])
*
* @param array{
* name: string, // (REQUIRED) The name of the auto follow pattern that should pause discovering new indices to follow.
+ * master_timeout: time, // Explicit operation timeout for connection to master node
* 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)
@@ -272,7 +279,7 @@ public function pauseAutoFollowPattern(array $params = [])
$url = '/_ccr/auto_follow/' . $this->encode($params['name']) . '/pause';
$method = 'POST';
- $url = $this->addQueryString($url, $params, ['pretty','human','error_trace','source','filter_path']);
+ $url = $this->addQueryString($url, $params, ['master_timeout','pretty','human','error_trace','source','filter_path']);
$headers = [
'Accept' => 'application/json',
];
@@ -287,6 +294,7 @@ public function pauseAutoFollowPattern(array $params = [])
*
* @param array{
* index: string, // (REQUIRED) The name of the follower index that should pause following its leader index.
+ * master_timeout: time, // Explicit operation timeout for connection to master node
* 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)
@@ -307,7 +315,7 @@ public function pauseFollow(array $params = [])
$url = '/' . $this->encode($params['index']) . '/_ccr/pause_follow';
$method = 'POST';
- $url = $this->addQueryString($url, $params, ['pretty','human','error_trace','source','filter_path']);
+ $url = $this->addQueryString($url, $params, ['master_timeout','pretty','human','error_trace','source','filter_path']);
$headers = [
'Accept' => 'application/json',
];
@@ -322,6 +330,7 @@ public function pauseFollow(array $params = [])
*
* @param array{
* name: string, // (REQUIRED) The name of the auto follow pattern.
+ * master_timeout: time, // Explicit operation timeout for connection to master node
* 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)
@@ -343,7 +352,7 @@ public function putAutoFollowPattern(array $params = [])
$url = '/_ccr/auto_follow/' . $this->encode($params['name']);
$method = 'PUT';
- $url = $this->addQueryString($url, $params, ['pretty','human','error_trace','source','filter_path']);
+ $url = $this->addQueryString($url, $params, ['master_timeout','pretty','human','error_trace','source','filter_path']);
$headers = [
'Accept' => 'application/json',
'Content-Type' => 'application/json',
@@ -359,6 +368,7 @@ public function putAutoFollowPattern(array $params = [])
*
* @param array{
* name: string, // (REQUIRED) The name of the auto follow pattern to resume discovering new indices to follow.
+ * master_timeout: time, // Explicit operation timeout for connection to master node
* 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)
@@ -379,7 +389,7 @@ public function resumeAutoFollowPattern(array $params = [])
$url = '/_ccr/auto_follow/' . $this->encode($params['name']) . '/resume';
$method = 'POST';
- $url = $this->addQueryString($url, $params, ['pretty','human','error_trace','source','filter_path']);
+ $url = $this->addQueryString($url, $params, ['master_timeout','pretty','human','error_trace','source','filter_path']);
$headers = [
'Accept' => 'application/json',
];
@@ -394,6 +404,7 @@ public function resumeAutoFollowPattern(array $params = [])
*
* @param array{
* index: string, // (REQUIRED) The name of the follow index to resume following.
+ * master_timeout: time, // Explicit operation timeout for connection to master node
* 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)
@@ -415,7 +426,7 @@ public function resumeFollow(array $params = [])
$url = '/' . $this->encode($params['index']) . '/_ccr/resume_follow';
$method = 'POST';
- $url = $this->addQueryString($url, $params, ['pretty','human','error_trace','source','filter_path']);
+ $url = $this->addQueryString($url, $params, ['master_timeout','pretty','human','error_trace','source','filter_path']);
$headers = [
'Accept' => 'application/json',
'Content-Type' => 'application/json',
@@ -430,6 +441,8 @@ public function resumeFollow(array $params = [])
* @see https://www.elastic.co/guide/en/elasticsearch/reference/current/ccr-get-stats.html
*
* @param array{
+ * timeout: time, // Explicit operation timeout
+ * master_timeout: time, // Explicit operation timeout for connection to master node
* 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)
@@ -448,7 +461,7 @@ public function stats(array $params = [])
$url = '/_ccr/stats';
$method = 'GET';
- $url = $this->addQueryString($url, $params, ['pretty','human','error_trace','source','filter_path']);
+ $url = $this->addQueryString($url, $params, ['timeout','master_timeout','pretty','human','error_trace','source','filter_path']);
$headers = [
'Accept' => 'application/json',
];
@@ -463,6 +476,7 @@ public function stats(array $params = [])
*
* @param array{
* index: string, // (REQUIRED) The name of the follower index that should be turned into a regular index.
+ * master_timeout: time, // Explicit operation timeout for connection to master node
* 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)
@@ -483,7 +497,7 @@ public function unfollow(array $params = [])
$url = '/' . $this->encode($params['index']) . '/_ccr/unfollow';
$method = 'POST';
- $url = $this->addQueryString($url, $params, ['pretty','human','error_trace','source','filter_path']);
+ $url = $this->addQueryString($url, $params, ['master_timeout','pretty','human','error_trace','source','filter_path']);
$headers = [
'Accept' => 'application/json',
];
diff --git a/src/Endpoints/Connector.php b/src/Endpoints/Connector.php
new file mode 100644
index 000000000..306461cd9
--- /dev/null
+++ b/src/Endpoints/Connector.php
@@ -0,0 +1,1076 @@
+checkRequiredParameters(['connector_id'], $params);
+ $url = '/_connector/' . $this->encode($params['connector_id']) . '/_check_in';
+ $method = 'PUT';
+
+ $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));
+ }
+
+
+ /**
+ * Deletes a connector.
+ *
+ * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/delete-connector-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 deleted.
+ * delete_sync_jobs: boolean, // Determines whether associated sync jobs are also deleted.
+ * 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 delete(array $params = [])
+ {
+ $this->checkRequiredParameters(['connector_id'], $params);
+ $url = '/_connector/' . $this->encode($params['connector_id']);
+ $method = 'DELETE';
+
+ $url = $this->addQueryString($url, $params, ['delete_sync_jobs','pretty','human','error_trace','source','filter_path']);
+ $headers = [
+ 'Accept' => 'application/json',
+ ];
+ return $this->client->sendRequest($this->createRequest($method, $url, $headers, $params['body'] ?? null));
+ }
+
+
+ /**
+ * Returns the details about a connector.
+ *
+ * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/get-connector-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 returned.
+ * 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 get(array $params = [])
+ {
+ $this->checkRequiredParameters(['connector_id'], $params);
+ $url = '/_connector/' . $this->encode($params['connector_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));
+ }
+
+
+ /**
+ * Updates the stats of last sync in the connector document.
+ *
+ * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/update-connector-last-sync-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) Object with stats related to the last connector sync run.
+ * } $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 lastSync(array $params = [])
+ {
+ $this->checkRequiredParameters(['connector_id','body'], $params);
+ $url = '/_connector/' . $this->encode($params['connector_id']) . '/_last_sync';
+ $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));
+ }
+
+
+ /**
+ * Lists all connectors.
+ *
+ * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/list-connector-api.html
+ * @internal This API is EXPERIMENTAL and may be changed or removed completely in a future release
+ *
+ * @param array{
+ * from: int, // Starting offset (default: 0)
+ * 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)
+ * 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 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 list(array $params = [])
+ {
+ $url = '/_connector';
+ $method = 'GET';
+
+ $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',
+ ];
+ return $this->client->sendRequest($this->createRequest($method, $url, $headers, $params['body'] ?? null));
+ }
+
+
+ /**
+ * Creates a connector.
+ *
+ * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/create-connector-api.html
+ * @internal This API is EXPERIMENTAL and may be changed or removed completely in a future release
+ *
+ * @param array{
+ * 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 connector configuration.
+ * } $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 post(array $params = [])
+ {
+ $this->checkRequiredParameters(['body'], $params);
+ $url = '/_connector';
+ $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));
+ }
+
+
+ /**
+ * Creates or updates a connector.
+ *
+ * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/create-connector-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 created or 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) The connector configuration.
+ * } $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 put(array $params = [])
+ {
+ $this->checkRequiredParameters(['connector_id','body'], $params);
+ $url = '/_connector/' . $this->encode($params['connector_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));
+ }
+
+
+ /**
+ * Cancels a connector sync job.
+ *
+ * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/cancel-connector-sync-job-api.html
+ * @internal This API is EXPERIMENTAL and may be changed or removed completely in a future release
+ *
+ * @param array{
+ * connector_sync_job_id: string, // (REQUIRED) The unique identifier of the connector sync job to be canceled
+ * 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 syncJobCancel(array $params = [])
+ {
+ $this->checkRequiredParameters(['connector_sync_job_id'], $params);
+ $url = '/_connector/_sync_job/' . $this->encode($params['connector_sync_job_id']) . '/_cancel';
+ $method = 'PUT';
+
+ $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));
+ }
+
+
+ /**
+ * Checks in a connector sync job (refreshes 'last_seen').
+ *
+ * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/check-in-connector-sync-job-api.html
+ * @internal This API is EXPERIMENTAL and may be changed or removed completely in a future release
+ *
+ * @param array{
+ * connector_sync_job_id: string, // (REQUIRED) The unique identifier of the connector sync job to be checked in
+ * 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 syncJobCheckIn(array $params = [])
+ {
+ $this->checkRequiredParameters(['connector_sync_job_id'], $params);
+ $url = '/_connector/_sync_job/' . $this->encode($params['connector_sync_job_id']) . '/_check_in';
+ $method = 'PUT';
+
+ $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));
+ }
+
+
+ /**
+ * Deletes a connector sync job.
+ *
+ * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/delete-connector-sync-job-api.html
+ * @internal This API is EXPERIMENTAL and may be changed or removed completely in a future release
+ *
+ * @param array{
+ * connector_sync_job_id: string, // (REQUIRED) The unique identifier of the connector sync job to be deleted.
+ * 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 syncJobDelete(array $params = [])
+ {
+ $this->checkRequiredParameters(['connector_sync_job_id'], $params);
+ $url = '/_connector/_sync_job/' . $this->encode($params['connector_sync_job_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));
+ }
+
+
+ /**
+ * Sets an error for a connector sync job.
+ *
+ * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/set-connector-sync-job-error-api.html
+ * @internal This API is EXPERIMENTAL and may be changed or removed completely in a future release
+ *
+ * @param array{
+ * connector_sync_job_id: string, // (REQUIRED) The unique identifier of the connector sync job to set an error for.
+ * 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 error to set in the connector sync job.
+ * } $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 syncJobError(array $params = [])
+ {
+ $this->checkRequiredParameters(['connector_sync_job_id','body'], $params);
+ $url = '/_connector/_sync_job/' . $this->encode($params['connector_sync_job_id']) . '/_error';
+ $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));
+ }
+
+
+ /**
+ * Returns the details about a connector sync job.
+ *
+ * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/get-connector-sync-job-api.html
+ * @internal This API is EXPERIMENTAL and may be changed or removed completely in a future release
+ *
+ * @param array{
+ * connector_sync_job_id: string, // (REQUIRED) The unique identifier of the connector sync job to be returned.
+ * 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 syncJobGet(array $params = [])
+ {
+ $this->checkRequiredParameters(['connector_sync_job_id'], $params);
+ $url = '/_connector/_sync_job/' . $this->encode($params['connector_sync_job_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));
+ }
+
+
+ /**
+ * Lists all connector sync jobs.
+ *
+ * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/list-connector-sync-jobs-api.html
+ * @internal This API is EXPERIMENTAL and may be changed or removed completely in a future release
+ *
+ * @param array{
+ * from: int, // Starting offset (default: 0)
+ * 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)
+ * 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 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 syncJobList(array $params = [])
+ {
+ $url = '/_connector/_sync_job';
+ $method = 'GET';
+
+ $url = $this->addQueryString($url, $params, ['from','size','status','connector_id','job_type','pretty','human','error_trace','source','filter_path']);
+ $headers = [
+ 'Accept' => 'application/json',
+ ];
+ return $this->client->sendRequest($this->createRequest($method, $url, $headers, $params['body'] ?? null));
+ }
+
+
+ /**
+ * Creates a connector sync job.
+ *
+ * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/create-connector-sync-job-api.html
+ * @internal This API is EXPERIMENTAL and may be changed or removed completely in a future release
+ *
+ * @param array{
+ * 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 connector sync job data.
+ * } $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 syncJobPost(array $params = [])
+ {
+ $this->checkRequiredParameters(['body'], $params);
+ $url = '/_connector/_sync_job';
+ $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));
+ }
+
+
+ /**
+ * Updates the stats fields in the connector sync job document.
+ *
+ * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/set-connector-sync-job-stats-api.html
+ * @internal This API is EXPERIMENTAL and may be changed or removed completely in a future release
+ *
+ * @param array{
+ * connector_sync_job_id: string, // (REQUIRED) The unique identifier of the connector sync job 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) The stats to update for the connector sync job.
+ * } $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 syncJobUpdateStats(array $params = [])
+ {
+ $this->checkRequiredParameters(['connector_sync_job_id','body'], $params);
+ $url = '/_connector/_sync_job/' . $this->encode($params['connector_sync_job_id']) . '/_stats';
+ $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));
+ }
+
+
+ /**
+ * Activates the draft filtering rules if they are in a validated state.
+ *
+ * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/update-connector-filtering-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.
+ * } $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 updateActiveFiltering(array $params = [])
+ {
+ $this->checkRequiredParameters(['connector_id'], $params);
+ $url = '/_connector/' . $this->encode($params['connector_id']) . '/_filtering/_activate';
+ $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 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.
+ *
+ * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/update-connector-configuration-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) Mapping between field names to configuration.
+ * } $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 updateConfiguration(array $params = [])
+ {
+ $this->checkRequiredParameters(['connector_id','body'], $params);
+ $url = '/_connector/' . $this->encode($params['connector_id']) . '/_configuration';
+ $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 error field in the connector document.
+ *
+ * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/update-connector-error-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 error.
+ * } $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 updateError(array $params = [])
+ {
+ $this->checkRequiredParameters(['connector_id','body'], $params);
+ $url = '/_connector/' . $this->encode($params['connector_id']) . '/_error';
+ $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 filtering field in the connector document.
+ *
+ * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/update-connector-filtering-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) A list of connector filtering configurations.
+ * } $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 updateFiltering(array $params = [])
+ {
+ $this->checkRequiredParameters(['connector_id','body'], $params);
+ $url = '/_connector/' . $this->encode($params['connector_id']) . '/_filtering';
+ $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 validation info of the draft filtering rules.
+ *
+ * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/update-connector-filtering-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) Validation info for the draft filtering rules
+ * } $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 updateFilteringValidation(array $params = [])
+ {
+ $this->checkRequiredParameters(['connector_id','body'], $params);
+ $url = '/_connector/' . $this->encode($params['connector_id']) . '/_filtering/_validation';
+ $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 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.
+ *
+ * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/update-connector-name-description-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 name and/or description.
+ * } $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 updateName(array $params = [])
+ {
+ $this->checkRequiredParameters(['connector_id','body'], $params);
+ $url = '/_connector/' . $this->encode($params['connector_id']) . '/_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 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.
+ *
+ * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/update-connector-pipeline-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 with connector ingest pipeline configuration.
+ * } $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 updatePipeline(array $params = [])
+ {
+ $this->checkRequiredParameters(['connector_id','body'], $params);
+ $url = '/_connector/' . $this->encode($params['connector_id']) . '/_pipeline';
+ $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 scheduling field in the connector document.
+ *
+ * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/update-connector-scheduling-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 scheduling configuration.
+ * } $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 updateScheduling(array $params = [])
+ {
+ $this->checkRequiredParameters(['connector_id','body'], $params);
+ $url = '/_connector/' . $this->encode($params['connector_id']) . '/_scheduling';
+ $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 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));
+ }
+}
diff --git a/src/Endpoints/Esql.php b/src/Endpoints/Esql.php
index c19392459..1c07eb4d8 100644
--- a/src/Endpoints/Esql.php
+++ b/src/Endpoints/Esql.php
@@ -28,21 +28,97 @@
*/
class Esql extends AbstractEndpoint
{
+ /**
+ * Executes an ESQL request asynchronously
+ *
+ * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/esql-async-query-api.html
+ *
+ * @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
*
* @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.
+ * 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
@@ -57,7 +133,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',
diff --git a/src/Endpoints/Indices.php b/src/Endpoints/Indices.php
index a1c2fab40..4db9a6af2 100644
--- a/src/Endpoints/Indices.php
+++ b/src/Endpoints/Indices.php
@@ -1684,6 +1684,7 @@ public function putMapping(array $params = [])
* master_timeout: time, // Specify timeout for connection to master
* timeout: time, // Explicit operation timeout
* preserve_existing: boolean, // Whether to update existing settings. If set to `true` existing settings on an index remain unchanged, the default is `false`
+ * reopen: boolean, // Whether to close and reopen the index to apply non-dynamic settings. If set to `true` the indices to which the settings are being applied will be closed temporarily and then reopened in order to apply the changes. The default is `false`
* ignore_unavailable: boolean, // Whether specified concrete indices should be ignored when unavailable (missing or closed)
* allow_no_indices: boolean, // Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes `_all` string or when no indices have been specified)
* expand_wildcards: enum, // Whether to expand wildcard expression to concrete indices that are open, closed or both.
@@ -1712,7 +1713,7 @@ public function putSettings(array $params = [])
$url = '/_settings';
$method = 'PUT';
}
- $url = $this->addQueryString($url, $params, ['master_timeout','timeout','preserve_existing','ignore_unavailable','allow_no_indices','expand_wildcards','flat_settings','pretty','human','error_trace','source','filter_path']);
+ $url = $this->addQueryString($url, $params, ['master_timeout','timeout','preserve_existing','reopen','ignore_unavailable','allow_no_indices','expand_wildcards','flat_settings','pretty','human','error_trace','source','filter_path']);
$headers = [
'Accept' => 'application/json',
'Content-Type' => 'application/json',
@@ -1879,6 +1880,45 @@ public function reloadSearchAnalyzers(array $params = [])
}
+ /**
+ * Resolves the specified index expressions to return information about each cluster, including the local cluster, if included.
+ *
+ * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-resolve-cluster-api.html
+ *
+ * @param array{
+ * name: list, // (REQUIRED) A comma-separated list of cluster:index names or wildcard expressions
+ * ignore_unavailable: boolean, // Whether specified concrete indices should be ignored when unavailable (missing or closed)
+ * ignore_throttled: boolean, // Whether specified concrete, expanded or aliased indices should be ignored when throttled
+ * allow_no_indices: boolean, // Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes `_all` string or when no indices have been specified)
+ * expand_wildcards: enum, // Whether wildcard expressions should get expanded to open or closed indices (default: open)
+ * 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 resolveCluster(array $params = [])
+ {
+ $this->checkRequiredParameters(['name'], $params);
+ $url = '/_resolve/cluster/' . $this->encode($params['name']);
+ $method = 'GET';
+
+ $url = $this->addQueryString($url, $params, ['ignore_unavailable','ignore_throttled','allow_no_indices','expand_wildcards','pretty','human','error_trace','source','filter_path']);
+ $headers = [
+ 'Accept' => 'application/json',
+ ];
+ return $this->client->sendRequest($this->createRequest($method, $url, $headers, $params['body'] ?? null));
+ }
+
+
/**
* Returns information about any matching indices, aliases, and data streams
*
@@ -1928,6 +1968,8 @@ public function resolveIndex(array $params = [])
* dry_run: boolean, // If set to true the rollover action will only be validated but not actually performed even if a condition matches. The default is false
* master_timeout: time, // Specify timeout for connection to master
* wait_for_active_shards: string, // Set the number of active shards to wait for on the newly created rollover index before the operation returns.
+ * lazy: 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.
+ * target_failure_store: boolean, // If set to true, the rollover action will be applied on the failure store of the data stream.
* 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)
@@ -1953,7 +1995,7 @@ public function rollover(array $params = [])
$url = '/' . $this->encode($params['alias']) . '/_rollover';
$method = 'POST';
}
- $url = $this->addQueryString($url, $params, ['timeout','dry_run','master_timeout','wait_for_active_shards','pretty','human','error_trace','source','filter_path']);
+ $url = $this->addQueryString($url, $params, ['timeout','dry_run','master_timeout','wait_for_active_shards','lazy','target_failure_store','pretty','human','error_trace','source','filter_path']);
$headers = [
'Accept' => 'application/json',
'Content-Type' => 'application/json',
diff --git a/src/Endpoints/Inference.php b/src/Endpoints/Inference.php
index 835d59c49..04cca3027 100644
--- a/src/Endpoints/Inference.php
+++ b/src/Endpoints/Inference.php
@@ -35,8 +35,8 @@ class Inference extends AbstractEndpoint
* @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
+ * inference_id: string, // (REQUIRED) The model Id
+ * task_type: string, // The task type
* 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)
@@ -53,10 +53,14 @@ class Inference extends AbstractEndpoint
*/
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';
-
+ $this->checkRequiredParameters(['inference_id'], $params);
+ if (isset($params['task_type'])) {
+ $url = '/_inference/' . $this->encode($params['task_type']) . '/' . $this->encode($params['inference_id']);
+ $method = 'DELETE';
+ } else {
+ $url = '/_inference/' . $this->encode($params['inference_id']);
+ $method = 'DELETE';
+ }
$url = $this->addQueryString($url, $params, ['pretty','human','error_trace','source','filter_path']);
$headers = [
'Accept' => 'application/json',
@@ -72,8 +76,8 @@ public function deleteModel(array $params = [])
* @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
+ * inference_id: string, // The inference Id
+ * task_type: string, // The task type
* 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)
@@ -81,7 +85,6 @@ public function deleteModel(array $params = [])
* 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
@@ -90,10 +93,16 @@ public function deleteModel(array $params = [])
*/
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';
-
+ if (isset($params['task_type']) && isset($params['inference_id'])) {
+ $url = '/_inference/' . $this->encode($params['task_type']) . '/' . $this->encode($params['inference_id']);
+ $method = 'GET';
+ } elseif (isset($params['inference_id'])) {
+ $url = '/_inference/' . $this->encode($params['inference_id']);
+ $method = 'GET';
+ } else {
+ $url = '/_inference';
+ $method = 'GET';
+ }
$url = $this->addQueryString($url, $params, ['pretty','human','error_trace','source','filter_path']);
$headers = [
'Accept' => 'application/json',
@@ -109,8 +118,8 @@ public function getModel(array $params = [])
* @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
+ * inference_id: string, // (REQUIRED) The inference Id
+ * task_type: string, // The task type
* 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)
@@ -128,10 +137,14 @@ public function getModel(array $params = [])
*/
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';
-
+ $this->checkRequiredParameters(['inference_id'], $params);
+ if (isset($params['task_type'])) {
+ $url = '/_inference/' . $this->encode($params['task_type']) . '/' . $this->encode($params['inference_id']);
+ $method = 'POST';
+ } else {
+ $url = '/_inference/' . $this->encode($params['inference_id']);
+ $method = 'POST';
+ }
$url = $this->addQueryString($url, $params, ['pretty','human','error_trace','source','filter_path']);
$headers = [
'Accept' => 'application/json',
@@ -148,8 +161,8 @@ public function inference(array $params = [])
* @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
+ * inference_id: string, // (REQUIRED) The inference Id
+ * task_type: string, // The task type
* 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)
@@ -167,10 +180,14 @@ public function inference(array $params = [])
*/
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';
-
+ $this->checkRequiredParameters(['inference_id'], $params);
+ if (isset($params['task_type'])) {
+ $url = '/_inference/' . $this->encode($params['task_type']) . '/' . $this->encode($params['inference_id']);
+ $method = 'PUT';
+ } else {
+ $url = '/_inference/' . $this->encode($params['inference_id']);
+ $method = 'PUT';
+ }
$url = $this->addQueryString($url, $params, ['pretty','human','error_trace','source','filter_path']);
$headers = [
'Accept' => 'application/json',
diff --git a/src/Endpoints/Profiling.php b/src/Endpoints/Profiling.php
new file mode 100644
index 000000000..b8a287ad1
--- /dev/null
+++ b/src/Endpoints/Profiling.php
@@ -0,0 +1,169 @@
+checkRequiredParameters(['body'], $params);
+ $url = '/_profiling/flamegraph';
+ $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));
+ }
+
+
+ /**
+ * Extracts raw stacktrace information from Universal Profiling.
+ *
+ * @see https://www.elastic.co/guide/en/observability/current/universal-profiling.html
+ *
+ * @param array{
+ * 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 filter conditions for stacktraces
+ * } $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 stacktraces(array $params = [])
+ {
+ $this->checkRequiredParameters(['body'], $params);
+ $url = '/_profiling/stacktraces';
+ $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));
+ }
+
+
+ /**
+ * Returns basic information about the status of Universal Profiling.
+ *
+ * @see https://www.elastic.co/guide/en/observability/current/universal-profiling.html
+ *
+ * @param array{
+ * master_timeout: time, // Explicit operation timeout for connection to master node
+ * timeout: time, // Explicit operation timeout
+ * wait_for_resources_created: boolean, // Whether to return immediately or wait until resources have been created
+ * 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 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 status(array $params = [])
+ {
+ $url = '/_profiling/status';
+ $method = 'GET';
+
+ $url = $this->addQueryString($url, $params, ['master_timeout','timeout','wait_for_resources_created','pretty','human','error_trace','source','filter_path']);
+ $headers = [
+ 'Accept' => 'application/json',
+ ];
+ return $this->client->sendRequest($this->createRequest($method, $url, $headers, $params['body'] ?? null));
+ }
+
+
+ /**
+ * Extracts a list of topN functions from Universal Profiling.
+ *
+ * @see https://www.elastic.co/guide/en/observability/current/universal-profiling.html
+ *
+ * @param array{
+ * 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 filter conditions for stacktraces
+ * } $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 topnFunctions(array $params = [])
+ {
+ $this->checkRequiredParameters(['body'], $params);
+ $url = '/_profiling/topn/functions';
+ $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));
+ }
+}
diff --git a/src/Endpoints/SearchApplication.php b/src/Endpoints/SearchApplication.php
index 8c97fc26a..e7769e2a6 100644
--- a/src/Endpoints/SearchApplication.php
+++ b/src/Endpoints/SearchApplication.php
@@ -213,6 +213,7 @@ public function list(array $params = [])
/**
* Creates a behavioral analytics event for existing collection.
*
+ * @see http://todo.com/tbd
* @internal This API is EXPERIMENTAL and may be changed or removed completely in a future release
*
* @param array{
@@ -370,6 +371,7 @@ public function renderQuery(array $params = [])
*
* @param array{
* name: string, // (REQUIRED) The name of the search application to be searched
+ * typed_keys: boolean, // Specify whether aggregation and suggester names should be prefixed by their respective types in the response
* 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)
@@ -391,7 +393,7 @@ public function search(array $params = [])
$url = '/_application/search_application/' . $this->encode($params['name']) . '/_search';
$method = empty($params['body']) ? 'GET' : 'POST';
- $url = $this->addQueryString($url, $params, ['pretty','human','error_trace','source','filter_path']);
+ $url = $this->addQueryString($url, $params, ['typed_keys','pretty','human','error_trace','source','filter_path']);
$headers = [
'Accept' => 'application/json',
'Content-Type' => 'application/json',
diff --git a/src/Endpoints/Security.php b/src/Endpoints/Security.php
index 8c7536587..8a6e01359 100644
--- a/src/Endpoints/Security.php
+++ b/src/Endpoints/Security.php
@@ -867,6 +867,8 @@ public function enrollNode(array $params = [])
* realm_name: string, // realm name of the user who created this API key to be retrieved
* owner: boolean, // flag to query API keys owned by the currently authenticated user
* with_limited_by: boolean, // flag to show the limited-by role descriptors of API Keys
+ * with_profile_uid: boolean, // flag to also retrieve the API Key's owner profile uid, if it exists
+ * active_only: boolean, // flag to limit response to only active (not invalidated or expired) API keys
* 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)
@@ -885,7 +887,7 @@ public function getApiKey(array $params = [])
$url = '/_security/api_key';
$method = 'GET';
- $url = $this->addQueryString($url, $params, ['id','name','username','realm_name','owner','with_limited_by','pretty','human','error_trace','source','filter_path']);
+ $url = $this->addQueryString($url, $params, ['id','name','username','realm_name','owner','with_limited_by','with_profile_uid','active_only','pretty','human','error_trace','source','filter_path']);
$headers = [
'Accept' => 'application/json',
];
@@ -1734,6 +1736,8 @@ public function putUser(array $params = [])
*
* @param array{
* with_limited_by: boolean, // flag to show the limited-by role descriptors of API Keys
+ * with_profile_uid: boolean, // flag to also retrieve the API Key's owner profile uid, if it exists
+ * typed_keys: boolean, // flag to prefix aggregation names by their respective types in the response
* 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)
@@ -1753,7 +1757,42 @@ public function queryApiKeys(array $params = [])
$url = '/_security/_query/api_key';
$method = empty($params['body']) ? 'GET' : 'POST';
- $url = $this->addQueryString($url, $params, ['with_limited_by','pretty','human','error_trace','source','filter_path']);
+ $url = $this->addQueryString($url, $params, ['with_limited_by','with_profile_uid','typed_keys','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 information for Users using a subset of query DSL
+ *
+ * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-query-user.html
+ *
+ * @param array{
+ * with_profile_uid: boolean, // flag to retrieve profile uid (if exists) associated with the user
+ * 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, // From, size, query, sort and search_after
+ * } $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 queryUser(array $params = [])
+ {
+ $url = '/_security/_query/user';
+ $method = empty($params['body']) ? 'GET' : 'POST';
+
+ $url = $this->addQueryString($url, $params, ['with_profile_uid','pretty','human','error_trace','source','filter_path']);
$headers = [
'Accept' => 'application/json',
'Content-Type' => 'application/json',
diff --git a/src/Endpoints/Simulate.php b/src/Endpoints/Simulate.php
new file mode 100644
index 000000000..cded13a69
--- /dev/null
+++ b/src/Endpoints/Simulate.php
@@ -0,0 +1,71 @@
+checkRequiredParameters(['body'], $params);
+ if (isset($params['index'])) {
+ $url = '/_ingest/' . $this->encode($params['index']) . '/_simulate';
+ $method = empty($params['body']) ? 'GET' : 'POST';
+ } else {
+ $url = '/_ingest/_simulate';
+ $method = empty($params['body']) ? 'GET' : 'POST';
+ }
+ $url = $this->addQueryString($url, $params, ['pipeline','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));
+ }
+}
diff --git a/src/Endpoints/Synonyms.php b/src/Endpoints/Synonyms.php
index 2256b4f09..a99f30aff 100644
--- a/src/Endpoints/Synonyms.php
+++ b/src/Endpoints/Synonyms.php
@@ -32,7 +32,6 @@ class Synonyms extends AbstractEndpoint
* Deletes a synonym set
*
* @see https://www.elastic.co/guide/en/elasticsearch/reference/master/delete-synonyms-set.html
- * @internal This API is EXPERIMENTAL and may be changed or removed completely in a future release
*
* @param array{
* id: string, // (REQUIRED) The id of the synonyms set to be deleted
@@ -68,7 +67,6 @@ public function deleteSynonym(array $params = [])
* Deletes a synonym rule in a synonym set
*
* @see https://www.elastic.co/guide/en/elasticsearch/reference/master/delete-synonym-rule.html
- * @internal This API is EXPERIMENTAL and may be changed or removed completely in a future release
*
* @param array{
* set_id: string, // (REQUIRED) The id of the synonym set to be updated
@@ -106,7 +104,6 @@ public function deleteSynonymRule(array $params = [])
* Retrieves a synonym set
*
* @see https://www.elastic.co/guide/en/elasticsearch/reference/master/get-synonyms-set.html
- * @internal This API is EXPERIMENTAL and may be changed or removed completely in a future release
*
* @param array{
* id: string, // (REQUIRED) The name of the synonyms set to be retrieved
@@ -144,7 +141,6 @@ public function getSynonym(array $params = [])
* Retrieves a synonym rule from a synonym set
*
* @see https://www.elastic.co/guide/en/elasticsearch/reference/master/get-synonym-rule.html
- * @internal This API is EXPERIMENTAL and may be changed or removed completely in a future release
*
* @param array{
* set_id: string, // (REQUIRED) The id of the synonym set to retrieve the synonym rule from
@@ -182,7 +178,6 @@ public function getSynonymRule(array $params = [])
* Retrieves a summary of all defined synonym sets
*
* @see https://www.elastic.co/guide/en/elasticsearch/reference/master/list-synonyms-sets.html
- * @internal This API is EXPERIMENTAL and may be changed or removed completely in a future release
*
* @param array{
* from: int, // Starting offset
@@ -217,7 +212,6 @@ public function getSynonymsSets(array $params = [])
* Creates or updates a synonyms set
*
* @see https://www.elastic.co/guide/en/elasticsearch/reference/master/put-synonyms-set.html
- * @internal This API is EXPERIMENTAL and may be changed or removed completely in a future release
*
* @param array{
* id: string, // (REQUIRED) The id of the synonyms set to be created or updated
@@ -255,7 +249,6 @@ public function putSynonym(array $params = [])
* Creates or updates a synonym rule in a synonym set
*
* @see https://www.elastic.co/guide/en/elasticsearch/reference/master/put-synonym-rule.html
- * @internal This API is EXPERIMENTAL and may be changed or removed completely in a future release
*
* @param array{
* set_id: string, // (REQUIRED) The id of the synonym set to be updated with the synonym rule
diff --git a/src/Endpoints/TextStructure.php b/src/Endpoints/TextStructure.php
index db65e57a8..6bfa564a3 100644
--- a/src/Endpoints/TextStructure.php
+++ b/src/Endpoints/TextStructure.php
@@ -28,6 +28,99 @@
*/
class TextStructure extends AbstractEndpoint
{
+ /**
+ * Finds the structure of a text field in an index.
+ *
+ * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/find-field-structure.html
+ *
+ * @param array{
+ * index: string, // The index containing the analyzed field
+ * field: string, // The field that should be analyzed
+ * documents_to_sample: int, // How many documents should be included in the analysis
+ * timeout: time, // Timeout after which the analysis will be aborted
+ * format: enum, // Optional parameter to specify the high level file format
+ * column_names: list, // Optional parameter containing a comma separated list of the column names for a delimited file
+ * delimiter: string, // Optional parameter to specify the delimiter character for a delimited file - must be a single character
+ * quote: string, // Optional parameter to specify the quote character for a delimited file - must be a single character
+ * should_trim_fields: boolean, // Optional parameter to specify whether the values between delimiters in a delimited file should have whitespace trimmed from them
+ * grok_pattern: string, // Optional parameter to specify the Grok pattern that should be used to extract fields from messages in a semi-structured text file
+ * ecs_compatibility: string, // Optional parameter to specify the compatibility mode with ECS Grok patterns - may be either 'v1' or 'disabled'
+ * timestamp_field: string, // Optional parameter to specify the timestamp field in the file
+ * timestamp_format: string, // Optional parameter to specify the timestamp format in the file - may be either a Joda or Java time format
+ * explain: boolean, // Whether to include a commentary on how the structure was derived
+ * 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 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 findFieldStructure(array $params = [])
+ {
+ $this->checkRequiredParameters(['index','field'], $params);
+ $url = '/_text_structure/find_field_structure';
+ $method = 'GET';
+
+ $url = $this->addQueryString($url, $params, ['index','field','documents_to_sample','timeout','format','column_names','delimiter','quote','should_trim_fields','grok_pattern','ecs_compatibility','timestamp_field','timestamp_format','explain','pretty','human','error_trace','source','filter_path']);
+ $headers = [
+ 'Accept' => 'application/json',
+ ];
+ return $this->client->sendRequest($this->createRequest($method, $url, $headers, $params['body'] ?? null));
+ }
+
+
+ /**
+ * Finds the structure of a list of messages. The messages must contain data that is suitable to be ingested into Elasticsearch.
+ *
+ * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/find-message-structure.html
+ *
+ * @param array{
+ * timeout: time, // Timeout after which the analysis will be aborted
+ * format: enum, // Optional parameter to specify the high level file format
+ * column_names: list, // Optional parameter containing a comma separated list of the column names for a delimited file
+ * delimiter: string, // Optional parameter to specify the delimiter character for a delimited file - must be a single character
+ * quote: string, // Optional parameter to specify the quote character for a delimited file - must be a single character
+ * should_trim_fields: boolean, // Optional parameter to specify whether the values between delimiters in a delimited file should have whitespace trimmed from them
+ * grok_pattern: string, // Optional parameter to specify the Grok pattern that should be used to extract fields from messages in a semi-structured text file
+ * ecs_compatibility: string, // Optional parameter to specify the compatibility mode with ECS Grok patterns - may be either 'v1' or 'disabled'
+ * timestamp_field: string, // Optional parameter to specify the timestamp field in the file
+ * timestamp_format: string, // Optional parameter to specify the timestamp format in the file - may be either a Joda or Java time format
+ * explain: boolean, // Whether to include a commentary on how the structure was derived
+ * 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) JSON object with one field [messages], containing an array of messages to be analyzed
+ * } $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 findMessageStructure(array $params = [])
+ {
+ $this->checkRequiredParameters(['body'], $params);
+ $url = '/_text_structure/find_message_structure';
+ $method = empty($params['body']) ? 'GET' : 'POST';
+
+ $url = $this->addQueryString($url, $params, ['timeout','format','column_names','delimiter','quote','should_trim_fields','grok_pattern','ecs_compatibility','timestamp_field','timestamp_format','explain','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));
+ }
+
+
/**
* Finds the structure of a text file. The text file must contain data that is suitable to be ingested into Elasticsearch.
*
@@ -76,4 +169,40 @@ public function findStructure(array $params = [])
];
return $this->client->sendRequest($this->createRequest($method, $url, $headers, $params['body'] ?? null));
}
+
+
+ /**
+ * Tests a Grok pattern on some text.
+ *
+ * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/test-grok-pattern.html
+ *
+ * @param array{
+ * ecs_compatibility: string, // Optional parameter to specify the compatibility mode with ECS Grok patterns - may be either 'v1' or 'disabled'
+ * 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 Grok pattern and text.
+ * } $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 testGrokPattern(array $params = [])
+ {
+ $this->checkRequiredParameters(['body'], $params);
+ $url = '/_text_structure/test_grok_pattern';
+ $method = empty($params['body']) ? 'GET' : 'POST';
+
+ $url = $this->addQueryString($url, $params, ['ecs_compatibility','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));
+ }
}
diff --git a/src/Response/Elasticsearch.php b/src/Response/Elasticsearch.php
index a8fe29dc7..267f72b12 100644
--- a/src/Response/Elasticsearch.php
+++ b/src/Response/Elasticsearch.php
@@ -15,17 +15,20 @@
namespace Elastic\Elasticsearch\Response;
use ArrayAccess;
+use DateTime;
use Elastic\Elasticsearch\Exception\ArrayAccessException;
use Elastic\Elasticsearch\Exception\ClientResponseException;
use Elastic\Elasticsearch\Exception\ServerResponseException;
use Elastic\Elasticsearch\Traits\MessageResponseTrait;
use Elastic\Elasticsearch\Traits\ProductCheckTrait;
+use Elastic\Elasticsearch\Utility;
use Elastic\Transport\Exception\UnknownContentTypeException;
use Elastic\Transport\Serializer\CsvSerializer;
use Elastic\Transport\Serializer\JsonSerializer;
use Elastic\Transport\Serializer\NDJsonSerializer;
use Elastic\Transport\Serializer\XmlSerializer;
use Psr\Http\Message\ResponseInterface;
+use stdClass;
/**
* Wraps a PSR-7 ResponseInterface offering helpers to deserialize the body response
@@ -196,6 +199,8 @@ public function offsetExists($offset): bool
* ArrayAccess interface
*
* @see https://www.php.net/manual/en/class.arrayaccess.php
+ *
+ * @return mixed
*/
#[\ReturnTypeWillChange]
public function offsetGet($offset)
@@ -222,4 +227,63 @@ public function offsetUnset($offset): void
{
throw new ArrayAccessException('The array is reading only');
}
+
+ /**
+ * Map the response body to an object of a specific class
+ * by default the class is the PHP standard one (stdClass)
+ *
+ * This mapping works only for ES|QL results (with columns and values)
+ * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/esql.html
+ *
+ * @return object[]
+ */
+ public function mapTo(string $class = stdClass::class): array
+ {
+ $response = $this->asArray();
+ if (!isset($response['columns']) || !isset($response['values'])) {
+ throw new UnknownContentTypeException(sprintf(
+ "The response is not a valid ES|QL result. I cannot mapTo(\"%s\")",
+ $class
+ ));
+ }
+ $iterator = [];
+ $ncol = count($response['columns']);
+ foreach ($response['values'] as $value) {
+ $obj = new $class;
+ for ($i=0; $i < $ncol; $i++) {
+ $field = Utility::formatVariableName($response['columns'][$i]['name']);
+ if ($class !== stdClass::class && !property_exists($obj, $field)) {
+ continue;
+ }
+ switch($response['columns'][$i]['type']) {
+ case 'boolean':
+ $obj->{$field} = (bool) $value[$i];
+ break;
+ case 'date':
+ $obj->{$field} = new DateTime($value[$i]);
+ break;
+ case 'alias':
+ case 'text':
+ case 'keyword':
+ case 'ip':
+ $obj->{$field} = (string) $value[$i];
+ break;
+ case 'integer':
+ $obj->{$field} = (int) $value[$i];
+ break;
+ case 'long':
+ case 'double':
+ $obj->{$field} = (float) $value[$i];
+ break;
+ case 'null':
+ $obj->{$field} = null;
+ break;
+ default:
+ $obj->{$field} = $value[$i];
+ }
+ }
+ $iterator[] = $obj;
+ }
+ return $iterator;
+ }
}
\ No newline at end of file
diff --git a/src/Traits/ClientEndpointsTrait.php b/src/Traits/ClientEndpointsTrait.php
index dd09540e7..7a850486f 100644
--- a/src/Traits/ClientEndpointsTrait.php
+++ b/src/Traits/ClientEndpointsTrait.php
@@ -45,6 +45,8 @@ trait ClientEndpointsTrait
* _source_includes: list, // Default list of fields to extract and return from the _source field, can be overridden on each sub-request
* pipeline: string, // The pipeline id to preprocess incoming documents with
* require_alias: boolean, // Sets require_alias for all incoming documents. Defaults to unset (false)
+ * require_data_stream: boolean, // When true, requires the destination to be a data stream (existing or to-be-created). Default is false
+ * list_executed_pipelines: boolean, // Sets list_executed_pipelines for all incoming documents. Defaults to unset (false)
* 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)
@@ -69,7 +71,7 @@ public function bulk(array $params = [])
$url = '/_bulk';
$method = 'POST';
}
- $url = $this->addQueryString($url, $params, ['wait_for_active_shards','refresh','routing','timeout','type','_source','_source_excludes','_source_includes','pipeline','require_alias','pretty','human','error_trace','source','filter_path']);
+ $url = $this->addQueryString($url, $params, ['wait_for_active_shards','refresh','routing','timeout','type','_source','_source_excludes','_source_includes','pipeline','require_alias','require_data_stream','list_executed_pipelines','pretty','human','error_trace','source','filter_path']);
$headers = [
'Accept' => 'application/json',
'Content-Type' => 'application/x-ndjson',
@@ -589,6 +591,7 @@ public function explain(array $params = [])
* include_unmapped: boolean, // Indicates whether unmapped fields should be included in the response.
* filters: list, // An optional set of filters: can include +metadata,-metadata,-nested,-multifield,-parent
* types: list, // Only return results for fields that have one of the types in the list
+ * include_empty_fields: boolean, // Include empty fields in result
* 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)
@@ -612,7 +615,7 @@ public function fieldCaps(array $params = [])
$url = '/_field_caps';
$method = empty($params['body']) ? 'GET' : 'POST';
}
- $url = $this->addQueryString($url, $params, ['fields','ignore_unavailable','allow_no_indices','expand_wildcards','include_unmapped','filters','types','pretty','human','error_trace','source','filter_path']);
+ $url = $this->addQueryString($url, $params, ['fields','ignore_unavailable','allow_no_indices','expand_wildcards','include_unmapped','filters','types','include_empty_fields','pretty','human','error_trace','source','filter_path']);
$headers = [
'Accept' => 'application/json',
'Content-Type' => 'application/json',
@@ -872,6 +875,7 @@ public function healthReport(array $params = [])
* if_primary_term: number, // only perform the index operation if the last operation that has changed the document has the specified primary term
* pipeline: string, // The pipeline id to preprocess incoming documents with
* require_alias: boolean, // When true, requires destination to be an alias. Default is false
+ * require_data_stream: boolean, // When true, requires the destination to be a data stream (existing or to-be-created). Default is false
* 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)
@@ -897,7 +901,7 @@ public function index(array $params = [])
$url = '/' . $this->encode($params['index']) . '/_doc';
$method = 'POST';
}
- $url = $this->addQueryString($url, $params, ['wait_for_active_shards','op_type','refresh','routing','timeout','version','version_type','if_seq_no','if_primary_term','pipeline','require_alias','pretty','human','error_trace','source','filter_path']);
+ $url = $this->addQueryString($url, $params, ['wait_for_active_shards','op_type','refresh','routing','timeout','version','version_type','if_seq_no','if_primary_term','pipeline','require_alias','require_data_stream','pretty','human','error_trace','source','filter_path']);
$headers = [
'Accept' => 'application/json',
'Content-Type' => 'application/json',
@@ -1186,6 +1190,7 @@ public function mtermvectors(array $params = [])
* 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, // An index_filter specified with the Query DSL
* } $params
*
* @throws MissingParameterException if a required parameter is missing
@@ -1204,6 +1209,7 @@ public function openPointInTime(array $params = [])
$url = $this->addQueryString($url, $params, ['preference','routing','ignore_unavailable','expand_wildcards','keep_alive','pretty','human','error_trace','source','filter_path']);
$headers = [
'Accept' => 'application/json',
+ 'Content-Type' => 'application/json',
];
return $this->sendRequest($this->createRequest($method, $url, $headers, $params['body'] ?? null));
}
diff --git a/src/Traits/NamespaceTrait.php b/src/Traits/NamespaceTrait.php
index 857f7ace8..2bfa63f50 100644
--- a/src/Traits/NamespaceTrait.php
+++ b/src/Traits/NamespaceTrait.php
@@ -21,6 +21,7 @@
use Elastic\Elasticsearch\Endpoints\Cat;
use Elastic\Elasticsearch\Endpoints\Ccr;
use Elastic\Elasticsearch\Endpoints\Cluster;
+use Elastic\Elasticsearch\Endpoints\Connector;
use Elastic\Elasticsearch\Endpoints\DanglingIndices;
use Elastic\Elasticsearch\Endpoints\Enrich;
use Elastic\Elasticsearch\Endpoints\Eql;
@@ -38,12 +39,14 @@
use Elastic\Elasticsearch\Endpoints\Ml;
use Elastic\Elasticsearch\Endpoints\Monitoring;
use Elastic\Elasticsearch\Endpoints\Nodes;
+use Elastic\Elasticsearch\Endpoints\Profiling;
use Elastic\Elasticsearch\Endpoints\QueryRuleset;
use Elastic\Elasticsearch\Endpoints\Rollup;
use Elastic\Elasticsearch\Endpoints\SearchApplication;
use Elastic\Elasticsearch\Endpoints\SearchableSnapshots;
use Elastic\Elasticsearch\Endpoints\Security;
use Elastic\Elasticsearch\Endpoints\Shutdown;
+use Elastic\Elasticsearch\Endpoints\Simulate;
use Elastic\Elasticsearch\Endpoints\Slm;
use Elastic\Elasticsearch\Endpoints\Snapshot;
use Elastic\Elasticsearch\Endpoints\Sql;
@@ -109,6 +112,15 @@ public function cluster(): Cluster
}
+ public function connector(): Connector
+ {
+ if (!isset($this->namespace['Connector'])) {
+ $this->namespace['Connector'] = new Connector($this);
+ }
+ return $this->namespace['Connector'];
+ }
+
+
public function danglingIndices(): DanglingIndices
{
if (!isset($this->namespace['DanglingIndices'])) {
@@ -262,6 +274,15 @@ public function nodes(): Nodes
}
+ public function profiling(): Profiling
+ {
+ if (!isset($this->namespace['Profiling'])) {
+ $this->namespace['Profiling'] = new Profiling($this);
+ }
+ return $this->namespace['Profiling'];
+ }
+
+
public function queryRuleset(): QueryRuleset
{
if (!isset($this->namespace['QueryRuleset'])) {
@@ -316,6 +337,15 @@ public function shutdown(): Shutdown
}
+ public function simulate(): Simulate
+ {
+ if (!isset($this->namespace['Simulate'])) {
+ $this->namespace['Simulate'] = new Simulate($this);
+ }
+ return $this->namespace['Simulate'];
+ }
+
+
public function slm(): Slm
{
if (!isset($this->namespace['Slm'])) {
diff --git a/src/Utility.php b/src/Utility.php
index 0bc8593e1..d54185ce5 100644
--- a/src/Utility.php
+++ b/src/Utility.php
@@ -45,4 +45,18 @@ public static function urlencode(string $url): string
? urlencode($url)
: rawurlencode($url);
}
+
+ /**
+ * Remove all the characters not valid for a PHP variable name
+ * The valid characters are: a-z, A-Z, 0-9 and _ (underscore)
+ * The variable name CANNOT start with a number
+ */
+ public static function formatVariableName(string $var): string
+ {
+ // If the first character is a digit, we append the underscore
+ if (is_int($var[0])) {
+ $var = '_' . $var;
+ }
+ return preg_replace('/[^a-zA-Z0-9_]/', '', $var);
+ }
}
\ No newline at end of file
diff --git a/tests/ClientBuilderTest.php b/tests/ClientBuilderTest.php
index bd32f0d7d..fb1bab26b 100644
--- a/tests/ClientBuilderTest.php
+++ b/tests/ClientBuilderTest.php
@@ -32,7 +32,11 @@ class ClientBuilderTest extends TestCase
{
protected ClientInterface $httpClient;
protected LoggerInterface $logger;
-
+ protected HttpAsyncClient $asyncHttpClient;
+ protected NodePoolInterface $nodePool;
+ protected Psr17Factory $psr17Factory;
+ protected ClientBuilder $builder;
+
public function setUp(): void
{
$this->httpClient = $this->createStub(ClientInterface::class);
diff --git a/tests/ClientTest.php b/tests/ClientTest.php
index 0878b8a9d..01443594e 100644
--- a/tests/ClientTest.php
+++ b/tests/ClientTest.php
@@ -20,6 +20,7 @@
use Elastic\Elasticsearch\Exception\ServerResponseException;
use Elastic\Elasticsearch\Response\Elasticsearch;
use Elastic\Transport\NodePool\NodePoolInterface;
+use Elastic\Transport\Transport;
use Elastic\Transport\TransportBuilder;
use Http\Mock\Client as MockClient;
use Http\Promise\Promise;
@@ -29,6 +30,12 @@
class ClientTest extends TestCase
{
+ protected LoggerInterface $logger;
+ protected MockClient $httpClient;
+ protected Transport $transport;
+ protected Psr17Factory $psr17Factory;
+ protected Client $client;
+
public function setUp(): void
{
$this->logger = $this->createStub(LoggerInterface::class);
diff --git a/tests/Integration/BasicTest.php b/tests/Integration/BasicTest.php
index df080dee0..0ddc0971a 100644
--- a/tests/Integration/BasicTest.php
+++ b/tests/Integration/BasicTest.php
@@ -14,6 +14,7 @@
namespace Elastic\Elasticsearch\Tests\Integration;
+use Elastic\Elasticsearch\Client;
use Elastic\Elasticsearch\Tests\Utility;
use PHPUnit\Framework\TestCase;
@@ -22,6 +23,8 @@
*/
class BasicTest extends TestCase
{
+ protected Client $client;
+
public function setUp(): void
{
$this->client = Utility::getClient();
diff --git a/tests/Integration/BulkTest.php b/tests/Integration/BulkTest.php
index f33aaff2f..b7d535e8a 100644
--- a/tests/Integration/BulkTest.php
+++ b/tests/Integration/BulkTest.php
@@ -24,6 +24,8 @@ class BulkTest extends TestCase
{
const TEST_INDEX = 'test';
+ protected Client $client;
+
public function setUp(): void
{
$this->client = Utility::getClient();
diff --git a/tests/Integration/MlTest.php b/tests/Integration/MlTest.php
index d86d8d6bc..1caa25ddf 100644
--- a/tests/Integration/MlTest.php
+++ b/tests/Integration/MlTest.php
@@ -25,6 +25,8 @@ class MlTest extends TestCase
{
const JOB_ID = 'total-requests';
+ protected Client $client;
+
public function setUp(): void
{
$this->client = Utility::getClient();
diff --git a/tests/Response/ElasticsearchTest.php b/tests/Response/ElasticsearchTest.php
index 735755038..1a3e30827 100644
--- a/tests/Response/ElasticsearchTest.php
+++ b/tests/Response/ElasticsearchTest.php
@@ -14,16 +14,25 @@
namespace Elastic\Elasticsearch\Tests\Response;
+use DateTime;
use Elastic\Elasticsearch\Exception\ArrayAccessException;
use Elastic\Elasticsearch\Exception\ClientResponseException;
use Elastic\Elasticsearch\Exception\ProductCheckException;
use Elastic\Elasticsearch\Exception\ServerResponseException;
use Elastic\Elasticsearch\Response\Elasticsearch;
+use Elastic\Transport\Exception\UnknownContentTypeException;
use Nyholm\Psr7\Factory\Psr17Factory;
use PHPUnit\Framework\TestCase;
-
+use Psr\Http\Message\ResponseInterface;
+use stdClass;
class ElasticsearchTest extends TestCase
{
+ protected Psr17Factory $psr17Factory;
+ protected ResponseInterface $elasticsearch;
+ protected ResponseInterface $response200;
+ protected ResponseInterface $response400;
+ protected ResponseInterface $response500;
+
public function setUp(): void
{
$this->psr17Factory = new Psr17Factory();
@@ -208,4 +217,84 @@ public function testWithStatusForPsr7Version1And2Compatibility()
$this->elasticsearch = $this->elasticsearch->withStatus(400);
$this->assertEquals(400, $this->elasticsearch->getStatusCode());
}
+
+ public function testMapToStdClassAsDefault()
+ {
+ $array = [
+ 'columns' => [
+ ['name' => 'a', 'type' => 'integer'],
+ ['name' => 'b', 'type' => 'date']
+ ],
+ 'values' => [
+ [1, '2023-10-23T12:15:03.360Z'],
+ [3, '2023-10-23T13:55:01.543Z']
+ ]
+ ];
+ $body = $this->psr17Factory->createStream(json_encode($array));
+ $this->elasticsearch->setResponse($this->response200->withBody($body));
+
+ $iterator = $this->elasticsearch->mapTo();
+ $this->assertIsArray($iterator);
+ $this->assertEquals(stdClass::class, get_class($iterator[0]));
+ $this->assertEquals(stdClass::class, get_class($iterator[1]));
+ $this->assertEquals('integer', gettype($iterator[0]->a));
+ $this->assertEquals(DateTime::class, get_class($iterator[0]->b));
+ $this->assertEquals('integer', gettype($iterator[1]->a));
+ $this->assertEquals(DateTime::class, get_class($iterator[1]->b));
+ }
+
+ public function testMapToStdClass()
+ {
+ $array = [
+ 'columns' => [
+ ['name' => 'a', 'type' => 'integer'],
+ ['name' => 'b', 'type' => 'date']
+ ],
+ 'values' => [
+ [1, '2023-10-23T12:15:03.360Z'],
+ [3, '2023-10-23T13:55:01.543Z']
+ ]
+ ];
+ $body = $this->psr17Factory->createStream(json_encode($array));
+ $this->elasticsearch->setResponse($this->response200->withBody($body));
+
+ $iterator = $this->elasticsearch->mapTo(stdClass::class);
+ $this->assertIsArray($iterator);
+ $this->assertEquals(stdClass::class, get_class($iterator[0]));
+ $this->assertEquals(stdClass::class, get_class($iterator[1]));
+ }
+
+ public function testMapToWithoutEsqlResponseWillThrowException()
+ {
+ $array = ['foo' => 'bar'];
+ $body = $this->psr17Factory->createStream(json_encode($array));
+ $this->elasticsearch->setResponse($this->response200->withBody($body));
+
+ $this->expectException(UnknownContentTypeException::class);
+ $iterator = $this->elasticsearch->mapTo();
+ }
+
+ public function testMapToCustomClass()
+ {
+ $array = [
+ 'columns' => [
+ ['name' => 'a', 'type' => 'integer'],
+ ['name' => 'b', 'type' => 'date']
+ ],
+ 'values' => [
+ [1, '2023-10-23T12:15:03.360Z'],
+ [3, '2023-10-23T13:55:01.543Z']
+ ]
+ ];
+ $body = $this->psr17Factory->createStream(json_encode($array));
+ $this->elasticsearch->setResponse($this->response200->withBody($body));
+
+ $iterator = $this->elasticsearch->mapTo(TestMapClass::class);
+
+ $this->assertIsArray($iterator);
+ $this->assertEquals(TestMapClass::class, get_class($iterator[0]));
+ $this->assertEquals('integer', gettype($iterator[0]->a));
+ $this->assertEquals(DateTime::class, get_class($iterator[0]->b));
+ $this->assertEquals('', $iterator[0]->c);
+ }
}
\ No newline at end of file
diff --git a/tests/Response/TestMapClass.php b/tests/Response/TestMapClass.php
new file mode 100644
index 000000000..e319ac71c
--- /dev/null
+++ b/tests/Response/TestMapClass.php
@@ -0,0 +1,24 @@
+symfonyAdapter = new Symfony;
diff --git a/tests/Transport/AsyncOnSuccessNoExceptionTest.php b/tests/Transport/AsyncOnSuccessNoExceptionTest.php
index 0fe67ca61..8ab66dadd 100644
--- a/tests/Transport/AsyncOnSuccessNoExceptionTest.php
+++ b/tests/Transport/AsyncOnSuccessNoExceptionTest.php
@@ -21,6 +21,9 @@
class AsyncOnSuccessNoExceptionTest extends TestCase
{
+ protected Psr17Factory $psr17Factory;
+ protected AsyncOnSuccessNoException $asyncOnSuccess;
+
public function setUp(): void
{
$this->asyncOnSuccess = new AsyncOnSuccessNoException();
diff --git a/tests/Transport/AsyncOnSuccessTest.php b/tests/Transport/AsyncOnSuccessTest.php
index e3d6689dc..301f101f8 100644
--- a/tests/Transport/AsyncOnSuccessTest.php
+++ b/tests/Transport/AsyncOnSuccessTest.php
@@ -23,6 +23,9 @@
class AsyncOnSuccessTest extends TestCase
{
+ protected Psr17Factory $psr17Factory;
+ protected AsyncOnSuccess $asyncOnSuccess;
+
public function setUp(): void
{
$this->asyncOnSuccess = new AsyncOnSuccess();
diff --git a/util/ActionTest.php b/util/ActionTest.php
index 67bdda131..79b32ce1c 100644
--- a/util/ActionTest.php
+++ b/util/ActionTest.php
@@ -336,6 +336,38 @@ private function length(array $actions)
]);
}
+ private function requires(array $requires)
+ {
+ if (isset($requires['test_runner_features'])) {
+ if (is_string($requires['test_runner_features'])) {
+ $requires['test_runner_features'] = [$requires['test_runner_features']];
+ }
+ foreach ($requires['test_runner_features'] as $req) {
+ if (!in_array($requires['test_runner_features'], self::SUPPORTED_FEATURES)) {
+ return YamlTests::render(self::TEMPLATE_SKIP_FEATURE, [
+ ':testname' => "__CLASS__ . '::' . __FUNCTION__",
+ ':feature' => sprintf("'%s'", $req)
+ ]);
+ }
+ }
+ }
+ if (isset($requires['cluster_features'])) {
+ if (is_string($requires['cluster_features'])) {
+ $part = explode('_', $requires['cluster_features']);
+ if ($part[0] === 'gte') {
+ $version = str_replace ('v','', $part[1]);
+ if (version_compare(YamlTests::$esVersion, $version, '<')) {
+ return YamlTests::render(self::TEMPLATE_SKIP_VERSION, [
+ ':testname' => "__CLASS__ . '::' . __FUNCTION__",
+ ':esversion' => sprintf("'%s'", YamlTests::$esVersion),
+ ':reason' => sprintf("'%s'", $requires['reason'] ?? '')
+ ]);
+ }
+ }
+ }
+ }
+ }
+
private function skip(array $actions)
{
if (isset($actions['version']) && isset($actions['reason'])) {
@@ -388,7 +420,21 @@ private function skip(array $actions)
break;
}
}
-
+ }
+ if (isset($actions['cluster_features'])) {
+ if (is_string($actions['cluster_features'])) {
+ $part = explode('_', $actions['cluster_features']);
+ if ($part[0] === 'gte') {
+ $version = str_replace ('v','', $part[1]);
+ if (version_compare(YamlTests::$esVersion, $version, '>=')) {
+ return YamlTests::render(self::TEMPLATE_SKIP_VERSION, [
+ ':testname' => "__CLASS__ . '::' . __FUNCTION__",
+ ':esversion' => sprintf("'%s'", YamlTests::$esVersion),
+ ':reason' => sprintf("'%s'", $actions['reason'] ?? '')
+ ]);
+ }
+ }
+ }
}
}
diff --git a/util/RestSpecRunner.php b/util/RestSpecRunner.php
index 121c68790..8f749c0ad 100644
--- a/util/RestSpecRunner.php
+++ b/util/RestSpecRunner.php
@@ -39,7 +39,8 @@
$version = $serverInfo['version']['number'];
$artifactFile = sprintf("rest-resources-zip-%s.zip", $version);
-$tempFilePath = sprintf("%s/%s.zip", sys_get_temp_dir(), $serverInfo['version']['build_hash']);
+$buildHash = $serverInfo['version']['build_hash'];
+$tempFilePath = sprintf("%s/%s.zip", sys_get_temp_dir(), $buildHash);
if (!file_exists($tempFilePath)) {
// Download of Elasticsearch rest-api artifacts
@@ -49,28 +50,37 @@
exit(1);
}
$content = json_decode($json, true);
+ $found = false;
foreach ($content['version']['builds'] as $builds) {
- if ($builds['projects']['elasticsearch']['commit_hash'] === $serverInfo['version']['build_hash']) {
+ if ($builds['projects']['elasticsearch']['commit_hash'] === $buildHash) {
// Download the artifact ZIP file (rest-resources-zip-$version.zip)
printf("Download %s\n", $builds['projects']['elasticsearch']['packages'][$artifactFile]['url']);
if (!copy($builds['projects']['elasticsearch']['packages'][$artifactFile]['url'], $tempFilePath)) {
printf ("ERROR: failed to download %s\n", $artifactFile);
}
+ $found = true;
break;
}
}
+ if (!$found) {
+ $build = $content['version']['builds'][0]; // pick the most recent
+ $resource = $build["projects"]["elasticsearch"]["packages"][sprintf("rest-resources-zip-%s.zip", $version)]['url'];
+ if (!copy($resource, $tempFilePath)) {
+ printf ("ERROR: failed to download %s\n", $resource);
+ }
+ }
} else {
printf("The file %s already exists\n", $tempFilePath);
}
if (!file_exists($tempFilePath)) {
- printf("ERROR: the commit_hash %s has not been found\n", $serverInfo['version']['build_hash']);
+ printf("ERROR: I cannot download file %s\n", $tempFilePath);
exit(1);
}
$zip = new ZipArchive();
$zip->open($tempFilePath);
-printf("Extracting %s\ninto %s/rest-spec/%s\n", $tempFilePath, __DIR__, $serverInfo['version']['build_hash']);
-$zip->extractTo(sprintf("%s/rest-spec/%s", __DIR__, $serverInfo['version']['build_hash']));
+printf("Extracting %s\ninto %s/rest-spec/%s\n", $tempFilePath, __DIR__, $buildHash);
+$zip->extractTo(sprintf("%s/rest-spec/%s", __DIR__, $buildHash));
$zip->close();
printf ("Rest-spec API installed successfully!\n\n");
\ No newline at end of file
diff --git a/util/YamlTests.php b/util/YamlTests.php
index b87d8d8bc..3cea1ac21 100644
--- a/util/YamlTests.php
+++ b/util/YamlTests.php
@@ -39,7 +39,8 @@ class YamlTests
'free/cluster.desired_nodes/20_dry_run.yml',
'free/health/',
'free/cluster.desired_balance/10_basic.yml',
- 'free/cluster.prevalidate_node_removal/10_basic.yml'
+ 'free/cluster.prevalidate_node_removal/10_basic.yml',
+ 'free/cluster.desired_nodes/11_old_format.yml'
];
const SKIPPED_TEST_OSS = [
@@ -55,6 +56,7 @@ class YamlTests
'Indices\GetIndexTemplate\_10_BasicTest::*' => 'Bool mismatch',
'Indices\PutTemplate\_10_BasicTest::PutTemplateCreate' => 'index_template [test] already exists',
'Indices\Refresh\_10_BasicTest::IndicesRefreshTestEmptyArray' => 'empty array?',
+ 'Indices\ResolveCluster\_10_Basic_Resolve_ClusterTest::TestResolveClusterOptionalParamsAreAccepted' => 'Bool mismatch',
'Indices\SimulateIndexTemplate\_10_BasicTest::SimulateIndexTemplateWithIndexNotMatchingAnyTemplate' => 'Bool mismatch',
'Search\Vectors\_90_Sparse_VectorTest::SparseVectorIn800X8110' => 'Undefined array key error',
'Snapshot\Create\_10_BasicTest::CreateASnapshot' => 'Invalid snapshot name [test_snapshot]',
@@ -66,6 +68,8 @@ class YamlTests
'ApiKey\_10_BasicTest::TestGetApiKey' => 'Mismatch values',
'ApiKey\_20_QueryTest::TestQueryApiKey' => 'Mismatch values',
'DataStream\_80_Resolve_Index_Data_StreamsTest::*' => 'Skipped all tests',
+ 'Dlm\_10_UsageTest::TestDataStreamLifecycleUsageStats' => 'Mismatch values',
+ 'Esql\_30_TypesTest::Unsigned_long' => 'Format number issue',
'Health\_10_UsageTest::UsageStatsOnTheHealthAPI' => 'Undefined array key \"green\"',
'License\_20_Put_LicenseTest::*' => 'License issue',
'License\_30_Enterprise_LicenseTest::*' => 'Invalid license',
@@ -93,16 +97,20 @@ class YamlTests
'RuntimeFields\_40_DateTest::GetMapping' => 'String mismatch',
'RuntimeFields\_50_IpTest::GetMapping' => 'String mismatch',
'RuntimeFields\_60_BooleanTest::GetMapping' => 'String mismatch',
+ 'SearchBusinessRules\_10_Pinned_QueryTest::TestPinnedQueryWithDocsAndNoIndexFailInPreviousVersions' => 'No exception thrown',
'SearchableSnapshots\_10_UsageTest::*' => 'Mismatch values',
'SearchableSnapshots\_20_Synthetic_SourceTest::*' => 'no_shard_available_action_exception',
'ServiceAccounts\_10_BasicTest::TestServiceAccountTokens' => 'Count mismatch',
'Snapshot\_10_BasicTest::CreateASourceOnlySnapshotAndThenRestoreIt' => 'Snapshot name already exists',
'Snapshot\_20_Operator_Privileges_DisabledTest::OperatorOnlySettingsCanBeSetAndRestoredByNonoperatorUserWhenOperatorPrivilegesIsDisabled' => 'Count mismatch',
+ 'Spatial\_130_Geo_Shape_RuntimeTest::GetMapping' => 'Escape string issue',
+ 'Sql\_SqlTest::PagingThroughResults' => 'Mismatch values',
'Ssl\_10_BasicTest::TestGetSSLCertificates' => 'Mismatch values',
'Token\_10_BasicTest::TestInvalidateUsersTokens' => 'Mismatch values',
'Token\_10_BasicTest::TestInvalidateRealmsTokens' => 'Mismatch values',
'Transform\_Transforms_CrudTest::TestDeleteTransformWhenItDoesNotExist' => 'Invalid version format: TRANSFORM HTTP/1.1',
'UnsignedLong\*' => 'Skipped all tests',
+ 'Users\_40_QueryTest::TestQueryUser' => 'Mismatch values',
'Vectors\_30_Sparse_Vector_BasicTest::DeprecatedFunctionSignature' => 'Failed asserting contains string',
];