diff --git a/.buildkite/Dockerfile b/.buildkite/Dockerfile
index 7d267991f..fb0f905d9 100644
--- a/.buildkite/Dockerfile
+++ b/.buildkite/Dockerfile
@@ -1,4 +1,4 @@
-ARG PHP_VERSION=8.0-cli
+ARG PHP_VERSION=8.4-cli
FROM php:${PHP_VERSION}
WORKDIR /usr/src/app
@@ -39,4 +39,4 @@ RUN composer install --no-progress > /dev/null
COPY . .
-CMD ["bash", ".buildkite/yaml-tests.sh"]
+CMD ["bash", ".buildkite/yaml-tests.sh"]
\ No newline at end of file
diff --git a/.buildkite/pipeline.yml b/.buildkite/pipeline.yml
index d087788f2..128c2c338 100644
--- a/.buildkite/pipeline.yml
+++ b/.buildkite/pipeline.yml
@@ -7,17 +7,16 @@ steps:
env:
PHP_VERSION: "{{ matrix.php }}"
TEST_SUITE: "{{ matrix.suite }}"
- STACK_VERSION: 8.14.0-SNAPSHOT
+ STACK_VERSION: 9.0.0-SNAPSHOT
+ BRANCH_CLIENT_TESTS: 9.0
matrix:
setup:
suite:
- - "free"
- "platinum"
php:
+ - "8.4-cli"
- "8.3-cli"
- "8.2-cli"
- "8.1-cli"
- - "8.0-cli"
- - "7.4-cli"
command: ./.buildkite/run-tests
artifact_paths: "*.xml"
diff --git a/.buildkite/run-repository.sh b/.buildkite/run-repository.sh
index 51a3d2bb5..6d31f4fd7 100644
--- a/.buildkite/run-repository.sh
+++ b/.buildkite/run-repository.sh
@@ -9,7 +9,7 @@ script_path=$(dirname $(realpath -s $0))
source $script_path/functions/imports.sh
set -euo pipefail
-PHP_VERSION=${PHP_VERSION-8.2-cli}
+PHP_VERSION=${PHP_VERSION-8.4-cli}
ELASTICSEARCH_URL=${ELASTICSEARCH_URL-"$elasticsearch_url"}
elasticsearch_container=${elasticsearch_container-}
@@ -18,6 +18,7 @@ echo -e "\033[34;1mINFO:\033[0m TEST_SUITE ${TEST_SUITE}\033[0m"
echo -e "\033[34;1mINFO:\033[0m URL ${ELASTICSEARCH_URL}\033[0m"
echo -e "\033[34;1mINFO:\033[0m CONTAINER ${elasticsearch_container}\033[0m"
echo -e "\033[34;1mINFO:\033[0m PHP_VERSION ${PHP_VERSION}\033[0m"
+echo -e "\033[34;1mINFO:\033[0m BRANCH_CLIENT_TESTS ${BRANCH_CLIENT_TESTS}\033[0m"
echo -e "\033[1m>>>>> Build docker container >>>>>>>>>>>>>>>>>>>>>>>>>>>>>\033[0m"
@@ -40,7 +41,8 @@ docker run \
--env TEST_SUITE=${TEST_SUITE} \
--env PHP_VERSION=${PHP_VERSION} \
--env ELASTICSEARCH_URL=${ELASTICSEARCH_URL} \
+ --env BRANCH_CLIENT_TESTS=${BRANCH_CLIENT_TESTS} \
--ulimit nofile=65535:65535 \
--name elasticsearch-php \
--rm \
- elastic/elasticsearch-php
+ elastic/elasticsearch-php
\ No newline at end of file
diff --git a/.buildkite/yaml-tests.sh b/.buildkite/yaml-tests.sh
index 0a83f93e2..5891bf6b2 100755
--- a/.buildkite/yaml-tests.sh
+++ b/.buildkite/yaml-tests.sh
@@ -1,10 +1,16 @@
#!/usr/bin/env bash
-# Checkout the YAML test from Elasticsearch tag
-php util/RestSpecRunner.php
+# Clone the elasticsearch-clients-tests repository
+git clone -b ${BRANCH_CLIENT_TESTS} https://github.com/elastic/elasticsearch-clients-tests.git tests/elasticsearch-clients-tests
-# Generate the YAML tests for PHPUnit
-php util/build_tests.php
+# Build the YAML tests
+php tests/build_es_tests.php tests/elasticsearch-clients-tests/tests stack tests/Yaml
# Run YAML tests
-vendor/bin/phpunit -c "phpunit-yaml-${TEST_SUITE}-tests.xml"
\ No newline at end of file
+vendor/bin/phpunit -c "phpunit-yaml-stack-tests.xml"
+
+# Remove Yaml tests
+rm -rf tests/Yaml
+
+# Remove elasticsearch-clients-tests folder
+rm -rf tests/elasticsearch-clients-tests
\ No newline at end of file
diff --git a/.github/workflows/docs-build.yml b/.github/workflows/docs-build.yml
new file mode 100644
index 000000000..bb466166d
--- /dev/null
+++ b/.github/workflows/docs-build.yml
@@ -0,0 +1,19 @@
+name: docs-build
+
+on:
+ push:
+ branches:
+ - main
+ pull_request_target: ~
+ merge_group: ~
+
+jobs:
+ docs-preview:
+ uses: elastic/docs-builder/.github/workflows/preview-build.yml@main
+ with:
+ path-pattern: docs/**
+ permissions:
+ deployments: write
+ id-token: write
+ contents: read
+ pull-requests: read
diff --git a/.github/workflows/docs-cleanup.yml b/.github/workflows/docs-cleanup.yml
new file mode 100644
index 000000000..f83e017b5
--- /dev/null
+++ b/.github/workflows/docs-cleanup.yml
@@ -0,0 +1,14 @@
+name: docs-cleanup
+
+on:
+ pull_request_target:
+ types:
+ - closed
+
+jobs:
+ docs-preview:
+ uses: elastic/docs-builder/.github/workflows/preview-cleanup.yml@main
+ permissions:
+ contents: none
+ id-token: write
+ deployments: write
diff --git a/.github/workflows/integration_test.yml b/.github/workflows/integration_test.yml
new file mode 100644
index 000000000..b91994068
--- /dev/null
+++ b/.github/workflows/integration_test.yml
@@ -0,0 +1,50 @@
+name: PHP integration tests
+
+on: [push, pull_request]
+
+jobs:
+ test:
+ name: Test
+ runs-on: ${{ matrix.os }}
+
+ strategy:
+ matrix:
+ php-version: [8.1, 8.2, 8.3, 8.4]
+ os: [ubuntu-latest]
+ es-version: [9.0.0-SNAPSHOT]
+
+ steps:
+ - name: Checkout
+ uses: actions/checkout@v4
+
+ - name: Use PHP ${{ matrix.php-version }}
+ uses: shivammathur/setup-php@v2
+ with:
+ php-version: ${{ matrix.php-version }}
+ extensions: yaml, zip, curl
+ coverage: none
+ env:
+ COMPOSER_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+
+ - name: Get composer cache directory
+ id: composercache
+ run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
+ - name: Cache dependencies
+ uses: actions/cache@v4
+ with:
+ path: ${{ steps.composercache.outputs.dir }}
+ key: ${{ runner.os }}-php-${{ matrix.php-version }}-${{ hashFiles('**/composer.json') }}
+ restore-keys: ${{ runner.os }}-php-${{ matrix.php-version }}-
+
+ - name: Install dependencies
+ run: |
+ composer install --prefer-dist
+
+ - name: Run Elasticsearch using start-local
+ run: |
+ curl -fsSL https://elastic.co/start-local | sh -s -- -v ${{ matrix.es-version }} -esonly
+
+ - name: Integration tests
+ run: |
+ source elastic-start-local/.env
+ ELASTICSEARCH_URL="http://elastic:${ES_LOCAL_PASSWORD}@localhost:9200" TEST_SUITE="free" composer run-script integration-test
diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml
index 822de1841..0e60b4ef9 100644
--- a/.github/workflows/test.yml
+++ b/.github/workflows/test.yml
@@ -1,4 +1,4 @@
-name: PHP test
+name: PHP tests
on: [push, pull_request]
@@ -9,9 +9,9 @@ jobs:
strategy:
matrix:
- php-version: [7.4, 8.0, 8.1, 8.2, 8.3]
+ php-version: [8.1, 8.2, 8.3, 8.4]
os: [ubuntu-latest]
- es-version: [8.14-SNAPSHOT]
+ es-version: [9.0.0-SNAPSHOT]
steps:
- name: Checkout
diff --git a/.github/workflows/yaml_test.yml b/.github/workflows/yaml_test.yml
new file mode 100644
index 000000000..dd4ac3f1f
--- /dev/null
+++ b/.github/workflows/yaml_test.yml
@@ -0,0 +1,57 @@
+name: PHP YAML tests
+
+on: [push, pull_request]
+
+jobs:
+ test:
+ name: Test
+ runs-on: ${{ matrix.os }}
+
+ strategy:
+ matrix:
+ php-version: [8.1, 8.2, 8.3, 8.4]
+ os: [ubuntu-latest]
+ es-version: [9.0.0-SNAPSHOT]
+ test-suite: [stack]
+ branch-client-tests: ["9.0"]
+
+ steps:
+ - name: Checkout
+ uses: actions/checkout@v4
+
+ - name: Use PHP ${{ matrix.php-version }}
+ uses: shivammathur/setup-php@v2
+ with:
+ php-version: ${{ matrix.php-version }}
+ extensions: yaml, zip, curl
+ coverage: none
+ env:
+ COMPOSER_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+
+ - name: Get composer cache directory
+ id: composercache
+ run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
+ - name: Cache dependencies
+ uses: actions/cache@v4
+ with:
+ path: ${{ steps.composercache.outputs.dir }}
+ key: ${{ runner.os }}-php-${{ matrix.php-version }}-${{ hashFiles('**/composer.json') }}
+ restore-keys: ${{ runner.os }}-php-${{ matrix.php-version }}-
+
+ - name: Install dependencies
+ run: |
+ composer install --prefer-dist
+
+ - name: Run Elasticsearch using start-local
+ run: |
+ curl -fsSL https://elastic.co/start-local | sh -s -- -v ${{ matrix.es-version }} -esonly
+
+ - name: Build PHPUnit tests
+ run: |
+ git clone -b ${{ matrix.branch-client-tests }} https://github.com/elastic/elasticsearch-clients-tests.git tests/elasticsearch-clients-tests
+ php tests/build_es_tests.php tests/elasticsearch-clients-tests/tests ${{ matrix.test-suite }} tests/Yaml
+
+ - name: YAML tests
+ run: |
+ source elastic-start-local/.env
+ ELASTICSEARCH_URL="http://elastic:${ES_LOCAL_PASSWORD}@localhost:9200" TEST_SUITE="free" vendor/bin/phpunit -c "phpunit-yaml-${{ matrix.test-suite }}-tests.xml"
diff --git a/.gitignore b/.gitignore
index 61b321f53..d2439897f 100755
--- a/.gitignore
+++ b/.gitignore
@@ -27,6 +27,7 @@ util/cache/
util/*.zip
util/output/
util/rest-spec
+elastic-start-local/
# Doctum docs generator
/doctum.phar
@@ -35,6 +36,7 @@ util/doctum.phar
# PHPUnit
/phpunit.xml
.phpunit.result.cache
+.phpunit.cache/
# Code coverage
build
diff --git a/BREAKING_CHANGES.md b/BREAKING_CHANGES.md
index b5b6bc48d..503a9cb57 100644
--- a/BREAKING_CHANGES.md
+++ b/BREAKING_CHANGES.md
@@ -1,3 +1,7 @@
+# 9.0
+
+- **Use of PHP 8.1+:** Starting from 9.0.0 the `elasticsearch-php` client requires PHP 8.1+.
+
# 8.0
This major release is a complete new PHP client for Elasticsearch. We build it from scratch!
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 6ceda3d5a..8bbd87174 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,3 +1,27 @@
+## Release 9.0.0
+
+- **Use of PHP 8.1+:** Starting from 9.0.0 the `elasticsearch-php` client requires PHP 8.1+.
+- **Compatibility with Elasticsearch 9.0:** All changes and additions to Elasticsearch APIs for its 9.0 release are reflected in this release.
+- **Serverless client merged in:** the `elastic/elasticsearch-serverless` client is being deprecated, and its functionality has been merged back into this client. This should have zero impact on the way the client works by default. If an endpoint is available in serverless, the PHP function will contains a `@group serverless` phpdoc attribute.
+If you try to use an endpoint that is not available in serverless you will get a `410` HTTP error with a message as follows:
+"this endpoint exists but is not available when running in serverless mode".
+The 9.0.0 client can recognize that it is communicating with a serverless instance if you are using a URL managed by Elastic (e.g. `*.elastic.cloud`).
+If you are using a proxy, the client will be able to recognize that the host is serverless from the first response. Alternatively, you can explicitly indicate that the host is serverless using the `Client::setServerless(true)` function (`false` by default).
+- **New transport library with PSR-18 cURL client as default:** we've removed the Guzzle dependency from the client. By default, the built-in cURL-based HTTP client will be used if no other PSR-18 compatible clients are detected. See release [9.0.0](https://github.com/elastic/elastic-transport-php/releases/tag/v9.0.0) of elastic-transport-php.
+
+## Release 8.17.1
+
+- Fix and improvements for PHPStan (rule level 5) #1442 (thanks @AJenbo)
+
+## Release 8.17.0
+
+- Updated the APIs to Elasticsearch [8.17.0](https://www.elastic.co/guide/en/elasticsearch/reference/current/release-notes-8.17.0.html)
+
+## Release 8.16.0
+
+- Updated the APIs to Elasticsearch [8.16.0](https://www.elastic.co/guide/en/elasticsearch/reference/current/release-notes-8.16.0.html)
+- Added the support of PHP 8.4 #1415 (thanks @ruudk)
+
## Release 8.15.0
Updated the APIs to Elasticsearch [8.15.0](https://www.elastic.co/guide/en/elasticsearch/reference/current/release-notes-8.15.0.html) and added the support of OpenTelemetry.
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
new file mode 100644
index 000000000..63a1a249b
--- /dev/null
+++ b/CONTRIBUTING.md
@@ -0,0 +1,93 @@
+# Contributing to the PHP Elasticsearch Client
+
+If you have a bugfix or new feature that you would like to contribute to
+elasticsearch-php, please find or open an issue about it first. Talk about what
+you would like to do. It may be that somebody is already working on it, or that
+there are particular issues that you should know about before implementing the
+change.
+
+We enjoy working with contributors to get their code accepted. There are many
+approaches to fixing a problem and it is important to find the best approach
+before writing too much code.
+
+## Running Elasticsearch locally
+
+We've provided a script to start an Elasticsearch cluster of a certain version
+found at `.buildkite/run-elasticsearch.sh`.
+
+There are several environment variables that control integration tests:
+
+- `TEST_SUITE`: `free` or `platinum` for running Elasticsearch in different
+ versions.
+- `STACK_VERSION`: Version of Elasticsearch to use. These should be
+ the same as tags of `docker.elastic.co/elasticsearch/elasticsearch`
+ such as `8.0.0-SNAPSHOT`, `7.x-SNAPSHOT`, etc. Defaults to the
+ same `*-SNAPSHOT` version as the branch.
+
+**NOTE: You don't need to run the live integration tests for all changes. If
+you don't have Elasticsearch running locally the integration tests will be skipped.**
+
+## API Code Generation
+
+All API methods in `src/Endpoints` and in `src/Traits/ClientEndpointsTrait.php` are
+automatically generated from the [Elasticsearch specification](https://github.com/elastic/elasticsearch-specification)
+and [rest-api-spec](https://github.com/elastic/elasticsearch/tree/master/rest-api-spec/src/main/resources/rest-api-spec/api).
+
+You can check if a PHP file has been generated searching for `@generated` tag
+in the source code (e.g. [here](https://github.com/elastic/elasticsearch-php/blob/main/src/Traits/ClientEndpointsTrait.php#L27)
+in the `ClientEndpointsTrait.php`).
+
+Any changes to these files should be avoid, you can submit to the Elasticsearch
+specification project and will be imported the next time the client will be generated.
+The generator itself is currently a private project.
+
+## Contributing Code Changes
+
+The process for contributing to any of the Elasticsearch repositories is similar.
+
+1. Please make sure you have signed the [Contributor License
+ Agreement](http://www.elastic.co/contributor-agreement/). We are not
+ asking you to assign copyright to us, but to give us the right to distribute
+ your code without restriction. We ask this of all contributors in order to
+ assure our users of the origin and continuing existence of the code. You only
+ need to sign the CLA once.
+
+2. Run the linter and test suite to ensure your changes do not break existing code.
+ Run the last optional step only if you want to test your changes with the
+ integration tests. You need to specify the `STACK_VERSION` of Elasticsearch (e.g.
+ `8.17.0`), you can check the Elasticsearch versions [here](https://github.com/elastic/elasticsearch/releases).
+
+ ```
+ # Run PHPStan, see https://phpstan.org/
+ $ composer run-script phpstan
+
+ # Run the unit tests
+ $ composer run-script test
+
+ # Run the integration tests (optional)
+ $ STACK_VERSION="8.17.0" .buildkite/run-tests
+ ```
+
+3. Rebase your changes.
+ Update your local repository with the most recent code from the main
+ elasticsearch-php repository, and rebase your branch on top of the latest branch.
+ If you want to propose a change in the latest version, you need to use the `main`
+ branch. If you are proposing for `8.x` version you should use the latest
+ minor branch (e.g. `8.17`). If want to propose a change for the oldest versions
+ you need to use the `7.17` or `6.8.x` branches. Remember, we support only the latest
+ minor of the previous majour. For instance, if the latest version is `8.x` we
+ support the last minor of `7.x` (i.e. `7.17`).
+ We prefer your changes to be squashed into a single commit for easier
+ backporting.
+
+4. Submit a pull request. Push your local changes to your forked copy of the
+ repository and submit a pull request. In the pull request, describe what your
+ changes do and mention the number of the issue where discussion has taken
+ place, eg “Closes #123″. Please consider adding or modifying tests related to
+ your changes.
+
+Then sit back and wait. There will probably be a discussion about the pull
+request and, if any changes are needed, we would love to work with you to get
+your pull request merged into elasticsearch-php.
+
+Thanks in advance for all your future contributions!
\ No newline at end of file
diff --git a/README.md b/README.md
index 0a686bc77..4464afb4b 100644
--- a/README.md
+++ b/README.md
@@ -1,5 +1,5 @@
-
+
# Elasticsearch PHP client
@@ -9,9 +9,12 @@
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)**
+You can run [Elasticsearch](https://www.elastic.co/elasticsearch) and [Kibana](https://www.elastic.co/kibana) on your local machine using this command:
+
+```bash
+curl -fsSL https://elastic.co/start-local | sh
+```
+or **[sign-up](https://cloud.elastic.co/registration?elektra=en-ess-sign-up-page)**
**for a free trial of Elastic Cloud**.
## Contents
@@ -40,7 +43,7 @@ of the getting started documentation.
## Usage
-The `elasticsearch-php` client offers 400+ endpoints for interacting with
+The `elasticsearch-php` client offers 500+ 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.
@@ -63,8 +66,8 @@ This client is versioned and released alongside Elasticsearch server.
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
-not `8.0`.
+For example, for Elasticsearch `8.16`, use `8.16` of this library or above, but
+not `9.0`.
## Compatibility
@@ -82,33 +85,24 @@ compatible with default distributions and without guarantees made.
| Elasticsearch Version | Elasticsearch-PHP Branch | Supported |
| --------------------- | ------------------------ | --------- |
| main | main | |
+| 9.x | 9.x | 9.x |
| 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.
-
-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)
- library for HTTP communications;
-- 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
- API response as in 7.x, no BC break here! :angel:
-- we changed the `ConnectionPool` in `NodePool`. The `connection` naming was
- ambigous since the objects are nodes (hosts)
+The 9.0.0 version of `elasticsearch-php` contains the same architecture of 8.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 avoid BC breaks for `9.x`, here the main changes:
+
+- **Compatibility with Elasticsearch 9.0:** All changes and additions to Elasticsearch APIs for its 9.0 release are reflected in this release.
+- **Serverless client merged in:** the `elastic/elasticsearch-serverless` client is being deprecated, and its functionality has been merged back into this client. This should have zero impact on the way the client works by default. If an endpoint is available in serverless, the PHP function will contains a `@group serverless` phpdoc attribute.
+If you try to use an endpoint that is not available in serverless you will get a `410` HTTP error with a message as follows:
+"this endpoint exists but is not available when running in serverless mode".
+The 9.0.0 client can recognize that it is communicating with a serverless instance if you are using a URL managed by Elastic (e.g. `*.elastic.cloud`).
+If you are using a proxy, the client will be able to recognize that the host is serverless from the first response. Alternatively, you can explicitly indicate that the host is serverless using the `Client::setServerless(true)` function (`false` by default).
+- **New transport library with PSR-18 cURL client as default:** we've removed the Guzzle dependency from the client. By default, the built-in cURL-based HTTP client will be used if no other PSR-18 compatible clients are detected. See release [9.0.0](https://github.com/elastic/elastic-transport-php/releases/tag/v9.0.0) of elastic-transport-php.
You can have a look at the [BREAKING_CHANGES](BREAKING_CHANGES.md) file for more
information.
@@ -180,19 +174,8 @@ You can checkout the
## 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
- [Contributor Agreement](https://www.elastic.co/contributor-agreement).
-- 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
- 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/).
+We welcome contributors to the project. You can refer to the [CONTRIBUTING](CONTRIBUTING.md)
+guide for more information.
Thanks in advance for your contribution! :heart:
diff --git a/composer.json b/composer.json
index 1a71c3be8..1d6688b09 100644
--- a/composer.json
+++ b/composer.json
@@ -3,32 +3,32 @@
"description": "PHP Client for Elasticsearch",
"keywords": [
"search",
- "client",
+ "client",
"elasticsearch",
"elastic"
],
"type": "library",
"license": "MIT",
"require": {
- "php": "^7.4 || ^8.0",
- "elastic/transport": "^8.10",
+ "php": "^8.1",
+ "elastic/transport": "^9.0",
"psr/http-client": "^1.0",
- "psr/http-message": "^1.1 || ^2.0",
- "psr/log": "^1|^2|^3",
- "guzzlehttp/guzzle": "^7.0"
+ "psr/http-message": "^2.0",
+ "psr/log": "^2.0|^3.0"
},
"require-dev": {
"ext-yaml": "*",
"ext-zip": "*",
- "mockery/mockery": "^1.5",
- "phpstan/phpstan": "^1.4",
- "phpunit/phpunit": "^9.5",
- "symfony/finder": "~4.0",
- "nyholm/psr7": "^1.5",
- "php-http/mock-client": "^1.5",
- "symfony/http-client": "^5.0|^6.0|^7.0",
+ "mockery/mockery": "^1.6",
+ "phpstan/phpstan": "^2.1",
+ "phpunit/phpunit": "^10.0",
+ "symfony/finder": "^6.0",
+ "nyholm/psr7": "^1.8",
+ "php-http/mock-client": "^1.6",
"psr/http-factory" : "^1.0",
- "php-http/message-factory" : "^1.0"
+ "guzzlehttp/guzzle": "^7.0",
+ "symfony/http-client": "^6.0|^7.0",
+ "nette/php-generator": "^4.0"
},
"autoload": {
"psr-4": {
@@ -52,7 +52,7 @@
"vendor/bin/phpunit --testdox -c phpunit-integration-cloud-tests.xml"
],
"phpstan": [
- "phpstan analyse src --level 2 --no-progress --memory-limit 256M"
+ "phpstan analyse --no-progress --memory-limit 256M"
]
},
"config": {
diff --git a/docs/breaking-changes.asciidoc b/docs/breaking-changes.asciidoc
deleted file mode 100644
index 7bbd4f8d9..000000000
--- a/docs/breaking-changes.asciidoc
+++ /dev/null
@@ -1,49 +0,0 @@
-[[breaking_changes]]
-=== Breaking changes from 7.x
-
-This major release is a complete new PHP client for {es}. We build it from scratch!
-We tried to reduce the BC breaks as much as possible but there are some (big) differences:
-
-[discrete]
-==== Architectural changes
-
-- we changed the namespace, now everything is under `Elastic\Elasticsearch`
-- we used the https://github.com/elastic/elastic-transport-php[elastic-transport-php] library for HTTP communications;
-- 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 endpoint using an https://github.com/elastic/elasticsearch-php/blob/master/src/Response/Elasticsearch.php[Elasticsearch] response class.
- This class wraps a https://www.php-fig.org/psr/psr-7/[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 ambigous since the objects are nodes (hosts)
-
-[discrete]
-==== Specific changes
-
-The following functions has been removed:
-
-- `ClientBuilder::getEndpoint()`
-- `ClientBuilder::getRegisteredNamespacesBuilders()`
-- `ClientBuilder::getRegisteredNamespacesBuilders()`
-- `ClientBuilder::defaultHandler()`
-- `ClientBuilder::multiHandler()`
-- `ClientBuilder::singleHandler()`
-- `ClientBuilder::setConnectionFactory()`
-- `ClientBuilder::setConnectionPool()`, you can use `ClientBuilder::setNodePool` instead
-- `ClientBuilder::setEndpoint()`
-- `ClientBuilder::registerNamespace()`
-- `ClientBuilder::setTransport()`, you can specify an HTTP PSR-18 client using `ClientBuilder::setHttpClient()`
-- `ClientBuilder::setHandler()`
-- `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 https://github.com/elastic/elastic-transport-php/blob/8.x/README.md#use-a-custom-selector[here] for more information
-- `ClientBuilder::setSniffOnStart()`
-- `ClientBuilder::includePortInHostHeader()`
-
-We removed the special `client` parameter passed in `$params` endpoints. In details:
-
-- `$params['client']['never_retry']`
-- `$params['client']['verbose']`
-- `$params['client']['port_in_header']`
-- `$params['client']['future']`, you can set HTTP async using `Client::setAsync(true)`
-- `$params['client']['ignore']`, you can disable the Exception using `Client::setResponseException(false)`
diff --git a/docs/config-hash.asciidoc b/docs/config-hash.asciidoc
deleted file mode 100644
index 97949e7ed..000000000
--- a/docs/config-hash.asciidoc
+++ /dev/null
@@ -1,41 +0,0 @@
-[discrete]
-[[config-hash]]
-=== Building the client from a configuration hash
-
-To help ease automated building of the client, all configurations can be
-provided in a setting hash instead of calling the individual methods directly.
-This functionality is exposed through the `ClientBuilder::fromConfig()` static
-method, which accepts an array of configurations and returns a fully built
-client.
-
-Array keys correspond to the method name, for example `retries` key corresponds
-to `setRetries()` method.
-
-[source,php]
-----
-$params = [
- 'hosts' => [
- 'localhost:9200'
- ],
- 'retries' => 2
-];
-$client = ClientBuilder::fromConfig($params);
-----
-
-Unknown parameters throw an exception, to help the user find potential problems.
-If this behavior is not desired (for example, you are using the hash for other
-purposes), you can set `$quiet = true` in fromConfig() to silence the exceptions.
-
-[source,php]
-----
-$params = [
- 'hosts' => [
- 'localhost:9200'
- ],
- 'retries' => 2,
- 'imNotReal' => 5
-];
-
-// Set $quiet to true to ignore the unknown `imNotReal` key
-$client = ClientBuilder::fromConfig($params, true);
-----
\ No newline at end of file
diff --git a/docs/configuration.asciidoc b/docs/configuration.asciidoc
deleted file mode 100644
index e5e2ee2a1..000000000
--- a/docs/configuration.asciidoc
+++ /dev/null
@@ -1,39 +0,0 @@
-[[configuration]]
-== Configuration
-
-Almost every aspect of the client is configurable. Most users only need to
-configure a few parameters to suit their needs, but it is possible to completely
-replace much of the internals if required.
-
-Custom configuration is accomplished before the client is instantiated, through
-the `ClientBuilder` class. You can find all the configuration options and
-check sample code that helps you replace the various components.
-
-To learn more about JSON in PHP, read <>.
-
-* <>
-* <>
-* <>
-* <>
-* <>
-* <>
-* <>
-* <>
-
-include::php_json_objects.asciidoc[]
-
-include::host-config.asciidoc[]
-
-include::set-retries.asciidoc[]
-
-include::http-meta-data.asciidoc[]
-
-include::logger.asciidoc[]
-
-include::http-client.asciidoc[]
-
-include::namespaces.asciidoc[]
-
-include::node-pool.asciidoc[]
-
-include::config-hash.asciidoc[]
diff --git a/docs/connecting.asciidoc b/docs/connecting.asciidoc
deleted file mode 100644
index 5c67cd43d..000000000
--- a/docs/connecting.asciidoc
+++ /dev/null
@@ -1,109 +0,0 @@
-[[connecting]]
-== Connecting
-
-This page contains the information you need to connect and use the Client with
-{es}.
-
-**On this page**
-
-* <>
-* <>
-
-[discrete]
-[[auth-ec]]
-=== Elastic Cloud
-
-You can connect to https://www.elastic.co/cloud/[Elastic Cloud] using an **API key**
-and a **Cloud ID**:
-
-[source,php]
-----
-$client = ClientBuilder::create()
- ->setElasticCloudId('')
- ->setApiKey('')
- ->build();
-----
-
-Where and can be retrieved using the Elastic Cloud web UI.
-
-You can get the `Cloud ID` from the `My deployment` page of your dashboard (see the red
-rectangle reported in the screenshot).
-
-image::images/cloud_id.png[alt="Elastic Cloud ID",align="center"]
-
-You can generate an `API key` in the `Management` page under the section `Security`.
-
-image::images/create_api_key.png[alt="Create API key",align="center"]
-
-When you click on `Create API key` button you can choose a name and set the other
-options (eg. restrict privileges, expire after time, etc).
-
-image::images/api_key_name.png[alt="Choose an API name",align="center"]
-
-After this step you will get the `API key`in the API keys page.
-
-image::images/cloud_api_key.png[alt="Cloud API key",align="center"]
-
-**IMPORTANT**: you need to copy and store the `API key`in a secure place, since you will not
-be able to view it again in Elastic Cloud.
-
-
-[discrete]
-[[auth-http]]
-=== Security by default (HTTPS)
-
-{es} 8.0 offers https://www.elastic.co/blog/introducing-simplified-elastic-stack-security[security by default],
-that means it uses https://en.wikipedia.org/wiki/Transport_Layer_Security[TLS]
-for protect the communication between client and server.
-
-In order to configure `elasticsearch-php` for connecting to {es} 8.0 we
-need to have the certificate authority file (CA).
-
-You can install {es} in different ways, for instance using https://www.elastic.co/guide/en/elasticsearch/reference/current/docker.html[Docker]
-you need to execute the followind command:
-
-[source,shell]
---------------------------
-docker pull docker.elastic.co/elasticsearch/elasticsearch:8.0.1
---------------------------
-
-Once you have the docker image installed you can execute {es},
-for instance using a single-node cluster configuration, as follows:
-
-[source,shell]
---------------------------
-docker network create elastic
-docker run --name es01 --net elastic -p 9200:9200 -p 9300:9300 -it docker.elastic.co/elasticsearch/elasticsearch:8.0.1
---------------------------
-
-This command creates an `elastic` Docker network and start {es}
-using the port `9200` (default).
-
-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}.
-
-Now that {es} is running we can get the `http_ca.crt` file certificate.
-We need to copy it from the docker instance, using the following command:
-
-[source,shell]
---------------------------
-docker cp es01:/usr/share/elasticsearch/config/certs/http_ca.crt .
---------------------------
-
-Once we have the `http_ca.crt` certificate and the `password`, copied during the
-start of {es} , we can use it to connect with `elasticsearch-php`
-as follows:
-
-[source,php]
---------------------------
-$client = ClientBuilder::create()
- ->setHosts(['https://localhost:9200'])
- ->setBasicAuthentication('elastic', 'password copied during Elasticsearch start')
- ->setCABundle('path/to/http_ca.crt')
- ->build();
---------------------------
-
-For more information about the Docker configuration of Elasticsearch you can
-read the official documentation https://www.elastic.co/guide/en/elasticsearch/reference/current/docker.html[here].
-
diff --git a/docs/crud.asciidoc b/docs/crud.asciidoc
deleted file mode 100644
index 98c2897cf..000000000
--- a/docs/crud.asciidoc
+++ /dev/null
@@ -1,257 +0,0 @@
-[[indexing_documents]]
-=== Indexing documents
-
-When you add documents to {es}, you index JSON documents. This maps naturally to
-PHP associative arrays, since they can easily be encoded in JSON. Therefore, in
-Elasticsearch-PHP you create and pass associative arrays to the client for
-indexing. There are several methods of ingesting data into {es} which we cover
-here.
-
-[discrete]
-==== Single document indexing
-
-When indexing a document, you can either provide an ID or let {es} generate one
-for you.
-
-{zwsp} +
-
-.Providing an ID value
-[source,php]
-----
-$params = [
- 'index' => 'my_index',
- 'id' => 'my_id',
- 'body' => [ 'testField' => 'abc']
-];
-
-// Document will be indexed to my_index/_doc/my_id
-$response = $client->index($params);
-----
-{zwsp} +
-
-.Omitting an ID value
-[source,php]
-----
-$params = [
- 'index' => 'my_index',
- 'body' => [ 'testField' => 'abc']
-];
-
-// Document will be indexed to my_index/_doc/
-$response = $client->index($params);
-----
-{zwsp} +
-
-If you need to set other parameters, such as a `routing` value, you specify
-those in the array alongside the `index`, and others. For example, let's set the
-routing and timestamp of this new document:
-
-.Additional parameters
-[source,php]
-----
-$params = [
- 'index' => 'my_index',
- 'id' => 'my_id',
- 'routing' => 'company_xyz',
- 'timestamp' => strtotime("-1d"),
- 'body' => [ 'testField' => 'abc']
-];
-
-
-$response = $client->index($params);
-----
-{zwsp} +
-
-[discrete]
-==== Bulk Indexing
-
-{es} also supports bulk indexing of documents. The bulk API expects JSON
-action/metadata pairs, separated by newlines. When constructing your documents
-in PHP, the process is similar. You first create an action array object (for
-example, an `index` object), then you create a document body object. This
-process repeats for all your documents.
-
-A simple example might look like this:
-
-.Bulk indexing with PHP arrays
-[source,php]
-----
-for($i = 0; $i < 100; $i++) {
- $params['body'][] = [
- 'index' => [
- '_index' => 'my_index',
- ]
- ];
-
- $params['body'][] = [
- 'my_field' => 'my_value',
- 'second_field' => 'some more values'
- ];
-}
-
-$responses = $client->bulk($params);
-----
-
-In practice, you'll likely have more documents than you want to send in a single
-bulk request. In that case, you need to batch up the requests and periodically
-send them:
-
-.Bulk indexing with batches
-[source,php]
-----
-$params = ['body' => []];
-
-for ($i = 1; $i <= 1234567; $i++) {
- $params['body'][] = [
- 'index' => [
- '_index' => 'my_index',
- '_id' => $i
- ]
- ];
-
- $params['body'][] = [
- 'my_field' => 'my_value',
- 'second_field' => 'some more values'
- ];
-
- // Every 1000 documents stop and send the bulk request
- if ($i % 1000 == 0) {
- $responses = $client->bulk($params);
-
- // erase the old bulk request
- $params = ['body' => []];
-
- // unset the bulk response when you are done to save memory
- unset($responses);
- }
-}
-
-// Send the last batch if it exists
-if (!empty($params['body'])) {
- $responses = $client->bulk($params);
-}
-----
-
-[[getting_documents]]
-=== Getting documents
-
-{es} provides realtime GETs of documents. This means that as soon as the
-document is indexed and your client receives an acknowledgement, you can
-immediately retrieve the document from any shard. Get operations are performed
-by requesting a document by its full `index/type/id` path:
-
-[source,php]
-----
-$params = [
- 'index' => 'my_index',
- 'id' => 'my_id'
-];
-
-// Get doc at /my_index/_doc/my_id
-$response = $client->get($params);
-----
-{zwsp} +
-
-[[updating_documents]]
-=== Updating documents
-
-Updating a document allows you to either completely replace the contents of the
-existing document, or perform a partial update to just some fields (either
-changing an existing field or adding new fields).
-
-[discrete]
-==== Partial document update
-
-If you want to partially update a document (for example, change an existing
-field or add a new one) you can do so by specifying the `doc` in the `body`
-parameter. This merges the fields in `doc` with the existing document.
-
-
-[source,php]
-----
-$params = [
- 'index' => 'my_index',
- 'id' => 'my_id',
- 'body' => [
- 'doc' => [
- 'new_field' => 'abc'
- ]
- ]
-];
-
-// Update doc at /my_index/_doc/my_id
-$response = $client->update($params);
-----
-{zwsp} +
-
-[discrete]
-==== Scripted document update
-
-Sometimes you need to perform a scripted update, such as incrementing a counter
-or appending a new value to an array. To perform a scripted update, you need to
-provide a script and usually a set of parameters:
-
-[source,php]
-----
-$params = [
- 'index' => 'my_index',
- 'id' => 'my_id',
- 'body' => [
- 'script' => 'ctx._source.counter += count',
- 'params' => [
- 'count' => 4
- ]
- ]
-];
-
-$response = $client->update($params);
-----
-{zwsp} +
-
-[discrete]
-==== Upserts
-
-Upserts are "Update or Insert" operations. This means an upsert attempts to run
-your update script, but if the document does not exist (or the field you are
-trying to update doesn't exist), default values are inserted instead.
-
-[source,php]
-----
-$params = [
- 'index' => 'my_index',
- 'id' => 'my_id',
- 'body' => [
- 'script' => [
- 'source' => 'ctx._source.counter += params.count',
- 'params' => [
- 'count' => 4
- ],
- ],
- 'upsert' => [
- 'counter' => 1
- ],
- ]
-];
-
-$response = $client->update($params);
-----
-{zwsp} +
-
-
-[[deleting_documents]]
-=== Deleting documents
-
-Finally, you can delete documents by specifying their full `/index/_doc_/id`
-path:
-
-[source,php]
-----
-$params = [
- 'index' => 'my_index',
- 'id' => 'my_id'
-];
-
-// Delete doc at /my_index/_doc_/my_id
-$response = $client->delete($params);
-----
-{zwsp} +
diff --git a/docs/docset.yml b/docs/docset.yml
new file mode 100644
index 000000000..b7c7189d5
--- /dev/null
+++ b/docs/docset.yml
@@ -0,0 +1,9 @@
+project: 'PHP client'
+cross_links:
+ - docs-content
+ - elasticsearch
+toc:
+ - toc: reference
+ - toc: release-notes
+subs:
+ es: "Elasticsearch"
diff --git a/docs/experimental-beta-apis.asciidoc b/docs/experimental-beta-apis.asciidoc
deleted file mode 100644
index 541f21a2f..000000000
--- a/docs/experimental-beta-apis.asciidoc
+++ /dev/null
@@ -1,74 +0,0 @@
-[[experimental_and_beta_apis]]
-=== Experimental and beta APIs
-
-The PHP client offers also `experimental` and `beta` APIs for {es}.
-
-The {es} APIs are marked using the following convention:
-
-- **Stable** APIs should be safe to use extensively in production. Any breaking
- changes to these APIs should only occur in major versions and will be
- documented in the breaking changes documentation for that release.
-- **Beta** APIs are on track to become stable and permanent features. Use them
- with caution because it is possible that breaking changes are made to these
- APIs in a minor version.
-- **Experimental** APIs are just that - an experiment. An experimental API might
- have breaking changes in any future version, or it might even be removed
- entirely.
-
-All the `experimental` and `beta` APIs are marked with a `@note` tag in the
-phpdoc section of the code.
-
-[discrete]
-=== Experimental
-
-The experimental APIs included in the current version of `elasticsearch-php`
-are:
-
-- https://www.elastic.co/guide/en/elasticsearch/reference/7.4/search-rank-eval.html[Ranking Evaluation]
-
-[source,php]
-----
-$client = ClientBuilder::create()->build();
-$params = [
- // ...
-];
-$result = $client->rankEval($params);
-----
-
-- https://www.elastic.co/guide/en/elasticsearch/painless/7.4/painless-execute-api.html[Painless Execute]
-
-[source,php]
-----
-$client = ClientBuilder::create()->build();
-$params = [
- // ...
-];
-$result = $client->scriptsPainlessExecute($params);
-----
-
-- Get Script Context
-
-Returns all script contexts.
-
-[source,php]
-----
-$client = ClientBuilder::create()->build();
-
-$result = $client->getScriptContext();
-----
-
-- Get Script Languages
-
-Returns available script types, languages and contexts.
-
-[source,php]
-----
-$client = ClientBuilder::create()->build();
-
-$result = $client->getScriptLanguages();
-----
-
-[discrete]
-=== Beta
-
-There are no beta APIs in the current version of `elasticsearch-php`.
\ No newline at end of file
diff --git a/docs/helpers/index.asciidoc b/docs/helpers/index.asciidoc
deleted file mode 100644
index 53b06b77c..000000000
--- a/docs/helpers/index.asciidoc
+++ /dev/null
@@ -1,10 +0,0 @@
-[[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/http-meta-data.asciidoc b/docs/http-meta-data.asciidoc
deleted file mode 100644
index 4195d08c8..000000000
--- a/docs/http-meta-data.asciidoc
+++ /dev/null
@@ -1,27 +0,0 @@
-[[http-meta-data]]
-=== HTTP Meta Data
-
-By default, the client sends some meta data about the HTTP connection using
-custom headers.
-
-You can disable or enable it using the following methods:
-
-
-==== Elastic Meta Header
-
-The client sends a `x-elastic-client-meta` header by default.
-This header is used to collect meta data about the versions of the components
-used by the client. For instance, a value of `x-elastic-client-meta` can be
-`es=8.0.0-s,php=8.0.0,t=8.0.0-s,a=0,gu=7.4.2, where each value is the
-version of `es=Elasticsearch`, `t` is the transport version (same of client),
-`a` is asyncronouts (`0=false` by default) and `gu=Guzzle`.
-
-If you would like to disable it you can use the `setElasticMetaHeader()`
-method, as follows:
-
-[source,php]
-----
-$client = Elasticsearch\ClientBuilder::create()
- ->setElasticMetaHeader(false)
- ->build();
-----
diff --git a/docs/index.asciidoc b/docs/index.asciidoc
deleted file mode 100644
index 63dbe4551..000000000
--- a/docs/index.asciidoc
+++ /dev/null
@@ -1,29 +0,0 @@
-
-= Elasticsearch-PHP
-
-:doctype: book
-
-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[]
-
-include::installation.asciidoc[]
-
-include::connecting.asciidoc[]
-
-include::usage.asciidoc[]
-
-include::configuration.asciidoc[]
-
-include::operations.asciidoc[]
-
-include::helpers/index.asciidoc[]
-
-include::release-notes.asciidoc[]
-
-include::redirects.asciidoc[]
\ No newline at end of file
diff --git a/docs/installation.asciidoc b/docs/installation.asciidoc
deleted file mode 100644
index 9766efe58..000000000
--- a/docs/installation.asciidoc
+++ /dev/null
@@ -1,39 +0,0 @@
-[[installation]]
-== Installation
-
-Elasticsearch-php can be used starting from PHP 7.4.
-To install the library you need to use http://getcomposer.org[composer] with the
-following command:
-
-[source,shell]
---------------------------
-composer require elasticsearch/elasticsearch
---------------------------
-
-If you don't have composer you can install it as follows:
-
-[source,shell]
---------------------------
-curl -s http://getcomposer.org/installer | php
-php composer.phar install
---------------------------
-
-More information about
-https://getcomposer.org/[Composer can be found at their website].
-
-When you have installed elasticsearch-php you can start using it
-with the `Client` class. You can use the `ClientBuilder` class to
-create this object, as follows:
-
-[source,php]
---------------------------
-require 'vendor/autoload.php';
-
-$client = Elastic\Elasticsearch\ClientBuilder::create()->build();
---------------------------
-+
-Client instantiation is performed with a static helper function `create()`. This
-creates a ClientBuilder object, which helps you to set custom configurations.
-When you are done configuring, call the `build()` method to generate a `Client`
-object. For further info, consult the <> section.
-
diff --git a/docs/logger.asciidoc b/docs/logger.asciidoc
deleted file mode 100644
index 94f92a426..000000000
--- a/docs/logger.asciidoc
+++ /dev/null
@@ -1,31 +0,0 @@
-[[enabling_logger]]
-=== Enabling the Logger
-
-Elasticsearch-PHP supports logging, but it is not enabled by default for
-performance reasons. If you wish to enable logging, you need to select a logging
-implementation, install it, then enable the logger in the Client. The
-recommended logger is https://github.com/Seldaek/monolog[Monolog], but any
-logger that implements the https://www.php-fig.org/psr/psr-3/[PSR-3] interface works.
-
-To begin using Monolog, just require it using composer:
-
-[source,shell]
-----------------------------
-composer require monolog/monolog
-----------------------------
-
-Once Monolog (or another logger) is installed, you need to create a log object
-and inject it into the client:
-
-[source,php]
-----
-use Monolog\Logger;
-use Monolog\Handler\StreamHandler;
-
-$logger = new Logger('name');
-$logger->pushHandler(new StreamHandler('path/to/your.log', Logger::WARNING));
-
-$client = ClientBuilder::create()
- ->setLogger($logger) // Set your custom logger
- ->build(); // Build the client object
-----
diff --git a/docs/namespaces.asciidoc b/docs/namespaces.asciidoc
deleted file mode 100644
index 48e993524..000000000
--- a/docs/namespaces.asciidoc
+++ /dev/null
@@ -1,112 +0,0 @@
-[[namespaces]]
-=== Namespaces
-
-The client has a number of "namespaces", which generally expose administrative
-functionality. The namespaces correspond to the various administrative endpoints
-in {es}. This is a complete list of namespaces:
-
-
-[width="40%",options="header",frame="topbot"]
-|============================
-| Namespace | Functionality
-| `asyncSearch()` | Provide asyncronous search
-| `autoscaling()` | Autoscaling features
-| `cat()` | Compact and aligned text (CAT), mainly for terminal
-| `ccr()` | Cross-cluster replication operations
-| `cluster()` | Cluster-centric stats and info
-| `danglingIndices()` | Dangling indices management
-| `enrich()` | Enrich policy management
-| `eql()` | Event Query Language
-| `features()` | Manage features provided by Elasticsearch and plugins
-| `fleet()` | Fleet’s use of Elasticsearch (experimental)
-| `graph()` | Graph explore for documents and terms
-| `ilm()` | Index lifecycle management (ILM)
-| `indices()` | Index-centric stats and info
-| `ingest()` | Ingest pipelines and processors
-| `license()` | License management
-| `logStash()` | Manage pipelines used by Logstash Central Management
-| `migration()` | Designed for indirect use by Kibana’s Upgrade Assistant
-| `ml()` | Machine learning features
-| `monitoring()` | Monitoring features
-| `monitoring()` | Monitoring features
-| `nodes()` | Node-centric stats and info
-| `rollup()` | Rollup features
-| `searchableSnapshots()` | Searchable snapshots operations
-| `security()` | Security features
-| `shutdown()` | Prepare nodes for temporary or permanent shutdown
-| `slm()` | Snapshot lifecycle management (SLM)
-| `snapshot()` | Methods to snapshot/restore your cluster and indices
-| `sql()` | Run SQL queries on Elasticsearch indices and data streams
-| `ssl()` | SSL certificate management
-| `tasks()` | Task management
-| `textStructure()` | Finds the structure of text
-| `transform()` | Transform features
-| `watcher()` | Watcher create actions based on conditions
-| `xpack()` | Retrieves information about the installed X-Pack features
-|============================
-
-Some methods are available in several different namespaces, which give you the
-same information but grouped into different contexts. To see how these
-namespaces work, let's look at the `_stats` output:
-
-
-[source,php]
-----
-$client = ClientBuilder::create()->build();
-
-// Index Stats
-// Corresponds to curl -XGET localhost:9200/_stats
-$response = $client->indices()->stats();
-
-// Node Stats
-// Corresponds to curl -XGET localhost:9200/_nodes/stats
-$response = $client->nodes()->stats();
-
-// Cluster Stats
-// Corresponds to curl -XGET localhost:9200/_cluster/stats
-$response = $client->cluster()->stats();
-----
-{zwsp} +
-
-As you can see, the same `stats()` call is made through three different
-namespaces. Sometimes the methods require parameters. These parameters work
-just like any other method in the library.
-
-For example, we can requests index stats about a specific index, or multiple
-indices:
-
-[source,php]
-----
-$client = ClientBuilder::create()->build();
-
-// Corresponds to curl -XGET localhost:9200/my_index/_stats
-$params['index'] = 'my_index';
-$response = $client->indices()->stats($params);
-
-// Corresponds to curl -XGET localhost:9200/my_index1,my_index2/_stats
-$params['index'] = ['my_index1', 'my_index2'];
-$response = $client->indices()->stats($params);
-----
-{zwsp} +
-
-The following example shows how you can add an alias to an existing index:
-
-[source,php]
-----
-$params['body'] = [
- 'actions' => [
- [
- 'add' => [
- 'index' => 'myindex',
- 'alias' => 'myalias'
- ]
- ]
- ]
-];
-$client->indices()->updateAliases($params);
-----
-
-Notice how both the `stats` calls and the `updateAliases` took a variety of
-parameters, each according to what the particular API requires. The `stats` API
-only requires an index name(s), while the `updateAliases` requires a body of
-actions.
\ No newline at end of file
diff --git a/docs/node-pool.asciidoc b/docs/node-pool.asciidoc
deleted file mode 100644
index fd309a908..000000000
--- a/docs/node-pool.asciidoc
+++ /dev/null
@@ -1,72 +0,0 @@
-[[node_pool]]
-=== Node Pool
-
-The node pool is a component of https://github.com/elastic/elastic-transport-php[elastic-transport-php]
-library used by elasticsearch-php.
-
-This component is responsible for maintaining the current list of nodes.
-Theoretically, nodes are either dead or alive. However, in the real world, things
-are never so clear. Nodes are sometimes in a gray-zone of _"probably dead but not
-confirmed"_, _"timed-out but unclear why"_ or _"recently dead but now alive"_.
-The job of the node pool is to manage this set of unruly connections and try to
-provide the best behavior to the client.
-
-If a node pool is unable to find an alive node to query against, it
-returns a `NoNodeAvailableException`.
-
-By default, the number of retries is equal to the number of nodes in your
-cluster. For example, your cluster may have 10 nodes. You execute a
-request and 9 out of the 10 nodes fail due to connection timeouts. The tenth
-node succeeds and the query executes. The first nine nodes are marked dead
-and their "dead" timers begin ticking.
-
-When the next request is sent to the client, nodes 1-9 are still considered
-"dead", so they are skipped. The request is sent to the only known alive node
-(#10), if this node fails, a `NoNodesAvailableException` is returned.
-
-The `SimpleNodePool` is the default node pool algorithm. It uses the following
-default values: RoundRobin as `SelectorInterface` and NoResurrect as `ResurrectInterface`.
-
-The Round-robin algorithm select the nodes in order, from the first node in the array
-to the latest. When arrived to the latest nodes, it will start again from the first.
-
-NOTE: The order of the nodes is randomized at runtime to maximize the usage of all the hosts.
-
-The `NoResurrect` option does not try to resurrect the node that has been marked as dead.
-If you want, you can specify the `ElasticsearchResurrect` class to check if a node that
-was dead is online again (resurrected).
-
-You can use the following configuration to enable the `ElasticsearchResurrect` class:
-
-[source,php]
-----
-use Elastic\Transport\NodePool\Resurrect\ElasticsearchResurrect;
-use Elastic\Transport\NodePool\Selector\RoundRobin;
-use Elastic\Transport\NodePool\SimpleNodePool;
-
-$nodePool = new SimpleNodePool(
- new RoundRobin(),
- new ElasticsearchResurrect()
-);
-
-$transport = TransportBuilder::create()
- ->setHosts(['localhost:9200'])
- ->setNodePool($nodePool)
- ->build();
-----
-
-
-[discrete]
-==== Using a custom NodePool, Selector and Resurrect
-
-If you want you can implement your custom node pool algorithm. We provided a
-https://github.com/elastic/elastic-transport-php/blob/master/src/NodePool/NodePoolInterface.php[NodePoolInterface]
-
-You can also customize the Selector and the Resurrect components of the node pool.
-You can use the following interfaces for the implementation:
-
-* https://github.com/elastic/elastic-transport-php/blob/master/src/NodePool/Selector/SelectorInterface.php[SelectorInterface]
-* https://github.com/elastic/elastic-transport-php/blob/master/src/NodePool/Resurrect/ResurrectInterface.php[ResurrectInterface]
-
-For more information about the Node Pool you can read the
-https://github.com/elastic/elastic-transport-php/blob/master/README.md[elastic-transport-php documentation].
diff --git a/docs/operations.asciidoc b/docs/operations.asciidoc
deleted file mode 100644
index e17b64997..000000000
--- a/docs/operations.asciidoc
+++ /dev/null
@@ -1,28 +0,0 @@
-[[operations]]
-== Operations
-
-This page contains the information you need to perform various {es} operations
-by using the Client.
-
-This section is a crash-course overview of the client and its syntax. If you
-are familiar with {es}, you'll notice that the methods are named just like REST
-endpoints.
-
-You may also notice that the client is configured in a manner that facilitates
-easy discovery via your IDE. All core actions are available under the `$client`
-object (indexing, searching, getting, etc). Index and cluster management are
-located under the `$client->indices()` and `$client->cluster()` objects,
-respectively.
-
-* <>
-* <>
-* <>
-* <>
-* <>
-* <>
-
-include::index-operations.asciidoc[]
-
-include::search-operations.asciidoc[]
-
-include::crud.asciidoc[]
\ No newline at end of file
diff --git a/docs/overview.asciidoc b/docs/overview.asciidoc
deleted file mode 100644
index cc03742c0..000000000
--- a/docs/overview.asciidoc
+++ /dev/null
@@ -1,54 +0,0 @@
-[[overview]]
-== Overview
-
-This is the official PHP client for {es}. It is designed to be a low-level
-client that does not stray from the REST API.
-
-All methods closely match the REST API, and furthermore, match the method
-structure of other language clients (Ruby, Python, and so on). We hope that this
-consistency makes it easy to get started with a client and to seamlessly switch
-from one language to the next with minimal effort.
-
-The client is designed to facilitate the API call using different way to read the
-results using associative array, object, string or https://www.php-fig.org/psr/psr-7/[PSR-7].
-
-Refer to the <> page for a step-by-step quick start with
-the PHP client.
-
-[discrete]
-[[psr-7-standard]]
-=== PSR 7 standard
-
-The {es} PHP client uses the https://www.php-fig.org/psr/[PSR] 7 standard. This
-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/php_json_objects.asciidoc b/docs/php_json_objects.asciidoc
deleted file mode 100644
index fa29496dd..000000000
--- a/docs/php_json_objects.asciidoc
+++ /dev/null
@@ -1,173 +0,0 @@
-[[php_json_objects]]
-=== Dealing with JSON arrays and objects in PHP
-
-A common source of confusion with the client revolves around JSON arrays and
-objects, and how to specify them in PHP. In particular, problems are caused by
-empty objects and arrays of objects. This page shows you some common patterns
-used in {es} JSON API and how to convert that to a PHP representation.
-
-[discrete]
-==== Empty Objects
-
-The {es} API uses empty JSON objects in several locations which can cause
-problems for PHP. Unlike other languages, PHP does not have a "short" notation
-for empty objects and many developers are unaware how to specify an empty
-object.
-
-Consider adding a highlight to a query:
-
-[source,json]
-----
-{
- "query" : {
- "match" : {
- "content" : "quick brown fox"
- }
- },
- "highlight" : {
- "fields" : {
- "content" : {} <1>
- }
- }
-}
-----
-<1> This empty JSON object is what causes problems.
-
-The problem is that PHP will automatically convert `"content" : {}` into
-`"content" : []`, which is no longer valid {es} DSL. We need to tell PHP that
-the empty object is explicitly an object, not an array. To define this query in
-PHP, you would do:
-
-[source,json]
-----
-$params['body'] = array(
- 'query' => array(
- 'match' => array(
- 'content' => 'quick brown fox'
- )
- ),
- 'highlight' => array(
- 'fields' => array(
- 'content' => new \stdClass() <1>
- )
- )
-);
-$results = $client->search($params);
-----
-<1> We use the generic PHP stdClass object to represent an empty object. The
-JSON now encodes correctly.
-
-By using an explicit stdClass object, we can force the `json_encode` parser to
-correctly output an empty object, instead of an empty array. This verbose
-solution is the only way to acomplish the goal in PHP... there is no "short"
-version of an empty object.
-
-[discrete]
-==== Arrays of Objects
-
-Another common pattern in {es} DSL is an array of objects. For example, consider
-adding a sort to your query:
-
-[source,json]
-----
-{
- "query" : {
- "match" : { "content" : "quick brown fox" }
- },
- "sort" : [ <1>
- {"time" : {"order" : "desc"}},
- {"popularity" : {"order" : "desc"}}
- ]
-}
-----
-<1> "sort" contains an array of JSON objects.
-
-This arrangement is very common, but the construction in PHP can be tricky since
-it requires nesting arrays. The verbosity of PHP tends to obscure what is
-actually going on. To construct an array of objects, you actually need an array
-of arrays:
-
-[source,json]
-----
-$params['body'] = array(
- 'query' => array(
- 'match' => array(
- 'content' => 'quick brown fox'
- )
- ),
- 'sort' => array( <1>
- array('time' => array('order' => 'desc')), <2>
- array('popularity' => array('order' => 'desc')) <3>
- )
-);
-$results = $client->search($params);
-----
-<1> This array encodes the `"sort" : []` array
-<2> This array encodes the `{"time" : {"order" : "desc"}}` object
-<3> This array encodes the `{"popularity" : {"order" : "desc"}}` object
-
-If you are on PHP 5.4+, we strongly encourage you to use the short array syntax.
-It makes these nested arrays much simpler to read:
-
-[source,json]
-----
-$params['body'] = [
- 'query' => [
- 'match' => [
- 'content' => 'quick brown fox'
- ]
- ],
- 'sort' => [
- ['time' => ['order' => 'desc']],
- ['popularity' => ['order' => 'desc']]
- ]
-];
-$results = $client->search($params);
-----
-
-[discrete]
-==== Arrays of empty objects
-
-Occasionally, you'll encounter DSL that requires both of the previous patterns.
-The function score query is a good example, it sometimes requires an array of
-objects, and some of those objects might be empty JSON objects.
-
-Given this query:
-
-[source,json]
-----
-{
- "query":{
- "function_score":{
- "functions":[
- {
- "random_score":{}
- }
- ],
- "boost_mode":"replace"
- }
- }
-}
-----
-
-We can build it using the following PHP code:
-
-
-[source,json]
-----
-$params['body'] = array(
- 'query' => array(
- 'function_score' => array(
- 'functions' => array( <1>
- array( <2>
- 'random_score' => new \stdClass() <3>
- )
- )
- )
- )
-);
-$results = $client->search($params);
-----
-<1> This encodes the array of objects: `"functions" : []`
-<2> This encodes an object inside the array: `{ "random_score": {} }`
-<3> This encodes the empty JSON object: `"random_score": {}`
\ No newline at end of file
diff --git a/docs/redirects.asciidoc b/docs/redirects.asciidoc
deleted file mode 100644
index c41a8cda4..000000000
--- a/docs/redirects.asciidoc
+++ /dev/null
@@ -1,24 +0,0 @@
-["appendix",role="exclude",id="redirects"]
-= Deleted pages
-
-The following pages have moved or been deleted.
-
-[role="exclude",id="experimental_and_beta_apis"]
-== Experimental and beta APIs
-
-This page has been removed.
-
-[role="exclude",id="security"]
-== Security
-
-This page has moved. See <>.
-
-[role="exclude",id="quickstart"]
-== Quickstart
-
-This page has moved. See <>.
-
-[role="exclude",id="ElasticsearchPHP_Endpoints"]
-== Reference – Endpoints
-
-This page has been removed.
\ No newline at end of file
diff --git a/docs/reference/client-helpers.md b/docs/reference/client-helpers.md
new file mode 100644
index 000000000..fec194e67
--- /dev/null
+++ b/docs/reference/client-helpers.md
@@ -0,0 +1,14 @@
+---
+mapped_pages:
+ - https://www.elastic.co/guide/en/elasticsearch/client/php-api/current/client-helpers.html
+---
+
+# Client helpers [client-helpers]
+
+The PHP client comes with the following helpers:
+
+* [Iterators](/reference/iterators.md)
+* [ES|QL](/reference/esql.md)
+
+
+
diff --git a/docs/reference/configuration.md b/docs/reference/configuration.md
new file mode 100644
index 000000000..1395d7a1e
--- /dev/null
+++ b/docs/reference/configuration.md
@@ -0,0 +1,30 @@
+---
+mapped_pages:
+ - https://www.elastic.co/guide/en/elasticsearch/client/php-api/current/configuration.html
+---
+
+# Configuration [configuration]
+
+Almost every aspect of the client is configurable. Most users only need to configure a few parameters to suit their needs, but it is possible to completely replace much of the internals if required.
+
+Custom configuration is accomplished before the client is instantiated, through the `ClientBuilder` class. You can find all the configuration options and check sample code that helps you replace the various components.
+
+To learn more about JSON in PHP, read [Dealing with JSON arrays and objects in PHP](/reference/php_json_objects.md).
+
+* [Host Configuration](/reference/host-config.md)
+* [Set retries](/reference/set-retries.md)
+* [HTTP Meta Data](/reference/http-meta-data.md)
+* [Enabling the Logger](/reference/enabling_logger.md)
+* [Configure the HTTP client](/reference/http-client.md)
+* [Namespaces](/reference/namespaces.md)
+* [Node Pool](/reference/node_pool.md)
+* [Building the client from a configuration hash](/reference/node_pool.md#config-hash)
+
+
+
+
+
+
+
+
+
diff --git a/docs/reference/connecting.md b/docs/reference/connecting.md
new file mode 100644
index 000000000..408bb8e22
--- /dev/null
+++ b/docs/reference/connecting.md
@@ -0,0 +1,341 @@
+---
+mapped_pages:
+ - https://www.elastic.co/guide/en/elasticsearch/client/php-api/current/connecting.html
+---
+
+# Connecting [connecting]
+
+This page contains the information you need to connect and use the Client with {{es}}.
+
+## Elastic Cloud [auth-ec]
+
+You can connect to [Elastic Cloud](https://www.elastic.co/cloud/) using an ***API key*** and a ***Cloud ID***:
+
+```php
+$client = ClientBuilder::create()
+ ->setElasticCloudId('')
+ ->setApiKey('')
+ ->build();
+```
+
+Where and can be retrieved using the Elastic Cloud web UI.
+
+You can get the `Cloud ID` from the `My deployment` page of your dashboard (see the red rectangle reported in the screenshot).
+
+
+
+You can generate an `API key` in the `Management` page under the section `Security`.
+
+
+
+When you click on `Create API key` button you can choose a name and set the other options (eg. restrict privileges, expire after time, etc).
+
+
+
+After this step you will get the `API key`in the API keys page.
+
+
+
+***IMPORTANT***: you need to copy and store the `API key`in a secure place, since you will not be able to view it again in Elastic Cloud.
+
+
+## Security by default (HTTPS) [auth-http]
+
+{{es}} 8.0 offers [security by default](https://www.elastic.co/blog/introducing-simplified-elastic-stack-security), that means it uses [TLS](https://en.wikipedia.org/wiki/Transport_Layer_Security) for protect the communication between client and server.
+
+In order to configure `elasticsearch-php` for connecting to {{es}} 8.0 we need to have the certificate authority file (CA).
+
+You can install {{es}} in different ways, for instance using [Docker](docs-content://deploy-manage/deploy/self-managed/install-elasticsearch-with-docker.md) you need to execute the followind command:
+
+```shell
+docker pull docker.elastic.co/elasticsearch/elasticsearch:8.0.1
+```
+
+Once you have the docker image installed you can execute {{es}}, for instance using a single-node cluster configuration, as follows:
+
+```shell
+docker network create elastic
+docker run --name es01 --net elastic -p 9200:9200 -p 9300:9300 -it docker.elastic.co/elasticsearch/elasticsearch:8.0.1
+```
+
+This command creates an `elastic` Docker network and start {{es}} using the port `9200` (default).
+
+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}}.
+
+Now that {{es}} is running we can get the `http_ca.crt` file certificate. We need to copy it from the docker instance, using the following command:
+
+```shell
+docker cp es01:/usr/share/elasticsearch/config/certs/http_ca.crt .
+```
+
+Once we have the `http_ca.crt` certificate and the `password`, copied during the start of {{es}} , we can use it to connect with `elasticsearch-php` as follows:
+
+```php
+$client = ClientBuilder::create()
+ ->setHosts(['https://localhost:9200'])
+ ->setBasicAuthentication('elastic', 'password copied during Elasticsearch start')
+ ->setCABundle('path/to/http_ca.crt')
+ ->build();
+```
+
+For more information about the Docker configuration of Elasticsearch you can read the official documentation [here](docs-content://deploy-manage/deploy/self-managed/install-elasticsearch-with-docker.md).
+
+
+## Usage [client-usage]
+
+This section is a crash-course overview of the client and its syntax. If you are familiar with {{es}}, you’ll notice that the methods are named just like REST endpoints.
+
+You may also notice that the client is configured in a manner that facilitates easy discovery via your IDE. All core actions are available under the `$client` object (indexing, searching, getting, etc). Index and cluster management are located under the `$client->indices()` and `$client->cluster()` objects, respectively.
+
+
+### Info API [_info_api]
+
+You can get information about the {{es}} instance using the `info()` API, as follows:
+
+```php
+$response = $client->info();
+```
+
+The response that you get back contains the information about {{es}}. The `$response` is an object of `Elastic\Elasticsearch\Response\Elasticsearch` class that implements `ElasticsearchInterface`, PSR-7 [ResponseInterface](https://www.php-fig.org/psr/psr-7/#33-psrhttpmessageresponseinterface) and [ArrayAccess](https://www.php.net/manual/en/class.arrayaccess.php).
+
+This means the `$response` is a [PSR-7](https://www.php-fig.org/psr/psr-7/) object:
+
+```php
+echo $response->getStatusCode(); // 200
+echo (string) $response->getBody(); // Response body in JSON
+```
+
+and also an "array", meaning you can access the response body as an associative array, as follows:
+
+```php
+echo $response['version']['number']; // 8.0.0
+
+var_dump($response->asArray()); // response body content as array
+```
+
+Moreover, you can also access the response body as object, string or bool:
+
+```php
+echo $response->version->number; // 8.0.0
+
+var_dump($response->asObject()); // response body content as object
+var_dump($response->asString()); // response body as string (JSON)
+var_dump($response->asBool()); // true if HTTP response code between 200 and 300
+```
+
+
+### Indexing a document [_indexing_a_document]
+
+To index a document, we need to specify three pieces of information: index, id and a document body. This is done by constructing an associative array of key:value pairs. The request body is itself an associative array with key:value pairs corresponding to the data in your document:
+
+```php
+$params = [
+ 'index' => 'my_index',
+ 'id' => 'my_id',
+ 'body' => ['testField' => 'abc']
+];
+
+$response = $client->index($params);
+print_r($response->asArray());
+```
+
+The response that you get back indicates that the document was created in the index that you specified. The response can be rendered as associatve array using the `asArray()` function. The array response contains a decoded version of the JSON that Elasticsearch returns:
+
+```php
+Array
+(
+ [_index] => my_index
+ [_type] => _doc
+ [_id] => my_id
+ [_version] => 1
+ [created] => 1
+)
+```
+
+
+### Set the body as JSON string [_set_the_body_as_json_string]
+
+If you want you can specify the `body`parameter as JSON string. This can be useful for testing (eg. copy & paste from online code examples) or if you have already some JSON documents to be stored in Elasticsearch.
+
+For instance, the previous index example can be re-written as follows:
+
+```php
+$params = [
+ 'index' => 'my_index',
+ 'id' => 'my_id',
+ 'body' => '{"testField" : "abc"}'
+];
+
+$response = $client->index($params);
+print_r($response->asArray());
+```
+
+
+### Getting a document [_getting_a_document]
+
+Let’s get the document that we just indexed. This returns the document:
+
+```php
+$params = [
+ 'index' => 'my_index',
+ 'id' => 'my_id'
+];
+
+$response = $client->get($params);
+print_r($response->asArray());
+```
+
+The response contains metadata such as index, version, and so on as well as a `_source` field, which is the original document you sent to {{es}}.
+
+```php
+Array
+(
+ [_index] => my_index
+ [_type] => _doc
+ [_id] => my_id
+ [_version] => 1
+ [found] => 1
+ [_source] => Array
+ (
+ [testField] => abc
+ )
+
+)
+```
+
+
+### Searching for a document [_searching_for_a_document]
+
+Searching is a hallmark of {{es}}, so let’s perform a search. We are going to use the `match` query as a demonstration:
+
+```php
+$params = [
+ 'index' => 'my_index',
+ 'body' => [
+ 'query' => [
+ 'match' => [
+ 'testField' => 'abc'
+ ]
+ ]
+ ]
+];
+
+$response = $client->search($params);
+print_r($response->asArray());
+```
+
+The response here is different from the previous ones. You can see metadata (`took`, `timed_out`, etc.) and an array named `hits`. This represents your search results. Inside of `hits` is another array named `hits`, which contains individual search results:
+
+```php
+Array
+(
+ [took] => 1
+ [timed_out] =>
+ [_shards] => Array
+ (
+ [total] => 5
+ [successful] => 5
+ [failed] => 0
+ )
+
+ [hits] => Array
+ (
+ [total] => 1
+ [max_score] => 0.30685282
+ [hits] => Array
+ (
+ [0] => Array
+ (
+ [_index] => my_index
+ [_type] => _doc
+ [_id] => my_id
+ [_score] => 0.30685282
+ [_source] => Array
+ (
+ [testField] => abc
+ )
+ )
+ )
+ )
+)
+```
+
+
+### Deleting a document [_deleting_a_document]
+
+Alright, let’s go ahead and delete the document that we added previously:
+
+```php
+$params = [
+ 'index' => 'my_index',
+ 'id' => 'my_id'
+];
+
+$response = $client->delete($params);
+print_r($response->asArray());
+```
+
+This syntax is identical to the `get` syntax. The only difference is the operation: `delete` instead of `get`. The response confirms the document is deleted:
+
+```php
+Array
+(
+ [found] => 1
+ [_index] => my_index
+ [_type] => _doc
+ [_id] => my_id
+ [_version] => 2
+)
+```
+
+
+### Deleting an index [_deleting_an_index_2]
+
+Due to the dynamic nature of {{es}}, the first document you added automatically built an index with some default settings. Delete that index and specify your own settings later:
+
+```php
+$deleteParams = [
+ 'index' => 'my_index'
+];
+$response = $client->indices()->delete($deleteParams);
+print_r($response->asArray());
+```
+
+The response:
+
+```php
+Array
+(
+ [acknowledged] => 1
+)
+```
+
+
+### Creating an index [_creating_an_index_2]
+
+Now that you are starting fresh (no data or index), add a new index with custom settings:
+
+```php
+$params = [
+ 'index' => 'my_index',
+ 'body' => [
+ 'settings' => [
+ 'number_of_shards' => 2,
+ 'number_of_replicas' => 0
+ ]
+ ]
+];
+
+$response = $client->indices()->create($params);
+print_r($response->asArray());
+```
+
+{{es}} now creates that index with your chosen settings and return an acknowledgement:
+
+```php
+Array
+(
+ [acknowledged] => 1
+)
+```
+
diff --git a/docs/reference/deleting_documents.md b/docs/reference/deleting_documents.md
new file mode 100644
index 000000000..cfb0bcce3
--- /dev/null
+++ b/docs/reference/deleting_documents.md
@@ -0,0 +1,21 @@
+---
+mapped_pages:
+ - https://www.elastic.co/guide/en/elasticsearch/client/php-api/current/deleting_documents.html
+---
+
+# Deleting documents [deleting_documents]
+
+Finally, you can delete documents by specifying their full `/index/_doc_/id` path:
+
+```php
+$params = [
+ 'index' => 'my_index',
+ 'id' => 'my_id'
+];
+
+// Delete doc at /my_index/_doc_/my_id
+$response = $client->delete($params);
+```
+
+
+
diff --git a/docs/reference/enabling_logger.md b/docs/reference/enabling_logger.md
new file mode 100644
index 000000000..317d199b4
--- /dev/null
+++ b/docs/reference/enabling_logger.md
@@ -0,0 +1,29 @@
+---
+mapped_pages:
+ - https://www.elastic.co/guide/en/elasticsearch/client/php-api/current/enabling_logger.html
+---
+
+# Enabling the Logger [enabling_logger]
+
+Elasticsearch-PHP supports logging, but it is not enabled by default for performance reasons. If you wish to enable logging, you need to select a logging implementation, install it, then enable the logger in the Client. The recommended logger is [Monolog](https://github.com/Seldaek/monolog), but any logger that implements the [PSR-3](https://www.php-fig.org/psr/psr-3/) interface works.
+
+To begin using Monolog, just require it using composer:
+
+```shell
+composer require monolog/monolog
+```
+
+Once Monolog (or another logger) is installed, you need to create a log object and inject it into the client:
+
+```php
+use Monolog\Logger;
+use Monolog\Handler\StreamHandler;
+
+$logger = new Logger('name');
+$logger->pushHandler(new StreamHandler('path/to/your.log', Logger::WARNING));
+
+$client = ClientBuilder::create()
+ ->setLogger($logger) // Set your custom logger
+ ->build(); // Build the client object
+```
+
diff --git a/docs/helpers/esql.asciidoc b/docs/reference/esql.md
similarity index 64%
rename from docs/helpers/esql.asciidoc
rename to docs/reference/esql.md
index 7e1d0ee64..a4cd11655 100644
--- a/docs/helpers/esql.asciidoc
+++ b/docs/reference/esql.md
@@ -1,37 +1,28 @@
-[[esql]]
-=== ES|QL in the PHP client
-++++
-ES|QL
-++++
+---
+navigation_title: "ES|QL"
+mapped_pages:
+ - https://www.elastic.co/guide/en/elasticsearch/client/php-api/current/esql.html
+---
+
+# ES|QL in the PHP client [esql]
+
-This page helps you understand and use {ref}/esql.html[ES|QL] in the
-PHP client.
+This page helps you understand and use [ES|QL](docs-content://explore-analyze/query-filter/languages/esql.md) 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].
+* Use the Elasticsearch [ES|QL API](https://www.elastic.co/docs/api/doc/elasticsearch/group/endpoint-esql) 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 [stdClass](https://www.php.net/manual/en/class.stdclass.php).
-[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.
+## How to use the ES|QL API [esql-how-to]
-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.
+The [ES|QL query API](https://www.elastic.co/docs/api/doc/elasticsearch/group/endpoint-esql) allows you to specify how results should be returned. You can choose a [response format](docs-content://explore-analyze/query-filter/languages/esql-rest.md#esql-rest-format) such as CSV, text, or JSON, then fine-tune it with parameters like column separators and locale.
-[[query-script]]
-Here's an example query and PHP script:
+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 = <<>) produces the following output:
+Using this response, the PHP script (provided [above](#query-script)) produces the following output:
```php
author : Stephen King
@@ -133,7 +124,7 @@ $result = $client->esql()->query([
var_dump($result->asArray());
```
-The response looks something like this:
+The response looks something like this:
```json
array(12) {
@@ -168,19 +159,15 @@ array(12) {
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.
+
+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
+## Define your own mapping [esql-custom-mapping]
-Although the `esql()->query()` API covers many use cases, your application
-might require a custom 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:
+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([
@@ -199,10 +186,9 @@ foreach ($books as $book) {
}
```
-You can also specify a class name for the mapping.
-All the values will be assigned to the properties of the class.
+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:
+Here’s an example mapper that returns an array of `Book` objects:
```php
class Book
@@ -218,4 +204,5 @@ $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/getting-started.asciidoc b/docs/reference/getting-started.md
similarity index 60%
rename from docs/getting-started.asciidoc
rename to docs/reference/getting-started.md
index e98facd81..31208841b 100644
--- a/docs/getting-started.asciidoc
+++ b/docs/reference/getting-started.md
@@ -1,88 +1,77 @@
-[[getting-started-php]]
-== Getting started
+---
+mapped_pages:
+ - https://www.elastic.co/guide/en/elasticsearch/client/php-api/current/getting-started-php.html
+ - https://www.elastic.co/guide/en/serverless/current/elasticsearch-php-client-getting-started.html
+---
-This page guides you through the installation process of the PHP client, shows
-you how to instantiate the client, and how to perform basic Elasticsearch
-operations with it.
+# Getting started [getting-started-php]
-[discrete]
-=== Requirements
+This page guides you through the installation process of the PHP client, shows you how to instantiate the client, and how to perform basic Elasticsearch operations with it.
-* http://getcomposer.org[composer]
-If you don't have composer you can install it by running the following commands:
+### Requirements [_requirements]
-[source,shell]
---------------------------
+* [composer](http://getcomposer.org)
+
+If you don’t have composer you can install it by running the following commands:
+
+```shell
curl -s http://getcomposer.org/installer | php
php composer.phar install
---------------------------
+```
-[discrete]
-=== Installation
+### Installation [_installation]
To install the latest version of the client, run the following command:
-[source,shell]
---------------------------
+```shell
composer require elasticsearch/elasticsearch
---------------------------
+```
-When you have installed elasticsearch-php you can start using it with the
-`Client` class. You can use the `ClientBuilder` class to create this object:
+When you have installed elasticsearch-php you can start using it with the `Client` class. You can use the `ClientBuilder` class to create this object:
-[source,php]
---------------------------
+```php
require 'vendor/autoload.php';
$client = Elastic\Elasticsearch\ClientBuilder::create()->build();
---------------------------
+```
-Refer to the <> page to learn more.
+Refer to the [*Installation*](/reference/installation.md) page to learn more.
-[discrete]
-=== Connecting
+### Connecting [_connecting]
-You can connect to the Elastic Cloud using an API key and the Elasticsearch
-endpoint.
+You can connect to the Elastic Cloud using an API key and the Elasticsearch endpoint.
-[source,php]
-----
+```php
$client = ClientBuilder::create()
->setHosts([''])
->setApiKey('')
->build();
-----
+```
-Your Elasticsearch endpoint can be found on the **My deployment** page of your
-deployment:
+Your Elasticsearch endpoint can be found on the ***My deployment*** page of your deployment:
-image::images/es_endpoint.jpg[alt="Finding Elasticsearch endpoint",align="center"]
+
-You can generate an API key on the **Management** page under Security.
+You can generate an API key on the ***Management*** page under Security.
-image::images/create_api_key.png[alt="Create API key",align="center"]
+
-For other connection options, refer to the <> section.
+For other connection options, refer to the [*Connecting*](/reference/connecting.md) section.
-[discrete]
-=== Operations
+### Operations [_operations]
-Time to use Elasticsearch! This section walks you through the basic, and most
-important, operations of Elasticsearch. For more operations and more advanced
-examples, refer to the <> page.
+Time to use Elasticsearch! This section walks you through the basic, and most important, operations of Elasticsearch. For more operations and more advanced examples, refer to the [*Operations*](/reference/operations.md) page.
-[discrete]
-==== Creating an index
+#### Creating an index [_creating_an_index]
This is how you create the `my_index` index:
-[source,php]
-----
+```php
$client = ClientBuilder::create()->build();
$params = [
'index' => 'my_index'
@@ -90,16 +79,14 @@ $params = [
// Create the index
$response = $client->indices()->create($params);
-----
+```
-[discrete]
-==== Indexing documents
+#### Indexing documents [_indexing_documents]
This is a simple way of indexing a document:
-[source,php]
-----
+```php
$params = [
'index' => 'my_index',
'body' => [ 'testField' => 'abc']
@@ -107,13 +94,11 @@ $params = [
// Document will be indexed to my_index/_doc/
$response = $client->index($params);
-----
+```
You can bulk index documents with batches in a slightly more complex way:
-.Bulk indexing with batches
-[source,php]
-----
+```php
$params = ['body' => []];
for ($i = 1; $i <= 1234567; $i++) {
@@ -145,16 +130,14 @@ for ($i = 1; $i <= 1234567; $i++) {
if (!empty($params['body'])) {
$responses = $client->bulk($params);
}
-----
+```
-[discrete]
-==== Getting documents
+#### Getting documents [_getting_documents]
You can get documents by using the following code:
-[source,php]
-----
+```php
$params = [
'index' => 'my_index',
'id' => 'my_id'
@@ -162,16 +145,14 @@ $params = [
// Get doc at /my_index/_doc/my_id
$response = $client->get($params);
-----
+```
-[discrete]
-==== Searching documents
+#### Searching documents [_searching_documents]
-This is how you can create a single match query with the PHP client:
+This is how you can create a single match query with the PHP client:
-[source,php]
-----
+```php
$params = [
'index' => 'my_index',
'body' => [
@@ -184,16 +165,14 @@ $params = [
];
$results = $client->search($params);
-----
+```
-[discrete]
-==== Updating documents
+#### Updating documents [_updating_documents]
This is how you can update a document, for example to add a new field:
-[source,php]
-----
+```php
$params = [
'index' => 'my_index',
'id' => 'my_id',
@@ -206,14 +185,12 @@ $params = [
// Update doc at /my_index/_doc/my_id
$response = $client->update($params);
-----
+```
-[discrete]
-==== Deleting documents
+#### Deleting documents [_deleting_documents]
-[source,php]
-----
+```php
$params = [
'index' => 'my_index',
'id' => 'my_id'
@@ -221,20 +198,18 @@ $params = [
// Delete doc at /my_index/_doc_/my_id
$response = $client->delete($params);
-----
+```
-[discrete]
-==== Deleting an index
+#### Deleting an index [_deleting_an_index]
-[source,php]
-----
+```php
$params = ['index' => 'my_index'];
$response = $client->indices()->delete($params);
-----
+```
+
+## Further reading [_further_reading]
-[discrete]
-== Further reading
+* Use [*Client helpers*](/reference/client-helpers.md) for a more confortable experience with the APIs.
-* Use <> for a more confortable experience with the APIs.
\ No newline at end of file
diff --git a/docs/reference/getting_documents.md b/docs/reference/getting_documents.md
new file mode 100644
index 000000000..8f0523a93
--- /dev/null
+++ b/docs/reference/getting_documents.md
@@ -0,0 +1,21 @@
+---
+mapped_pages:
+ - https://www.elastic.co/guide/en/elasticsearch/client/php-api/current/getting_documents.html
+---
+
+# Getting documents [getting_documents]
+
+{{es}} provides realtime GETs of documents. This means that as soon as the document is indexed and your client receives an acknowledgement, you can immediately retrieve the document from any shard. Get operations are performed by requesting a document by its full `index/type/id` path:
+
+```php
+$params = [
+ 'index' => 'my_index',
+ 'id' => 'my_id'
+];
+
+// Get doc at /my_index/_doc/my_id
+$response = $client->get($params);
+```
+
+
+
diff --git a/docs/host-config.asciidoc b/docs/reference/host-config.md
similarity index 68%
rename from docs/host-config.asciidoc
rename to docs/reference/host-config.md
index 81b8c7b86..818116d45 100644
--- a/docs/host-config.asciidoc
+++ b/docs/reference/host-config.md
@@ -1,19 +1,17 @@
-[[host-config]]
-=== Host Configuration
+---
+mapped_pages:
+ - https://www.elastic.co/guide/en/elasticsearch/client/php-api/current/host-config.html
+---
+
+# Host Configuration [host-config]
The client offers an options to configure hosts.
-The most common configuration is telling the client about your cluster: the
-number of nodes, their addresses, and ports. If no hosts are specified, the
-client attempts to connect to `localhost:9200`.
+The most common configuration is telling the client about your cluster: the number of nodes, their addresses, and ports. If no hosts are specified, the client attempts to connect to `localhost:9200`.
-This behavior can be changed by using the `setHosts()` method on
-`ClientBuilder`. The method accepts an array of values, each entry corresponding
-to one node in your cluster. The format of the host can vary, depending on your
-needs (ip vs hostname, port, ssl, etc).
+This behavior can be changed by using the `setHosts()` method on `ClientBuilder`. The method accepts an array of values, each entry corresponding to one node in your cluster. The format of the host can vary, depending on your needs (ip vs hostname, port, ssl, etc).
-[source,php]
-----
+```php
$hosts = [
'192.168.1.1:9200', // IP + Port
'192.168.1.2', // Just IP
@@ -25,13 +23,11 @@ $hosts = [
$client = ClientBuilder::create() // Instantiate a new ClientBuilder
->setHosts($hosts) // Set the hosts
->build(); // Build the client object
-----
+```
-Notice that the `ClientBuilder` object allows chaining method calls for brevity.
-It is also possible to call the methods individually:
+Notice that the `ClientBuilder` object allows chaining method calls for brevity. It is also possible to call the methods individually:
-[source,php]
-----
+```php
$hosts = [
'192.168.1.1:9200', // IP + Port
'192.168.1.2', // Just IP
@@ -43,4 +39,5 @@ $hosts = [
$clientBuilder = ClientBuilder::create(); // Instantiate a new ClientBuilder
$clientBuilder->setHosts($hosts); // Set the hosts
$client = $clientBuilder->build(); // Build the client object
-----
+```
+
diff --git a/docs/http-client.asciidoc b/docs/reference/http-client.md
similarity index 54%
rename from docs/http-client.asciidoc
rename to docs/reference/http-client.md
index 170f1473f..dad38e612 100644
--- a/docs/http-client.asciidoc
+++ b/docs/reference/http-client.md
@@ -1,59 +1,47 @@
-[[http-client]]
-=== Configure the HTTP client
+---
+mapped_pages:
+ - https://www.elastic.co/guide/en/elasticsearch/client/php-api/current/http-client.html
+---
-Elasticsearch-php uses https://github.com/elastic/elastic-transport-php[elastic-transport-php]
-for managing the HTTP tranport. This is an HTTP client provided by Elastic
-that can be configured to use any https://www.php-fig.org/psr/psr-18/[PSR-18] client library.
+# Configure the HTTP client [http-client]
-Elasticsearch-php uses Guzzle as default HTTP client but you can specify
-any other client using the `setHttpClient()` function, as follows:
+Elasticsearch-php uses [elastic-transport-php](https://github.com/elastic/elastic-transport-php) for managing the HTTP tranport. This is an HTTP client provided by Elastic that can be configured to use any [PSR-18](https://www.php-fig.org/psr/psr-18/) client library.
+Elasticsearch-php uses Guzzle as default HTTP client but you can specify any other client using the `setHttpClient()` function, as follows:
-[source,php]
-----
+```php
use Symfony\Component\HttpClient\Psr18Client;
$client = ClientBuilder::create()
->setHttpClient(new Psr18Client)
->build();
-----
+```
-For instance, in this example we used the https://symfony.com/doc/current/http_client.html[Symfony HTTP Client].
+For instance, in this example we used the [Symfony HTTP Client](https://symfony.com/doc/current/http_client.html).
-[discrete]
-==== Setting the client options
-If you want you can set the options for a specific PSR-18 client
-using the `ClientBuilder::setHttpClientOptions($options)` method.
-The `$options` is an array of key:value options that are
-specifics to the HTTP client used.
+## Setting the client options [_setting_the_client_options]
-For instance, if you are using Guzzle (default) and you need to use a
-https://docs.guzzlephp.org/en/stable/request-options.html#proxy[proxy]
-you can use the following settings:
+If you want you can set the options for a specific PSR-18 client using the `ClientBuilder::setHttpClientOptions($options)` method. The `$options` is an array of key:value options that are specifics to the HTTP client used.
-[source,php]
-----
+For instance, if you are using Guzzle (default) and you need to use a [proxy](https://docs.guzzlephp.org/en/stable/request-options.html#proxy) you can use the following settings:
+
+```php
$client = ClientBuilder::create()
->setHttpClientOptions([
'proxy' => 'http://localhost:8125'
])
->build();
-----
+```
-[discrete]
-==== Configuring the HTTP async client
+## Configuring the HTTP async client [_configuring_the_http_async_client]
-Elasticsearch-php can works using an asyncronous HTTP client that implements
-the https://github.com/php-http/httplug/blob/master/src/HttpAsyncClient.php[HttpAsyncClient] interface
-of the http://httplug.io/[HTTPlug] project.
+Elasticsearch-php can works using an asyncronous HTTP client that implements the [HttpAsyncClient](https://github.com/php-http/httplug/blob/master/src/HttpAsyncClient.php) interface of the [HTTPlug](http://httplug.io/) project.
-Unfortunately, there is not yet a PSR standard for HTTP async client.
-We used the HTTPlug interface that is quite simple, as follows:
+Unfortunately, there is not yet a PSR standard for HTTP async client. We used the HTTPlug interface that is quite simple, as follows:
-[source,php]
-----
+```php
namespace Http\Client;
use Http\Promise\Promise;
@@ -66,13 +54,11 @@ interface HttpAsyncClient
*/
public function sendAsyncRequest(RequestInterface $request);
}
-----
+```
-You can enable the HTTP async in elasticsearch-php using the `setAsync()` function,
-as follows:
+You can enable the HTTP async in elasticsearch-php using the `setAsync()` function, as follows:
-[source,php]
-----
+```php
$client = ClientBuilder::create()
->build();
@@ -87,20 +73,15 @@ for ($i=0; $i<10; $i++) {
]
]);
}
-----
+```
-The previous example stores 10 random documents using the HTTP asyncronous feature.
-The `$promise` response is an object of https://github.com/php-http/promise/blob/master/src/Promise.php[promises/a+]
-interface.
+The previous example stores 10 random documents using the HTTP asyncronous feature. The `$promise` response is an object of [promises/a+](https://github.com/php-http/promise/blob/master/src/Promise.php) interface.
-A promise represents a single result of an asynchronous operation.
-It is not necessarily available at a specific time, but should become in the future.
+A promise represents a single result of an asynchronous operation. It is not necessarily available at a specific time, but should become in the future.
-If you need to know the response you can just call the `wait()` function,
-as follows:
+If you need to know the response you can just call the `wait()` function, as follows:
-[source,php]
-----
+```php
$promise = $client->index([
'index' => 'my-index',
'body' => [
@@ -109,16 +90,13 @@ $promise = $client->index([
]);
$result = $promise->wait();
print_r($result->asArray());
-----
+```
-The `wait()` function block the execution until we will recevie the
-HTTP response from {es}.
+The `wait()` function block the execution until we will recevie the HTTP response from {{es}}.
-Instead of waiting, you can handle things asynchronously using the
-`then()` function, as follows:
+Instead of waiting, you can handle things asynchronously using the `then()` function, as follows:
-[source,php]
-----
+```php
use Psr\Http\Message\ResponseInterface; // PSR-7
$promise = $client->index([
@@ -141,8 +119,7 @@ $promise->then(
throw $exception;
}
);
-----
+```
-More information about Promise are available at the
-https://docs.php-http.org/en/latest/components/promise.html[HTTPlug documentation page].
+More information about Promise are available at the [HTTPlug documentation page](https://docs.php-http.org/en/latest/components/promise.html).
diff --git a/docs/reference/http-meta-data.md b/docs/reference/http-meta-data.md
new file mode 100644
index 000000000..08ce86404
--- /dev/null
+++ b/docs/reference/http-meta-data.md
@@ -0,0 +1,24 @@
+---
+mapped_pages:
+ - https://www.elastic.co/guide/en/elasticsearch/client/php-api/current/http-meta-data.html
+---
+
+# HTTP Meta Data [http-meta-data]
+
+By default, the client sends some meta data about the HTTP connection using custom headers.
+
+You can disable or enable it using the following methods:
+
+## Elastic Meta Header [_elastic_meta_header]
+
+The client sends a `x-elastic-client-meta` header by default. This header is used to collect meta data about the versions of the components used by the client. For instance, a value of `x-elastic-client-meta` can be `es=8.0.0-s,php=8.0.0,t=8.0.0-s,a=0,gu=7.4.2, where each value is the version of `es=Elasticsearch`, `t` is the transport version (same of client), `a` is asyncronouts (`0=false` by default) and `gu=Guzzle`.
+
+If you would like to disable it you can use the `setElasticMetaHeader()` method, as follows:
+
+```php
+$client = Elasticsearch\ClientBuilder::create()
+ ->setElasticMetaHeader(false)
+ ->build();
+```
+
+
diff --git a/docs/images/api_key_name.png b/docs/reference/images/api_key_name.png
similarity index 100%
rename from docs/images/api_key_name.png
rename to docs/reference/images/api_key_name.png
diff --git a/docs/images/cloud_api_key.png b/docs/reference/images/cloud_api_key.png
similarity index 100%
rename from docs/images/cloud_api_key.png
rename to docs/reference/images/cloud_api_key.png
diff --git a/docs/images/cloud_id.png b/docs/reference/images/cloud_id.png
similarity index 100%
rename from docs/images/cloud_id.png
rename to docs/reference/images/cloud_id.png
diff --git a/docs/images/create_api_key.png b/docs/reference/images/create_api_key.png
similarity index 100%
rename from docs/images/create_api_key.png
rename to docs/reference/images/create_api_key.png
diff --git a/docs/images/es_endpoint.jpg b/docs/reference/images/es_endpoint.jpg
similarity index 100%
rename from docs/images/es_endpoint.jpg
rename to docs/reference/images/es_endpoint.jpg
diff --git a/docs/reference/index.md b/docs/reference/index.md
new file mode 100644
index 000000000..1622f8fae
--- /dev/null
+++ b/docs/reference/index.md
@@ -0,0 +1,37 @@
+---
+mapped_pages:
+ - https://www.elastic.co/guide/en/elasticsearch/client/php-api/current/index.html
+ - https://www.elastic.co/guide/en/elasticsearch/client/php-api/current/overview.html
+---
+
+# PHP [overview]
+
+This is the official PHP client for {{es}}. It is designed to be a low-level client that does not stray from the REST API.
+
+All methods closely match the REST API, and furthermore, match the method structure of other language clients (Ruby, Python, and so on). We hope that this consistency makes it easy to get started with a client and to seamlessly switch from one language to the next with minimal effort.
+
+The client is designed to facilitate the API call using different way to read the results using associative array, object, string or [PSR-7](https://www.php-fig.org/psr/psr-7/).
+
+Refer to the [*Getting started*](/reference/getting-started.md) page for a step-by-step quick start with the PHP client.
+
+
+## PSR 7 standard [psr-7-standard]
+
+The {{es}} PHP client uses the [PSR](https://www.php-fig.org/psr/) 7 standard. This standard is a community effort that contains a set of interfaces defined by the PHP Framework Interop Group. For more information, refer to the [PSR 7 standard documentation](https://www.php-fig.org/psr/psr-7/).
+
+
+## {{es}} and PHP version Compatibility [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 |
+
+* [Breaking changes from 7.x](https://www.elastic.co/guide/en/elasticsearch/client/php-api/7.17/breaking_changes.html)
+
+
diff --git a/docs/index-operations.asciidoc b/docs/reference/index_management.md
similarity index 71%
rename from docs/index-operations.asciidoc
rename to docs/reference/index_management.md
index c40dba055..7fc6e165a 100644
--- a/docs/index-operations.asciidoc
+++ b/docs/reference/index_management.md
@@ -1,19 +1,18 @@
-[[index_management]]
-=== Index management operations
+---
+mapped_pages:
+ - https://www.elastic.co/guide/en/elasticsearch/client/php-api/current/index_management.html
+---
-Index management operations allow you to manage the indices in your {es}
-cluster, such as creating, deleting and updating indices and their
-mappings/settings.
+# Index management operations [index_management]
-[discrete]
-==== Create an index
+Index management operations allow you to manage the indices in your {{es}} cluster, such as creating, deleting and updating indices and their mappings/settings.
-The index operations are all contained under a distinct namespace, separated
-from other methods that are on the root client object. As an example, let's
-create a new index:
-[source,php]
-----
+### Create an index [_create_an_index]
+
+The index operations are all contained under a distinct namespace, separated from other methods that are on the root client object. As an example, let’s create a new index:
+
+```php
$client = ClientBuilder::create()->build();
$params = [
'index' => 'my_index'
@@ -21,15 +20,13 @@ $params = [
// Create the index
$response = $client->indices()->create($params);
-----
-{zwsp} +
+```
+
+
-You can specify any parameters that would normally be included in a new index
-creation API. All parameters that would normally go in the request body are
-located in the 'body' parameter:
+You can specify any parameters that would normally be included in a new index creation API. All parameters that would normally go in the request body are located in the *body* parameter:
-[source,php]
-----
+```php
$client = ClientBuilder::create()->build();
$params = [
'index' => 'my_index',
@@ -57,19 +54,16 @@ $params = [
// Create the index with mappings and settings now
$response = $client->indices()->create($params);
-----
-{zwsp} +
+```
+
+
+
-[discrete]
-==== Create an index (advanced example)
+### Create an index (advanced example) [_create_an_index_advanced_example]
-This is a more complicated example of creating an index, showing how to define
-analyzers, tokenizers, filters and index settings. Although essentially the same
-as the previous example, the more complicated example can be helpful for "real
-world" usage of the client since this particular syntax is easy to mess up.
+This is a more complicated example of creating an index, showing how to define analyzers, tokenizers, filters and index settings. Although essentially the same as the previous example, the more complicated example can be helpful for "real world" usage of the client since this particular syntax is easy to mess up.
-[source,php]
-----
+```php
$params = [
'index' => 'reuters',
'body' => [
@@ -130,33 +124,31 @@ $params = [
]
];
$client->indices()->create($params);
-----
-<1> The top level `settings` contains config about the index (# of shards, etc)
-as well as analyzers.
-<2> `analysis` is nested inside of `settings`, and contains tokenizers, filters,
-char filters and analyzers.
-<3> `mappings` is another element nested inside of `settings`, and contains the
-mappings for various types.
+```
-[discrete]
-==== Delete an index
+1. The top level `settings` contains config about the index (# of shards, etc) as well as analyzers.
+2. `analysis` is nested inside of `settings`, and contains tokenizers, filters, char filters and analyzers.
+3. `mappings` is another element nested inside of `settings`, and contains the mappings for various types.
+
+
+
+### Delete an index [_delete_an_index]
Deleting an index is very simple:
-[source,php]
-----
+```php
$params = ['index' => 'my_index'];
$response = $client->indices()->delete($params);
-----
-{zwsp} +
+```
+
+
+
-[discrete]
-=== PUT Settings API
+## PUT Settings API [_put_settings_api]
The PUT Settings API allows you to modify any index setting that is dynamic:
-[source,php]
-----
+```php
$params = [
'index' => 'my_index',
'body' => [
@@ -168,17 +160,16 @@ $params = [
];
$response = $client->indices()->putSettings($params);
-----
-{zwsp} +
+```
-[discrete]
-==== GET Settings API
+
-The GET Settings API shows you the currently configured settings for one or more
-indices:
-[source,php]
-----
+### GET Settings API [_get_settings_api]
+
+The GET Settings API shows you the currently configured settings for one or more indices:
+
+```php
// Get settings for one index
$params = ['index' => 'my_index'];
$response = $client->indices()->getSettings($params);
@@ -188,16 +179,16 @@ $params = [
'index' => [ 'my_index', 'my_index2' ]
];
$response = $client->indices()->getSettings($params);
-----
-{zwsp} +
+```
+
+
-[discrete]
-==== PUT Mappings API
-The PUT Mappings API allows you to modify or add to an existing index's mapping.
+### PUT Mappings API [_put_mappings_api]
-[source,php]
-----
+The PUT Mappings API allows you to modify or add to an existing index’s mapping.
+
+```php
// Set the index and type
$params = [
'index' => 'my_index',
@@ -219,17 +210,16 @@ $params = [
// Update the index mapping
$client->indices()->putMapping($params);
-----
-{zwsp} +
+```
+
+
-[discrete]
-==== GET Mappings API
-The GET Mappings API returns the mapping details about your indices. Depending
-on the mappings that you wish to retrieve, you can specify one of more indices:
+### GET Mappings API [_get_mappings_api]
-[source,php]
-----
+The GET Mappings API returns the mapping details about your indices. Depending on the mappings that you wish to retrieve, you can specify one of more indices:
+
+```php
// Get mappings for all indices
$response = $client->indices()->getMapping();
@@ -242,25 +232,20 @@ $params = [
'index' => [ 'my_index', 'my_index2' ]
];
$response = $client->indices()->getMapping($params);
-----
-{zwsp} +
+```
+
+
-[discrete]
-==== Other APIs in the indices namespace
-There are a number of other APIs in the indices namespace that allow you to
-manage your {es} indices (add/remove templates, flush segments, close indices,
-etc).
+### Other APIs in the indices namespace [_other_apis_in_the_indices_namespace]
-If you use an IDE with autocompletion, you should be able to easily explore the
-indices namespace by typing:
+There are a number of other APIs in the indices namespace that allow you to manage your {{es}} indices (add/remove templates, flush segments, close indices, etc).
-[source,php]
-----
+If you use an IDE with autocompletion, you should be able to easily explore the indices namespace by typing:
+
+```php
$client->indices()->
-----
+```
+
+And perusing the list of available methods. Alternatively, browsing the `\Elasticsearch\Namespaces\Indices.php` file shows you the full list of available method calls (as well as parameter lists in the comments for each method).
-And perusing the list of available methods. Alternatively, browsing the
-`\Elasticsearch\Namespaces\Indices.php` file shows you the full list of
-available method calls (as well as parameter lists in the comments for each
-method).
diff --git a/docs/reference/indexing_documents.md b/docs/reference/indexing_documents.md
new file mode 100644
index 000000000..210fd85de
--- /dev/null
+++ b/docs/reference/indexing_documents.md
@@ -0,0 +1,118 @@
+---
+mapped_pages:
+ - https://www.elastic.co/guide/en/elasticsearch/client/php-api/current/indexing_documents.html
+---
+
+# Indexing documents [indexing_documents]
+
+When you add documents to {{es}}, you index JSON documents. This maps naturally to PHP associative arrays, since they can easily be encoded in JSON. Therefore, in Elasticsearch-PHP you create and pass associative arrays to the client for indexing. There are several methods of ingesting data into {{es}} which we cover here.
+
+
+## Single document indexing [_single_document_indexing]
+
+When indexing a document, you can either provide an ID or let {{es}} generate one for you.
+
+
+
+```php
+$params = [
+ 'index' => 'my_index',
+ 'id' => 'my_id',
+ 'body' => [ 'testField' => 'abc']
+];
+
+// Document will be indexed to my_index/_doc/my_id
+$response = $client->index($params);
+```
+
+
+
+```php
+$params = [
+ 'index' => 'my_index',
+ 'body' => [ 'testField' => 'abc']
+];
+
+// Document will be indexed to my_index/_doc/
+$response = $client->index($params);
+```
+
+
+
+If you need to set other parameters, such as a `routing` value, you specify those in the array alongside the `index`, and others. For example, let’s set the routing and timestamp of this new document:
+
+```php
+$params = [
+ 'index' => 'my_index',
+ 'id' => 'my_id',
+ 'routing' => 'company_xyz',
+ 'timestamp' => strtotime("-1d"),
+ 'body' => [ 'testField' => 'abc']
+];
+
+
+$response = $client->index($params);
+```
+
+
+
+
+## Bulk Indexing [_bulk_indexing]
+
+{{es}} also supports bulk indexing of documents. The bulk API expects JSON action/metadata pairs, separated by newlines. When constructing your documents in PHP, the process is similar. You first create an action array object (for example, an `index` object), then you create a document body object. This process repeats for all your documents.
+
+A simple example might look like this:
+
+```php
+for($i = 0; $i < 100; $i++) {
+ $params['body'][] = [
+ 'index' => [
+ '_index' => 'my_index',
+ ]
+ ];
+
+ $params['body'][] = [
+ 'my_field' => 'my_value',
+ 'second_field' => 'some more values'
+ ];
+}
+
+$responses = $client->bulk($params);
+```
+
+In practice, you’ll likely have more documents than you want to send in a single bulk request. In that case, you need to batch up the requests and periodically send them:
+
+```php
+$params = ['body' => []];
+
+for ($i = 1; $i <= 1234567; $i++) {
+ $params['body'][] = [
+ 'index' => [
+ '_index' => 'my_index',
+ '_id' => $i
+ ]
+ ];
+
+ $params['body'][] = [
+ 'my_field' => 'my_value',
+ 'second_field' => 'some more values'
+ ];
+
+ // Every 1000 documents stop and send the bulk request
+ if ($i % 1000 == 0) {
+ $responses = $client->bulk($params);
+
+ // erase the old bulk request
+ $params = ['body' => []];
+
+ // unset the bulk response when you are done to save memory
+ unset($responses);
+ }
+}
+
+// Send the last batch if it exists
+if (!empty($params['body'])) {
+ $responses = $client->bulk($params);
+}
+```
+
diff --git a/docs/reference/installation.md b/docs/reference/installation.md
new file mode 100644
index 000000000..52962a9de
--- /dev/null
+++ b/docs/reference/installation.md
@@ -0,0 +1,32 @@
+---
+mapped_pages:
+ - https://www.elastic.co/guide/en/elasticsearch/client/php-api/current/installation.html
+---
+
+# Installation [installation]
+
+Elasticsearch-php can be used starting from PHP 7.4. To install the library you need to use [composer](http://getcomposer.org) with the following command:
+
+```shell
+composer require elasticsearch/elasticsearch
+```
+
+If you don’t have composer you can install it as follows:
+
+```shell
+curl -s http://getcomposer.org/installer | php
+php composer.phar install
+```
+
+More information about [Composer can be found at their website](https://getcomposer.org/).
+
+When you have installed elasticsearch-php you can start using it with the `Client` class. You can use the `ClientBuilder` class to create this object, as follows:
+
+```php
+require 'vendor/autoload.php';
+
+$client = Elastic\Elasticsearch\ClientBuilder::create()->build();
+```
+
++ Client instantiation is performed with a static helper function `create()`. This creates a ClientBuilder object, which helps you to set custom configurations. When you are done configuring, call the `build()` method to generate a `Client` object. For further info, consult the [*Configuration*](/reference/configuration.md) section.
+
diff --git a/docs/helpers/iterators.asciidoc b/docs/reference/iterators.md
similarity index 76%
rename from docs/helpers/iterators.asciidoc
rename to docs/reference/iterators.md
index 1af6ee902..22d7c8903 100644
--- a/docs/helpers/iterators.asciidoc
+++ b/docs/reference/iterators.md
@@ -1,19 +1,19 @@
-[[iterators]]
-=== Iterators
+---
+mapped_pages:
+ - https://www.elastic.co/guide/en/elasticsearch/client/php-api/current/iterators.html
+---
+
+# Iterators [iterators]
The PHP client includes helpers for iterating through results by page or by hits.
-[[search-response-iterator]]
-==== Search response iterator
+## Search response iterator [search-response-iterator]
-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].
+Use the `SearchResponseIterator` to iterate page by page in a search result using [pagination](elasticsearch://reference/elasticsearch/rest-apis/paginate-search-results.md).
-Here's an example:
+Here’s an example:
-[source,php]
-----
+```php
use Elastic\Elasticsearch\Helper\Iterators\SearchResponseIterator;
$search_params = [
@@ -35,21 +35,16 @@ foreach($pages as $page) {
// e.g. prints the number of document per page (100)
echo count($page['hits']['hits']), PHP_EOL;
}
-----
+```
-[discrete]
-[[search-hit-iterator]]
-==== Search hit iterator
+### Search hit iterator [search-hit-iterator]
-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].
+Use the `SearchHitIterator` to iterate in a `SearchResponseIterator` without worrying about [pagination](elasticsearch://reference/elasticsearch/rest-apis/paginate-search-results.md).
-Here's an example:
+Here’s an example:
-[source,php]
-----
+```php
use Elastic\Elasticsearch\Helper\Iterators\SearchHitIterator;
use Elastic\Elasticsearch\Helper\Iterators\SearchResponseIterator;
@@ -73,4 +68,6 @@ foreach($hits as $hit) {
// e.g. prints the document id
echo $hit['_id'], PHP_EOL;
}
-----
+```
+
+
diff --git a/docs/reference/namespaces.md b/docs/reference/namespaces.md
new file mode 100644
index 000000000..32d65e0cf
--- /dev/null
+++ b/docs/reference/namespaces.md
@@ -0,0 +1,102 @@
+---
+mapped_pages:
+ - https://www.elastic.co/guide/en/elasticsearch/client/php-api/current/namespaces.html
+---
+
+# Namespaces [namespaces]
+
+The client has a number of "namespaces", which generally expose administrative functionality. The namespaces correspond to the various administrative endpoints in {{es}}. This is a complete list of namespaces:
+
+| Namespace | Functionality |
+| --- | --- |
+| `asyncSearch()` | Provide asyncronous search |
+| `autoscaling()` | Autoscaling features |
+| `cat()` | Compact and aligned text (CAT), mainly for terminal |
+| `ccr()` | Cross-cluster replication operations |
+| `cluster()` | Cluster-centric stats and info |
+| `danglingIndices()` | Dangling indices management |
+| `enrich()` | Enrich policy management |
+| `eql()` | Event Query Language |
+| `features()` | Manage features provided by Elasticsearch and plugins |
+| `fleet()` | Fleet’s use of Elasticsearch (experimental) |
+| `graph()` | Graph explore for documents and terms |
+| `ilm()` | Index lifecycle management (ILM) |
+| `indices()` | Index-centric stats and info |
+| `ingest()` | Ingest pipelines and processors |
+| `license()` | License management |
+| `logStash()` | Manage pipelines used by Logstash Central Management |
+| `migration()` | Designed for indirect use by Kibana’s Upgrade Assistant |
+| `ml()` | Machine learning features |
+| `monitoring()` | Monitoring features |
+| `monitoring()` | Monitoring features |
+| `nodes()` | Node-centric stats and info |
+| `rollup()` | Rollup features |
+| `searchableSnapshots()` | Searchable snapshots operations |
+| `security()` | Security features |
+| `shutdown()` | Prepare nodes for temporary or permanent shutdown |
+| `slm()` | Snapshot lifecycle management (SLM) |
+| `snapshot()` | Methods to snapshot/restore your cluster and indices |
+| `sql()` | Run SQL queries on Elasticsearch indices and data streams |
+| `ssl()` | SSL certificate management |
+| `tasks()` | Task management |
+| `textStructure()` | Finds the structure of text |
+| `transform()` | Transform features |
+| `watcher()` | Watcher create actions based on conditions |
+| `xpack()` | Retrieves information about the installed X-Pack features |
+
+Some methods are available in several different namespaces, which give you the same information but grouped into different contexts. To see how these namespaces work, let’s look at the `_stats` output:
+
+```php
+$client = ClientBuilder::create()->build();
+
+// Index Stats
+// Corresponds to curl -XGET localhost:9200/_stats
+$response = $client->indices()->stats();
+
+// Node Stats
+// Corresponds to curl -XGET localhost:9200/_nodes/stats
+$response = $client->nodes()->stats();
+
+// Cluster Stats
+// Corresponds to curl -XGET localhost:9200/_cluster/stats
+$response = $client->cluster()->stats();
+```
+
+
+
+As you can see, the same `stats()` call is made through three different namespaces. Sometimes the methods require parameters. These parameters work just like any other method in the library.
+
+For example, we can requests index stats about a specific index, or multiple indices:
+
+```php
+$client = ClientBuilder::create()->build();
+
+// Corresponds to curl -XGET localhost:9200/my_index/_stats
+$params['index'] = 'my_index';
+$response = $client->indices()->stats($params);
+
+// Corresponds to curl -XGET localhost:9200/my_index1,my_index2/_stats
+$params['index'] = ['my_index1', 'my_index2'];
+$response = $client->indices()->stats($params);
+```
+
+
+
+The following example shows how you can add an alias to an existing index:
+
+```php
+$params['body'] = [
+ 'actions' => [
+ [
+ 'add' => [
+ 'index' => 'myindex',
+ 'alias' => 'myalias'
+ ]
+ ]
+ ]
+];
+$client->indices()->updateAliases($params);
+```
+
+Notice how both the `stats` calls and the `updateAliases` took a variety of parameters, each according to what the particular API requires. The `stats` API only requires an index name(s), while the `updateAliases` requires a body of actions.
+
diff --git a/docs/reference/node_pool.md b/docs/reference/node_pool.md
new file mode 100644
index 000000000..7c53b6a1a
--- /dev/null
+++ b/docs/reference/node_pool.md
@@ -0,0 +1,90 @@
+---
+mapped_pages:
+ - https://www.elastic.co/guide/en/elasticsearch/client/php-api/current/node_pool.html
+---
+
+# Node Pool [node_pool]
+
+The node pool is a component of [elastic-transport-php](https://github.com/elastic/elastic-transport-php) library used by elasticsearch-php.
+
+This component is responsible for maintaining the current list of nodes. Theoretically, nodes are either dead or alive. However, in the real world, things are never so clear. Nodes are sometimes in a gray-zone of *"probably dead but not confirmed"*, *"timed-out but unclear why"* or *"recently dead but now alive"*. The job of the node pool is to manage this set of unruly connections and try to provide the best behavior to the client.
+
+If a node pool is unable to find an alive node to query against, it returns a `NoNodeAvailableException`.
+
+By default, the number of retries is equal to the number of nodes in your cluster. For example, your cluster may have 10 nodes. You execute a request and 9 out of the 10 nodes fail due to connection timeouts. The tenth node succeeds and the query executes. The first nine nodes are marked dead and their "dead" timers begin ticking.
+
+When the next request is sent to the client, nodes 1-9 are still considered "dead", so they are skipped. The request is sent to the only known alive node (#10), if this node fails, a `NoNodesAvailableException` is returned.
+
+The `SimpleNodePool` is the default node pool algorithm. It uses the following default values: RoundRobin as `SelectorInterface` and NoResurrect as `ResurrectInterface`.
+
+The Round-robin algorithm select the nodes in order, from the first node in the array to the latest. When arrived to the latest nodes, it will start again from the first.
+
+::::{note}
+The order of the nodes is randomized at runtime to maximize the usage of all the hosts.
+::::
+
+
+The `NoResurrect` option does not try to resurrect the node that has been marked as dead. If you want, you can specify the `ElasticsearchResurrect` class to check if a node that was dead is online again (resurrected).
+
+You can use the following configuration to enable the `ElasticsearchResurrect` class:
+
+```php
+use Elastic\Transport\NodePool\Resurrect\ElasticsearchResurrect;
+use Elastic\Transport\NodePool\Selector\RoundRobin;
+use Elastic\Transport\NodePool\SimpleNodePool;
+
+$nodePool = new SimpleNodePool(
+ new RoundRobin(),
+ new ElasticsearchResurrect()
+);
+
+$transport = TransportBuilder::create()
+ ->setHosts(['localhost:9200'])
+ ->setNodePool($nodePool)
+ ->build();
+```
+
+
+### Using a custom NodePool, Selector and Resurrect [_using_a_custom_nodepool_selector_and_resurrect]
+
+If you want you can implement your custom node pool algorithm. We provided a [NodePoolInterface](https://github.com/elastic/elastic-transport-php/blob/master/src/NodePool/NodePoolInterface.php)
+
+You can also customize the Selector and the Resurrect components of the node pool. You can use the following interfaces for the implementation:
+
+* [SelectorInterface](https://github.com/elastic/elastic-transport-php/blob/master/src/NodePool/Selector/SelectorInterface.php)
+* [ResurrectInterface](https://github.com/elastic/elastic-transport-php/blob/master/src/NodePool/Resurrect/ResurrectInterface.php)
+
+For more information about the Node Pool you can read the [elastic-transport-php documentation](https://github.com/elastic/elastic-transport-php/blob/master/README.md).
+
+
+## Building the client from a configuration hash [config-hash]
+
+To help ease automated building of the client, all configurations can be provided in a setting hash instead of calling the individual methods directly. This functionality is exposed through the `ClientBuilder::fromConfig()` static method, which accepts an array of configurations and returns a fully built client.
+
+Array keys correspond to the method name, for example `retries` key corresponds to `setRetries()` method.
+
+```php
+$params = [
+ 'hosts' => [
+ 'localhost:9200'
+ ],
+ 'retries' => 2
+];
+$client = ClientBuilder::fromConfig($params);
+```
+
+Unknown parameters throw an exception, to help the user find potential problems. If this behavior is not desired (for example, you are using the hash for other purposes), you can set `$quiet = true` in fromConfig() to silence the exceptions.
+
+```php
+$params = [
+ 'hosts' => [
+ 'localhost:9200'
+ ],
+ 'retries' => 2,
+ 'imNotReal' => 5
+];
+
+// Set $quiet to true to ignore the unknown `imNotReal` key
+$client = ClientBuilder::fromConfig($params, true);
+```
+
diff --git a/docs/reference/operations.md b/docs/reference/operations.md
new file mode 100644
index 000000000..1b8cb41dc
--- /dev/null
+++ b/docs/reference/operations.md
@@ -0,0 +1,26 @@
+---
+mapped_pages:
+ - https://www.elastic.co/guide/en/elasticsearch/client/php-api/current/operations.html
+---
+
+# Operations [operations]
+
+This page contains the information you need to perform various {{es}} operations by using the Client.
+
+This section is a crash-course overview of the client and its syntax. If you are familiar with {{es}}, you’ll notice that the methods are named just like REST endpoints.
+
+You may also notice that the client is configured in a manner that facilitates easy discovery via your IDE. All core actions are available under the `$client` object (indexing, searching, getting, etc). Index and cluster management are located under the `$client->indices()` and `$client->cluster()` objects, respectively.
+
+* [Index management operations](/reference/index_management.md)
+* [Search operations](/reference/search_operations.md)
+* [Indexing documents](/reference/indexing_documents.md)
+* [Getting documents](/reference/getting_documents.md)
+* [Updating documents](/reference/updating_documents.md)
+* [Deleting documents](/reference/deleting_documents.md)
+
+
+
+
+
+
+
diff --git a/docs/reference/php_json_objects.md b/docs/reference/php_json_objects.md
new file mode 100644
index 000000000..be00a441a
--- /dev/null
+++ b/docs/reference/php_json_objects.md
@@ -0,0 +1,160 @@
+---
+mapped_pages:
+ - https://www.elastic.co/guide/en/elasticsearch/client/php-api/current/php_json_objects.html
+---
+
+# Dealing with JSON arrays and objects in PHP [php_json_objects]
+
+A common source of confusion with the client revolves around JSON arrays and objects, and how to specify them in PHP. In particular, problems are caused by empty objects and arrays of objects. This page shows you some common patterns used in {{es}} JSON API and how to convert that to a PHP representation.
+
+
+## Empty Objects [_empty_objects]
+
+The {{es}} API uses empty JSON objects in several locations which can cause problems for PHP. Unlike other languages, PHP does not have a "short" notation for empty objects and many developers are unaware how to specify an empty object.
+
+Consider adding a highlight to a query:
+
+```json
+{
+ "query" : {
+ "match" : {
+ "content" : "quick brown fox"
+ }
+ },
+ "highlight" : {
+ "fields" : {
+ "content" : {} <1>
+ }
+ }
+}
+```
+
+1. This empty JSON object is what causes problems.
+
+
+The problem is that PHP will automatically convert `"content" : {}` into `"content" : []`, which is no longer valid {{es}} DSL. We need to tell PHP that the empty object is explicitly an object, not an array. To define this query in PHP, you would do:
+
+```json
+$params['body'] = array(
+ 'query' => array(
+ 'match' => array(
+ 'content' => 'quick brown fox'
+ )
+ ),
+ 'highlight' => array(
+ 'fields' => array(
+ 'content' => new \stdClass() <1>
+ )
+ )
+);
+$results = $client->search($params);
+```
+
+1. We use the generic PHP stdClass object to represent an empty object. The JSON now encodes correctly.
+
+
+By using an explicit stdClass object, we can force the `json_encode` parser to correctly output an empty object, instead of an empty array. This verbose solution is the only way to acomplish the goal in PHP… there is no "short" version of an empty object.
+
+
+## Arrays of Objects [_arrays_of_objects]
+
+Another common pattern in {{es}} DSL is an array of objects. For example, consider adding a sort to your query:
+
+```json
+{
+ "query" : {
+ "match" : { "content" : "quick brown fox" }
+ },
+ "sort" : [ <1>
+ {"time" : {"order" : "desc"}},
+ {"popularity" : {"order" : "desc"}}
+ ]
+}
+```
+
+1. "sort" contains an array of JSON objects.
+
+
+This arrangement is very common, but the construction in PHP can be tricky since it requires nesting arrays. The verbosity of PHP tends to obscure what is actually going on. To construct an array of objects, you actually need an array of arrays:
+
+```json
+$params['body'] = array(
+ 'query' => array(
+ 'match' => array(
+ 'content' => 'quick brown fox'
+ )
+ ),
+ 'sort' => array( <1>
+ array('time' => array('order' => 'desc')), <2>
+ array('popularity' => array('order' => 'desc')) <3>
+ )
+);
+$results = $client->search($params);
+```
+
+1. This array encodes the `"sort" : []` array
+2. This array encodes the `{"time" : {"order" : "desc"}}` object
+3. This array encodes the `{"popularity" : {"order" : "desc"}}` object
+
+
+If you are on PHP 5.4+, we strongly encourage you to use the short array syntax. It makes these nested arrays much simpler to read:
+
+```json
+$params['body'] = [
+ 'query' => [
+ 'match' => [
+ 'content' => 'quick brown fox'
+ ]
+ ],
+ 'sort' => [
+ ['time' => ['order' => 'desc']],
+ ['popularity' => ['order' => 'desc']]
+ ]
+];
+$results = $client->search($params);
+```
+
+
+## Arrays of empty objects [_arrays_of_empty_objects]
+
+Occasionally, you’ll encounter DSL that requires both of the previous patterns. The function score query is a good example, it sometimes requires an array of objects, and some of those objects might be empty JSON objects.
+
+Given this query:
+
+```json
+{
+ "query":{
+ "function_score":{
+ "functions":[
+ {
+ "random_score":{}
+ }
+ ],
+ "boost_mode":"replace"
+ }
+ }
+}
+```
+
+We can build it using the following PHP code:
+
+```json
+$params['body'] = array(
+ 'query' => array(
+ 'function_score' => array(
+ 'functions' => array( <1>
+ array( <2>
+ 'random_score' => new \stdClass() <3>
+ )
+ )
+ )
+ )
+);
+$results = $client->search($params);
+```
+
+1. This encodes the array of objects: `"functions" : []`
+2. This encodes an object inside the array: `{ "random_score": {} }`
+3. This encodes the empty JSON object: `"random_score": {}`
+
+
diff --git a/docs/search-operations.asciidoc b/docs/reference/search_operations.md
similarity index 62%
rename from docs/search-operations.asciidoc
rename to docs/reference/search_operations.md
index 6b6226549..7f938e42a 100644
--- a/docs/search-operations.asciidoc
+++ b/docs/reference/search_operations.md
@@ -1,20 +1,20 @@
-[[search_operations]]
-=== Search operations
+---
+mapped_pages:
+ - https://www.elastic.co/guide/en/elasticsearch/client/php-api/current/search_operations.html
+---
-Well...it isn't called {es} for nothing! Let's talk about search operations in
-the client.
+# Search operations [search_operations]
-The client gives you full access to every query and parameter exposed by the
-REST API, following the naming scheme as much as possible. Let's look at a few
-examples so you can become familiar with the syntax.
+Well…it isn’t called {{es}} for nothing! Let’s talk about search operations in the client.
-[discrete]
-==== Match query
+The client gives you full access to every query and parameter exposed by the REST API, following the naming scheme as much as possible. Let’s look at a few examples so you can become familiar with the syntax.
+
+
+## Match query [_match_query]
Here is a standard curl for a match query:
-[source,shell]
-----
+```shell
curl -XGET 'localhost:9200/my_index/_search' -d '{
"query" : {
"match" : {
@@ -22,14 +22,13 @@ curl -XGET 'localhost:9200/my_index/_search' -d '{
}
}
}'
-----
-{zwsp} +
+```
+
And here is the same query constructed in the client:
-[source,php]
-----
+```php
$params = [
'index' => 'my_index',
'body' => [
@@ -42,17 +41,13 @@ $params = [
];
$results = $client->search($params);
-----
-{zwsp} +
+```
+
-Notice how the structure and layout of the PHP array is identical to that of the
-JSON request body. This makes it very simple to convert JSON examples into PHP.
-A quick method to check your PHP array (for more complex examples) is to encode
-it back to JSON and check it:
+Notice how the structure and layout of the PHP array is identical to that of the JSON request body. This makes it very simple to convert JSON examples into PHP. A quick method to check your PHP array (for more complex examples) is to encode it back to JSON and check it:
-[source,php]
-----
+```php
$params = [
'index' => 'my_index',
'body' => [
@@ -68,18 +63,14 @@ print_r(json_encode($params['body']));
{"query":{"match":{"testField":"abc"}}}
-----
-{zwsp} +
+```
+
-.Using Raw JSON
-****
-Sometimes it is convenient to use raw JSON for testing purposes, or when
-migrating from a different system. You can use raw JSON as a string in the body,
-and the client detects this automatically:
+::::{admonition} Using Raw JSON
+Sometimes it is convenient to use raw JSON for testing purposes, or when migrating from a different system. You can use raw JSON as a string in the body, and the client detects this automatically:
-[source,php]
-----
+```php
$json = '{
"query" : {
"match" : {
@@ -94,17 +85,16 @@ $params = [
];
$results = $client->search($params);
-----
-****
-{zwsp} +
+```
+
+::::
-Search results follow the same format as {es} search response, the only
-difference is that the JSON response is serialized back into PHP arrays. Working
-with the search results is as simple as iterating over the array values:
+
-[source,php]
-----
+Search results follow the same format as {{es}} search response, the only difference is that the JSON response is serialized back into PHP arrays. Working with the search results is as simple as iterating over the array values:
+
+```php
$params = [
'index' => 'my_index',
'body' => [
@@ -123,17 +113,16 @@ $maxScore = $results['hits']['max_score'];
$score = $results['hits']['hits'][0]['_score'];
$doc = $results['hits']['hits'][0]['_source'];
-----
-{zwsp} +
+```
+
+
-[discrete]
-==== Bool Queries
-Bool queries can be easily constructed using the client. For example, this
-query:
+## Bool Queries [_bool_queries]
-[source,shell]
-----
+Bool queries can be easily constructed using the client. For example, this query:
+
+```shell
curl -XGET 'localhost:9200/my_index/_search' -d '{
"query" : {
"bool" : {
@@ -148,14 +137,13 @@ curl -XGET 'localhost:9200/my_index/_search' -d '{
}
}
}'
-----
-{zwsp} +
+```
+
Would be structured like this (note the position of the square brackets):
-[source,php]
-----
+```php
$params = [
'index' => 'my_index',
'body' => [
@@ -171,26 +159,20 @@ $params = [
];
$results = $client->search($params);
-----
-{zwsp} +
+```
+
+
+Notice that the `must` clause accepts an array of arrays. This is serialized into an array of JSON objects internally, so the final resulting output is identical to the curl example. For more details about arrays and objects in PHP, see [Dealing with JSON Arrays and Objects in PHP](/reference/php_json_objects.md).
-Notice that the `must` clause accepts an array of arrays. This is serialized
-into an array of JSON objects internally, so the final resulting output is
-identical to the curl example. For more details about arrays and objects in PHP,
-see <>.
-[discrete]
-==== A more complicated example
+## A more complicated example [_a_more_complicated_example]
-Let's construct a slightly more complicated example: a boolean query that
-contains both a filter and a query. This is a very common activity in {es}
-queries, so it will be a good demonstration.
+Let’s construct a slightly more complicated example: a boolean query that contains both a filter and a query. This is a very common activity in {{es}} queries, so it will be a good demonstration.
The curl version of the query:
-[source,shell]
-----
+```shell
curl -XGET 'localhost:9200/my_index/_search' -d '{
"query" : {
"bool" : {
@@ -203,14 +185,13 @@ curl -XGET 'localhost:9200/my_index/_search' -d '{
}
}
}'
-----
-{zwsp} +
+```
+
And in PHP:
-[source,php]
-----
+```php
$params = [
'index' => 'my_index',
'body' => [
@@ -229,31 +210,22 @@ $params = [
$results = $client->search($params);
-----
-{zwsp} +
+```
+
-[discrete]
-==== Scrolling
-The scrolling functionality of {es} is used to paginate over many documents in a
-bulk manner, such as exporting all the documents belonging to a single user. It
-is more efficient than regular search because it doesn't need to maintain an
-expensive priority queue ordering the documents.
+## Scrolling [_scrolling]
-Scrolling works by maintaining a "point in time" snapshot of the index which is
-then used to page over. This window allows consistent paging even if there is
-background indexing/updating/deleting. First, you execute a search request with
-`scroll` enabled. This returns a "page" of documents, and a `scroll_id` which is
-used to continue paginating through the hits.
+The scrolling functionality of {{es}} is used to paginate over many documents in a bulk manner, such as exporting all the documents belonging to a single user. It is more efficient than regular search because it doesn’t need to maintain an expensive priority queue ordering the documents.
-More details about scrolling can be found in the
-{ref-7x}/search-request-body.html#request-body-search-scroll[reference documentation].
+Scrolling works by maintaining a "point in time" snapshot of the index which is then used to page over. This window allows consistent paging even if there is background indexing/updating/deleting. First, you execute a search request with `scroll` enabled. This returns a "page" of documents, and a `scroll_id` which is used to continue paginating through the hits.
+
+More details about scrolling can be found in the [reference documentation](elasticsearch://reference/elasticsearch/rest-apis/paginate-search-results.md#scroll-search-results).
This is an example which can be used as a template for more advanced operations:
-[source,php]
-----
+```php
$client = ClientBuilder::create()->build();
$params = [
'scroll' => '30s', // how long between scroll requests. should be small!
@@ -261,7 +233,7 @@ $params = [
'index' => 'my_index',
'body' => [
'query' => [
- 'match_all' => new \stdClass()
+ 'match_all' => new \stdClass()
]
]
];
@@ -290,4 +262,5 @@ while (isset($response['hits']['hits']) && count($response['hits']['hits']) > 0)
]
]);
}
-----
+```
+
diff --git a/docs/reference/set-retries.md b/docs/reference/set-retries.md
new file mode 100644
index 000000000..df2d5bd5b
--- /dev/null
+++ b/docs/reference/set-retries.md
@@ -0,0 +1,32 @@
+---
+mapped_pages:
+ - https://www.elastic.co/guide/en/elasticsearch/client/php-api/current/set-retries.html
+---
+
+# Set retries [set-retries]
+
+By default, the client will retry `n` times, where `n = number of nodes` in your cluster. A retry is only performed if the operation results in a "hard" exception: connection refusal, connection timeout, DNS lookup timeout, etc. 4xx and 5xx errors are not considered retriable events, since the node returns an operational response.
+
+If you would like to disable retries, or change the number, you can do so with the `setRetries()` method:
+
+```php
+$client = ClientBuilder::create()
+ ->setRetries(2)
+ ->build();
+```
+
+When the client runs out of retries, it will throw the last exception that it received. For example, if you have ten alive nodes, and `setRetries(5)`, the client attempts to execute the command up to five times. If all five nodes result in a connection timeout (for example), the client will throw an `NoNodeAvailableException`.
+
+```php
+use Elastic\Transport\Exception\NoNodeAvailableException;
+
+$client = ClientBuilder::create()
+ ->build();
+
+try {
+ $reponse = $client->info();
+} catch (NoNodeAvailableException $e) {
+ printf("No nodes alive: %s", $e->getMessage());
+}
+```
+
diff --git a/docs/reference/toc.yml b/docs/reference/toc.yml
new file mode 100644
index 000000000..e58d0e544
--- /dev/null
+++ b/docs/reference/toc.yml
@@ -0,0 +1,27 @@
+toc:
+ - file: index.md
+ - file: getting-started.md
+ - file: installation.md
+ - file: connecting.md
+ - file: configuration.md
+ children:
+ - file: php_json_objects.md
+ - file: host-config.md
+ - file: set-retries.md
+ - file: http-meta-data.md
+ - file: enabling_logger.md
+ - file: http-client.md
+ - file: namespaces.md
+ - file: node_pool.md
+ - file: operations.md
+ children:
+ - file: index_management.md
+ - file: search_operations.md
+ - file: indexing_documents.md
+ - file: getting_documents.md
+ - file: updating_documents.md
+ - file: deleting_documents.md
+ - file: client-helpers.md
+ children:
+ - file: iterators.md
+ - file: esql.md
\ No newline at end of file
diff --git a/docs/reference/updating_documents.md b/docs/reference/updating_documents.md
new file mode 100644
index 000000000..841abb1bc
--- /dev/null
+++ b/docs/reference/updating_documents.md
@@ -0,0 +1,80 @@
+---
+mapped_pages:
+ - https://www.elastic.co/guide/en/elasticsearch/client/php-api/current/updating_documents.html
+---
+
+# Updating documents [updating_documents]
+
+Updating a document allows you to either completely replace the contents of the existing document, or perform a partial update to just some fields (either changing an existing field or adding new fields).
+
+
+## Partial document update [_partial_document_update]
+
+If you want to partially update a document (for example, change an existing field or add a new one) you can do so by specifying the `doc` in the `body` parameter. This merges the fields in `doc` with the existing document.
+
+```php
+$params = [
+ 'index' => 'my_index',
+ 'id' => 'my_id',
+ 'body' => [
+ 'doc' => [
+ 'new_field' => 'abc'
+ ]
+ ]
+];
+
+// Update doc at /my_index/_doc/my_id
+$response = $client->update($params);
+```
+
+
+
+
+## Scripted document update [_scripted_document_update]
+
+Sometimes you need to perform a scripted update, such as incrementing a counter or appending a new value to an array. To perform a scripted update, you need to provide a script and usually a set of parameters:
+
+```php
+$params = [
+ 'index' => 'my_index',
+ 'id' => 'my_id',
+ 'body' => [
+ 'script' => 'ctx._source.counter += count',
+ 'params' => [
+ 'count' => 4
+ ]
+ ]
+];
+
+$response = $client->update($params);
+```
+
+
+
+
+## Upserts [_upserts]
+
+Upserts are "Update or Insert" operations. This means an upsert attempts to run your update script, but if the document does not exist (or the field you are trying to update doesn’t exist), default values are inserted instead.
+
+```php
+$params = [
+ 'index' => 'my_index',
+ 'id' => 'my_id',
+ 'body' => [
+ 'script' => [
+ 'source' => 'ctx._source.counter += params.count',
+ 'params' => [
+ 'count' => 4
+ ],
+ ],
+ 'upsert' => [
+ 'counter' => 1
+ ],
+ ]
+];
+
+$response = $client->update($params);
+```
+
+
+
diff --git a/docs/release-notes.asciidoc b/docs/release-notes.asciidoc
deleted file mode 100644
index 2bf712f57..000000000
--- a/docs/release-notes.asciidoc
+++ /dev/null
@@ -1,592 +0,0 @@
-[[release-notes]]
-== Release notes
-
-* <>
-* <>
-* <>
-* <>
-* <>
-* <>
-* <>
-* <>
-* <>
-* <>
-* <>
-* <>
-* <>
-* <>
-* <>
-* <>
-* <>
-* <>
-* <>
-* <>
-* <>
-* <>
-* <>
-* <>
-* <>
-* <>
-* <>
-* <>
-* <>
-* <>
-* <>
-* <>
-* <>
-* <>
-* <>
-* <>
-* <>
-* <>
-* <>
-* <>
-* <>
-* <>
-* <>
-* <>
-* <>
-
-[discrete]
-[[rn-8-15-0]]
-=== 8.15.0
-
-* Updated the API endpoints to Elasticserach 8.15.0
-* Added the OpenTelemetry support, for more information
- you can refer to the https://github.com/elastic/elastic-transport-php?tab=readme-ov-file#opentelemetry[elastic-transport-php]
- documentation
-
-[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
-
-* Updated the API endpoints to Elasticserach 8.11.0
-* Fixed path in hosts configuration is ignored
- https://github.com/elastic/elasticsearch-php/issues/1377[#1377]
-
-
-[discrete]
-[[rn-8-10-0]]
-=== 8.10.0
-
-* Updated the API endpoints to Elasticserach 8.10.0
-
-[discrete]
-[[rn-8-9-0]]
-=== 8.9.0
-
-* Updated the API endpoints to Elasticserach 8.9.0
-* Fixed issue with psr/http-message, changed PSR-7 versions to 1.1 and 2.0
- https://github.com/elastic/elasticsearch-php/pull/1344[#1344]
-
-[discrete]
-[[rn-8-8-0]]
-=== 8.8.0
-
-* Updated the API endpoints to Elasticserach 8.8.0
-* Added SearchHitIterators and SearchResponseIterator helpers revised with new version
- https://github.com/elastic/elasticsearch-php/pull/1302[#1302]
-
-[discrete]
-[[rn-8-7-0]]
-=== 8.7.0
-
-* Updated the API endpoints to Elasticserach 8.7.0
-* Allow plugin for `php-http/discovery` library
- https://github.com/elastic/elasticsearch-php/pull/1294[#1294]
-
-[discrete]
-[[rn-8-6-1]]
-=== 8.6.1
-
-* Updated the API endpoints to Elasticserach 8.6.0
-
-[discrete]
-[[rn-8-5-0]]
-=== 8.5.0
-
-* Updated the API endpoints to Elasticserach 8.5.0
-
-[discrete]
-[[rn-8-4-0]]
-=== 8.4.0
-
-* Added a `ClientInterface` to simplify the mock of the Client,
- this is a fix for https://github.com/elastic/elasticsearch-php/issues/1227[#1227]
- https://github.com/elastic/elasticsearch-php/pull/1249[#1249]
-* Added the support of Symfony HTTP client, fixing the issue https://github.com/elastic/elasticsearch-php/issues/1241[#1241]
- https://github.com/elastic/elasticsearch-php/pull/1243[#1243]
-* Added the API compatibility header
- https://github.com/elastic/elasticsearch-php/pull/1233[#1233]
-* Updated the API endpoints to Elasticserach 8.4.0
-
-[discrete]
-[[rn-8-3-0]]
-=== 8.3.0
-
-* Updated the API endpoints to Elasticserach 8.3.0
-
-[discrete]
-[[rn-8-2-0]]
-=== 8.2.0
-
-* Updated the API endpoints to Elasticserach 8.2.0
-* Added the array support for `text/plain`
- https://github.com/elastic/elasticsearch-php/pull/1220[#1220]
-
-[discrete]
-[[rn-8-1-0]]
-=== 8.1.0
-
-* Updated the API endpoints to Elasticserach 8.1.0
-
-[discrete]
-[[rn-8-0-1]]
-=== 8.0.1
-
-* use of `NoNodeAvailableException` exception in endpoints, fixing
- https://github.com/elastic/elasticsearch-php/issues/1209[#1209]
-
-
-[discrete]
-[[rn-8-0-0]]
-=== 8.0.0
-
-This new major version of elasticsearch-php contains a brand new implementation
-compared with 7.x. It supports https://www.php-fig.org/psr/psr-7/[PSR-7] for HTTP
-messages and https://www.php-fig.org/psr/psr-18/[PSR-18] for HTTP client
-communications. We used the https://github.com/elastic/elastic-transport-php[elastic-transport-php]
-library for HTTP communications.
-
-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 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 response class.
- This class wraps a a 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!
-
-You can have a look at the https://github.com/elastic/elasticsearch-php/blob/8.0/BREAKING_CHANGES.md[BREAKING_CHANGES]
-online document for more information.
-
-
-[discrete]
-[[rn-7-17-0]]
-=== 7.17.0
-
-* Allow psr/log v3
- https://github.com/elastic/elasticsearch-php/pull/1184[#1184]
-
-
-[discrete]
-[[rn-7-16-0]]
-=== 7.16.0
-
-* Added support of includePortInHostHeader in ClientBuilder::fromConfig
- https://github.com/elastic/elasticsearch-php/pull/1181[#1181]
-* Fixed UTF-16 issue in SmartSerializer with single unpaired surrogate in unicode escape
- https://github.com/elastic/elasticsearch-php/pull/1179[#1179]
-* Replace trait with abstract class to avoid Deprecated Functionality issue in PHP 8.1
- https://github.com/elastic/elasticsearch-php/pull/1175[#1175]
-
-
-[discrete]
-[[rn-7-15-0]]
-=== 7.15.0
-
-* Updated endpoints for Elasticsearch 7.15.0
- https://github.com/elastic/elasticsearch-php/commit/995f6d4bde7de76004e95d7a434b1d59da7a7e75[995f6d4]
-
-
-[discrete]
-[[rn-7-14-0]]
-=== 7.14.0
-
-* Usage of psr/log version 2
- https://github.com/elastic/elasticsearch-php/pull/1154[#1154]
-* Update search iterators to send `scroll_id` inside the request body
- https://github.com/elastic/elasticsearch-php/pull/1134[#1134]
-* Added the `ingest.geoip.downloader.enabled=false` setting for ES
- https://github.com/elastic/elasticsearch-php/commit/586735109dc18f22bfdf3b73ab0621b37e857be1[5867351]
-* Removed phpcs for autogenerated files (endpoints)
- https://github.com/elastic/elasticsearch-php/commit/651c57b2e6bf98a0fd48220949966e630e5a804a[651c57b]
-
-
-[discrete]
-[[rn-7-13-1]]
-=== 7.13.1
-
-* Added port in url for trace and logger messages
- https://github.com/elastic/elasticsearch-php/pull/1126[#1126]
-
-
-[discrete]
-[[rn-7-13-0]]
-=== 7.13.0
-
-* (DOCS) Added the HTTP meta data section
- https://github.com/elastic/elasticsearch-php/pull/1143[#1143]
-* Added support for API Compatibility Header
- https://github.com/elastic/elasticsearch-php/pull/1142[#1142]
-* (DOCS) Added Helpers section to PHP book
- https://github.com/elastic/elasticsearch-php/pull/1129[#1129]
-* Added the API description in phpdoc section for each endpoint
- https://github.com/elastic/elasticsearch-php/commit/9e05c8108b638b60cc676b6a4f4be97c7df9eb64[9e05c81]
-* Usage of PHPUnit 9 only + migrated xml configurations
- https://github.com/elastic/elasticsearch-php/commit/038b5dd043dc76b20b9f5f265ea914a38d33568d[038b5dd]
-
-
-[discrete]
-[[rn-7-12-0]]
-=== 7.12.0
-
-* Updated the endpoints for ES 7.12 + removed `cpliakas/git-wrapper` in favor of
- `symplify/git-wrapper`
- https://github.com/elastic/elasticsearch-php/commit/136d5b9717b3806c6b34ef8a5076bfe7cee8b46e[136d5b9]
-* Fixed warning header as array in YAML tests generator
- https://github.com/elastic/elasticsearch-php/commit/0d81be131bfc7eff6ef82468e61c16077a892aab[0d81be1]
-* Refactored TEST_SUITE with free, platinum + removed old YamlRunnerTest
- https://github.com/elastic/elasticsearch-php/commit/f69d96fc283580177002b4088c279c3d0c07befe[f69d96f]
-
-
-[discrete]
-[[rn-7-11-0]]
-=== 7.11.0
-
-* Added the `X-Elastic-Client-Meta` header which is used by Elastic Cloud and
- can be disabled with `ClientBuilder::setElasticMetaHeader(false)`
- https://github.com/elastic/elasticsearch-php/pull/1089[#1089]
-* Replaced `array_walk` with `array_map` in `Connection::getURI` for PHP 8
- compatibility
- https://github.com/elastic/elasticsearch-php/pull/1075[#1075]
-* Remove unnecessary `InvalidArgumentExceptions`
- https://github.com/elastic/elasticsearch-php/pull/1069[#1069]
-* Introducing PHP 8 compatibility
- https://github.com/elastic/elasticsearch-php/pull/1063[#1063]
-* Replace Sami by Doctum and fix `.gitignore`
- https://github.com/elastic/elasticsearch-php/pull/1062[#1062]
-
-
-[discrete]
-[[rn-7-10-0]]
-=== 7.10.0
-
-* Updated endpoints and namespaces for {es} 7.10
- https://github.com/elastic/elasticsearch-php/commit/3ceb7484a111aa20126168460c79f098c4fe0792[3ceb748]
-* Fixed ClientBuilder::fromConfig allowing multiple function parameters (for
- example, `setApiKey`)
- https://github.com/elastic/elasticsearch-php/pull/1076[#1076]
-* Refactored the YAML tests using generated PHPUnit code
- [85fadc2](https://github.com/elastic/elasticsearch-php/commit/85fadc2bd4b2b309b19761a50ff13010d43a524d)
-
-
-[discrete]
-[[rn-7-9-1]]
-=== 7.9.1
-
-* Fixed using object instead of array in onFailure transport event
- https://github.com/elastic/elasticsearch-php/pull/1066[#1066]
-* Fixed reset custom header after endpoint call
- https://github.com/elastic/elasticsearch-php/pull/1065[#1065]
-* Show generic error messages when server returns no response
- https://github.com/elastic/elasticsearch-php/pull/1056[#1056]
-
-
-[discrete]
-[[rn-7-9-0]]
-=== 7.9.0
-
-* Updated endpoints and namespaces for {es} 7.9
- https://github.com/elastic/elasticsearch-php/commit/28bf0ed6df6bc95f83f369509431d97907bfdeb0[28bf0ed]
-* Moved `scroll_id` into `body` for search operations in the documentation
- https://github.com/elastic/elasticsearch-php/pull/1052[#1052]
-* Fixed PHP 7.4 preloading feature for autoload.php
- https://github.com/elastic/elasticsearch-php/pull/1051[#1051]
-* Improved message of JSON errors using `json_last_error_msg()`
- https://github.com/elastic/elasticsearch-php/pull/1045[#1045]
-
-
-[discrete]
-[[rn-7-8-0]]
-=== 7.8.0
-
-* Updated endpoints and namespaces for {es} 7.8
- https://github.com/elastic/elasticsearch-php/commit/f2a0828d5ee9d126ad63e2a1d43f70b4013845e2[f2a0828]
-* Improved documentation
- https://github.com/elastic/elasticsearch-php/pull/1038[#1038],
- https://github.com/elastic/elasticsearch-php/pull/1027[#1027],
- https://github.com/elastic/elasticsearch-php/pull/1025[#1025]
-
-
-[discrete]
-[[rn-7-7-0]]
-=== 7.7.0
-
-* Removed setId() into endpoints, fixed `util/GenerateEndpoints.php`
- https://github.com/elastic/elasticsearch-php/pull/1026[#1026]
-* Fixes JsonErrorException with code instead of message
- https://github.com/elastic/elasticsearch-php/pull/1022[#1022]
-* Better exception message for Could not parse URI
- https://github.com/elastic/elasticsearch-php/pull/1016[#1016]
-* Added JUnit log for PHPUnit
- https://github.com/elastic/elasticsearch-php/commit/88b7e1ce80a5a52c1d64d00c55fef77097bbd8a9[88b7e1c]
-* Added the XPack endpoints
- https://github.com/elastic/elasticsearch-php/commit/763d91a3d506075316b84a38b2bed7a098da5028[763d91a]
-
-
-
-[discrete]
-[[rn-7-6-1]]
-=== 7.6.1
-
-* Fixed issue with `guzzlehttp/ringphp` and `guzzle/streams` using forks
- `ezimuel/ringphp` and `ezimuel/guzzlestreams`
- https://github.com/elastic/elasticsearch-php/commit/92a6a4adda5eafd1823c7c9c386e2c7e5e75cd08[92a6a4a]
-
-
-[discrete]
-[[rn-7-6-0]]
-=== 7.6.0
-
-* Generated the new endpoints for {es} 7.6.0
- https://github.com/elastic/elasticsearch-php/commit/be31f317af704f333b43bbcc7c01ddc7c91ec6f8[be31f31]
-
-
-[discrete]
-[[rn-7-5-1]]
-=== 7.5.1
-
-* Fixes port missing in log https://github.com/elastic/elasticsearch-php/issues/925[#925]
- https://github.com/elastic/elasticsearch-php/commit/125594b40d167ef1509b3ee49a3f93426390c426[75e0888]
-* Added `ClientBuilder::includePortInHostHeader()` to add the `port` in the
- `Host` header. This fixes https://github.com/elastic/elasticsearch-php/issues/993[#993].
- By default the `port` is not included in the `Host` header.
- https://github.com/elastic/elasticsearch-php/pull/997[#997]
-* Replace abandoned packages: ringphp, streams and phpstan-shim
- https://github.com/elastic/elasticsearch-php/pull/996[#996]
-* Fixed gzip compression when setting Cloud Id
- https://github.com/elastic/elasticsearch-php/pull/986[#986]
-
-
-[discrete]
-[[rn-7-5-0]]
-=== 7.5.0
-
-* Fixed `Client::extractArgument` iterable casting to array; this allows passing
- a `Traversable` body for some endpoints (for example, Bulk, Msearch,
- MsearchTemplate)
- https://github.com/elastic/elasticsearch-php/pull/983[#983]
-* Fixed the Response Exception if the `reason` field is null
- https://github.com/elastic/elasticsearch-php/pull/980[#980]
-* Added support for PHP 7.4
- https://github.com/elastic/elasticsearch-php/pull/976[#976]
-
-
-[discrete]
-[[rn-7-4-1]]
-=== 7.4.1
-
-* We added the suppress operator `@` for the deprecation messages
- `@trigger_error()`. With this approach, we don't break existing application
- that convert PHP errors in Exception (for example, using Laravel with issue
- https://github.com/babenkoivan/scout-elasticsearch-driver/issues/297[297])
- Using the `@` operator is still possible to intercept the deprecation message
- using a custom error handler.
- https://github.com/elastic/elasticsearch-php/pull/973[#973]
-* Add missing leading slash in the URL of put mapping endpoint
- https://github.com/elastic/elasticsearch-php/pull/970[#970]
-* Fix pre 7.2 endpoint class name with aliases + reapply fix #947. This PR
- solved the unexpected BC break introduce in 7.4.0 with the code
- generation tool
- https://github.com/elastic/elasticsearch-php/pull/968[#968]
-
-
-[discrete]
-[[rn-7-4-0]]
-=== 7.4.0
-
-* Added the code generation for endpoints and namespaces based on the
- https://github.com/elastic/elasticsearch/tree/v7.4.2/rest-api-spec/src/main/resources/rest-api-spec/api[REST API specification]
- of {es}. This tool is available in `util/GenerateEndpoints.php`.
- https://github.com/elastic/elasticsearch-php/pull/966[#966]
-* Fixed the asciidoc
- https://www.elastic.co/guide/en/elasticsearch/client/php-api/current/ElasticsearchPHP_Endpoints.html[endpoints documentation]
- based on the code generation using https://github.com/FriendsOfPHP/Sami[Sami]
- project https://github.com/elastic/elasticsearch-php/pull/966[#966]
-* All the `experimental` and `beta` APIs are now signed with a `@note` tag in
- the phpdoc section (for example,
- https://github.com/elastic/elasticsearch-php/blob/master/src/Elasticsearch/Client.php[$client->rankEval()]).
- For more information read the
- https://www.elastic.co/guide/en/elasticsearch/client/php-api/{branch}/experimental_and_beta_apis.html[experimental and beta APIs]
- section in the documentation.
- https://github.com/elastic/elasticsearch-php/pull/966[#966]
-* Removed `AlreadyExpiredException` since it has been removed
- from {es} with https://github.com/elastic/elasticsearch/pull/24857[#24857]
- https://github.com/elastic/elasticsearch-php/pull/954[#954]
-
-
-[discrete]
-[[rn-7-3-0]]
-=== 7.3.0
-
-* Added support for simplified access to the `X-Opaque-Id` header
- https://github.com/elastic/elasticsearch-php/pull/952[#952]
-* Added the HTTP port in the log messages
- https://github.com/elastic/elasticsearch-php/pull/950[#950]
-* Fixed hostname with underscore (ClientBuilder::prependMissingScheme)
- https://github.com/elastic/elasticsearch-php/pull/949[#949]
-* Removed unused Monolog in ClientBuilder
- https://github.com/elastic/elasticsearch-php/pull/948[#948]
-
-
-[discrete]
-[[rn-7-2-2]]
-=== 7.2.2
-
-* Reintroduced the optional parameter in
- `Elasticsearch\Namespaces\IndicesNamespace::getAliases()`.
- This fixes the BC break introduced in 7.2.0 and 7.2.1.
- https://github.com/elastic/elasticsearch-php/pull/947[#947]
-
-
-[discrete]
-[[rn-7-2-1]]
-=== 7.2.1
-
-* Reintroduced `Elasticsearch\Namespaces\IndicesNamespace::getAliases()` as proxy
- to `IndicesNamespace::getAlias()` to prevent BC breaks. The `getAliases()` is
- marked as deprecated and it will be removed from `elasticsearch-php 8.0`
- https://github.com/elastic/elasticsearch-php/pull/943[#943]
-
-[discrete]
-==== Docs
-
-* Fixed missing put mapping code snippet in code examples
- https://github.com/elastic/elasticsearch-php/pull/938[#938]
-
-
-[discrete]
-[[rn-7-2-0]]
-=== 7.2.0
-
-* Updated the API endpoints for working with {es} 7.2.0:
- * added `wait_for_active_shards` parameter to `indices.close` API;
- * added `expand_wildcards` parameter to `cluster.health` API;
- * added include_unloaded_segments`, `expand_wildcards`, `forbid_closed_indices`
- parameters to `indices.stats` API.
- https://github.com/elastic/elasticsearch-php/pull/933/commits/27d721ba44b8c199388650c5a1c8bd69757229aa[27d721b]
-* Updated the phpdoc parameters for all the API endpoints
- https://github.com/elastic/elasticsearch-php/pull/933/commits/27d721ba44b8c199388650c5a1c8bd69757229aa[27d721b]
-* Improved the Travis CI speed using cache feature with composer
- https://github.com/elastic/elasticsearch-php/pull/929[#929]
-* Fixed `php_uname()` usage checking if it is disabled
- https://github.com/elastic/elasticsearch-php/pull/927[#927]
-* Added support of Elastic Cloud ID and API key authentication
- https://github.com/elastic/elasticsearch-php/pull/923[#923]
-
-
-[discrete]
-[[rn-7-1-1]]
-=== 7.1.1
-
-* Fixed `ClientBuilder::setSSLVerification()` to accept string or boolean
- https://github.com/elastic/elasticsearch-php/pull/917[#917]
-* Fix type hinting for `setBody` in
- `Elasticsearch\Endpoints\Ingest\Pipeline\Put`
- https://github.com/elastic/elasticsearch-php/pull/913[#913]
-
-
-[discrete]
-[[rn-7-1-0]]
-=== 7.1.0
-
-* Added warning log for {es} response containing the `Warning` header
- https://github.com/elastic/elasticsearch-php/pull/911[#911]
-* Fixed #838 hosting company is blocking ports because of `YamlRunnerTest.php`
- https://github.com/elastic/elasticsearch-php/pull/844[#844]
-* Specialized inheritance of `NoNodesAvailableException` to extend
- `ServerErrorResponseException` instead of the generic `\Exception`
- https://github.com/elastic/elasticsearch-php/pull/607[#607]
-* Fixed scroll TTL is extracted but not set as a body param
- https://github.com/elastic/elasticsearch-php/pull/907[#907]
-
-[discrete]
-==== Testing
-
-* Improved the speed of integration tests removing snapshots delete from
- `YamlRunnerTest::clean`
- https://github.com/elastic/elasticsearch-php/pull/911[#911]
-* Reduced the number of skipping YAML integration tests from 20 to 6
- https://github.com/elastic/elasticsearch-php/pull/911[#911]
-
-[discrete]
-==== Docs
-
-* Documentation updated for {es} 7
- https://github.com/elastic/elasticsearch-php/pull/904[#904]
-
-
-[discrete]
-[[rn-7-0-2]]
-=== 7.0.2
-
-* Fixed incorrect return type hint when using async requests/futures
- https://github.com/elastic/elasticsearch-php/pull/905[#905]
-
-
-[discrete]
-[[rn-7-0-1]]
-=== 7.0.1
-
-* Fixed SniffingConnectionPool removing the return type of Connection::sniff()
- https://github.com/elastic/elasticsearch-php/pull/899[#899]
-
-
-[discrete]
-[[rn-7-0-0]]
-=== 7.0.0
-
-* Requirement of PHP 7.1 instead of 7.0 that is not supported since 1 Jan 2019.
- https://github.com/elastic/elasticsearch-php/pull/897[#897]
-* Code refactoring using type hints and return type declarations where possible
- https://github.com/elastic/elasticsearch-php/pull/897[#897]
-* Update vendor libraries (PHPUnit 7.5, Symfony YAML 4.3, and so on)
- https://github.com/elastic/elasticsearch-php/pull/897[#897]
-* Updated all the API endpoints using the
- https://github.com/elastic/elasticsearch/tree/v7.0.0/rest-api-spec/src/main/resources/rest-api-spec/api[latest 7.0.0 specs]
- of {es} https://github.com/elastic/elasticsearch-php/pull/897[#897]
-* Added the `User-Agent` in each HTTP request
- https://github.com/elastic/elasticsearch-php/pull/898[#898]
-* Simplified the logging methods
- `logRequestFail($request, $response, $exception)` and
- `logRequestSuccess($request, $response)` in
- `Elasticsearch\Connections\Connection`
- https://github.com/elastic/elasticsearch-php/pull/876[#876]
-* Fix `json_encode` for unicode(emoji) characters
- https://github.com/elastic/elasticsearch-php/pull/856[#856]
-* Fix HTTP port specification using CURLOPT_PORT, not anymore in the host
- https://github.com/elastic/elasticsearch-php/pull/782[#782]
diff --git a/docs/release-notes/breaking-changes.md b/docs/release-notes/breaking-changes.md
new file mode 100644
index 000000000..aba176560
--- /dev/null
+++ b/docs/release-notes/breaking-changes.md
@@ -0,0 +1,28 @@
+---
+navigation_title: "Breaking changes"
+mapped_pages:
+ - https://www.elastic.co/guide/en/elasticsearch/client/php-api/current/breaking_changes.html
+---
+
+# Elasticsearch PHP Client breaking changes [elasticsearch-php-client-breaking-changes]
+Breaking changes can impact your Elastic applications, potentially disrupting normal operations. Before you upgrade, carefully review the Elasticsearch PHP Client breaking changes and take the necessary steps to mitigate any issues. To learn how to upgrade, check [Upgrade](docs-content://deploy-manage/upgrade.md).
+
+% ## Next version [elasticsearch-php-client-nextversion-breaking-changes]
+
+% ::::{dropdown} Title of breaking change
+% Description of the breaking change.
+% For more information, check [PR #](PR link).
+% **Impact** Impact of the breaking change.
+% **Action** Steps for mitigating deprecation impact.
+% ::::
+
+## 9.0.0 [elasticsearch-php-client-900-breaking-changes]
+
+- **Use of PHP 8.1+:** Starting from 9.0.0 the `elasticsearch-php` client requires PHP 8.1+.
+
+% ::::{dropdown} Title of breaking change
+% Description of the breaking change.
+% For more information, check [PR #](PR link).
+% **Impact** Impact of the breaking change.
+% **Action** Steps for mitigating deprecation impact.
+% ::::
\ No newline at end of file
diff --git a/docs/release-notes/deprecations.md b/docs/release-notes/deprecations.md
new file mode 100644
index 000000000..93d8a73fe
--- /dev/null
+++ b/docs/release-notes/deprecations.md
@@ -0,0 +1,26 @@
+---
+navigation_title: "Deprecations"
+---
+
+# Elasticsearch PHP Client deprecations [elasticsearch-php-client-deprecations]
+Over time, certain Elastic functionality becomes outdated and is replaced or removed. To help with the transition, Elastic deprecates functionality for a period before removal, giving you time to update your applications.
+
+Review the deprecated functionality for Elasticsearch PHP Client. While deprecations have no immediate impact, we strongly encourage you update your implementation after you upgrade. To learn how to upgrade, check out [Upgrade](docs-content://deploy-manage/upgrade.md).
+
+% ## Next version [elasticsearch-php-client-versionnext-deprecations]
+
+% ::::{dropdown} Deprecation title
+% Description of the deprecation.
+% For more information, check [PR #](PR link).
+% **Impact** Impact of deprecation.
+% **Action** Steps for mitigating deprecation impact.
+% ::::
+
+## 9.0.0 [elasticsearch-php-client-900-deprecations]
+
+- **Utility::urlencode():** this function has been deprecated in favor of [rawurlencode()](https://www.php.net/manual/en/function.rawurlencode.php) of PHP (see [#1278](https://github.com/elastic/elasticsearch-php/issues/1278)).
+
+% Description of the deprecation and steps to update implementation.
+% For more information, check [PR #](PR link).
+% **Impact**
+% **Action**
\ No newline at end of file
diff --git a/docs/release-notes/index.md b/docs/release-notes/index.md
new file mode 100644
index 000000000..bf5928c7c
--- /dev/null
+++ b/docs/release-notes/index.md
@@ -0,0 +1,37 @@
+---
+navigation_title: "Elasticsearch PHP Client"
+mapped_pages:
+ - https://www.elastic.co/guide/en/elasticsearch/client/php-api/current/release-notes.html
+---
+
+# Elasticsearch PHP Client release notes [elasticsearch-php-client-release-notes]
+
+Review the changes, fixes, and more in each version of Elasticsearch PHP Client.
+
+To check for security updates, go to [Security announcements for the Elastic stack](https://discuss.elastic.co/c/announcements/security-announcements/31).
+
+% Release notes include only features, enhancements, and fixes. Add breaking changes, deprecations, and known issues to the applicable release notes sections.
+
+% ## version.next [felasticsearch-php-client-next-release-notes]
+
+% ### Features and enhancements [elasticsearch-php-client-next-features-enhancements]
+% *
+
+% ### Fixes [elasticsearch-php-client-next-fixes]
+% *
+
+## 9.0.0 [elasticsearch-php-client-900-release-notes]
+
+### Features and enhancements [elasticsearch-php-client-900-features-enhancements]
+
+- **Compatibility with Elasticsearch 9.0:** All changes and additions to Elasticsearch APIs for its 9.0 release are reflected in this release.
+- **Serverless client merged in:** the `elastic/elasticsearch-serverless` client is being deprecated, and its functionality has been merged back into this client. This should have zero impact on the way the client works by default. If an endpoint is available in serverless, the PHP function will contains a `@group serverless` phpdoc attribute.
+If you try to use an endpoint that is not available in serverless you will get a `410` HTTP error with a message as follows:
+"this endpoint exists but is not available when running in serverless mode".
+The 9.0.0 client can recognize that it is communicating with a serverless instance if you are using a URL managed by Elastic (e.g. `*.elastic.cloud`).
+If you are using a proxy, the client will be able to recognize that the host is serverless from the first response. Alternatively, you can explicitly indicate that the host is serverless using the `Client::setServerless(true)` function (`false` by default).
+- **New transport library with PSR-18 cURL client as default:** we've removed the Guzzle dependency from the client. By default, the built-in cURL-based HTTP client will be used if no other PSR-18 compatible clients are detected. See release [9.0.0](https://github.com/elastic/elastic-transport-php/releases/tag/v9.0.0) of elastic-transport-php.
+
+### Fixes [elasticsearch-php-client-900-fixes]
+
+- **Fixed PHPStan array shape:** we fixed the array shape definition for all the endpoints, upgrading PHPStan to verion 2.1. See PR [#1439](https://github.com/elastic/elasticsearch-php/pull/1439)
\ No newline at end of file
diff --git a/docs/release-notes/known-issues.md b/docs/release-notes/known-issues.md
new file mode 100644
index 000000000..8a6af7b29
--- /dev/null
+++ b/docs/release-notes/known-issues.md
@@ -0,0 +1,24 @@
+---
+navigation_title: "Known issues"
+
+---
+
+# Elasticsearch PHP Client known issues [elasticsearch-php-client-known-issues]
+
+## 9.0.0
+
+_No known issues_
+
+% Use the following template to add entries to this page.
+
+% :::{dropdown} Title of known issue
+% **Details**
+% On [Month/Day/Year], a known issue was discovered that [description of known issue].
+
+% **Workaround**
+% Workaround description.
+
+% **Resolved**
+% On [Month/Day/Year], this issue was resolved.
+
+:::
\ No newline at end of file
diff --git a/docs/release-notes/toc.yml b/docs/release-notes/toc.yml
new file mode 100644
index 000000000..a41006794
--- /dev/null
+++ b/docs/release-notes/toc.yml
@@ -0,0 +1,5 @@
+toc:
+ - file: index.md
+ - file: known-issues.md
+ - file: breaking-changes.md
+ - file: deprecations.md
\ No newline at end of file
diff --git a/docs/set-retries.asciidoc b/docs/set-retries.asciidoc
deleted file mode 100644
index fe809289a..000000000
--- a/docs/set-retries.asciidoc
+++ /dev/null
@@ -1,39 +0,0 @@
-[[set-retries]]
-=== Set retries
-
-By default, the client will retry `n` times, where `n = number of nodes` in your
-cluster. A retry is only performed if the operation results in a "hard"
-exception: connection refusal, connection timeout, DNS lookup timeout, etc. 4xx
-and 5xx errors are not considered retriable events, since the node returns an
-operational response.
-
-If you would like to disable retries, or change the number, you can do so with
-the `setRetries()` method:
-
-[source,php]
-----------------------------
-
-$client = ClientBuilder::create()
- ->setRetries(2)
- ->build();
-----------------------------
-
-When the client runs out of retries, it will throw the last exception that it
-received. For example, if you have ten alive nodes, and `setRetries(5)`, the
-client attempts to execute the command up to five times. If all five nodes
-result in a connection timeout (for example), the client will throw an
-`NoNodeAvailableException`.
-
-[source,php]
-----------------------------
-use Elastic\Transport\Exception\NoNodeAvailableException;
-
-$client = ClientBuilder::create()
- ->build();
-
-try {
- $reponse = $client->info();
-} catch (NoNodeAvailableException $e) {
- printf("No nodes alive: %s", $e->getMessage());
-}
-----------------------------
\ No newline at end of file
diff --git a/docs/usage.asciidoc b/docs/usage.asciidoc
deleted file mode 100644
index d63f560cf..000000000
--- a/docs/usage.asciidoc
+++ /dev/null
@@ -1,312 +0,0 @@
-[discrete]
-[[client-usage]]
-=== Usage
-
-This section is a crash-course overview of the client and its syntax. If you
-are familiar with {es}, you'll notice that the methods are named just like REST
-endpoints.
-
-You may also notice that the client is configured in a manner that facilitates
-easy discovery via your IDE. All core actions are available under the `$client`
-object (indexing, searching, getting, etc). Index and cluster management are
-located under the `$client->indices()` and `$client->cluster()` objects,
-respectively.
-
-[discrete]
-==== Info API
-
-You can get information about the {es} instance using the `info()` API,
-as follows:
-
-[source,php]
-----------------------------
-$response = $client->info();
-----------------------------
-
-The response that you get back contains the information about {es}.
-The `$response` is an object of `Elastic\Elasticsearch\Response\Elasticsearch`
-class that implements `ElasticsearchInterface`, PSR-7 https://www.php-fig.org/psr/psr-7/#33-psrhttpmessageresponseinterface[ResponseInterface]
-and https://www.php.net/manual/en/class.arrayaccess.php[ArrayAccess].
-
-This means the `$response` is a https://www.php-fig.org/psr/psr-7/[PSR-7]
-object:
-
-[source,php]
-----------------------------
-echo $response->getStatusCode(); // 200
-echo (string) $response->getBody(); // Response body in JSON
-----------------------------
-
-and also an "array", meaning you can access the response body as an
-associative array, as follows:
-
-[source,php]
-----------------------------
-echo $response['version']['number']; // 8.0.0
-
-var_dump($response->asArray()); // response body content as array
-----------------------------
-
-Moreover, you can also access the response body as object, string or bool:
-
-[source,php]
-----------------------------
-echo $response->version->number; // 8.0.0
-
-var_dump($response->asObject()); // response body content as object
-var_dump($response->asString()); // response body as string (JSON)
-var_dump($response->asBool()); // true if HTTP response code between 200 and 300
-----------------------------
-
-[discrete]
-==== Indexing a document
-
-To index a document, we need to specify three pieces of information: index, id
-and a document body. This is done by constructing an associative array of
-key:value pairs. The request body is itself an associative array with key:value
-pairs corresponding to the data in your document:
-
-[source,php]
-----------------------------
-$params = [
- 'index' => 'my_index',
- 'id' => 'my_id',
- 'body' => ['testField' => 'abc']
-];
-
-$response = $client->index($params);
-print_r($response->asArray());
-----------------------------
-
-The response that you get back indicates that the document was created in the
-index that you specified. The response can be rendered as associatve array
-using the `asArray()` function. The array response contains a
-decoded version of the JSON that Elasticsearch returns:
-
-[source,php]
-----------------------------
-Array
-(
- [_index] => my_index
- [_type] => _doc
- [_id] => my_id
- [_version] => 1
- [created] => 1
-)
-----------------------------
-
-[discrete]
-==== Set the body as JSON string
-
-If you want you can specify the `body`parameter as JSON string. This can be
-useful for testing (eg. copy & paste from online code examples) or if you
-have already some JSON documents to be stored in Elasticsearch.
-
-For instance, the previous index example can be re-written as follows:
-
-[source,php]
-----------------------------
-$params = [
- 'index' => 'my_index',
- 'id' => 'my_id',
- 'body' => '{"testField" : "abc"}'
-];
-
-$response = $client->index($params);
-print_r($response->asArray());
-----------------------------
-
-[discrete]
-==== Getting a document
-
-Let's get the document that we just indexed. This returns the document:
-
-[source,php]
-----------------------------
-$params = [
- 'index' => 'my_index',
- 'id' => 'my_id'
-];
-
-$response = $client->get($params);
-print_r($response->asArray());
-----------------------------
-
-The response contains metadata such as index, version, and so on as well as a
-`_source` field, which is the original document you sent to {es}.
-
-[source,php]
-----------------------------
-Array
-(
- [_index] => my_index
- [_type] => _doc
- [_id] => my_id
- [_version] => 1
- [found] => 1
- [_source] => Array
- (
- [testField] => abc
- )
-
-)
-----------------------------
-
-
-[discrete]
-==== Searching for a document
-
-Searching is a hallmark of {es}, so let's perform a search. We are going to use
-the `match` query as a demonstration:
-
-[source,php]
-----------------------------
-$params = [
- 'index' => 'my_index',
- 'body' => [
- 'query' => [
- 'match' => [
- 'testField' => 'abc'
- ]
- ]
- ]
-];
-
-$response = $client->search($params);
-print_r($response->asArray());
-----------------------------
-
-The response here is different from the previous ones. You can see metadata
-(`took`, `timed_out`, etc.) and an array named `hits`. This represents your
-search results. Inside of `hits` is another array named `hits`, which contains
-individual search results:
-
-[source,php]
-----------------------------
-Array
-(
- [took] => 1
- [timed_out] =>
- [_shards] => Array
- (
- [total] => 5
- [successful] => 5
- [failed] => 0
- )
-
- [hits] => Array
- (
- [total] => 1
- [max_score] => 0.30685282
- [hits] => Array
- (
- [0] => Array
- (
- [_index] => my_index
- [_type] => _doc
- [_id] => my_id
- [_score] => 0.30685282
- [_source] => Array
- (
- [testField] => abc
- )
- )
- )
- )
-)
-----------------------------
-
-
-[discrete]
-==== Deleting a document
-
-Alright, let's go ahead and delete the document that we added previously:
-
-[source,php]
-----------------------------
-$params = [
- 'index' => 'my_index',
- 'id' => 'my_id'
-];
-
-$response = $client->delete($params);
-print_r($response->asArray());
-----------------------------
-
-This syntax is identical to the `get` syntax. The only difference is the
-operation: `delete` instead of `get`. The response confirms the document is
-deleted:
-
-[source,php]
-----------------------------
-Array
-(
- [found] => 1
- [_index] => my_index
- [_type] => _doc
- [_id] => my_id
- [_version] => 2
-)
-----------------------------
-
-
-[discrete]
-==== Deleting an index
-
-Due to the dynamic nature of {es}, the first document you added automatically
-built an index with some default settings. Delete that index and specify your
-own settings later:
-
-[source,php]
-----------------------------
-$deleteParams = [
- 'index' => 'my_index'
-];
-$response = $client->indices()->delete($deleteParams);
-print_r($response->asArray());
-----------------------------
-
-The response:
-
-
-[source,php]
-----------------------------
-Array
-(
- [acknowledged] => 1
-)
-----------------------------
-
-
-[discrete]
-==== Creating an index
-
-Now that you are starting fresh (no data or index), add a new index with custom
-settings:
-
-[source,php]
-----------------------------
-$params = [
- 'index' => 'my_index',
- 'body' => [
- 'settings' => [
- 'number_of_shards' => 2,
- 'number_of_replicas' => 0
- ]
- ]
-];
-
-$response = $client->indices()->create($params);
-print_r($response->asArray());
-----------------------------
-
-{es} now creates that index with your chosen settings and return an
-acknowledgement:
-
-[source,php]
-----------------------------
-Array
-(
- [acknowledged] => 1
-)
-----------------------------
diff --git a/phpstan.neon b/phpstan.neon
index 8e7aa19ae..76e5fed53 100644
--- a/phpstan.neon
+++ b/phpstan.neon
@@ -1,3 +1,8 @@
parameters:
+ level: 5
+ paths:
+ - src
+ reportUnmatchedIgnoredErrors: false
ignoreErrors:
- - '#PHPDoc tag @param has invalid value#'
+ - '#Offset ''body'' on array\{\}\|array\{#'
+ - '#Access to an undefined property Elastic\\Elasticsearch\\Client::\$client.#'
\ No newline at end of file
diff --git a/phpunit-yaml-free-tests.xml b/phpunit-yaml-free-tests.xml
deleted file mode 100644
index efb0dc28c..000000000
--- a/phpunit-yaml-free-tests.xml
+++ /dev/null
@@ -1,24 +0,0 @@
-
-
-
-
- src
-
-
-
-
-
-
-
- tests/Yaml/Free
-
-
-
-
- free
-
-
-
-
-
-
diff --git a/phpunit-yaml-platinum-tests.xml b/phpunit-yaml-platinum-tests.xml
deleted file mode 100644
index 307602b9d..000000000
--- a/phpunit-yaml-platinum-tests.xml
+++ /dev/null
@@ -1,24 +0,0 @@
-
-
-
-
- src
-
-
-
-
-
-
-
- tests/Yaml/Platinum
-
-
-
-
- platinum
-
-
-
-
-
-
diff --git a/phpunit-yaml-serverless-tests.xml b/phpunit-yaml-serverless-tests.xml
new file mode 100644
index 000000000..5041e9a5f
--- /dev/null
+++ b/phpunit-yaml-serverless-tests.xml
@@ -0,0 +1,24 @@
+
+
+
+
+
+
+
+ tests/Yaml
+
+
+
+
+ serverless
+
+
+
+
+
+
+
+ src
+
+
+
diff --git a/phpunit-yaml-stack-tests.xml b/phpunit-yaml-stack-tests.xml
new file mode 100644
index 000000000..d18293b9d
--- /dev/null
+++ b/phpunit-yaml-stack-tests.xml
@@ -0,0 +1,24 @@
+
+
+
+
+
+
+
+ tests/Yaml
+
+
+
+
+ stack
+
+
+
+
+
+
+
+ src
+
+
+
diff --git a/phpunit.xml.dist b/phpunit.xml.dist
index 1172040f9..f96539a3b 100644
--- a/phpunit.xml.dist
+++ b/phpunit.xml.dist
@@ -1,10 +1,5 @@
-
-
-
- src
-
-
+tests
@@ -18,4 +13,9 @@
cloud
+
+
+ src
+
+
diff --git a/src/Client.php b/src/Client.php
index 64d2608dc..9388061a1 100644
--- a/src/Client.php
+++ b/src/Client.php
@@ -23,13 +23,16 @@
use Elastic\Transport\Transport;
use Http\Promise\Promise;
use Psr\Http\Message\RequestInterface;
+use Psr\Http\Message\ResponseInterface;
use Psr\Log\LoggerInterface;
final class Client implements ClientInterface
{
const CLIENT_NAME = 'es';
- const VERSION = '8.15.0';
- const API_COMPATIBILITY_HEADER = '%s/vnd.elasticsearch+%s; compatible-with=8';
+ const VERSION = '9.0.0';
+ const API_COMPATIBILITY_HEADER = '%s/vnd.elasticsearch+%s; compatible-with=9';
+ const API_VERSION_HEADER = 'elastic-api-version';
+ const API_VERSION = '2023-10-31';
const SEARCH_ENDPOINTS = [
'search',
@@ -50,6 +53,7 @@ final class Client implements ClientInterface
protected Transport $transport;
protected LoggerInterface $logger;
+ protected bool $serverless = false;
/**
* Specify is the request is asyncronous
@@ -156,6 +160,23 @@ public function getResponseException(): bool
return $this->responseException;
}
+ /**
+ * @inheritdoc
+ */
+ public function setServerless(bool $value): self
+ {
+ $this->serverless = $value;
+ return $this;
+ }
+
+ /**
+ * @inheritdoc
+ */
+ public function getServerless(): bool
+ {
+ return $this->serverless;
+ }
+
/**
* @inheritdoc
*/
@@ -168,8 +189,8 @@ public function sendRequest(RequestInterface $request)
}
$this->transport->setAsyncOnSuccess(
$request->getMethod() === 'HEAD'
- ? new AsyncOnSuccessNoException
- : ($this->getResponseException() ? new AsyncOnSuccess : new AsyncOnSuccessNoException)
+ ? new AsyncOnSuccessNoException($this)
+ : ($this->getResponseException() ? new AsyncOnSuccess($this) : new AsyncOnSuccessNoException($this))
);
return $this->transport->sendAsyncRequest($request);
}
@@ -183,6 +204,7 @@ public function sendRequest(RequestInterface $request)
$result = new Elasticsearch;
$result->setResponse($response, $request->getMethod() === 'HEAD' ? false : $this->getResponseException());
+ $this->serverless = $result->isServerless();
return $result;
}
}
\ No newline at end of file
diff --git a/src/ClientBuilder.php b/src/ClientBuilder.php
index 0d05e1bdf..128ca398f 100644
--- a/src/ClientBuilder.php
+++ b/src/ClientBuilder.php
@@ -25,7 +25,6 @@
use Elastic\Transport\NodePool\NodePoolInterface;
use Elastic\Transport\Transport;
use Elastic\Transport\TransportBuilder;
-use GuzzleHttp\Client as GuzzleHttpClient;
use Http\Client\HttpAsyncClient;
use Psr\Http\Client\ClientInterface;
use Psr\Log\LoggerInterface;
@@ -226,7 +225,7 @@ public function setHosts(array $hosts): ClientBuilder
*
* @see https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-create-api-key.html
*/
- public function setApiKey(string $apiKey, string $id = null): ClientBuilder
+ public function setApiKey(string $apiKey, ?string $id = null): ClientBuilder
{
if (empty($id)) {
$this->apiKey = $apiKey;
@@ -272,7 +271,7 @@ public function setRetries(int $retries): ClientBuilder
* @param string $cert The name of a file containing a PEM formatted certificate
* @param string $password if the certificate requires a password
*/
- public function setSSLCert(string $cert, string $password = null): ClientBuilder
+ public function setSSLCert(string $cert, ?string $password = null): ClientBuilder
{
$this->sslCert = [$cert, $password];
return $this;
@@ -295,7 +294,7 @@ public function setCABundle(string $cert): ClientBuilder
* @param string $key The name of a file containing a private SSL key
* @param string $password if the private key requires a password
*/
- public function setSSLKey(string $key, string $password = null): ClientBuilder
+ public function setSSLKey(string $key, ?string $password = null): ClientBuilder
{
$this->sslKey = [$key, $password];
return $this;
@@ -390,10 +389,10 @@ public function build(): Client
}
/**
- * Elastic cloud optimized with gzip
+ * Elastic cloud or serverless optimized with gzip
* @see https://github.com/elastic/elasticsearch-php/issues/1241 omit for Symfony HTTP Client
*/
- if (!empty($this->cloudId) && !$this->isSymfonyHttpClient($transport)) {
+ if ((!empty($this->cloudId) || $this->isCloud($this->hosts) || $this->isServerless($this->hosts)) && !$this->isSymfonyHttpClient($transport)) {
$transport->setHeader('Accept-Encoding', 'gzip');
}
@@ -401,9 +400,47 @@ public function build(): Client
// Enable or disable the x-elastic-client-meta header
$client->setElasticMetaHeader($this->elasticMetaHeader);
+ if ($this->isServerless($this->hosts)) {
+ $client->setServerless(true);
+ }
return $client;
}
+ /**
+ * Check if the hosts contains an Elastic Cloud url
+ */
+ protected function isCloud(array $hosts): bool
+ {
+ if (empty($hosts) || count($hosts)>1) {
+ return false;
+ }
+ $url = $hosts[0];
+ // Elastic Cloud gcp
+ if (preg_match('/\.cloud\.es\.io/i', $url)) {
+ return true;
+ }
+ // Elastic Cloud aws or azure
+ if (preg_match('/\.elastic-cloud\.com/i', $url)) {
+ return true;
+ }
+ return false;
+ }
+
+ /**
+ * Check if the hosts contains an Elastic Serverless url
+ */
+ protected function isServerless(array $hosts): bool
+ {
+ if (empty($hosts) || count($hosts)>1) {
+ return false;
+ }
+ $url = $hosts[0];
+ if (preg_match('/\.elastic\.cloud/i', $url)) {
+ return true;
+ }
+ return false;
+ }
+
/**
* Returns true if the transport HTTP client is Symfony
*/
@@ -469,4 +506,4 @@ protected function setOptions(ClientInterface $client, array $config, array $cli
$adapter = new $adapterClass;
return $adapter->setConfig($client, $config, $clientOptions);
}
-}
\ No newline at end of file
+}
diff --git a/src/ClientInterface.php b/src/ClientInterface.php
index 04b982c85..b71eaf560 100644
--- a/src/ClientInterface.php
+++ b/src/ClientInterface.php
@@ -62,6 +62,16 @@ public function setResponseException(bool $active): self;
*/
public function getResponseException(): bool;
+ /**
+ * Set Elastic Serverless to true or false
+ */
+ public function setServerless(bool $value): self;
+
+ /**
+ * Returns true if the client is set (or connected) to Serverless
+ */
+ public function getServerless(): bool;
+
/**
* Send the HTTP request using the Elastic Transport.
* It manages syncronous and asyncronus requests using Client::getAsync()
diff --git a/src/Endpoints/AsyncSearch.php b/src/Endpoints/AsyncSearch.php
index a1a0cee41..9433d2a56 100644
--- a/src/Endpoints/AsyncSearch.php
+++ b/src/Endpoints/AsyncSearch.php
@@ -31,15 +31,16 @@ class AsyncSearch extends AbstractEndpoint
/**
* Deletes an async search by ID. If the search is still running, the search request will be cancelled. Otherwise, the saved search results are deleted.
*
- * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/async-search.html
+ * @link https://www.elastic.co/guide/en/elasticsearch/reference/current/async-search.html
+ * @group serverless
*
* @param array{
* id: string, // (REQUIRED) The async search ID
- * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false)
- * human: boolean, // Return human readable values for statistics. (DEFAULT: true)
- * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false)
- * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests.
- * filter_path: list, // A comma-separated list of filters used to reduce the response.
+ * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false)
+ * human?: bool, // Return human readable values for statistics. (DEFAULT: true)
+ * error_trace?: bool, // 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?: string|array, // A comma-separated list of filters used to reduce the response.
* } $params
*
* @throws MissingParameterException if a required parameter is missing
@@ -49,8 +50,9 @@ class AsyncSearch extends AbstractEndpoint
*
* @return Elasticsearch|Promise
*/
- public function delete(array $params = [])
+ public function delete(?array $params = null)
{
+ $params = $params ?? [];
$this->checkRequiredParameters(['id'], $params);
$url = '/_async_search/' . $this->encode($params['id']);
$method = 'DELETE';
@@ -68,18 +70,19 @@ public function delete(array $params = [])
/**
* Retrieves the results of a previously submitted async search request given its ID.
*
- * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/async-search.html
+ * @link https://www.elastic.co/guide/en/elasticsearch/reference/current/async-search.html
+ * @group serverless
*
* @param array{
* id: string, // (REQUIRED) The async search 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
- * 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)
- * 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.
+ * wait_for_completion_timeout?: int|string, // Specify the time that the request should block waiting for the final response
+ * keep_alive?: int|string, // Specify the time interval in which the results (partial or final) for this search will be available
+ * typed_keys?: bool, // Specify whether aggregation and suggester names should be prefixed by their respective types in the response
+ * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false)
+ * human?: bool, // Return human readable values for statistics. (DEFAULT: true)
+ * error_trace?: bool, // 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?: string|array, // A comma-separated list of filters used to reduce the response.
* } $params
*
* @throws MissingParameterException if a required parameter is missing
@@ -89,8 +92,9 @@ public function delete(array $params = [])
*
* @return Elasticsearch|Promise
*/
- public function get(array $params = [])
+ public function get(?array $params = null)
{
+ $params = $params ?? [];
$this->checkRequiredParameters(['id'], $params);
$url = '/_async_search/' . $this->encode($params['id']);
$method = 'GET';
@@ -108,16 +112,17 @@ public function get(array $params = [])
/**
* Retrieves the status of a previously submitted async search request given its ID.
*
- * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/async-search.html
+ * @link https://www.elastic.co/guide/en/elasticsearch/reference/current/async-search.html
+ * @group serverless
*
* @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)
- * 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.
+ * keep_alive?: int|string, // Specify the time interval in which the results (partial or final) for this search will be available
+ * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false)
+ * human?: bool, // Return human readable values for statistics. (DEFAULT: true)
+ * error_trace?: bool, // 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?: string|array, // A comma-separated list of filters used to reduce the response.
* } $params
*
* @throws MissingParameterException if a required parameter is missing
@@ -127,8 +132,9 @@ public function get(array $params = [])
*
* @return Elasticsearch|Promise
*/
- public function status(array $params = [])
+ public function status(?array $params = null)
{
+ $params = $params ?? [];
$this->checkRequiredParameters(['id'], $params);
$url = '/_async_search/status/' . $this->encode($params['id']);
$method = 'GET';
@@ -146,57 +152,60 @@ public function status(array $params = [])
/**
* Executes a search request asynchronously.
*
- * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/async-search.html
+ * @link https://www.elastic.co/guide/en/elasticsearch/reference/current/async-search.html
+ * @group serverless
*
* @param array{
- * index: list, // A comma-separated list of index names to search; use `_all` or empty string to perform the operation on all indices
- * wait_for_completion_timeout: time, // Specify the time that the request should block waiting for the final response
- * keep_on_completion: boolean, // Control whether the response should be stored in the cluster if it completed within the provided [wait_for_completion] time (default: false)
- * keep_alive: time, // Update the time interval in which the results (partial or final) for this search will be available
- * batched_reduce_size: number, // The number of shard results that should be reduced at once on the coordinating node. This value should be used as the granularity at which progress results will be made available.
- * request_cache: boolean, // Specify if request cache should be used for this request or not, defaults to true
- * analyzer: string, // The analyzer to use for the query string
- * analyze_wildcard: boolean, // Specify whether wildcard and prefix queries should be analyzed (default: false)
- * default_operator: enum, // The default operator for query string query (AND or OR)
- * df: string, // The field to use as default where no field prefix is given in the query string
- * explain: boolean, // Specify whether to return detailed information about score computation as part of a hit
- * stored_fields: list, // A comma-separated list of stored fields to return as part of a hit
- * docvalue_fields: list, // A comma-separated list of fields to return as the docvalue representation of a field for each hit
- * from: number, // Starting offset (default: 0)
- * 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 to expand wildcard expression to concrete indices that are open, closed or both.
- * lenient: boolean, // Specify whether format-based query failures (such as providing text to a numeric field) should be ignored
- * preference: string, // Specify the node or shard the operation should be performed on (default: random)
- * q: string, // Query in the Lucene query string syntax
- * routing: list, // A comma-separated list of specific routing values
- * search_type: enum, // Search operation type
- * size: number, // Number of hits to return (default: 10)
- * sort: list, // A comma-separated list of : pairs
- * _source: list, // True or false to return the _source field or not, or a list of fields to return
- * _source_excludes: list, // A list of fields to exclude from the returned _source field
- * _source_includes: list, // A list of fields to extract and return from the _source field
- * terminate_after: number, // The maximum number of documents to collect for each shard, upon reaching which the query execution will terminate early.
- * stats: list, // Specific 'tag' of the request for logging and statistical purposes
- * suggest_field: string, // Specify which field to use for suggestions
- * suggest_mode: enum, // Specify suggest mode
- * suggest_size: number, // How many suggestions to return in response
- * suggest_text: string, // The source text for which the suggestions should be returned
- * timeout: time, // Explicit operation timeout
- * track_scores: boolean, // Whether to calculate and return scores even if they are not used for sorting
- * track_total_hits: boolean|long, // Indicate if the number of documents that match the query should be tracked. A number can also be specified, to accurately track the total hit count up to the number.
- * allow_partial_search_results: boolean, // Indicate if an error should be returned if there is a partial search failure or timeout
- * typed_keys: boolean, // Specify whether aggregation and suggester names should be prefixed by their respective types in the response
- * version: boolean, // Specify whether to return document version as part of a hit
- * seq_no_primary_term: boolean, // Specify whether to return sequence number and primary term of the last modification of each hit
- * max_concurrent_shard_requests: number, // The number of concurrent shard requests per node this search executes concurrently. This value should be used to limit the impact of the search on the cluster in order to limit the number of concurrent shard requests
- * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false)
- * human: boolean, // Return human readable values for statistics. (DEFAULT: true)
- * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false)
- * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests.
- * filter_path: list, // A comma-separated list of filters used to reduce the response.
- * body: array, // The search definition using the Query DSL
+ * index?: string|array, // A comma-separated list of index names to search; use `_all` or empty string to perform the operation on all indices
+ * wait_for_completion_timeout?: int|string, // Specify the time that the request should block waiting for the final response
+ * keep_on_completion?: bool, // Control whether the response should be stored in the cluster if it completed within the provided [wait_for_completion] time (default: false)
+ * keep_alive?: int|string, // Update the time interval in which the results (partial or final) for this search will be available
+ * batched_reduce_size?: int, // The number of shard results that should be reduced at once on the coordinating node. This value should be used as the granularity at which progress results will be made available.
+ * request_cache?: bool, // Specify if request cache should be used for this request or not, defaults to true
+ * analyzer?: string, // The analyzer to use for the query string
+ * analyze_wildcard?: bool, // Specify whether wildcard and prefix queries should be analyzed (default: false)
+ * ccs_minimize_roundtrips?: bool, // When doing a cross-cluster search, setting it to true may improve overall search latency, particularly when searching clusters with a large number of shards. However, when set to true, the progress of searches on the remote clusters will not be received until the search finishes on all clusters.
+ * default_operator?: string, // The default operator for query string query (AND or OR)
+ * df?: string, // The field to use as default where no field prefix is given in the query string
+ * explain?: bool, // Specify whether to return detailed information about score computation as part of a hit
+ * stored_fields?: string|array, // A comma-separated list of stored fields to return as part of a hit
+ * docvalue_fields?: string|array, // A comma-separated list of fields to return as the docvalue representation of a field for each hit
+ * from?: int, // Starting offset (default: 0)
+ * ignore_unavailable?: bool, // Whether specified concrete indices should be ignored when unavailable (missing or closed)
+ * ignore_throttled?: bool, // Whether specified concrete, expanded or aliased indices should be ignored when throttled
+ * allow_no_indices?: bool, // 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?: string, // Whether to expand wildcard expression to concrete indices that are open, closed or both.
+ * lenient?: bool, // Specify whether format-based query failures (such as providing text to a numeric field) should be ignored
+ * preference?: string, // Specify the node or shard the operation should be performed on (default: random)
+ * rest_total_hits_as_int?: bool, // Indicates whether hits.total should be rendered as an integer or an object in the rest search response
+ * q?: string, // Query in the Lucene query string syntax
+ * routing?: string|array, // A comma-separated list of specific routing values
+ * search_type?: string, // Search operation type
+ * size?: int, // Number of hits to return (default: 10)
+ * sort?: string|array, // A comma-separated list of : pairs
+ * _source?: string|array, // True or false to return the _source field or not, or a list of fields to return
+ * _source_excludes?: string|array, // A list of fields to exclude from the returned _source field
+ * _source_includes?: string|array, // A list of fields to extract and return from the _source field
+ * terminate_after?: int, // The maximum number of documents to collect for each shard, upon reaching which the query execution will terminate early.
+ * stats?: string|array, // Specific 'tag' of the request for logging and statistical purposes
+ * suggest_field?: string, // Specify which field to use for suggestions
+ * suggest_mode?: string, // Specify suggest mode
+ * suggest_size?: int, // How many suggestions to return in response
+ * suggest_text?: string, // The source text for which the suggestions should be returned
+ * timeout?: int|string, // Explicit operation timeout
+ * track_scores?: bool, // Whether to calculate and return scores even if they are not used for sorting
+ * track_total_hits?: bool|int, // Indicate if the number of documents that match the query should be tracked. A number can also be specified, to accurately track the total hit count up to the number.
+ * allow_partial_search_results?: bool, // Indicate if an error should be returned if there is a partial search failure or timeout
+ * typed_keys?: bool, // Specify whether aggregation and suggester names should be prefixed by their respective types in the response
+ * version?: bool, // Specify whether to return document version as part of a hit
+ * seq_no_primary_term?: bool, // Specify whether to return sequence number and primary term of the last modification of each hit
+ * max_concurrent_shard_requests?: int, // The number of concurrent shard requests per node this search executes concurrently. This value should be used to limit the impact of the search on the cluster in order to limit the number of concurrent shard requests
+ * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false)
+ * human?: bool, // Return human readable values for statistics. (DEFAULT: true)
+ * error_trace?: bool, // 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?: string|array, // A comma-separated list of filters used to reduce the response.
+ * body?: string|array, // The search definition using the Query DSL. If body is a string must be a valid JSON.
* } $params
*
* @throws NoNodeAvailableException if all the hosts are offline
@@ -205,16 +214,17 @@ public function status(array $params = [])
*
* @return Elasticsearch|Promise
*/
- public function submit(array $params = [])
+ public function submit(?array $params = null)
{
+ $params = $params ?? [];
if (isset($params['index'])) {
- $url = '/' . $this->encode($params['index']) . '/_async_search';
+ $url = '/' . $this->encode($this->convertValue($params['index'])) . '/_async_search';
$method = 'POST';
} else {
$url = '/_async_search';
$method = 'POST';
}
- $url = $this->addQueryString($url, $params, ['wait_for_completion_timeout','keep_on_completion','keep_alive','batched_reduce_size','request_cache','analyzer','analyze_wildcard','default_operator','df','explain','stored_fields','docvalue_fields','from','ignore_unavailable','ignore_throttled','allow_no_indices','expand_wildcards','lenient','preference','q','routing','search_type','size','sort','_source','_source_excludes','_source_includes','terminate_after','stats','suggest_field','suggest_mode','suggest_size','suggest_text','timeout','track_scores','track_total_hits','allow_partial_search_results','typed_keys','version','seq_no_primary_term','max_concurrent_shard_requests','pretty','human','error_trace','source','filter_path']);
+ $url = $this->addQueryString($url, $params, ['wait_for_completion_timeout','keep_on_completion','keep_alive','batched_reduce_size','request_cache','analyzer','analyze_wildcard','ccs_minimize_roundtrips','default_operator','df','explain','stored_fields','docvalue_fields','from','ignore_unavailable','ignore_throttled','allow_no_indices','expand_wildcards','lenient','preference','rest_total_hits_as_int','q','routing','search_type','size','sort','_source','_source_excludes','_source_includes','terminate_after','stats','suggest_field','suggest_mode','suggest_size','suggest_text','timeout','track_scores','track_total_hits','allow_partial_search_results','typed_keys','version','seq_no_primary_term','max_concurrent_shard_requests','pretty','human','error_trace','source','filter_path']);
$headers = [
'Accept' => 'application/json',
'Content-Type' => 'application/json',
diff --git a/src/Endpoints/Autoscaling.php b/src/Endpoints/Autoscaling.php
index 75481fc88..41f0a5299 100644
--- a/src/Endpoints/Autoscaling.php
+++ b/src/Endpoints/Autoscaling.php
@@ -31,17 +31,17 @@ class Autoscaling extends AbstractEndpoint
/**
* Deletes an autoscaling policy. Designed for indirect use by ECE/ESS and ECK. Direct use is not supported.
*
- * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/autoscaling-delete-autoscaling-policy.html
+ * @link https://www.elastic.co/guide/en/elasticsearch/reference/current/autoscaling-delete-autoscaling-policy.html
*
* @param array{
* name: string, // (REQUIRED) the name of the autoscaling policy
- * master_timeout: time, // Timeout for processing on master node
- * timeout: time, // Timeout for acknowledgement of update from all nodes in cluster
- * 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.
+ * master_timeout?: int|string, // Timeout for processing on master node
+ * timeout?: int|string, // Timeout for acknowledgement of update from all nodes in cluster
+ * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false)
+ * human?: bool, // Return human readable values for statistics. (DEFAULT: true)
+ * error_trace?: bool, // 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?: string|array, // A comma-separated list of filters used to reduce the response.
* } $params
*
* @throws MissingParameterException if a required parameter is missing
@@ -51,8 +51,9 @@ class Autoscaling extends AbstractEndpoint
*
* @return Elasticsearch|Promise
*/
- public function deleteAutoscalingPolicy(array $params = [])
+ public function deleteAutoscalingPolicy(?array $params = null)
{
+ $params = $params ?? [];
$this->checkRequiredParameters(['name'], $params);
$url = '/_autoscaling/policy/' . $this->encode($params['name']);
$method = 'DELETE';
@@ -70,15 +71,15 @@ public function deleteAutoscalingPolicy(array $params = [])
/**
* Gets the current autoscaling capacity based on the configured autoscaling policy. Designed for indirect use by ECE/ESS and ECK. Direct use is not supported.
*
- * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/autoscaling-get-autoscaling-capacity.html
+ * @link https://www.elastic.co/guide/en/elasticsearch/reference/current/autoscaling-get-autoscaling-capacity.html
*
* @param array{
- * master_timeout: time, // Timeout for processing on 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)
- * 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.
+ * master_timeout?: int|string, // Timeout for processing on master node
+ * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false)
+ * human?: bool, // Return human readable values for statistics. (DEFAULT: true)
+ * error_trace?: bool, // 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?: string|array, // A comma-separated list of filters used to reduce the response.
* } $params
*
* @throws NoNodeAvailableException if all the hosts are offline
@@ -87,8 +88,9 @@ public function deleteAutoscalingPolicy(array $params = [])
*
* @return Elasticsearch|Promise
*/
- public function getAutoscalingCapacity(array $params = [])
+ public function getAutoscalingCapacity(?array $params = null)
{
+ $params = $params ?? [];
$url = '/_autoscaling/capacity';
$method = 'GET';
@@ -105,16 +107,16 @@ public function getAutoscalingCapacity(array $params = [])
/**
* Retrieves an autoscaling policy. Designed for indirect use by ECE/ESS and ECK. Direct use is not supported.
*
- * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/autoscaling-get-autoscaling-policy.html
+ * @link https://www.elastic.co/guide/en/elasticsearch/reference/current/autoscaling-get-autoscaling-policy.html
*
* @param array{
* name: string, // (REQUIRED) the name of the autoscaling policy
- * master_timeout: time, // Timeout for processing on 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)
- * 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.
+ * master_timeout?: int|string, // Timeout for processing on master node
+ * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false)
+ * human?: bool, // Return human readable values for statistics. (DEFAULT: true)
+ * error_trace?: bool, // 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?: string|array, // A comma-separated list of filters used to reduce the response.
* } $params
*
* @throws MissingParameterException if a required parameter is missing
@@ -124,8 +126,9 @@ public function getAutoscalingCapacity(array $params = [])
*
* @return Elasticsearch|Promise
*/
- public function getAutoscalingPolicy(array $params = [])
+ public function getAutoscalingPolicy(?array $params = null)
{
+ $params = $params ?? [];
$this->checkRequiredParameters(['name'], $params);
$url = '/_autoscaling/policy/' . $this->encode($params['name']);
$method = 'GET';
@@ -143,18 +146,18 @@ public function getAutoscalingPolicy(array $params = [])
/**
* Creates a new autoscaling policy. Designed for indirect use by ECE/ESS and ECK. Direct use is not supported.
*
- * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/autoscaling-put-autoscaling-policy.html
+ * @link https://www.elastic.co/guide/en/elasticsearch/reference/current/autoscaling-put-autoscaling-policy.html
*
* @param array{
* name: string, // (REQUIRED) the name of the autoscaling policy
- * master_timeout: time, // Timeout for processing on master node
- * timeout: time, // Timeout for acknowledgement of update from all nodes in cluster
- * 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 specification of the autoscaling policy
+ * master_timeout?: int|string, // Timeout for processing on master node
+ * timeout?: int|string, // Timeout for acknowledgement of update from all nodes in cluster
+ * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false)
+ * human?: bool, // Return human readable values for statistics. (DEFAULT: true)
+ * error_trace?: bool, // 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?: string|array, // A comma-separated list of filters used to reduce the response.
+ * body: string|array, // (REQUIRED) the specification of the autoscaling policy. If body is a string must be a valid JSON.
* } $params
*
* @throws MissingParameterException if a required parameter is missing
@@ -164,8 +167,9 @@ public function getAutoscalingPolicy(array $params = [])
*
* @return Elasticsearch|Promise
*/
- public function putAutoscalingPolicy(array $params = [])
+ public function putAutoscalingPolicy(?array $params = null)
{
+ $params = $params ?? [];
$this->checkRequiredParameters(['name','body'], $params);
$url = '/_autoscaling/policy/' . $this->encode($params['name']);
$method = 'PUT';
diff --git a/src/Endpoints/Cat.php b/src/Endpoints/Cat.php
index 026f7ba32..5411ebac7 100644
--- a/src/Endpoints/Cat.php
+++ b/src/Endpoints/Cat.php
@@ -31,22 +31,23 @@ class Cat extends AbstractEndpoint
/**
* Shows information about currently configured aliases to indices including filter and routing infos.
*
- * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/cat-alias.html
+ * @link https://www.elastic.co/guide/en/elasticsearch/reference/master/cat-alias.html
+ * @group serverless
*
* @param array{
- * name: list, // A comma-separated list of alias names to return
- * format: string, // a short version of the Accept header, e.g. json, yaml
- * local: boolean, // Return local information, do not retrieve the state from master node (default: false)
- * h: list, // Comma-separated list of column names to display
- * help: boolean, // Return help information
- * s: list, // Comma-separated list of column names or column aliases to sort by
- * v: boolean, // Verbose mode. Display column headers
- * expand_wildcards: enum, // Whether to expand wildcard expression to concrete indices that are open, closed or both.
- * 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.
+ * name?: string|array, // A comma-separated list of alias names to return
+ * format?: string, // a short version of the Accept header, e.g. json, yaml
+ * h?: string|array, // Comma-separated list of column names to display
+ * help?: bool, // Return help information
+ * s?: string|array, // Comma-separated list of column names or column aliases to sort by
+ * v?: bool, // Verbose mode. Display column headers
+ * expand_wildcards?: string, // Whether to expand wildcard expression to concrete indices that are open, closed or both.
+ * master_timeout?: int|string, // Timeout for waiting for new cluster state in case it is blocked
+ * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false)
+ * human?: bool, // Return human readable values for statistics. (DEFAULT: true)
+ * error_trace?: bool, // 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?: string|array, // A comma-separated list of filters used to reduce the response.
* } $params
*
* @throws NoNodeAvailableException if all the hosts are offline
@@ -55,16 +56,17 @@ class Cat extends AbstractEndpoint
*
* @return Elasticsearch|Promise
*/
- public function aliases(array $params = [])
+ public function aliases(?array $params = null)
{
+ $params = $params ?? [];
if (isset($params['name'])) {
- $url = '/_cat/aliases/' . $this->encode($params['name']);
+ $url = '/_cat/aliases/' . $this->encode($this->convertValue($params['name']));
$method = 'GET';
} else {
$url = '/_cat/aliases';
$method = 'GET';
}
- $url = $this->addQueryString($url, $params, ['format','local','h','help','s','v','expand_wildcards','pretty','human','error_trace','source','filter_path']);
+ $url = $this->addQueryString($url, $params, ['format','h','help','s','v','expand_wildcards','master_timeout','pretty','human','error_trace','source','filter_path']);
$headers = [
'Accept' => 'text/plain,application/json',
];
@@ -77,23 +79,23 @@ public function aliases(array $params = [])
/**
* Provides a snapshot of how many shards are allocated to each data node and how much disk space they are using.
*
- * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/cat-allocation.html
+ * @link https://www.elastic.co/guide/en/elasticsearch/reference/master/cat-allocation.html
*
* @param array{
- * node_id: list, // A comma-separated list of node IDs or names to limit the returned information
- * format: string, // a short version of the Accept header, e.g. json, yaml
- * bytes: enum, // The unit in which to display byte values
- * local: boolean, // Return local information, do not retrieve the state from master node (default: false)
- * master_timeout: time, // Explicit operation timeout for connection to master node
- * h: list, // Comma-separated list of column names to display
- * help: boolean, // Return help information
- * s: list, // Comma-separated list of column names or column aliases to sort by
- * v: boolean, // Verbose mode. Display column headers
- * 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.
+ * node_id?: string|array, // A comma-separated list of node IDs or names to limit the returned information
+ * format?: string, // a short version of the Accept header, e.g. json, yaml
+ * bytes?: string, // The unit in which to display byte values
+ * local?: bool, // Return local information, do not retrieve the state from master node (default: false)
+ * master_timeout?: int|string, // Explicit operation timeout for connection to master node
+ * h?: string|array, // Comma-separated list of column names to display
+ * help?: bool, // Return help information
+ * s?: string|array, // Comma-separated list of column names or column aliases to sort by
+ * v?: bool, // Verbose mode. Display column headers
+ * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false)
+ * human?: bool, // Return human readable values for statistics. (DEFAULT: true)
+ * error_trace?: bool, // 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?: string|array, // A comma-separated list of filters used to reduce the response.
* } $params
*
* @throws NoNodeAvailableException if all the hosts are offline
@@ -102,10 +104,11 @@ public function aliases(array $params = [])
*
* @return Elasticsearch|Promise
*/
- public function allocation(array $params = [])
+ public function allocation(?array $params = null)
{
+ $params = $params ?? [];
if (isset($params['node_id'])) {
- $url = '/_cat/allocation/' . $this->encode($params['node_id']);
+ $url = '/_cat/allocation/' . $this->encode($this->convertValue($params['node_id']));
$method = 'GET';
} else {
$url = '/_cat/allocation';
@@ -124,22 +127,23 @@ public function allocation(array $params = [])
/**
* Returns information about existing component_templates templates.
*
- * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/cat-component-templates.html
+ * @link https://www.elastic.co/guide/en/elasticsearch/reference/master/cat-component-templates.html
+ * @group serverless
*
* @param array{
- * name: string, // A pattern that returned component template names must match
- * format: string, // a short version of the Accept header, e.g. json, yaml
- * local: boolean, // Return local information, do not retrieve the state from master node (default: false)
- * master_timeout: time, // Explicit operation timeout for connection to master node
- * h: list, // Comma-separated list of column names to display
- * help: boolean, // Return help information
- * s: list, // Comma-separated list of column names or column aliases to sort by
- * v: boolean, // Verbose mode. Display column headers
- * 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.
+ * name?: string, // A pattern that returned component template names must match
+ * format?: string, // a short version of the Accept header, e.g. json, yaml
+ * local?: bool, // Return local information, do not retrieve the state from master node (default: false)
+ * master_timeout?: int|string, // Explicit operation timeout for connection to master node
+ * h?: string|array, // Comma-separated list of column names to display
+ * help?: bool, // Return help information
+ * s?: string|array, // Comma-separated list of column names or column aliases to sort by
+ * v?: bool, // Verbose mode. Display column headers
+ * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false)
+ * human?: bool, // Return human readable values for statistics. (DEFAULT: true)
+ * error_trace?: bool, // 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?: string|array, // A comma-separated list of filters used to reduce the response.
* } $params
*
* @throws NoNodeAvailableException if all the hosts are offline
@@ -148,8 +152,9 @@ public function allocation(array $params = [])
*
* @return Elasticsearch|Promise
*/
- public function componentTemplates(array $params = [])
+ public function componentTemplates(?array $params = null)
{
+ $params = $params ?? [];
if (isset($params['name'])) {
$url = '/_cat/component_templates/' . $this->encode($params['name']);
$method = 'GET';
@@ -170,20 +175,21 @@ public function componentTemplates(array $params = [])
/**
* Provides quick access to the document count of the entire cluster, or individual indices.
*
- * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/cat-count.html
+ * @link https://www.elastic.co/guide/en/elasticsearch/reference/master/cat-count.html
+ * @group serverless
*
* @param array{
- * index: list, // A comma-separated list of index names to limit the returned information
- * format: string, // a short version of the Accept header, e.g. json, yaml
- * h: list, // Comma-separated list of column names to display
- * help: boolean, // Return help information
- * s: list, // Comma-separated list of column names or column aliases to sort by
- * v: boolean, // Verbose mode. Display column headers
- * 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.
+ * index?: string|array, // A comma-separated list of index names to limit the returned information
+ * format?: string, // a short version of the Accept header, e.g. json, yaml
+ * h?: string|array, // Comma-separated list of column names to display
+ * help?: bool, // Return help information
+ * s?: string|array, // Comma-separated list of column names or column aliases to sort by
+ * v?: bool, // Verbose mode. Display column headers
+ * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false)
+ * human?: bool, // Return human readable values for statistics. (DEFAULT: true)
+ * error_trace?: bool, // 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?: string|array, // A comma-separated list of filters used to reduce the response.
* } $params
*
* @throws NoNodeAvailableException if all the hosts are offline
@@ -192,10 +198,11 @@ public function componentTemplates(array $params = [])
*
* @return Elasticsearch|Promise
*/
- public function count(array $params = [])
+ public function count(?array $params = null)
{
+ $params = $params ?? [];
if (isset($params['index'])) {
- $url = '/_cat/count/' . $this->encode($params['index']);
+ $url = '/_cat/count/' . $this->encode($this->convertValue($params['index']));
$method = 'GET';
} else {
$url = '/_cat/count';
@@ -214,21 +221,21 @@ public function count(array $params = [])
/**
* Shows how much heap memory is currently being used by fielddata on every data node in the cluster.
*
- * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/cat-fielddata.html
+ * @link https://www.elastic.co/guide/en/elasticsearch/reference/master/cat-fielddata.html
*
* @param array{
- * fields: list, // A comma-separated list of fields to return the fielddata size
- * format: string, // a short version of the Accept header, e.g. json, yaml
- * bytes: enum, // The unit in which to display byte values
- * h: list, // Comma-separated list of column names to display
- * help: boolean, // Return help information
- * s: list, // Comma-separated list of column names or column aliases to sort by
- * v: boolean, // Verbose mode. Display column headers
- * 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.
+ * fields?: string|array, // A comma-separated list of fields to return the fielddata size
+ * format?: string, // a short version of the Accept header, e.g. json, yaml
+ * bytes?: string, // The unit in which to display byte values
+ * h?: string|array, // Comma-separated list of column names to display
+ * help?: bool, // Return help information
+ * s?: string|array, // Comma-separated list of column names or column aliases to sort by
+ * v?: bool, // Verbose mode. Display column headers
+ * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false)
+ * human?: bool, // Return human readable values for statistics. (DEFAULT: true)
+ * error_trace?: bool, // 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?: string|array, // A comma-separated list of filters used to reduce the response.
* } $params
*
* @throws NoNodeAvailableException if all the hosts are offline
@@ -237,10 +244,11 @@ public function count(array $params = [])
*
* @return Elasticsearch|Promise
*/
- public function fielddata(array $params = [])
+ public function fielddata(?array $params = null)
{
+ $params = $params ?? [];
if (isset($params['fields'])) {
- $url = '/_cat/fielddata/' . $this->encode($params['fields']);
+ $url = '/_cat/fielddata/' . $this->encode($this->convertValue($params['fields']));
$method = 'GET';
} else {
$url = '/_cat/fielddata';
@@ -259,21 +267,21 @@ public function fielddata(array $params = [])
/**
* Returns a concise representation of the cluster health.
*
- * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/cat-health.html
+ * @link https://www.elastic.co/guide/en/elasticsearch/reference/master/cat-health.html
*
* @param array{
- * format: string, // a short version of the Accept header, e.g. json, yaml
- * h: list, // Comma-separated list of column names to display
- * help: boolean, // Return help information
- * s: list, // Comma-separated list of column names or column aliases to sort by
- * time: enum, // The unit in which to display time values
- * ts: boolean, // Set to false to disable timestamping
- * v: boolean, // Verbose mode. Display column headers
- * 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.
+ * format?: string, // a short version of the Accept header, e.g. json, yaml
+ * h?: string|array, // Comma-separated list of column names to display
+ * help?: bool, // Return help information
+ * s?: string|array, // Comma-separated list of column names or column aliases to sort by
+ * time?: string, // The unit in which to display time values
+ * ts?: bool, // Set to false to disable timestamping
+ * v?: bool, // Verbose mode. Display column headers
+ * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false)
+ * human?: bool, // Return human readable values for statistics. (DEFAULT: true)
+ * error_trace?: bool, // 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?: string|array, // A comma-separated list of filters used to reduce the response.
* } $params
*
* @throws NoNodeAvailableException if all the hosts are offline
@@ -282,8 +290,9 @@ public function fielddata(array $params = [])
*
* @return Elasticsearch|Promise
*/
- public function health(array $params = [])
+ public function health(?array $params = null)
{
+ $params = $params ?? [];
$url = '/_cat/health';
$method = 'GET';
@@ -300,16 +309,15 @@ public function health(array $params = [])
/**
* Returns help for the Cat APIs.
*
- * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/cat.html
+ * @link https://www.elastic.co/guide/en/elasticsearch/reference/master/cat.html
+ * @group serverless
*
* @param array{
- * help: boolean, // Return help information
- * s: list, // Comma-separated list of column names or column aliases to sort by
- * 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.
+ * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false)
+ * human?: bool, // Return human readable values for statistics. (DEFAULT: true)
+ * error_trace?: bool, // 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?: string|array, // A comma-separated list of filters used to reduce the response.
* } $params
*
* @throws NoNodeAvailableException if all the hosts are offline
@@ -318,12 +326,13 @@ public function health(array $params = [])
*
* @return Elasticsearch|Promise
*/
- public function help(array $params = [])
+ public function help(?array $params = null)
{
+ $params = $params ?? [];
$url = '/_cat';
$method = 'GET';
- $url = $this->addQueryString($url, $params, ['help','s','pretty','human','error_trace','source','filter_path']);
+ $url = $this->addQueryString($url, $params, ['pretty','human','error_trace','source','filter_path']);
$headers = [
'Accept' => 'text/plain',
];
@@ -336,27 +345,28 @@ public function help(array $params = [])
/**
* Returns information about indices: number of primaries and replicas, document counts, disk size, ...
*
- * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/cat-indices.html
+ * @link https://www.elastic.co/guide/en/elasticsearch/reference/master/cat-indices.html
+ * @group serverless
*
* @param array{
- * index: list, // A comma-separated list of index names to limit the returned information
- * format: string, // a short version of the Accept header, e.g. json, yaml
- * bytes: enum, // The unit in which to display byte values
- * master_timeout: time, // Explicit operation timeout for connection to master node
- * h: list, // Comma-separated list of column names to display
- * health: enum, // A health status ("green", "yellow", or "red" to filter only indices matching the specified health status
- * help: boolean, // Return help information
- * pri: boolean, // Set to true to return stats only for primary shards
- * s: list, // Comma-separated list of column names or column aliases to sort by
- * time: enum, // The unit in which to display time values
- * v: boolean, // Verbose mode. Display column headers
- * include_unloaded_segments: boolean, // If set to true segment stats will include stats for segments that are not currently loaded into memory
- * expand_wildcards: enum, // Whether to expand wildcard expression to concrete indices that are open, closed or both.
- * 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.
+ * index?: string|array, // A comma-separated list of index names to limit the returned information
+ * format?: string, // a short version of the Accept header, e.g. json, yaml
+ * bytes?: string, // The unit in which to display byte values
+ * master_timeout?: int|string, // Explicit operation timeout for connection to master node
+ * h?: string|array, // Comma-separated list of column names to display
+ * health?: string, // A health status ("green", "yellow", or "red" to filter only indices matching the specified health status
+ * help?: bool, // Return help information
+ * pri?: bool, // Set to true to return stats only for primary shards
+ * s?: string|array, // Comma-separated list of column names or column aliases to sort by
+ * time?: string, // The unit in which to display time values
+ * v?: bool, // Verbose mode. Display column headers
+ * include_unloaded_segments?: bool, // If set to true segment stats will include stats for segments that are not currently loaded into memory
+ * expand_wildcards?: string, // Whether to expand wildcard expression to concrete indices that are open, closed or both.
+ * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false)
+ * human?: bool, // Return human readable values for statistics. (DEFAULT: true)
+ * error_trace?: bool, // 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?: string|array, // A comma-separated list of filters used to reduce the response.
* } $params
*
* @throws NoNodeAvailableException if all the hosts are offline
@@ -365,10 +375,11 @@ public function help(array $params = [])
*
* @return Elasticsearch|Promise
*/
- public function indices(array $params = [])
+ public function indices(?array $params = null)
{
+ $params = $params ?? [];
if (isset($params['index'])) {
- $url = '/_cat/indices/' . $this->encode($params['index']);
+ $url = '/_cat/indices/' . $this->encode($this->convertValue($params['index']));
$method = 'GET';
} else {
$url = '/_cat/indices';
@@ -387,21 +398,21 @@ public function indices(array $params = [])
/**
* Returns information about the master node.
*
- * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/cat-master.html
+ * @link https://www.elastic.co/guide/en/elasticsearch/reference/master/cat-master.html
*
* @param array{
- * format: string, // a short version of the Accept header, e.g. json, yaml
- * local: boolean, // Return local information, do not retrieve the state from master node (default: false)
- * master_timeout: time, // Explicit operation timeout for connection to master node
- * h: list, // Comma-separated list of column names to display
- * help: boolean, // Return help information
- * s: list, // Comma-separated list of column names or column aliases to sort by
- * v: boolean, // Verbose mode. Display column headers
- * 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.
+ * format?: string, // a short version of the Accept header, e.g. json, yaml
+ * local?: bool, // Return local information, do not retrieve the state from master node (default: false)
+ * master_timeout?: int|string, // Explicit operation timeout for connection to master node
+ * h?: string|array, // Comma-separated list of column names to display
+ * help?: bool, // Return help information
+ * s?: string|array, // Comma-separated list of column names or column aliases to sort by
+ * v?: bool, // Verbose mode. Display column headers
+ * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false)
+ * human?: bool, // Return human readable values for statistics. (DEFAULT: true)
+ * error_trace?: bool, // 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?: string|array, // A comma-separated list of filters used to reduce the response.
* } $params
*
* @throws NoNodeAvailableException if all the hosts are offline
@@ -410,8 +421,9 @@ public function indices(array $params = [])
*
* @return Elasticsearch|Promise
*/
- public function master(array $params = [])
+ public function master(?array $params = null)
{
+ $params = $params ?? [];
$url = '/_cat/master';
$method = 'GET';
@@ -428,23 +440,24 @@ public function master(array $params = [])
/**
* Gets configuration and usage information about data frame analytics jobs.
*
- * @see http://www.elastic.co/guide/en/elasticsearch/reference/current/cat-dfanalytics.html
+ * @link http://www.elastic.co/guide/en/elasticsearch/reference/current/cat-dfanalytics.html
+ * @group serverless
*
* @param array{
- * id: string, // The ID of the data frame analytics to fetch
- * allow_no_match: boolean, // Whether to ignore if a wildcard expression matches no configs. (This includes `_all` string or when no configs have been specified)
- * bytes: enum, // The unit in which to display byte values
- * format: string, // a short version of the Accept header, e.g. json, yaml
- * h: list, // Comma-separated list of column names to display
- * help: boolean, // Return help information
- * s: list, // Comma-separated list of column names or column aliases to sort by
- * time: enum, // The unit in which to display time values
- * v: boolean, // Verbose mode. Display column headers
- * 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.
+ * id?: string, // The ID of the data frame analytics to fetch
+ * allow_no_match?: bool, // Whether to ignore if a wildcard expression matches no configs. (This includes `_all` string or when no configs have been specified)
+ * bytes?: string, // The unit in which to display byte values
+ * format?: string, // a short version of the Accept header, e.g. json, yaml
+ * h?: string|array, // Comma-separated list of column names to display
+ * help?: bool, // Return help information
+ * s?: string|array, // Comma-separated list of column names or column aliases to sort by
+ * time?: string, // The unit in which to display time values
+ * v?: bool, // Verbose mode. Display column headers
+ * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false)
+ * human?: bool, // Return human readable values for statistics. (DEFAULT: true)
+ * error_trace?: bool, // 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?: string|array, // A comma-separated list of filters used to reduce the response.
* } $params
*
* @throws NoNodeAvailableException if all the hosts are offline
@@ -453,8 +466,9 @@ public function master(array $params = [])
*
* @return Elasticsearch|Promise
*/
- public function mlDataFrameAnalytics(array $params = [])
+ public function mlDataFrameAnalytics(?array $params = null)
{
+ $params = $params ?? [];
if (isset($params['id'])) {
$url = '/_cat/ml/data_frame/analytics/' . $this->encode($params['id']);
$method = 'GET';
@@ -475,22 +489,23 @@ public function mlDataFrameAnalytics(array $params = [])
/**
* Gets configuration and usage information about datafeeds.
*
- * @see http://www.elastic.co/guide/en/elasticsearch/reference/current/cat-datafeeds.html
+ * @link http://www.elastic.co/guide/en/elasticsearch/reference/current/cat-datafeeds.html
+ * @group serverless
*
* @param array{
- * datafeed_id: string, // The ID of the datafeeds stats to fetch
- * allow_no_match: boolean, // Whether to ignore if a wildcard expression matches no datafeeds. (This includes `_all` string or when no datafeeds have been specified)
- * format: string, // a short version of the Accept header, e.g. json, yaml
- * h: list, // Comma-separated list of column names to display
- * help: boolean, // Return help information
- * s: list, // Comma-separated list of column names or column aliases to sort by
- * time: enum, // The unit in which to display time values
- * v: boolean, // Verbose mode. Display column headers
- * 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.
+ * datafeed_id?: string, // The ID of the datafeeds stats to fetch
+ * allow_no_match?: bool, // Whether to ignore if a wildcard expression matches no datafeeds. (This includes `_all` string or when no datafeeds have been specified)
+ * format?: string, // a short version of the Accept header, e.g. json, yaml
+ * h?: string|array, // Comma-separated list of column names to display
+ * help?: bool, // Return help information
+ * s?: string|array, // Comma-separated list of column names or column aliases to sort by
+ * time?: string, // The unit in which to display time values
+ * v?: bool, // Verbose mode. Display column headers
+ * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false)
+ * human?: bool, // Return human readable values for statistics. (DEFAULT: true)
+ * error_trace?: bool, // 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?: string|array, // A comma-separated list of filters used to reduce the response.
* } $params
*
* @throws NoNodeAvailableException if all the hosts are offline
@@ -499,8 +514,9 @@ public function mlDataFrameAnalytics(array $params = [])
*
* @return Elasticsearch|Promise
*/
- public function mlDatafeeds(array $params = [])
+ public function mlDatafeeds(?array $params = null)
{
+ $params = $params ?? [];
if (isset($params['datafeed_id'])) {
$url = '/_cat/ml/datafeeds/' . $this->encode($params['datafeed_id']);
$method = 'GET';
@@ -521,23 +537,24 @@ public function mlDatafeeds(array $params = [])
/**
* Gets configuration and usage information about anomaly detection jobs.
*
- * @see http://www.elastic.co/guide/en/elasticsearch/reference/current/cat-anomaly-detectors.html
+ * @link http://www.elastic.co/guide/en/elasticsearch/reference/current/cat-anomaly-detectors.html
+ * @group serverless
*
* @param array{
- * job_id: string, // The ID of the jobs stats to fetch
- * allow_no_match: boolean, // Whether to ignore if a wildcard expression matches no jobs. (This includes `_all` string or when no jobs have been specified)
- * bytes: enum, // The unit in which to display byte values
- * format: string, // a short version of the Accept header, e.g. json, yaml
- * h: list, // Comma-separated list of column names to display
- * help: boolean, // Return help information
- * s: list, // Comma-separated list of column names or column aliases to sort by
- * time: enum, // The unit in which to display time values
- * v: boolean, // Verbose mode. Display column headers
- * 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.
+ * job_id?: string, // The ID of the jobs stats to fetch
+ * allow_no_match?: bool, // Whether to ignore if a wildcard expression matches no jobs. (This includes `_all` string or when no jobs have been specified)
+ * bytes?: string, // The unit in which to display byte values
+ * format?: string, // a short version of the Accept header, e.g. json, yaml
+ * h?: string|array, // Comma-separated list of column names to display
+ * help?: bool, // Return help information
+ * s?: string|array, // Comma-separated list of column names or column aliases to sort by
+ * time?: string, // The unit in which to display time values
+ * v?: bool, // Verbose mode. Display column headers
+ * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false)
+ * human?: bool, // Return human readable values for statistics. (DEFAULT: true)
+ * error_trace?: bool, // 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?: string|array, // A comma-separated list of filters used to reduce the response.
* } $params
*
* @throws NoNodeAvailableException if all the hosts are offline
@@ -546,8 +563,9 @@ public function mlDatafeeds(array $params = [])
*
* @return Elasticsearch|Promise
*/
- public function mlJobs(array $params = [])
+ public function mlJobs(?array $params = null)
{
+ $params = $params ?? [];
if (isset($params['job_id'])) {
$url = '/_cat/ml/anomaly_detectors/' . $this->encode($params['job_id']);
$method = 'GET';
@@ -568,25 +586,26 @@ public function mlJobs(array $params = [])
/**
* Gets configuration and usage information about inference trained models.
*
- * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/cat-trained-model.html
+ * @link https://www.elastic.co/guide/en/elasticsearch/reference/current/cat-trained-model.html
+ * @group serverless
*
* @param array{
- * model_id: string, // The ID of the trained models stats to fetch
- * allow_no_match: boolean, // Whether to ignore if a wildcard expression matches no trained models. (This includes `_all` string or when no trained models have been specified)
- * from: int, // skips a number of trained models
- * size: int, // specifies a max number of trained models to get
- * bytes: enum, // The unit in which to display byte values
- * format: string, // a short version of the Accept header, e.g. json, yaml
- * h: list, // Comma-separated list of column names to display
- * help: boolean, // Return help information
- * s: list, // Comma-separated list of column names or column aliases to sort by
- * time: enum, // The unit in which to display time values
- * v: boolean, // Verbose mode. Display column headers
- * 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.
+ * model_id?: string, // The ID of the trained models stats to fetch
+ * allow_no_match?: bool, // Whether to ignore if a wildcard expression matches no trained models. (This includes `_all` string or when no trained models have been specified)
+ * from?: int, // skips a number of trained models
+ * size?: int, // specifies a max number of trained models to get
+ * bytes?: string, // The unit in which to display byte values
+ * format?: string, // a short version of the Accept header, e.g. json, yaml
+ * h?: string|array, // Comma-separated list of column names to display
+ * help?: bool, // Return help information
+ * s?: string|array, // Comma-separated list of column names or column aliases to sort by
+ * time?: string, // The unit in which to display time values
+ * v?: bool, // Verbose mode. Display column headers
+ * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false)
+ * human?: bool, // Return human readable values for statistics. (DEFAULT: true)
+ * error_trace?: bool, // 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?: string|array, // A comma-separated list of filters used to reduce the response.
* } $params
*
* @throws NoNodeAvailableException if all the hosts are offline
@@ -595,8 +614,9 @@ public function mlJobs(array $params = [])
*
* @return Elasticsearch|Promise
*/
- public function mlTrainedModels(array $params = [])
+ public function mlTrainedModels(?array $params = null)
{
+ $params = $params ?? [];
if (isset($params['model_id'])) {
$url = '/_cat/ml/trained_models/' . $this->encode($params['model_id']);
$method = 'GET';
@@ -617,21 +637,21 @@ public function mlTrainedModels(array $params = [])
/**
* Returns information about custom node attributes.
*
- * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/cat-nodeattrs.html
+ * @link https://www.elastic.co/guide/en/elasticsearch/reference/master/cat-nodeattrs.html
*
* @param array{
- * format: string, // a short version of the Accept header, e.g. json, yaml
- * local: boolean, // Return local information, do not retrieve the state from master node (default: false)
- * master_timeout: time, // Explicit operation timeout for connection to master node
- * h: list, // Comma-separated list of column names to display
- * help: boolean, // Return help information
- * s: list, // Comma-separated list of column names or column aliases to sort by
- * v: boolean, // Verbose mode. Display column headers
- * 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.
+ * format?: string, // a short version of the Accept header, e.g. json, yaml
+ * local?: bool, // Return local information, do not retrieve the state from master node (default: false)
+ * master_timeout?: int|string, // Explicit operation timeout for connection to master node
+ * h?: string|array, // Comma-separated list of column names to display
+ * help?: bool, // Return help information
+ * s?: string|array, // Comma-separated list of column names or column aliases to sort by
+ * v?: bool, // Verbose mode. Display column headers
+ * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false)
+ * human?: bool, // Return human readable values for statistics. (DEFAULT: true)
+ * error_trace?: bool, // 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?: string|array, // A comma-separated list of filters used to reduce the response.
* } $params
*
* @throws NoNodeAvailableException if all the hosts are offline
@@ -640,8 +660,9 @@ public function mlTrainedModels(array $params = [])
*
* @return Elasticsearch|Promise
*/
- public function nodeattrs(array $params = [])
+ public function nodeattrs(?array $params = null)
{
+ $params = $params ?? [];
$url = '/_cat/nodeattrs';
$method = 'GET';
@@ -658,24 +679,24 @@ public function nodeattrs(array $params = [])
/**
* Returns basic statistics about performance of cluster nodes.
*
- * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/cat-nodes.html
+ * @link https://www.elastic.co/guide/en/elasticsearch/reference/master/cat-nodes.html
*
* @param array{
- * bytes: enum, // The unit in which to display byte values
- * format: string, // a short version of the Accept header, e.g. json, yaml
- * full_id: boolean, // Return the full node ID instead of the shortened version (default: false)
- * master_timeout: time, // Explicit operation timeout for connection to master node
- * h: list, // Comma-separated list of column names to display
- * help: boolean, // Return help information
- * s: list, // Comma-separated list of column names or column aliases to sort by
- * time: enum, // The unit in which to display time values
- * v: boolean, // Verbose mode. Display column headers
- * include_unloaded_segments: boolean, // If set to true segment stats will include stats for segments that are not currently loaded into memory
- * 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.
+ * bytes?: string, // The unit in which to display byte values
+ * format?: string, // a short version of the Accept header, e.g. json, yaml
+ * full_id?: bool, // Return the full node ID instead of the shortened version (default: false)
+ * master_timeout?: int|string, // Explicit operation timeout for connection to master node
+ * h?: string|array, // Comma-separated list of column names to display
+ * help?: bool, // Return help information
+ * s?: string|array, // Comma-separated list of column names or column aliases to sort by
+ * time?: string, // The unit in which to display time values
+ * v?: bool, // Verbose mode. Display column headers
+ * include_unloaded_segments?: bool, // If set to true segment stats will include stats for segments that are not currently loaded into memory
+ * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false)
+ * human?: bool, // Return human readable values for statistics. (DEFAULT: true)
+ * error_trace?: bool, // 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?: string|array, // A comma-separated list of filters used to reduce the response.
* } $params
*
* @throws NoNodeAvailableException if all the hosts are offline
@@ -684,8 +705,9 @@ public function nodeattrs(array $params = [])
*
* @return Elasticsearch|Promise
*/
- public function nodes(array $params = [])
+ public function nodes(?array $params = null)
{
+ $params = $params ?? [];
$url = '/_cat/nodes';
$method = 'GET';
@@ -702,22 +724,22 @@ public function nodes(array $params = [])
/**
* Returns a concise representation of the cluster pending tasks.
*
- * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/cat-pending-tasks.html
+ * @link https://www.elastic.co/guide/en/elasticsearch/reference/master/cat-pending-tasks.html
*
* @param array{
- * format: string, // a short version of the Accept header, e.g. json, yaml
- * local: boolean, // Return local information, do not retrieve the state from master node (default: false)
- * master_timeout: time, // Explicit operation timeout for connection to master node
- * h: list, // Comma-separated list of column names to display
- * help: boolean, // Return help information
- * s: list, // Comma-separated list of column names or column aliases to sort by
- * time: enum, // The unit in which to display time values
- * v: boolean, // Verbose mode. Display column headers
- * 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.
+ * format?: string, // a short version of the Accept header, e.g. json, yaml
+ * local?: bool, // Return local information, do not retrieve the state from master node (default: false)
+ * master_timeout?: int|string, // Explicit operation timeout for connection to master node
+ * h?: string|array, // Comma-separated list of column names to display
+ * help?: bool, // Return help information
+ * s?: string|array, // Comma-separated list of column names or column aliases to sort by
+ * time?: string, // The unit in which to display time values
+ * v?: bool, // Verbose mode. Display column headers
+ * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false)
+ * human?: bool, // Return human readable values for statistics. (DEFAULT: true)
+ * error_trace?: bool, // 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?: string|array, // A comma-separated list of filters used to reduce the response.
* } $params
*
* @throws NoNodeAvailableException if all the hosts are offline
@@ -726,8 +748,9 @@ public function nodes(array $params = [])
*
* @return Elasticsearch|Promise
*/
- public function pendingTasks(array $params = [])
+ public function pendingTasks(?array $params = null)
{
+ $params = $params ?? [];
$url = '/_cat/pending_tasks';
$method = 'GET';
@@ -744,22 +767,22 @@ public function pendingTasks(array $params = [])
/**
* Returns information about installed plugins across nodes node.
*
- * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/cat-plugins.html
+ * @link https://www.elastic.co/guide/en/elasticsearch/reference/master/cat-plugins.html
*
* @param array{
- * format: string, // a short version of the Accept header, e.g. json, yaml
- * local: boolean, // Return local information, do not retrieve the state from master node (default: false)
- * master_timeout: time, // Explicit operation timeout for connection to master node
- * h: list, // Comma-separated list of column names to display
- * help: boolean, // Return help information
- * include_bootstrap: boolean, // Include bootstrap plugins in the response
- * s: list, // Comma-separated list of column names or column aliases to sort by
- * v: boolean, // Verbose mode. Display column headers
- * 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.
+ * format?: string, // a short version of the Accept header, e.g. json, yaml
+ * local?: bool, // Return local information, do not retrieve the state from master node (default: false)
+ * master_timeout?: int|string, // Explicit operation timeout for connection to master node
+ * h?: string|array, // Comma-separated list of column names to display
+ * help?: bool, // Return help information
+ * include_bootstrap?: bool, // Include bootstrap plugins in the response
+ * s?: string|array, // Comma-separated list of column names or column aliases to sort by
+ * v?: bool, // Verbose mode. Display column headers
+ * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false)
+ * human?: bool, // Return human readable values for statistics. (DEFAULT: true)
+ * error_trace?: bool, // 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?: string|array, // A comma-separated list of filters used to reduce the response.
* } $params
*
* @throws NoNodeAvailableException if all the hosts are offline
@@ -768,8 +791,9 @@ public function pendingTasks(array $params = [])
*
* @return Elasticsearch|Promise
*/
- public function plugins(array $params = [])
+ public function plugins(?array $params = null)
{
+ $params = $params ?? [];
$url = '/_cat/plugins';
$method = 'GET';
@@ -786,24 +810,24 @@ public function plugins(array $params = [])
/**
* Returns information about index shard recoveries, both on-going completed.
*
- * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/cat-recovery.html
+ * @link https://www.elastic.co/guide/en/elasticsearch/reference/master/cat-recovery.html
*
* @param array{
- * index: list, // Comma-separated list or wildcard expression of index names to limit the returned information
- * format: string, // a short version of the Accept header, e.g. json, yaml
- * active_only: boolean, // If `true`, the response only includes ongoing shard recoveries
- * bytes: enum, // The unit in which to display byte values
- * detailed: boolean, // If `true`, the response includes detailed information about shard recoveries
- * h: list, // Comma-separated list of column names to display
- * help: boolean, // Return help information
- * s: list, // Comma-separated list of column names or column aliases to sort by
- * time: enum, // The unit in which to display time values
- * v: boolean, // Verbose mode. Display column headers
- * 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.
+ * index?: string|array, // Comma-separated list or wildcard expression of index names to limit the returned information
+ * format?: string, // a short version of the Accept header, e.g. json, yaml
+ * active_only?: bool, // If `true`, the response only includes ongoing shard recoveries
+ * bytes?: string, // The unit in which to display byte values
+ * detailed?: bool, // If `true`, the response includes detailed information about shard recoveries
+ * h?: string|array, // Comma-separated list of column names to display
+ * help?: bool, // Return help information
+ * s?: string|array, // Comma-separated list of column names or column aliases to sort by
+ * time?: string, // The unit in which to display time values
+ * v?: bool, // Verbose mode. Display column headers
+ * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false)
+ * human?: bool, // Return human readable values for statistics. (DEFAULT: true)
+ * error_trace?: bool, // 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?: string|array, // A comma-separated list of filters used to reduce the response.
* } $params
*
* @throws NoNodeAvailableException if all the hosts are offline
@@ -812,10 +836,11 @@ public function plugins(array $params = [])
*
* @return Elasticsearch|Promise
*/
- public function recovery(array $params = [])
+ public function recovery(?array $params = null)
{
+ $params = $params ?? [];
if (isset($params['index'])) {
- $url = '/_cat/recovery/' . $this->encode($params['index']);
+ $url = '/_cat/recovery/' . $this->encode($this->convertValue($params['index']));
$method = 'GET';
} else {
$url = '/_cat/recovery';
@@ -834,21 +859,21 @@ public function recovery(array $params = [])
/**
* Returns information about snapshot repositories registered in the cluster.
*
- * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/cat-repositories.html
+ * @link https://www.elastic.co/guide/en/elasticsearch/reference/master/cat-repositories.html
*
* @param array{
- * format: string, // a short version of the Accept header, e.g. json, yaml
- * local: boolean, // Return local information, do not retrieve the state from master node
- * master_timeout: time, // Explicit operation timeout for connection to master node
- * h: list, // Comma-separated list of column names to display
- * help: boolean, // Return help information
- * s: list, // Comma-separated list of column names or column aliases to sort by
- * v: boolean, // Verbose mode. Display column headers
- * 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.
+ * format?: string, // a short version of the Accept header, e.g. json, yaml
+ * local?: bool, // Return local information, do not retrieve the state from master node
+ * master_timeout?: int|string, // Explicit operation timeout for connection to master node
+ * h?: string|array, // Comma-separated list of column names to display
+ * help?: bool, // Return help information
+ * s?: string|array, // Comma-separated list of column names or column aliases to sort by
+ * v?: bool, // Verbose mode. Display column headers
+ * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false)
+ * human?: bool, // Return human readable values for statistics. (DEFAULT: true)
+ * error_trace?: bool, // 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?: string|array, // A comma-separated list of filters used to reduce the response.
* } $params
*
* @throws NoNodeAvailableException if all the hosts are offline
@@ -857,8 +882,9 @@ public function recovery(array $params = [])
*
* @return Elasticsearch|Promise
*/
- public function repositories(array $params = [])
+ public function repositories(?array $params = null)
{
+ $params = $params ?? [];
$url = '/_cat/repositories';
$method = 'GET';
@@ -875,21 +901,23 @@ public function repositories(array $params = [])
/**
* Provides low-level information about the segments in the shards of an index.
*
- * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/cat-segments.html
+ * @link https://www.elastic.co/guide/en/elasticsearch/reference/master/cat-segments.html
*
* @param array{
- * index: list, // A comma-separated list of index names to limit the returned information
- * format: string, // a short version of the Accept header, e.g. json, yaml
- * bytes: enum, // The unit in which to display byte values
- * h: list, // Comma-separated list of column names to display
- * help: boolean, // Return help information
- * s: list, // Comma-separated list of column names or column aliases to sort by
- * v: boolean, // Verbose mode. Display column headers
- * 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.
+ * index?: string|array, // A comma-separated list of index names to limit the returned information
+ * format?: string, // a short version of the Accept header, e.g. json, yaml
+ * local?: bool, // Return local information, do not retrieve the state from master node (default: false)
+ * master_timeout?: int|string, // Explicit operation timeout for connection to master node
+ * bytes?: string, // The unit in which to display byte values
+ * h?: string|array, // Comma-separated list of column names to display
+ * help?: bool, // Return help information
+ * s?: string|array, // Comma-separated list of column names or column aliases to sort by
+ * v?: bool, // Verbose mode. Display column headers
+ * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false)
+ * human?: bool, // Return human readable values for statistics. (DEFAULT: true)
+ * error_trace?: bool, // 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?: string|array, // A comma-separated list of filters used to reduce the response.
* } $params
*
* @throws NoNodeAvailableException if all the hosts are offline
@@ -898,16 +926,17 @@ public function repositories(array $params = [])
*
* @return Elasticsearch|Promise
*/
- public function segments(array $params = [])
+ public function segments(?array $params = null)
{
+ $params = $params ?? [];
if (isset($params['index'])) {
- $url = '/_cat/segments/' . $this->encode($params['index']);
+ $url = '/_cat/segments/' . $this->encode($this->convertValue($params['index']));
$method = 'GET';
} else {
$url = '/_cat/segments';
$method = 'GET';
}
- $url = $this->addQueryString($url, $params, ['format','bytes','h','help','s','v','pretty','human','error_trace','source','filter_path']);
+ $url = $this->addQueryString($url, $params, ['format','local','master_timeout','bytes','h','help','s','v','pretty','human','error_trace','source','filter_path']);
$headers = [
'Accept' => 'text/plain,application/json',
];
@@ -920,23 +949,23 @@ public function segments(array $params = [])
/**
* Provides a detailed view of shard allocation on nodes.
*
- * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/cat-shards.html
+ * @link https://www.elastic.co/guide/en/elasticsearch/reference/master/cat-shards.html
*
* @param array{
- * index: list, // A comma-separated list of index names to limit the returned information
- * format: string, // a short version of the Accept header, e.g. json, yaml
- * bytes: enum, // The unit in which to display byte values
- * master_timeout: time, // Explicit operation timeout for connection to master node
- * h: list, // Comma-separated list of column names to display
- * help: boolean, // Return help information
- * s: list, // Comma-separated list of column names or column aliases to sort by
- * time: enum, // The unit in which to display time values
- * v: boolean, // Verbose mode. Display column headers
- * 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.
+ * index?: string|array, // A comma-separated list of index names to limit the returned information
+ * format?: string, // a short version of the Accept header, e.g. json, yaml
+ * bytes?: string, // The unit in which to display byte values
+ * master_timeout?: int|string, // Explicit operation timeout for connection to master node
+ * h?: string|array, // Comma-separated list of column names to display
+ * help?: bool, // Return help information
+ * s?: string|array, // Comma-separated list of column names or column aliases to sort by
+ * time?: string, // The unit in which to display time values
+ * v?: bool, // Verbose mode. Display column headers
+ * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false)
+ * human?: bool, // Return human readable values for statistics. (DEFAULT: true)
+ * error_trace?: bool, // 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?: string|array, // A comma-separated list of filters used to reduce the response.
* } $params
*
* @throws NoNodeAvailableException if all the hosts are offline
@@ -945,10 +974,11 @@ public function segments(array $params = [])
*
* @return Elasticsearch|Promise
*/
- public function shards(array $params = [])
+ public function shards(?array $params = null)
{
+ $params = $params ?? [];
if (isset($params['index'])) {
- $url = '/_cat/shards/' . $this->encode($params['index']);
+ $url = '/_cat/shards/' . $this->encode($this->convertValue($params['index']));
$method = 'GET';
} else {
$url = '/_cat/shards';
@@ -967,23 +997,23 @@ public function shards(array $params = [])
/**
* Returns all snapshots in a specific repository.
*
- * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/cat-snapshots.html
+ * @link https://www.elastic.co/guide/en/elasticsearch/reference/master/cat-snapshots.html
*
* @param array{
- * repository: list, // Name of repository from which to fetch the snapshot information
- * format: string, // a short version of the Accept header, e.g. json, yaml
- * ignore_unavailable: boolean, // Set to true to ignore unavailable snapshots
- * master_timeout: time, // Explicit operation timeout for connection to master node
- * h: list, // Comma-separated list of column names to display
- * help: boolean, // Return help information
- * s: list, // Comma-separated list of column names or column aliases to sort by
- * time: enum, // The unit in which to display time values
- * v: boolean, // Verbose mode. Display column headers
- * 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.
+ * repository?: string|array, // Name of repository from which to fetch the snapshot information
+ * format?: string, // a short version of the Accept header, e.g. json, yaml
+ * ignore_unavailable?: bool, // Set to true to ignore unavailable snapshots
+ * master_timeout?: int|string, // Explicit operation timeout for connection to master node
+ * h?: string|array, // Comma-separated list of column names to display
+ * help?: bool, // Return help information
+ * s?: string|array, // Comma-separated list of column names or column aliases to sort by
+ * time?: string, // The unit in which to display time values
+ * v?: bool, // Verbose mode. Display column headers
+ * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false)
+ * human?: bool, // Return human readable values for statistics. (DEFAULT: true)
+ * error_trace?: bool, // 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?: string|array, // A comma-separated list of filters used to reduce the response.
* } $params
*
* @throws NoNodeAvailableException if all the hosts are offline
@@ -992,10 +1022,11 @@ public function shards(array $params = [])
*
* @return Elasticsearch|Promise
*/
- public function snapshots(array $params = [])
+ public function snapshots(?array $params = null)
{
+ $params = $params ?? [];
if (isset($params['repository'])) {
- $url = '/_cat/snapshots/' . $this->encode($params['repository']);
+ $url = '/_cat/snapshots/' . $this->encode($this->convertValue($params['repository']));
$method = 'GET';
} else {
$url = '/_cat/snapshots';
@@ -1014,25 +1045,27 @@ public function snapshots(array $params = [])
/**
* Returns information about the tasks currently executing on one or more nodes in the cluster.
*
- * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/tasks.html
+ * @link https://www.elastic.co/guide/en/elasticsearch/reference/master/tasks.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
- * nodes: list, // A comma-separated list of node IDs or names to limit the returned information; use `_local` to return information from the node you're connecting to, leave empty to get information from all nodes
- * actions: list, // A comma-separated list of actions that should be returned. Leave empty to return all.
- * detailed: boolean, // Return detailed task information (default: false)
- * parent_task_id: string, // Return tasks with specified parent task id (node_id:task_number). Set to -1 to return all.
- * h: list, // Comma-separated list of column names to display
- * help: boolean, // Return help information
- * s: list, // Comma-separated list of column names or column aliases to sort by
- * time: enum, // The unit in which to display time values
- * v: boolean, // Verbose mode. Display column headers
- * 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.
+ * format?: string, // a short version of the Accept header, e.g. json, yaml
+ * nodes?: string|array, // A comma-separated list of node IDs or names to limit the returned information; use `_local` to return information from the node you're connecting to, leave empty to get information from all nodes
+ * actions?: string|array, // A comma-separated list of actions that should be returned. Leave empty to return all.
+ * detailed?: bool, // Return detailed task information (default: false)
+ * parent_task_id?: string, // Return tasks with specified parent task id (node_id:task_number). Set to -1 to return all.
+ * h?: string|array, // Comma-separated list of column names to display
+ * help?: bool, // Return help information
+ * s?: string|array, // Comma-separated list of column names or column aliases to sort by
+ * time?: string, // The unit in which to display time values
+ * v?: bool, // Verbose mode. Display column headers
+ * timeout?: int|string, // Period to wait for a response. If no response is received before the timeout expires, the request fails and returns an error.
+ * wait_for_completion?: bool, // If `true`, the request blocks until the task has completed.
+ * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false)
+ * human?: bool, // Return human readable values for statistics. (DEFAULT: true)
+ * error_trace?: bool, // 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?: string|array, // A comma-separated list of filters used to reduce the response.
* } $params
*
* @throws NoNodeAvailableException if all the hosts are offline
@@ -1041,12 +1074,13 @@ public function snapshots(array $params = [])
*
* @return Elasticsearch|Promise
*/
- public function tasks(array $params = [])
+ public function tasks(?array $params = null)
{
+ $params = $params ?? [];
$url = '/_cat/tasks';
$method = 'GET';
- $url = $this->addQueryString($url, $params, ['format','nodes','actions','detailed','parent_task_id','h','help','s','time','v','pretty','human','error_trace','source','filter_path']);
+ $url = $this->addQueryString($url, $params, ['format','nodes','actions','detailed','parent_task_id','h','help','s','time','v','timeout','wait_for_completion','pretty','human','error_trace','source','filter_path']);
$headers = [
'Accept' => 'text/plain,application/json',
];
@@ -1059,22 +1093,22 @@ public function tasks(array $params = [])
/**
* Returns information about existing templates.
*
- * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/cat-templates.html
+ * @link https://www.elastic.co/guide/en/elasticsearch/reference/master/cat-templates.html
*
* @param array{
- * name: string, // A pattern that returned template names must match
- * format: string, // a short version of the Accept header, e.g. json, yaml
- * local: boolean, // Return local information, do not retrieve the state from master node (default: false)
- * master_timeout: time, // Explicit operation timeout for connection to master node
- * h: list, // Comma-separated list of column names to display
- * help: boolean, // Return help information
- * s: list, // Comma-separated list of column names or column aliases to sort by
- * v: boolean, // Verbose mode. Display column headers
- * 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.
+ * name?: string, // A pattern that returned template names must match
+ * format?: string, // a short version of the Accept header, e.g. json, yaml
+ * local?: bool, // Return local information, do not retrieve the state from master node (default: false)
+ * master_timeout?: int|string, // Explicit operation timeout for connection to master node
+ * h?: string|array, // Comma-separated list of column names to display
+ * help?: bool, // Return help information
+ * s?: string|array, // Comma-separated list of column names or column aliases to sort by
+ * v?: bool, // Verbose mode. Display column headers
+ * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false)
+ * human?: bool, // Return human readable values for statistics. (DEFAULT: true)
+ * error_trace?: bool, // 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?: string|array, // A comma-separated list of filters used to reduce the response.
* } $params
*
* @throws NoNodeAvailableException if all the hosts are offline
@@ -1083,8 +1117,9 @@ public function tasks(array $params = [])
*
* @return Elasticsearch|Promise
*/
- public function templates(array $params = [])
+ public function templates(?array $params = null)
{
+ $params = $params ?? [];
if (isset($params['name'])) {
$url = '/_cat/templates/' . $this->encode($params['name']);
$method = 'GET';
@@ -1106,23 +1141,23 @@ public function templates(array $params = [])
* Returns cluster-wide thread pool statistics per node.
* By default the active, queue and rejected statistics are returned for all thread pools.
*
- * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/cat-thread-pool.html
+ * @link https://www.elastic.co/guide/en/elasticsearch/reference/master/cat-thread-pool.html
*
* @param array{
- * thread_pool_patterns: list, // A comma-separated list of regular-expressions to filter the thread pools in the output
- * format: string, // a short version of the Accept header, e.g. json, yaml
- * time: enum, // The unit in which to display time values
- * local: boolean, // Return local information, do not retrieve the state from master node (default: false)
- * master_timeout: time, // Explicit operation timeout for connection to master node
- * h: list, // Comma-separated list of column names to display
- * help: boolean, // Return help information
- * s: list, // Comma-separated list of column names or column aliases to sort by
- * v: boolean, // Verbose mode. Display column headers
- * 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.
+ * thread_pool_patterns?: string|array, // A comma-separated list of regular-expressions to filter the thread pools in the output
+ * format?: string, // a short version of the Accept header, e.g. json, yaml
+ * time?: string, // The unit in which to display time values
+ * local?: bool, // Return local information, do not retrieve the state from master node (default: false)
+ * master_timeout?: int|string, // Explicit operation timeout for connection to master node
+ * h?: string|array, // Comma-separated list of column names to display
+ * help?: bool, // Return help information
+ * s?: string|array, // Comma-separated list of column names or column aliases to sort by
+ * v?: bool, // Verbose mode. Display column headers
+ * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false)
+ * human?: bool, // Return human readable values for statistics. (DEFAULT: true)
+ * error_trace?: bool, // 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?: string|array, // A comma-separated list of filters used to reduce the response.
* } $params
*
* @throws NoNodeAvailableException if all the hosts are offline
@@ -1131,10 +1166,11 @@ public function templates(array $params = [])
*
* @return Elasticsearch|Promise
*/
- public function threadPool(array $params = [])
+ public function threadPool(?array $params = null)
{
+ $params = $params ?? [];
if (isset($params['thread_pool_patterns'])) {
- $url = '/_cat/thread_pool/' . $this->encode($params['thread_pool_patterns']);
+ $url = '/_cat/thread_pool/' . $this->encode($this->convertValue($params['thread_pool_patterns']));
$method = 'GET';
} else {
$url = '/_cat/thread_pool';
@@ -1153,24 +1189,25 @@ public function threadPool(array $params = [])
/**
* Gets configuration and usage information about transforms.
*
- * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/cat-transforms.html
+ * @link https://www.elastic.co/guide/en/elasticsearch/reference/current/cat-transforms.html
+ * @group serverless
*
* @param array{
- * transform_id: string, // The id of the transform for which to get stats. '_all' or '*' implies all transforms
- * from: int, // skips a number of transform configs, defaults to 0
- * size: int, // specifies a max number of transforms to get, defaults to 100
- * allow_no_match: boolean, // Whether to ignore if a wildcard expression matches no transforms. (This includes `_all` string or when no transforms have been specified)
- * format: string, // a short version of the Accept header, e.g. json, yaml
- * h: list, // Comma-separated list of column names to display
- * help: boolean, // Return help information
- * s: list, // Comma-separated list of column names or column aliases to sort by
- * time: enum, // The unit in which to display time values
- * v: boolean, // Verbose mode. Display column headers
- * 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.
+ * transform_id?: string, // The id of the transform for which to get stats. '_all' or '*' implies all transforms
+ * from?: int, // skips a number of transform configs, defaults to 0
+ * size?: int, // specifies a max number of transforms to get, defaults to 100
+ * allow_no_match?: bool, // Whether to ignore if a wildcard expression matches no transforms. (This includes `_all` string or when no transforms have been specified)
+ * format?: string, // a short version of the Accept header, e.g. json, yaml
+ * h?: string|array, // Comma-separated list of column names to display
+ * help?: bool, // Return help information
+ * s?: string|array, // Comma-separated list of column names or column aliases to sort by
+ * time?: string, // The unit in which to display time values
+ * v?: bool, // Verbose mode. Display column headers
+ * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false)
+ * human?: bool, // Return human readable values for statistics. (DEFAULT: true)
+ * error_trace?: bool, // 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?: string|array, // A comma-separated list of filters used to reduce the response.
* } $params
*
* @throws NoNodeAvailableException if all the hosts are offline
@@ -1179,8 +1216,9 @@ public function threadPool(array $params = [])
*
* @return Elasticsearch|Promise
*/
- public function transforms(array $params = [])
+ public function transforms(?array $params = null)
{
+ $params = $params ?? [];
if (isset($params['transform_id'])) {
$url = '/_cat/transforms/' . $this->encode($params['transform_id']);
$method = 'GET';
diff --git a/src/Endpoints/Ccr.php b/src/Endpoints/Ccr.php
index 9a14314c4..218fb9efa 100644
--- a/src/Endpoints/Ccr.php
+++ b/src/Endpoints/Ccr.php
@@ -31,16 +31,16 @@ class Ccr extends AbstractEndpoint
/**
* Deletes auto-follow patterns.
*
- * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/ccr-delete-auto-follow-pattern.html
+ * @link https://www.elastic.co/guide/en/elasticsearch/reference/current/ccr-delete-auto-follow-pattern.html
*
* @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)
- * 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.
+ * master_timeout?: int|string, // Explicit operation timeout for connection to master node
+ * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false)
+ * human?: bool, // Return human readable values for statistics. (DEFAULT: true)
+ * error_trace?: bool, // 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?: string|array, // A comma-separated list of filters used to reduce the response.
* } $params
*
* @throws MissingParameterException if a required parameter is missing
@@ -50,8 +50,9 @@ class Ccr extends AbstractEndpoint
*
* @return Elasticsearch|Promise
*/
- public function deleteAutoFollowPattern(array $params = [])
+ public function deleteAutoFollowPattern(?array $params = null)
{
+ $params = $params ?? [];
$this->checkRequiredParameters(['name'], $params);
$url = '/_ccr/auto_follow/' . $this->encode($params['name']);
$method = 'DELETE';
@@ -69,18 +70,18 @@ public function deleteAutoFollowPattern(array $params = [])
/**
* Creates a new follower index configured to follow the referenced leader index.
*
- * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/ccr-put-follow.html
+ * @link https://www.elastic.co/guide/en/elasticsearch/reference/current/ccr-put-follow.html
*
* @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)
- * 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 name of the leader index and other optional ccr related parameters
+ * 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?: int|string, // Explicit operation timeout for connection to master node
+ * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false)
+ * human?: bool, // Return human readable values for statistics. (DEFAULT: true)
+ * error_trace?: bool, // 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?: string|array, // A comma-separated list of filters used to reduce the response.
+ * body: string|array, // (REQUIRED) The name of the leader index and other optional ccr related parameters. If body is a string must be a valid JSON.
* } $params
*
* @throws MissingParameterException if a required parameter is missing
@@ -90,8 +91,9 @@ public function deleteAutoFollowPattern(array $params = [])
*
* @return Elasticsearch|Promise
*/
- public function follow(array $params = [])
+ public function follow(?array $params = null)
{
+ $params = $params ?? [];
$this->checkRequiredParameters(['index','body'], $params);
$url = '/' . $this->encode($params['index']) . '/_ccr/follow';
$method = 'PUT';
@@ -110,16 +112,16 @@ public function follow(array $params = [])
/**
* Retrieves information about all follower indices, including parameters and status for each follower index
*
- * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/ccr-get-follow-info.html
+ * @link https://www.elastic.co/guide/en/elasticsearch/reference/current/ccr-get-follow-info.html
*
* @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)
- * 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.
+ * index: string|array, // (REQUIRED) A comma-separated list of index patterns; use `_all` to perform the operation on all indices
+ * master_timeout?: int|string, // Explicit operation timeout for connection to master node
+ * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false)
+ * human?: bool, // Return human readable values for statistics. (DEFAULT: true)
+ * error_trace?: bool, // 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?: string|array, // A comma-separated list of filters used to reduce the response.
* } $params
*
* @throws MissingParameterException if a required parameter is missing
@@ -129,10 +131,11 @@ public function follow(array $params = [])
*
* @return Elasticsearch|Promise
*/
- public function followInfo(array $params = [])
+ public function followInfo(?array $params = null)
{
+ $params = $params ?? [];
$this->checkRequiredParameters(['index'], $params);
- $url = '/' . $this->encode($params['index']) . '/_ccr/info';
+ $url = '/' . $this->encode($this->convertValue($params['index'])) . '/_ccr/info';
$method = 'GET';
$url = $this->addQueryString($url, $params, ['master_timeout','pretty','human','error_trace','source','filter_path']);
@@ -148,16 +151,16 @@ public function followInfo(array $params = [])
/**
* Retrieves follower stats. return shard-level stats about the following tasks associated with each shard for the specified indices.
*
- * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/ccr-get-follow-stats.html
+ * @link https://www.elastic.co/guide/en/elasticsearch/reference/current/ccr-get-follow-stats.html
*
* @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)
- * 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.
+ * index: string|array, // (REQUIRED) A comma-separated list of index patterns; use `_all` to perform the operation on all indices
+ * timeout?: int|string, // Explicit operation timeout
+ * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false)
+ * human?: bool, // Return human readable values for statistics. (DEFAULT: true)
+ * error_trace?: bool, // 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?: string|array, // A comma-separated list of filters used to reduce the response.
* } $params
*
* @throws MissingParameterException if a required parameter is missing
@@ -167,10 +170,11 @@ public function followInfo(array $params = [])
*
* @return Elasticsearch|Promise
*/
- public function followStats(array $params = [])
+ public function followStats(?array $params = null)
{
+ $params = $params ?? [];
$this->checkRequiredParameters(['index'], $params);
- $url = '/' . $this->encode($params['index']) . '/_ccr/stats';
+ $url = '/' . $this->encode($this->convertValue($params['index'])) . '/_ccr/stats';
$method = 'GET';
$url = $this->addQueryString($url, $params, ['timeout','pretty','human','error_trace','source','filter_path']);
@@ -186,17 +190,17 @@ public function followStats(array $params = [])
/**
* Removes the follower retention leases from the leader.
*
- * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/ccr-post-forget-follower.html
+ * @link https://www.elastic.co/guide/en/elasticsearch/reference/current/ccr-post-forget-follower.html
*
* @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)
- * 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 name and UUID of the follower index, the name of the cluster containing the follower index, and the alias from the perspective of that cluster for the remote cluster containing the leader index
+ * timeout?: int|string, // Explicit operation timeout
+ * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false)
+ * human?: bool, // Return human readable values for statistics. (DEFAULT: true)
+ * error_trace?: bool, // 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?: string|array, // A comma-separated list of filters used to reduce the response.
+ * body: string|array, // (REQUIRED) the name and UUID of the follower index, the name of the cluster containing the follower index, and the alias from the perspective of that cluster for the remote cluster containing the leader index. If body is a string must be a valid JSON.
* } $params
*
* @throws MissingParameterException if a required parameter is missing
@@ -206,8 +210,9 @@ public function followStats(array $params = [])
*
* @return Elasticsearch|Promise
*/
- public function forgetFollower(array $params = [])
+ public function forgetFollower(?array $params = null)
{
+ $params = $params ?? [];
$this->checkRequiredParameters(['index','body'], $params);
$url = '/' . $this->encode($params['index']) . '/_ccr/forget_follower';
$method = 'POST';
@@ -226,16 +231,16 @@ public function forgetFollower(array $params = [])
/**
* Gets configured auto-follow patterns. Returns the specified auto-follow pattern collection.
*
- * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/ccr-get-auto-follow-pattern.html
+ * @link https://www.elastic.co/guide/en/elasticsearch/reference/current/ccr-get-auto-follow-pattern.html
*
* @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)
- * 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.
+ * name?: string, // The name of the auto follow pattern.
+ * master_timeout?: int|string, // Explicit operation timeout for connection to master node
+ * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false)
+ * human?: bool, // Return human readable values for statistics. (DEFAULT: true)
+ * error_trace?: bool, // 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?: string|array, // A comma-separated list of filters used to reduce the response.
* } $params
*
* @throws NoNodeAvailableException if all the hosts are offline
@@ -244,8 +249,9 @@ public function forgetFollower(array $params = [])
*
* @return Elasticsearch|Promise
*/
- public function getAutoFollowPattern(array $params = [])
+ public function getAutoFollowPattern(?array $params = null)
{
+ $params = $params ?? [];
if (isset($params['name'])) {
$url = '/_ccr/auto_follow/' . $this->encode($params['name']);
$method = 'GET';
@@ -266,16 +272,16 @@ public function getAutoFollowPattern(array $params = [])
/**
* Pauses an auto-follow pattern
*
- * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/ccr-pause-auto-follow-pattern.html
+ * @link https://www.elastic.co/guide/en/elasticsearch/reference/current/ccr-pause-auto-follow-pattern.html
*
* @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)
- * 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.
+ * master_timeout?: int|string, // Explicit operation timeout for connection to master node
+ * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false)
+ * human?: bool, // Return human readable values for statistics. (DEFAULT: true)
+ * error_trace?: bool, // 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?: string|array, // A comma-separated list of filters used to reduce the response.
* } $params
*
* @throws MissingParameterException if a required parameter is missing
@@ -285,8 +291,9 @@ public function getAutoFollowPattern(array $params = [])
*
* @return Elasticsearch|Promise
*/
- public function pauseAutoFollowPattern(array $params = [])
+ public function pauseAutoFollowPattern(?array $params = null)
{
+ $params = $params ?? [];
$this->checkRequiredParameters(['name'], $params);
$url = '/_ccr/auto_follow/' . $this->encode($params['name']) . '/pause';
$method = 'POST';
@@ -304,16 +311,16 @@ public function pauseAutoFollowPattern(array $params = [])
/**
* Pauses a follower index. The follower index will not fetch any additional operations from the leader index.
*
- * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/ccr-post-pause-follow.html
+ * @link https://www.elastic.co/guide/en/elasticsearch/reference/current/ccr-post-pause-follow.html
*
* @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)
- * 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.
+ * master_timeout?: int|string, // Explicit operation timeout for connection to master node
+ * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false)
+ * human?: bool, // Return human readable values for statistics. (DEFAULT: true)
+ * error_trace?: bool, // 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?: string|array, // A comma-separated list of filters used to reduce the response.
* } $params
*
* @throws MissingParameterException if a required parameter is missing
@@ -323,8 +330,9 @@ public function pauseAutoFollowPattern(array $params = [])
*
* @return Elasticsearch|Promise
*/
- public function pauseFollow(array $params = [])
+ public function pauseFollow(?array $params = null)
{
+ $params = $params ?? [];
$this->checkRequiredParameters(['index'], $params);
$url = '/' . $this->encode($params['index']) . '/_ccr/pause_follow';
$method = 'POST';
@@ -342,17 +350,17 @@ public function pauseFollow(array $params = [])
/**
* Creates a new named collection of auto-follow patterns against a specified remote cluster. Newly created indices on the remote cluster matching any of the specified patterns will be automatically configured as follower indices.
*
- * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/ccr-put-auto-follow-pattern.html
+ * @link https://www.elastic.co/guide/en/elasticsearch/reference/current/ccr-put-auto-follow-pattern.html
*
* @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)
- * 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 specification of the auto follow pattern
+ * master_timeout?: int|string, // Explicit operation timeout for connection to master node
+ * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false)
+ * human?: bool, // Return human readable values for statistics. (DEFAULT: true)
+ * error_trace?: bool, // 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?: string|array, // A comma-separated list of filters used to reduce the response.
+ * body: string|array, // (REQUIRED) The specification of the auto follow pattern. If body is a string must be a valid JSON.
* } $params
*
* @throws MissingParameterException if a required parameter is missing
@@ -362,8 +370,9 @@ public function pauseFollow(array $params = [])
*
* @return Elasticsearch|Promise
*/
- public function putAutoFollowPattern(array $params = [])
+ public function putAutoFollowPattern(?array $params = null)
{
+ $params = $params ?? [];
$this->checkRequiredParameters(['name','body'], $params);
$url = '/_ccr/auto_follow/' . $this->encode($params['name']);
$method = 'PUT';
@@ -382,16 +391,16 @@ public function putAutoFollowPattern(array $params = [])
/**
* Resumes an auto-follow pattern that has been paused
*
- * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/ccr-resume-auto-follow-pattern.html
+ * @link https://www.elastic.co/guide/en/elasticsearch/reference/current/ccr-resume-auto-follow-pattern.html
*
* @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)
- * 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.
+ * master_timeout?: int|string, // Explicit operation timeout for connection to master node
+ * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false)
+ * human?: bool, // Return human readable values for statistics. (DEFAULT: true)
+ * error_trace?: bool, // 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?: string|array, // A comma-separated list of filters used to reduce the response.
* } $params
*
* @throws MissingParameterException if a required parameter is missing
@@ -401,8 +410,9 @@ public function putAutoFollowPattern(array $params = [])
*
* @return Elasticsearch|Promise
*/
- public function resumeAutoFollowPattern(array $params = [])
+ public function resumeAutoFollowPattern(?array $params = null)
{
+ $params = $params ?? [];
$this->checkRequiredParameters(['name'], $params);
$url = '/_ccr/auto_follow/' . $this->encode($params['name']) . '/resume';
$method = 'POST';
@@ -420,17 +430,17 @@ public function resumeAutoFollowPattern(array $params = [])
/**
* Resumes a follower index that has been paused
*
- * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/ccr-post-resume-follow.html
+ * @link https://www.elastic.co/guide/en/elasticsearch/reference/current/ccr-post-resume-follow.html
*
* @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)
- * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests.
- * filter_path: list, // A comma-separated list of filters used to reduce the response.
- * body: array, // The name of the leader index and other optional ccr related parameters
+ * master_timeout?: int|string, // Explicit operation timeout for connection to master node
+ * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false)
+ * human?: bool, // Return human readable values for statistics. (DEFAULT: true)
+ * error_trace?: bool, // 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?: string|array, // A comma-separated list of filters used to reduce the response.
+ * body?: string|array, // The name of the leader index and other optional ccr related parameters. If body is a string must be a valid JSON.
* } $params
*
* @throws MissingParameterException if a required parameter is missing
@@ -440,8 +450,9 @@ public function resumeAutoFollowPattern(array $params = [])
*
* @return Elasticsearch|Promise
*/
- public function resumeFollow(array $params = [])
+ public function resumeFollow(?array $params = null)
{
+ $params = $params ?? [];
$this->checkRequiredParameters(['index'], $params);
$url = '/' . $this->encode($params['index']) . '/_ccr/resume_follow';
$method = 'POST';
@@ -460,16 +471,16 @@ public function resumeFollow(array $params = [])
/**
* Gets all stats related to cross-cluster replication.
*
- * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/ccr-get-stats.html
+ * @link 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)
- * 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.
+ * timeout?: int|string, // Explicit operation timeout
+ * master_timeout?: int|string, // Explicit operation timeout for connection to master node
+ * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false)
+ * human?: bool, // Return human readable values for statistics. (DEFAULT: true)
+ * error_trace?: bool, // 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?: string|array, // A comma-separated list of filters used to reduce the response.
* } $params
*
* @throws NoNodeAvailableException if all the hosts are offline
@@ -478,8 +489,9 @@ public function resumeFollow(array $params = [])
*
* @return Elasticsearch|Promise
*/
- public function stats(array $params = [])
+ public function stats(?array $params = null)
{
+ $params = $params ?? [];
$url = '/_ccr/stats';
$method = 'GET';
@@ -496,16 +508,16 @@ public function stats(array $params = [])
/**
* Stops the following task associated with a follower index and removes index metadata and settings associated with cross-cluster replication.
*
- * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/ccr-post-unfollow.html
+ * @link https://www.elastic.co/guide/en/elasticsearch/reference/current/ccr-post-unfollow.html
*
* @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)
- * 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.
+ * master_timeout?: int|string, // Explicit operation timeout for connection to master node
+ * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false)
+ * human?: bool, // Return human readable values for statistics. (DEFAULT: true)
+ * error_trace?: bool, // 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?: string|array, // A comma-separated list of filters used to reduce the response.
* } $params
*
* @throws MissingParameterException if a required parameter is missing
@@ -515,8 +527,9 @@ public function stats(array $params = [])
*
* @return Elasticsearch|Promise
*/
- public function unfollow(array $params = [])
+ public function unfollow(?array $params = null)
{
+ $params = $params ?? [];
$this->checkRequiredParameters(['index'], $params);
$url = '/' . $this->encode($params['index']) . '/_ccr/unfollow';
$method = 'POST';
diff --git a/src/Endpoints/Cluster.php b/src/Endpoints/Cluster.php
index 203fcaf5b..4ddc638db 100644
--- a/src/Endpoints/Cluster.php
+++ b/src/Endpoints/Cluster.php
@@ -31,18 +31,18 @@ class Cluster extends AbstractEndpoint
/**
* Provides explanations for shard allocations in the cluster.
*
- * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/cluster-allocation-explain.html
+ * @link https://www.elastic.co/guide/en/elasticsearch/reference/master/cluster-allocation-explain.html
*
* @param array{
- * master_timeout: time, // Timeout for connection to master node
- * include_yes_decisions: boolean, // Return 'YES' decisions in explanation (default: false)
- * include_disk_info: boolean, // Return information about disk usage and shard sizes (default: 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)
- * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests.
- * filter_path: list, // A comma-separated list of filters used to reduce the response.
- * body: array, // The index, shard, and primary flag to explain. Empty means 'explain a randomly-chosen unassigned shard'
+ * master_timeout?: int|string, // Timeout for connection to master node
+ * include_yes_decisions?: bool, // Return 'YES' decisions in explanation (default: false)
+ * include_disk_info?: bool, // Return information about disk usage and shard sizes (default: false)
+ * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false)
+ * human?: bool, // Return human readable values for statistics. (DEFAULT: true)
+ * error_trace?: bool, // 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?: string|array, // A comma-separated list of filters used to reduce the response.
+ * body?: string|array, // The index, shard, and primary flag to explain. Empty means 'explain a randomly-chosen unassigned shard'. If body is a string must be a valid JSON.
* } $params
*
* @throws NoNodeAvailableException if all the hosts are offline
@@ -51,8 +51,9 @@ class Cluster extends AbstractEndpoint
*
* @return Elasticsearch|Promise
*/
- public function allocationExplain(array $params = [])
+ public function allocationExplain(?array $params = null)
{
+ $params = $params ?? [];
$url = '/_cluster/allocation/explain';
$method = empty($params['body']) ? 'GET' : 'POST';
@@ -70,17 +71,18 @@ public function allocationExplain(array $params = [])
/**
* Deletes a component template
*
- * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-component-template.html
+ * @link https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-component-template.html
+ * @group serverless
*
* @param array{
* name: string, // (REQUIRED) The name of the template
- * timeout: time, // Explicit operation timeout
- * master_timeout: time, // Specify timeout for connection to master
- * 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.
+ * timeout?: int|string, // Explicit operation timeout
+ * master_timeout?: int|string, // Specify timeout for connection to master
+ * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false)
+ * human?: bool, // Return human readable values for statistics. (DEFAULT: true)
+ * error_trace?: bool, // 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?: string|array, // A comma-separated list of filters used to reduce the response.
* } $params
*
* @throws MissingParameterException if a required parameter is missing
@@ -90,8 +92,9 @@ public function allocationExplain(array $params = [])
*
* @return Elasticsearch|Promise
*/
- public function deleteComponentTemplate(array $params = [])
+ public function deleteComponentTemplate(?array $params = null)
{
+ $params = $params ?? [];
$this->checkRequiredParameters(['name'], $params);
$url = '/_component_template/' . $this->encode($params['name']);
$method = 'DELETE';
@@ -109,16 +112,16 @@ public function deleteComponentTemplate(array $params = [])
/**
* Clears cluster voting config exclusions.
*
- * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/voting-config-exclusions.html
+ * @link https://www.elastic.co/guide/en/elasticsearch/reference/master/voting-config-exclusions.html
*
* @param array{
- * wait_for_removal: boolean, // Specifies whether to wait for all excluded nodes to be removed from the cluster before clearing the voting configuration exclusions list.
- * master_timeout: time, // Timeout for submitting request to master
- * 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.
+ * wait_for_removal?: bool, // Specifies whether to wait for all excluded nodes to be removed from the cluster before clearing the voting configuration exclusions list.
+ * master_timeout?: int|string, // Timeout for submitting request to master
+ * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false)
+ * human?: bool, // Return human readable values for statistics. (DEFAULT: true)
+ * error_trace?: bool, // 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?: string|array, // A comma-separated list of filters used to reduce the response.
* } $params
*
* @throws NoNodeAvailableException if all the hosts are offline
@@ -127,8 +130,9 @@ public function deleteComponentTemplate(array $params = [])
*
* @return Elasticsearch|Promise
*/
- public function deleteVotingConfigExclusions(array $params = [])
+ public function deleteVotingConfigExclusions(?array $params = null)
{
+ $params = $params ?? [];
$url = '/_cluster/voting_config_exclusions';
$method = 'DELETE';
@@ -145,17 +149,18 @@ public function deleteVotingConfigExclusions(array $params = [])
/**
* Returns information about whether a particular component template exist
*
- * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-component-template.html
+ * @link https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-component-template.html
+ * @group serverless
*
* @param array{
* name: string, // (REQUIRED) The name of the template
- * master_timeout: time, // Explicit operation timeout for connection to master node
- * local: boolean, // Return local information, do not retrieve the state from master node (default: 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)
- * 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.
+ * master_timeout?: int|string, // Timeout for waiting for new cluster state in case it is blocked
+ * local?: bool, // Return local information, do not retrieve the state from master node (default: false)
+ * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false)
+ * human?: bool, // Return human readable values for statistics. (DEFAULT: true)
+ * error_trace?: bool, // 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?: string|array, // A comma-separated list of filters used to reduce the response.
* } $params
*
* @throws MissingParameterException if a required parameter is missing
@@ -165,8 +170,9 @@ public function deleteVotingConfigExclusions(array $params = [])
*
* @return Elasticsearch|Promise
*/
- public function existsComponentTemplate(array $params = [])
+ public function existsComponentTemplate(?array $params = null)
{
+ $params = $params ?? [];
$this->checkRequiredParameters(['name'], $params);
$url = '/_component_template/' . $this->encode($params['name']);
$method = 'HEAD';
@@ -184,18 +190,19 @@ public function existsComponentTemplate(array $params = [])
/**
* Returns one or more component templates
*
- * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-component-template.html
+ * @link https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-component-template.html
+ * @group serverless
*
* @param array{
- * name: list, // The comma separated names of the component templates
- * master_timeout: time, // Explicit operation timeout for connection to master node
- * local: boolean, // Return local information, do not retrieve the state from master node (default: false)
- * include_defaults: boolean, // Return all default configurations for the component template (default: 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)
- * 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.
+ * name?: string|array, // The comma separated names of the component templates
+ * master_timeout?: int|string, // Timeout for waiting for new cluster state in case it is blocked
+ * local?: bool, // Return local information, do not retrieve the state from master node (default: false)
+ * include_defaults?: bool, // Return all default configurations for the component template (default: false)
+ * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false)
+ * human?: bool, // Return human readable values for statistics. (DEFAULT: true)
+ * error_trace?: bool, // 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?: string|array, // A comma-separated list of filters used to reduce the response.
* } $params
*
* @throws NoNodeAvailableException if all the hosts are offline
@@ -204,10 +211,11 @@ public function existsComponentTemplate(array $params = [])
*
* @return Elasticsearch|Promise
*/
- public function getComponentTemplate(array $params = [])
+ public function getComponentTemplate(?array $params = null)
{
+ $params = $params ?? [];
if (isset($params['name'])) {
- $url = '/_component_template/' . $this->encode($params['name']);
+ $url = '/_component_template/' . $this->encode($this->convertValue($params['name']));
$method = 'GET';
} else {
$url = '/_component_template';
@@ -226,18 +234,18 @@ public function getComponentTemplate(array $params = [])
/**
* Returns cluster settings.
*
- * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/cluster-get-settings.html
+ * @link https://www.elastic.co/guide/en/elasticsearch/reference/master/cluster-get-settings.html
*
* @param array{
- * flat_settings: boolean, // Return settings in flat format (default: false)
- * master_timeout: time, // Explicit operation timeout for connection to master node
- * timeout: time, // Explicit operation timeout
- * include_defaults: boolean, // Whether to return all default clusters setting.
- * 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.
+ * flat_settings?: bool, // Return settings in flat format (default: false)
+ * master_timeout?: int|string, // Timeout for waiting for new cluster state in case it is blocked
+ * timeout?: int|string, // Explicit operation timeout
+ * include_defaults?: bool, // Whether to return all default clusters setting.
+ * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false)
+ * human?: bool, // Return human readable values for statistics. (DEFAULT: true)
+ * error_trace?: bool, // 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?: string|array, // A comma-separated list of filters used to reduce the response.
* } $params
*
* @throws NoNodeAvailableException if all the hosts are offline
@@ -246,8 +254,9 @@ public function getComponentTemplate(array $params = [])
*
* @return Elasticsearch|Promise
*/
- public function getSettings(array $params = [])
+ public function getSettings(?array $params = null)
{
+ $params = $params ?? [];
$url = '/_cluster/settings';
$method = 'GET';
@@ -264,26 +273,26 @@ public function getSettings(array $params = [])
/**
* Returns basic information about the health of the cluster.
*
- * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/cluster-health.html
+ * @link https://www.elastic.co/guide/en/elasticsearch/reference/master/cluster-health.html
*
* @param array{
- * index: list, // Limit the information returned to a specific index
- * expand_wildcards: enum, // Whether to expand wildcard expression to concrete indices that are open, closed or both.
- * level: enum, // Specify the level of detail for returned information
- * local: boolean, // Return local information, do not retrieve the state from master node (default: false)
- * master_timeout: time, // Explicit operation timeout for connection to master node
- * timeout: time, // Explicit operation timeout
- * wait_for_active_shards: string, // Wait until the specified number of shards is active
- * wait_for_nodes: string, // Wait until the specified number of nodes is available
- * wait_for_events: enum, // Wait until all currently queued events with the given priority are processed
- * wait_for_no_relocating_shards: boolean, // Whether to wait until there are no relocating shards in the cluster
- * wait_for_no_initializing_shards: boolean, // Whether to wait until there are no initializing shards in the cluster
- * wait_for_status: enum, // Wait until cluster is in a specific state
- * 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.
+ * index?: string|array, // Limit the information returned to a specific index
+ * expand_wildcards?: string, // Whether to expand wildcard expression to concrete indices that are open, closed or both.
+ * level?: string, // Specify the level of detail for returned information
+ * local?: bool, // Return local information, do not retrieve the state from master node (default: false)
+ * master_timeout?: int|string, // Explicit operation timeout for connection to master node
+ * timeout?: int|string, // Explicit operation timeout
+ * wait_for_active_shards?: string, // Wait until the specified number of shards is active
+ * wait_for_nodes?: string, // Wait until the specified number of nodes is available
+ * wait_for_events?: string, // Wait until all currently queued events with the given priority are processed
+ * wait_for_no_relocating_shards?: bool, // Whether to wait until there are no relocating shards in the cluster
+ * wait_for_no_initializing_shards?: bool, // Whether to wait until there are no initializing shards in the cluster
+ * wait_for_status?: string, // Wait until cluster is in a specific state
+ * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false)
+ * human?: bool, // Return human readable values for statistics. (DEFAULT: true)
+ * error_trace?: bool, // 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?: string|array, // A comma-separated list of filters used to reduce the response.
* } $params
*
* @throws NoNodeAvailableException if all the hosts are offline
@@ -292,10 +301,11 @@ public function getSettings(array $params = [])
*
* @return Elasticsearch|Promise
*/
- public function health(array $params = [])
+ public function health(?array $params = null)
{
+ $params = $params ?? [];
if (isset($params['index'])) {
- $url = '/_cluster/health/' . $this->encode($params['index']);
+ $url = '/_cluster/health/' . $this->encode($this->convertValue($params['index']));
$method = 'GET';
} else {
$url = '/_cluster/health';
@@ -314,15 +324,16 @@ public function health(array $params = [])
/**
* Returns different information about the cluster.
*
- * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/cluster-info.html
+ * @link https://www.elastic.co/guide/en/elasticsearch/reference/master/cluster-info.html
+ * @group serverless
*
* @param array{
- * target: list, // (REQUIRED) Limit the information returned to the specified target.
- * 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.
+ * target: string|array, // (REQUIRED) Limit the information returned to the specified target.
+ * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false)
+ * human?: bool, // Return human readable values for statistics. (DEFAULT: true)
+ * error_trace?: bool, // 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?: string|array, // A comma-separated list of filters used to reduce the response.
* } $params
*
* @throws MissingParameterException if a required parameter is missing
@@ -332,10 +343,11 @@ public function health(array $params = [])
*
* @return Elasticsearch|Promise
*/
- public function info(array $params = [])
+ public function info(?array $params = null)
{
+ $params = $params ?? [];
$this->checkRequiredParameters(['target'], $params);
- $url = '/_info/' . $this->encode($params['target']);
+ $url = '/_info/' . $this->encode($this->convertValue($params['target']));
$method = 'GET';
$url = $this->addQueryString($url, $params, ['pretty','human','error_trace','source','filter_path']);
@@ -352,16 +364,16 @@ public function info(array $params = [])
* Returns a list of any cluster-level changes (e.g. create index, update mapping,
* allocate or fail shard) which have not yet been executed.
*
- * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/cluster-pending.html
+ * @link https://www.elastic.co/guide/en/elasticsearch/reference/master/cluster-pending.html
*
* @param array{
- * local: boolean, // Return local information, do not retrieve the state from master node (default: false)
- * master_timeout: time, // Specify timeout for connection to master
- * 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.
+ * local?: bool, // Return local information, do not retrieve the state from master node (default: false)
+ * master_timeout?: int|string, // Specify timeout for connection to master
+ * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false)
+ * human?: bool, // Return human readable values for statistics. (DEFAULT: true)
+ * error_trace?: bool, // 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?: string|array, // A comma-separated list of filters used to reduce the response.
* } $params
*
* @throws NoNodeAvailableException if all the hosts are offline
@@ -370,8 +382,9 @@ public function info(array $params = [])
*
* @return Elasticsearch|Promise
*/
- public function pendingTasks(array $params = [])
+ public function pendingTasks(?array $params = null)
{
+ $params = $params ?? [];
$url = '/_cluster/pending_tasks';
$method = 'GET';
@@ -388,18 +401,18 @@ public function pendingTasks(array $params = [])
/**
* Updates the cluster voting config exclusions by node ids or node names.
*
- * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/voting-config-exclusions.html
+ * @link https://www.elastic.co/guide/en/elasticsearch/reference/master/voting-config-exclusions.html
*
* @param array{
- * node_ids: string, // A comma-separated list of the persistent ids of the nodes to exclude from the voting configuration. If specified, you may not also specify ?node_names.
- * node_names: string, // A comma-separated list of the names of the nodes to exclude from the voting configuration. If specified, you may not also specify ?node_ids.
- * timeout: time, // Explicit operation timeout
- * master_timeout: time, // Timeout for submitting request to master
- * 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.
+ * node_ids?: string, // A comma-separated list of the persistent ids of the nodes to exclude from the voting configuration. If specified, you may not also specify ?node_names.
+ * node_names?: string, // A comma-separated list of the names of the nodes to exclude from the voting configuration. If specified, you may not also specify ?node_ids.
+ * timeout?: int|string, // Explicit operation timeout
+ * master_timeout?: int|string, // Timeout for submitting request to master
+ * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false)
+ * human?: bool, // Return human readable values for statistics. (DEFAULT: true)
+ * error_trace?: bool, // 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?: string|array, // A comma-separated list of filters used to reduce the response.
* } $params
*
* @throws NoNodeAvailableException if all the hosts are offline
@@ -408,8 +421,9 @@ public function pendingTasks(array $params = [])
*
* @return Elasticsearch|Promise
*/
- public function postVotingConfigExclusions(array $params = [])
+ public function postVotingConfigExclusions(?array $params = null)
{
+ $params = $params ?? [];
$url = '/_cluster/voting_config_exclusions';
$method = 'POST';
@@ -426,19 +440,20 @@ public function postVotingConfigExclusions(array $params = [])
/**
* Creates or updates a component template
*
- * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-component-template.html
+ * @link https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-component-template.html
+ * @group serverless
*
* @param array{
* name: string, // (REQUIRED) The name of the template
- * create: boolean, // Whether the index template should only be added if new or can also replace an existing one
- * timeout: time, // Explicit operation timeout
- * master_timeout: time, // Specify timeout for connection to master
- * 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 template definition
+ * create?: bool, // Whether the index template should only be added if new or can also replace an existing one
+ * timeout?: int|string, // Explicit operation timeout
+ * master_timeout?: int|string, // Specify timeout for connection to master
+ * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false)
+ * human?: bool, // Return human readable values for statistics. (DEFAULT: true)
+ * error_trace?: bool, // 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?: string|array, // A comma-separated list of filters used to reduce the response.
+ * body: string|array, // (REQUIRED) The template definition. If body is a string must be a valid JSON.
* } $params
*
* @throws MissingParameterException if a required parameter is missing
@@ -448,8 +463,9 @@ public function postVotingConfigExclusions(array $params = [])
*
* @return Elasticsearch|Promise
*/
- public function putComponentTemplate(array $params = [])
+ public function putComponentTemplate(?array $params = null)
{
+ $params = $params ?? [];
$this->checkRequiredParameters(['name','body'], $params);
$url = '/_component_template/' . $this->encode($params['name']);
$method = 'PUT';
@@ -468,18 +484,18 @@ public function putComponentTemplate(array $params = [])
/**
* Updates the cluster settings.
*
- * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/cluster-update-settings.html
+ * @link https://www.elastic.co/guide/en/elasticsearch/reference/master/cluster-update-settings.html
*
* @param array{
- * flat_settings: boolean, // Return settings in flat format (default: false)
- * master_timeout: time, // Explicit operation timeout for connection to master node
- * 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)
- * 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 settings to be updated. Can be either `transient` or `persistent` (survives cluster restart).
+ * flat_settings?: bool, // Return settings in flat format (default: false)
+ * master_timeout?: int|string, // Explicit operation timeout for connection to master node
+ * timeout?: int|string, // Explicit operation timeout
+ * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false)
+ * human?: bool, // Return human readable values for statistics. (DEFAULT: true)
+ * error_trace?: bool, // 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?: string|array, // A comma-separated list of filters used to reduce the response.
+ * body: string|array, // (REQUIRED) The settings to be updated. Can be either `transient` or `persistent` (survives cluster restart).. If body is a string must be a valid JSON.
* } $params
*
* @throws NoNodeAvailableException if all the hosts are offline
@@ -488,8 +504,9 @@ public function putComponentTemplate(array $params = [])
*
* @return Elasticsearch|Promise
*/
- public function putSettings(array $params = [])
+ public function putSettings(?array $params = null)
{
+ $params = $params ?? [];
$this->checkRequiredParameters(['body'], $params);
$url = '/_cluster/settings';
$method = 'PUT';
@@ -508,14 +525,14 @@ public function putSettings(array $params = [])
/**
* Returns the information about configured remote clusters.
*
- * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/cluster-remote-info.html
+ * @link https://www.elastic.co/guide/en/elasticsearch/reference/master/cluster-remote-info.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.
+ * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false)
+ * human?: bool, // Return human readable values for statistics. (DEFAULT: true)
+ * error_trace?: bool, // 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?: string|array, // A comma-separated list of filters used to reduce the response.
* } $params
*
* @throws NoNodeAvailableException if all the hosts are offline
@@ -524,8 +541,9 @@ public function putSettings(array $params = [])
*
* @return Elasticsearch|Promise
*/
- public function remoteInfo(array $params = [])
+ public function remoteInfo(?array $params = null)
{
+ $params = $params ?? [];
$url = '/_remote/info';
$method = 'GET';
@@ -542,21 +560,21 @@ public function remoteInfo(array $params = [])
/**
* Allows to manually change the allocation of individual shards in the cluster.
*
- * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/cluster-reroute.html
+ * @link https://www.elastic.co/guide/en/elasticsearch/reference/master/cluster-reroute.html
*
* @param array{
- * dry_run: boolean, // Simulate the operation only and return the resulting state
- * explain: boolean, // Return an explanation of why the commands can or cannot be executed
- * retry_failed: boolean, // Retries allocation of shards that are blocked due to too many subsequent allocation failures
- * metric: list, // Limit the information returned to the specified metrics. Defaults to all but metadata
- * master_timeout: time, // Explicit operation timeout for connection to master node
- * 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)
- * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests.
- * filter_path: list, // A comma-separated list of filters used to reduce the response.
- * body: array, // The definition of `commands` to perform (`move`, `cancel`, `allocate`)
+ * dry_run?: bool, // Simulate the operation only and return the resulting state
+ * explain?: bool, // Return an explanation of why the commands can or cannot be executed
+ * retry_failed?: bool, // Retries allocation of shards that are blocked due to too many subsequent allocation failures
+ * metric?: string|array, // Limit the information returned to the specified metrics. Defaults to all but metadata
+ * master_timeout?: int|string, // Explicit operation timeout for connection to master node
+ * timeout?: int|string, // Explicit operation timeout
+ * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false)
+ * human?: bool, // Return human readable values for statistics. (DEFAULT: true)
+ * error_trace?: bool, // 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?: string|array, // A comma-separated list of filters used to reduce the response.
+ * body?: string|array, // The definition of `commands` to perform (`move`, `cancel`, `allocate`). If body is a string must be a valid JSON.
* } $params
*
* @throws NoNodeAvailableException if all the hosts are offline
@@ -565,8 +583,9 @@ public function remoteInfo(array $params = [])
*
* @return Elasticsearch|Promise
*/
- public function reroute(array $params = [])
+ public function reroute(?array $params = null)
{
+ $params = $params ?? [];
$url = '/_cluster/reroute';
$method = 'POST';
@@ -584,24 +603,24 @@ public function reroute(array $params = [])
/**
* Returns a comprehensive information about the state of the cluster.
*
- * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/cluster-state.html
+ * @link https://www.elastic.co/guide/en/elasticsearch/reference/master/cluster-state.html
*
* @param array{
- * metric: list, // Limit the information returned to the specified metrics
- * index: list, // A comma-separated list of index names; use `_all` or empty string to perform the operation on all indices
- * local: boolean, // Return local information, do not retrieve the state from master node (default: false)
- * master_timeout: time, // Specify timeout for connection to master
- * flat_settings: boolean, // Return settings in flat format (default: false)
- * wait_for_metadata_version: number, // Wait for the metadata version to be equal or greater than the specified metadata version
- * wait_for_timeout: time, // The maximum time to wait for wait_for_metadata_version before timing out
- * 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.
- * 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.
+ * metric?: string|array, // Limit the information returned to the specified metrics
+ * index?: string|array, // A comma-separated list of index names; use `_all` or empty string to perform the operation on all indices
+ * local?: bool, // Return local information, do not retrieve the state from master node (default: false)
+ * master_timeout?: int|string, // Specify timeout for connection to master
+ * flat_settings?: bool, // Return settings in flat format (default: false)
+ * wait_for_metadata_version?: int, // Wait for the metadata version to be equal or greater than the specified metadata version
+ * wait_for_timeout?: int|string, // The maximum time to wait for wait_for_metadata_version before timing out
+ * ignore_unavailable?: bool, // Whether specified concrete indices should be ignored when unavailable (missing or closed)
+ * allow_no_indices?: bool, // 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?: string, // Whether to expand wildcard expression to concrete indices that are open, closed or both.
+ * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false)
+ * human?: bool, // Return human readable values for statistics. (DEFAULT: true)
+ * error_trace?: bool, // 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?: string|array, // A comma-separated list of filters used to reduce the response.
* } $params
*
* @throws NoNodeAvailableException if all the hosts are offline
@@ -610,13 +629,14 @@ public function reroute(array $params = [])
*
* @return Elasticsearch|Promise
*/
- public function state(array $params = [])
+ public function state(?array $params = null)
{
+ $params = $params ?? [];
if (isset($params['index']) && isset($params['metric'])) {
- $url = '/_cluster/state/' . $this->encode($params['metric']) . '/' . $this->encode($params['index']);
+ $url = '/_cluster/state/' . $this->encode($this->convertValue($params['metric'])) . '/' . $this->encode($this->convertValue($params['index']));
$method = 'GET';
} elseif (isset($params['metric'])) {
- $url = '/_cluster/state/' . $this->encode($params['metric']);
+ $url = '/_cluster/state/' . $this->encode($this->convertValue($params['metric']));
$method = 'GET';
} else {
$url = '/_cluster/state';
@@ -635,17 +655,17 @@ public function state(array $params = [])
/**
* Returns high-level overview of cluster statistics.
*
- * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/cluster-stats.html
+ * @link https://www.elastic.co/guide/en/elasticsearch/reference/master/cluster-stats.html
*
* @param array{
- * node_id: list, // A comma-separated list of node IDs or names to limit the returned information; use `_local` to return information from the node you're connecting to, leave empty to get information from all nodes
- * flat_settings: boolean, // Return settings in flat format (default: false)
- * 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)
- * 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.
+ * node_id?: string|array, // A comma-separated list of node IDs or names to limit the returned information; use `_local` to return information from the node you're connecting to, leave empty to get information from all nodes
+ * include_remotes?: bool, // Include remote cluster data into the response (default: false)
+ * timeout?: int|string, // Explicit operation timeout
+ * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false)
+ * human?: bool, // Return human readable values for statistics. (DEFAULT: true)
+ * error_trace?: bool, // 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?: string|array, // A comma-separated list of filters used to reduce the response.
* } $params
*
* @throws NoNodeAvailableException if all the hosts are offline
@@ -654,16 +674,17 @@ public function state(array $params = [])
*
* @return Elasticsearch|Promise
*/
- public function stats(array $params = [])
+ public function stats(?array $params = null)
{
+ $params = $params ?? [];
if (isset($params['node_id'])) {
- $url = '/_cluster/stats/nodes/' . $this->encode($params['node_id']);
+ $url = '/_cluster/stats/nodes/' . $this->encode($this->convertValue($params['node_id']));
$method = 'GET';
} else {
$url = '/_cluster/stats';
$method = 'GET';
}
- $url = $this->addQueryString($url, $params, ['flat_settings','timeout','pretty','human','error_trace','source','filter_path']);
+ $url = $this->addQueryString($url, $params, ['include_remotes','timeout','pretty','human','error_trace','source','filter_path']);
$headers = [
'Accept' => 'application/json',
];
diff --git a/src/Endpoints/Connector.php b/src/Endpoints/Connector.php
index 98ab0ec59..be7c9c10f 100644
--- a/src/Endpoints/Connector.php
+++ b/src/Endpoints/Connector.php
@@ -31,16 +31,17 @@ class Connector extends AbstractEndpoint
/**
* Updates the last_seen timestamp in the connector document.
*
- * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/check-in-connector-api.html
+ * @link https://www.elastic.co/guide/en/elasticsearch/reference/master/check-in-connector-api.html
+ * @group serverless
* @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.
+ * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false)
+ * human?: bool, // Return human readable values for statistics. (DEFAULT: true)
+ * error_trace?: bool, // 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?: string|array, // A comma-separated list of filters used to reduce the response.
* } $params
*
* @throws MissingParameterException if a required parameter is missing
@@ -50,8 +51,9 @@ class Connector extends AbstractEndpoint
*
* @return Elasticsearch|Promise
*/
- public function checkIn(array $params = [])
+ public function checkIn(?array $params = null)
{
+ $params = $params ?? [];
$this->checkRequiredParameters(['connector_id'], $params);
$url = '/_connector/' . $this->encode($params['connector_id']) . '/_check_in';
$method = 'PUT';
@@ -69,17 +71,19 @@ public function checkIn(array $params = [])
/**
* Deletes a connector.
*
- * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/delete-connector-api.html
+ * @link https://www.elastic.co/guide/en/elasticsearch/reference/master/delete-connector-api.html
+ * @group serverless
* @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.
+ * hard?: bool, // If true, the connector doc is deleted. If false, connector doc is marked as deleted (soft-deleted).
+ * delete_sync_jobs?: bool, // Determines whether associated sync jobs are also deleted.
+ * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false)
+ * human?: bool, // Return human readable values for statistics. (DEFAULT: true)
+ * error_trace?: bool, // 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?: string|array, // A comma-separated list of filters used to reduce the response.
* } $params
*
* @throws MissingParameterException if a required parameter is missing
@@ -89,13 +93,14 @@ public function checkIn(array $params = [])
*
* @return Elasticsearch|Promise
*/
- public function delete(array $params = [])
+ public function delete(?array $params = null)
{
+ $params = $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']);
+ $url = $this->addQueryString($url, $params, ['hard','delete_sync_jobs','pretty','human','error_trace','source','filter_path']);
$headers = [
'Accept' => 'application/json',
];
@@ -108,16 +113,18 @@ public function delete(array $params = [])
/**
* Returns the details about a connector.
*
- * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/get-connector-api.html
+ * @link https://www.elastic.co/guide/en/elasticsearch/reference/master/get-connector-api.html
+ * @group serverless
* @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.
+ * include_deleted?: bool, // A flag indicating whether to return connectors that have been soft-deleted.
+ * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false)
+ * human?: bool, // Return human readable values for statistics. (DEFAULT: true)
+ * error_trace?: bool, // 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?: string|array, // A comma-separated list of filters used to reduce the response.
* } $params
*
* @throws MissingParameterException if a required parameter is missing
@@ -127,13 +134,14 @@ public function delete(array $params = [])
*
* @return Elasticsearch|Promise
*/
- public function get(array $params = [])
+ public function get(?array $params = null)
{
+ $params = $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']);
+ $url = $this->addQueryString($url, $params, ['include_deleted','pretty','human','error_trace','source','filter_path']);
$headers = [
'Accept' => 'application/json',
];
@@ -146,17 +154,17 @@ public function get(array $params = [])
/**
* 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
+ * @link 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.
+ * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false)
+ * human?: bool, // Return human readable values for statistics. (DEFAULT: true)
+ * error_trace?: bool, // 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?: string|array, // A comma-separated list of filters used to reduce the response.
+ * body: string|array, // (REQUIRED) Object with stats related to the last connector sync run.. If body is a string must be a valid JSON.
* } $params
*
* @throws MissingParameterException if a required parameter is missing
@@ -166,8 +174,9 @@ public function get(array $params = [])
*
* @return Elasticsearch|Promise
*/
- public function lastSync(array $params = [])
+ public function lastSync(?array $params = null)
{
+ $params = $params ?? [];
$this->checkRequiredParameters(['connector_id','body'], $params);
$url = '/_connector/' . $this->encode($params['connector_id']) . '/_last_sync';
$method = 'PUT';
@@ -186,21 +195,23 @@ public function lastSync(array $params = [])
/**
* Lists all connectors.
*
- * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/list-connector-api.html
+ * @link https://www.elastic.co/guide/en/elasticsearch/reference/master/list-connector-api.html
+ * @group serverless
* @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.
+ * from?: int, // Starting offset (default: 0)
+ * size?: int, // Specifies a max number of results to get (default: 100)
+ * index_name?: string|array, // A comma-separated list of connector index names to fetch connector documents for
+ * connector_name?: string|array, // A comma-separated list of connector names to fetch connector documents for
+ * service_type?: string|array, // 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
+ * include_deleted?: bool, // A flag indicating whether to return connectors that have been soft-deleted.
+ * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false)
+ * human?: bool, // Return human readable values for statistics. (DEFAULT: true)
+ * error_trace?: bool, // 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?: string|array, // A comma-separated list of filters used to reduce the response.
* } $params
*
* @throws NoNodeAvailableException if all the hosts are offline
@@ -209,12 +220,13 @@ public function lastSync(array $params = [])
*
* @return Elasticsearch|Promise
*/
- public function list(array $params = [])
+ public function list(?array $params = null)
{
+ $params = $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']);
+ $url = $this->addQueryString($url, $params, ['from','size','index_name','connector_name','service_type','query','include_deleted','pretty','human','error_trace','source','filter_path']);
$headers = [
'Accept' => 'application/json',
];
@@ -227,16 +239,17 @@ public function list(array $params = [])
/**
* Creates a connector.
*
- * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/create-connector-api.html
+ * @link https://www.elastic.co/guide/en/elasticsearch/reference/master/create-connector-api.html
+ * @group serverless
* @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, // The connector configuration.
+ * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false)
+ * human?: bool, // Return human readable values for statistics. (DEFAULT: true)
+ * error_trace?: bool, // 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?: string|array