Skip to content

Commit f6b27bd

Browse files
committed
Merge from 8.0
2 parents 3cab97a + 27e46b0 commit f6b27bd

File tree

219 files changed

+20378
-176268
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

219 files changed

+20378
-176268
lines changed

.ci/Dockerfile

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,24 @@
1-
ARG PHP_VERSION=7.4-cli
1+
ARG PHP_VERSION=8.0-cli
22
FROM php:${PHP_VERSION}
33

44
WORKDIR /usr/src/app
55

66
# Install git
7-
RUN apt-get update && \
8-
apt-get install -y --no-install-recommends git
7+
RUN apt-get update -qq > /dev/null && \
8+
apt-get install -y --no-install-recommends git -qq > /dev/null
99

1010
# Install zip extension for PHP
1111
RUN apt-get install -y \
1212
libzip-dev \
1313
zip \
1414
libyaml-dev \
15-
&& docker-php-ext-install zip
15+
-qq > /dev/null \
16+
&& docker-php-ext-install zip > /dev/null
1617

1718
# Install yaml extension for PHP
18-
RUN pecl channel-update pecl.php.net
19-
RUN pecl install yaml && docker-php-ext-enable yaml
19+
RUN pecl channel-update pecl.php.net > /dev/null
20+
RUN pecl install yaml > /dev/null
21+
RUN docker-php-ext-enable yaml > /dev/null
2022

2123
# Print PHP version
2224
RUN php -v
@@ -30,7 +32,7 @@ RUN composer --version
3032
COPY composer.json .
3133

3234
# Install dependencies with composer
33-
RUN composer install
35+
RUN composer install --no-progress > /dev/null
3436

3537
COPY . .
3638

.ci/docker/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
ARG PHP_VERSION=7.4-cli
1+
ARG PHP_VERSION=8.0-cli
22
FROM php:${PHP_VERSION}
33

44
# Create app directory

.ci/run-elasticsearch.sh

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
# Export the TEST_SUITE variable, eg. 'free' or 'platinum' defaults to 'free'.
88
# Export the NUMBER_OF_NODES variable to start more than 1 node
99

10-
# Version 1.6.0
10+
# Version 1.6.1
1111
# - Initial version of the run-elasticsearch.sh script
1212
# - Deleting the volume should not dependent on the container still running
1313
# - Fixed `ES_JAVA_OPTS` config
@@ -20,6 +20,7 @@
2020
# - Added ingest.geoip.downloader.enabled=false as it causes false positives in testing
2121
# - Moved ELASTIC_PASSWORD and xpack.security.enabled to the base arguments for "Security On by default"
2222
# - Use https only when TEST_SUITE is "platinum", when "free" use http
23+
# - Set xpack.security.enabled=false for "free" and xpack.security.enabled=true for "platinum"
2324

2425
script_path=$(dirname $(realpath -s $0))
2526
source $script_path/functions/imports.sh
@@ -34,7 +35,6 @@ cluster_name=${moniker}${suffix}
3435
declare -a volumes
3536
environment=($(cat <<-END
3637
--env ELASTIC_PASSWORD=$elastic_password
37-
--env xpack.security.enabled=false
3838
--env node.name=$es_node_name
3939
--env cluster.name=$cluster_name
4040
--env cluster.initial_master_nodes=$master_node_name
@@ -73,6 +73,7 @@ END
7373
))
7474
else
7575
environment+=($(cat <<-END
76+
--env xpack.security.enabled=false
7677
--env xpack.security.http.ssl.enabled=false
7778
END
7879
))
@@ -88,7 +89,7 @@ fi
8889
docker_pull_attempts=0
8990
until [ "$docker_pull_attempts" -ge 5 ]
9091
do
91-
docker pull docker.elastic.co/elasticsearch/"$elasticsearch_container" && break
92+
docker pull -q docker.elastic.co/elasticsearch/"$elasticsearch_container" && break
9293
docker_pull_attempts=$((docker_pull_attempts+1))
9394
echo "Failed to pull image, retrying in 10 seconds (retry $docker_pull_attempts/5)..."
9495
sleep 10
@@ -127,7 +128,7 @@ END
127128
--ulimit memlock=-1:-1 \
128129
--detach="$local_detach" \
129130
--health-cmd="curl $cert_validation_flags --fail $elasticsearch_url/_cluster/health || exit 1" \
130-
--health-interval=2s \
131+
--health-interval=5s \
131132
--health-retries=20 \
132133
--health-timeout=2s \
133134
--rm \

.ci/run-repository.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ script_path=$(dirname $(realpath -s $0))
99
source $script_path/functions/imports.sh
1010
set -euo pipefail
1111

12-
PHP_VERSION=${PHP_VERSION-7.4-cli}
12+
PHP_VERSION=${PHP_VERSION-8.0-cli}
1313
ELASTICSEARCH_URL=${ELASTICSEARCH_URL-"$elasticsearch_url"}
1414
elasticsearch_container=${elasticsearch_container-}
1515

.ci/test-matrix.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
---
22
STACK_VERSION:
3-
- 8.0.0-SNAPSHOT
3+
- 8.0-SNAPSHOT
44

55
PHP_VERSION:
6+
- 8.1-cli
67
- 8.0-cli
78
- 7.4-cli
8-
- 7.3-cli
99

1010
TEST_SUITE:
1111
- free

.gitattributes

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,8 @@
55
/util export-ignore
66
/.gitattributes export-ignore
77
/.gitignore export-ignore
8-
/.gitmodules export-ignore
9-
/.php_cs export-ignore
108
/phpstan.neon export-ignore
119
/phpunit-integration-tests.xml export-ignore
1210
/phpunit-yaml-free-tests.xml export-ignore
1311
/phpunit-yaml-platinum-tests.xml export-ignore
1412
/phpunit.xml.dist export-ignore
15-
/ruleset.xml export-ignore

.github/license-header.txt

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,11 @@
11
/**
2-
* Elasticsearch PHP client
2+
* Elasticsearch PHP Client
33
*
4-
* @link https://github.com/elastic/elasticsearch-php/
4+
* @link https://github.com/elastic/elasticsearch-php
55
* @copyright Copyright (c) Elasticsearch B.V (https://www.elastic.co)
6-
* @license http://www.apache.org/licenses/LICENSE-2.0 Apache License, Version 2.0
7-
* @license https://www.gnu.org/licenses/lgpl-2.1.html GNU Lesser General Public License, Version 2.1
6+
* @license https://opensource.org/licenses/MIT MIT License
87
*
98
* Licensed to Elasticsearch B.V under one or more agreements.
10-
* Elasticsearch B.V licenses this file to you under the Apache 2.0 License or
11-
* the GNU Lesser General Public License, Version 2.1, at your option.
9+
* Elasticsearch B.V licenses this file to you under the MIT License.
1210
* See the LICENSE file in the project root for more information.
1311
*/

.github/workflows/test.yml

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@ jobs:
99

1010
strategy:
1111
matrix:
12-
php-version: [7.3, 7.4, 8.0]
12+
php-version: [7.4, 8.0, 8.1]
1313
os: [ubuntu-latest]
14-
es-version: [8.0.0-SNAPSHOT]
14+
es-version: [8.0-SNAPSHOT]
1515

1616
steps:
1717
- name: Checkout
@@ -40,19 +40,13 @@ jobs:
4040
run: |
4141
composer install --prefer-dist
4242
43-
- name: PHP Coding Standards
44-
run: |
45-
composer run-script phpcs
46-
4743
- name: PHP Static Analysis Tool
4844
run: |
4945
composer run-script phpstan
5046
5147
- name: Unit tests
5248
run: |
53-
vendor/bin/phpunit -c phpunit.xml.dist
54-
env:
55-
TEST_SUITE: free
49+
composer run-script test
5650
5751
- name: Configure sysctl limits
5852
run: |
@@ -68,7 +62,6 @@ jobs:
6862

6963
- name: Integration tests
7064
run: |
71-
vendor/bin/phpunit -c phpunit-integration-tests.xml
65+
composer run-script integration-test
7266
env:
73-
ELASTICSEARCH_URL: http://localhost:9200
74-
67+
TEST_SUITE: free

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ build
4545
tests/*-junit.xml
4646

4747
# YAML tests
48-
tests/Elasticsearch/Tests/Yaml
48+
tests/Yaml
4949

5050
# Exclude .ci/make.sh artifcats
5151
.ci/output

.php_cs

Lines changed: 0 additions & 23 deletions
This file was deleted.

BREAKING_CHANGES.md

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,55 @@
1+
# 8.0
2+
3+
This major release is a complete new PHP client for Elasticsearch. We build it from scratch!
4+
We tried to reduce the BC breaks as much as possible but there are some (big) differences:
5+
6+
## Architectural changes:
7+
8+
- we changed the namespace, now everything is under `Elastic\Elasticsearch`
9+
- we used the [elastic-transport-php](https://github.com/elastic/elastic-transport-php) library for HTTP communications;
10+
- we changed the `Exception` model, using the namespace `Elastic\Elasticsearch\Exception`. All the exceptions extends the
11+
`ElasticsearchException` interface, as in 7.x
12+
- we changed the response type of each endpoints using an [Elasticsearch](src/Response/Elasticsearch.php) response class.
13+
This class wraps a a [PSR-7](https://www.php-fig.org/psr/psr-7/) response allowing the access of the body response
14+
as array or object. This means you can access the API response as in 7.x, no BC break here! :angel:
15+
- we changed the `ConnectionPool` in `NodePool`. The `connection` naming was ambigous since the objects are nodes (hosts)
16+
17+
## Specific changes:
18+
19+
The following functions has been removed:
20+
21+
- `ClientBuilder::getEndpoint()`
22+
- `ClientBuilder::getRegisteredNamespacesBuilders()`
23+
- `ClientBuilder::getRegisteredNamespacesBuilders()`
24+
- `ClientBuilder::defaultHandler()`
25+
- `ClientBuilder::multiHandler()`
26+
- `ClientBuilder::singleHandler()`
27+
- `ClientBuilder::setConnectionFactory()`
28+
- `ClientBuilder::setConnectionPool()`, you can use `ClientBuilder::setNodePool` instead
29+
- `ClientBuilder::setEndpoint()`
30+
- `ClientBuilder::registerNamespace()`
31+
- `ClientBuilder::setTransport()`, you can specify an HTTP PSR-18 client using `ClientBuilder::setHttpClient()`
32+
- `ClientBuilder::setHandler()`
33+
- `ClientBuilder::setTracer()`, you can only set a Logger using `ClientBuilder::setLogger()`
34+
- `ClientBuilder::setSerializer()`
35+
- `ClientBuilder::setConnectionParams()`, you can use `ClientBuilder::setHttpClientOptions()` instead
36+
- `ClientBuilder::setSelector()`, you can set a `Selector` using the `setNodePool`, see [here](https://github.com/elastic/elastic-transport-php/blob/8.x/README.md#use-a-custom-selector) for more information
37+
- `ClientBuilder::setSniffOnStart()`
38+
- `ClientBuilder::includePortInHostHeader()`
39+
40+
We removed the special `client` parameter passed in `$params` endpoints. In details:
41+
42+
- `$params['client']['never_retry']`
43+
- `$params['client']['verbose']`
44+
- `$params['client']['port_in_header']`
45+
- `$params['client']['future']`, you can set HTTP async using `Client::setAsync(true)`
46+
- `$params['client']['ignore']`, you can disable the Exception using `Client::setResponseException(false)`
47+
48+
# 7.17
49+
50+
- We changed the signature of `Elasticsearch\Common\EmptyLogger::log` adding the `void` return type.
51+
This change has been needed to support psr/log v3.
52+
153
# 7.4
254

355
- Using a deprecated parameter is notified triggering a [E_USER_DEPRECATED](https://www.php.net/manual/en/errorfunc.constants.php)

CHANGELOG.md

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,48 @@
1+
## Release 8.0.0
2+
3+
- Finally the 8.0.0 GA for [Elasticsearch 8](https://www.elastic.co/blog/whats-new-elastic-8-0-0).
4+
5+
## Release 8.0.0-rc2
6+
7+
- Added the common parameters in all the endpoints
8+
[6427f8c](https://github.com/elastic/elasticsearch-php/commit/6427f8c42ba2afbe82c00adffdf93dd60b439432)
9+
10+
## Release 8.0.0-rc1
11+
12+
- Fixed query string in API endpoints + added a first integration test
13+
[e404235](https://github.com/elastic/elasticsearch-php/commit/e404235890b53a99242f7fc5ddea6ee6b2459e8f)
14+
- Added AdapterOptions class and setNodePool() in ClientBuilder
15+
[9150f71](https://github.com/elastic/elasticsearch-php/commit/9150f717488ddb74d83a119d215c0584aa98c95a)
16+
- Fixed urlencode in params, Exception in test code generation
17+
[142327b](https://github.com/elastic/elasticsearch-php/commit/142327b3cb730042ec0b21b7c6076164bb0721ed)
18+
- Improved client/server response exception messages
19+
[50de3e6](https://github.com/elastic/elasticsearch-php/commit/50de3e60fc9b0167a948a992fda78bc5e1a42152)
20+
21+
## Release 8.0.0-alpha
22+
23+
First alpha release of elasticsearch-php 8.0.0.
24+
25+
This major release is a complete new PHP client for Elasticsearch. We build it from scratch!
26+
We tried to reduce the BC breaks as much as possible but there are some (big) differences:
27+
28+
### Architectural changes:
29+
30+
- we changed the namespace, now everything is under `Elastic\Elasticsearch`
31+
- we used the [elastic-transport-php](https://github.com/elastic/elastic-transport-php) library for HTTP communications;
32+
- we changed the `Exception` model, using the namespace `Elastic\Elasticsearch\Exception`. All the exceptions extends the
33+
`ElasticsearchException` interface, as in 7.x
34+
- we changed the response type of each endpoints using an [Elasticsearch](src/Response/Elasticsearch.php) response class.
35+
This class wraps a a [PSR-7](https://www.php-fig.org/psr/psr-7/) response allowing the access of the body response
36+
as array or object. This means you can access the API response as in 7.x, no BC break here! :angel:
37+
- we changed the `ConnectionPool` in `NodePool`. The `connection` naming was ambigous since the objects are nodes (hosts)
38+
39+
You can have a look at the [BREAKING_CHANGES](BREAKING_CHANGES.md) file for more information.
40+
41+
## Release 7.17.0
42+
43+
- Allow psr/log v3
44+
[#1184](https://github.com/elastic/elasticsearch-php/pull/1184)
45+
146
## Release 7.16.0
247

348
- Added support of includePortInHostHeader in ClientBuilder::fromConfig

LICENSE

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,19 @@
1-
Copyright 2013-2020 Elasticsearch B.V.
1+
Copyright 2022 Elasticsearch B.V (https://www.elastic.co)
22

3-
elasticsearch-php is licensed under the Apache License, Version 2.0
4-
(<LICENSE-APACHE> or <http://www.apache.org/licenses/LICENSE-2.0>) or the GNU
5-
Lesser General Public License, Version 2.1 (<LICENSE-LGPL> or
6-
<https://www.gnu.org/licenses/lgpl-2.1.html>) at your option.
3+
Permission is hereby granted, free of charge, to any person obtaining a copy
4+
of this software and associated documentation files (the "Software"), to deal
5+
in the Software without restriction, including without limitation the rights
6+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7+
copies of the Software, and to permit persons to whom the Software is
8+
furnished to do so, subject to the following conditions:
9+
10+
The above copyright notice and this permission notice shall be included in
11+
all copies or substantial portions of the Software.
12+
13+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19+
THE SOFTWARE.

0 commit comments

Comments
 (0)