Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Up to elasticsearch 8 #2181

Merged
merged 29 commits into from
Jan 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
eef6f44
Up client
pawelkeska Nov 24, 2023
a9b4a04
Fix docker
pawelkeska Nov 24, 2023
f703b00
[Docker] Add workdir
pawelkeska Nov 24, 2023
0ac966c
Change endpoints to elasticsearch client
pawelkeska Nov 24, 2023
7b66fcd
Fix CS
pawelkeska Nov 24, 2023
c33f065
Remove deprecated tests
pawelkeska Nov 24, 2023
088b857
Fix elasticsearch version in Docker
pawelkeska Nov 24, 2023
6734638
Fix tests
pawelkeska Nov 24, 2023
b9bb402
Move to transport from elasticsearch lib
pawelkeska Nov 28, 2023
d2b60e1
Delete old transport
pawelkeska Nov 28, 2023
3c7fe15
Add helpers to response
pawelkeska Nov 28, 2023
db92e43
[Phpstan] Remove transport erorrs from baseline
pawelkeska Nov 28, 2023
a29169c
Update composer dependencies
pawelkeska Nov 28, 2023
bf71075
[Tests] Fix all
pawelkeska Nov 28, 2023
bde081c
[Tests] Fix percentiles
pawelkeska Nov 28, 2023
2d5a3a1
[Fix] Remove elasticsearch response from ResultSet
pawelkeska Nov 28, 2023
2b6e63b
[Tests] Fix tests after remove elasticsearch response from ResultSet
pawelkeska Nov 28, 2023
4a7aab8
[Tests] Fix names
pawelkeska Nov 29, 2023
b68987a
[Tests] Fix dependencies for lowest package psr7
pawelkeska Jan 15, 2024
2ffcaa9
[Tests] Fix assertObjectHasProperty
pawelkeska Jan 15, 2024
b49d7eb
[CS][DX] Refactor
pawelkeska Jan 15, 2024
f3ff343
Wrap elasticsearch response by elastica response
pawelkeska Jan 15, 2024
d78a453
Remove response helper classes
pawelkeska Jan 15, 2024
5690fbb
Add delete snapshot repository
pawelkeska Jan 15, 2024
032c4c8
[Tests] Fix snapshot tests
pawelkeska Jan 15, 2024
59a0602
[Tests] Restore node plugins test
pawelkeska Jan 15, 2024
d7d1a71
[Tests] Util
pawelkeska Jan 15, 2024
9e96adb
[Tests] Client
pawelkeska Jan 16, 2024
6ccbbda
[CS][DX] Refactor
pawelkeska Jan 16, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,14 @@
"require": {
"php": "~8.0.0 || ~8.1.0 || ~8.2.0",
"ext-json": "*",
"elasticsearch/elasticsearch": "^7.10",
"elastic/transport": "^8.8",
"elasticsearch/elasticsearch": "^8.11",
"guzzlehttp/psr7": "^2.0",
"nyholm/dsn": "^2.0.0",
"psr/log": "^1.0 || ^2.0 || ^3.0",
"symfony/deprecation-contracts": "^3.0"
},
"require-dev": {
"aws/aws-sdk-php": "^3.155",
"guzzlehttp/guzzle": "^7.2",
"phpstan/phpstan": "^1.5",
"phpstan/phpstan-phpunit": "^1.1",
Expand All @@ -45,6 +46,11 @@
"Elastica\\Test\\": "tests/"
}
},
"config": {
"allow-plugins": {
"php-http/discovery": true
}
},
"extra": {
"branch-alias": {
"dev-master": "7.0.x-dev"
Expand Down
4 changes: 3 additions & 1 deletion docker/docker-compose.es.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ version: '3.8'

services:
es01:
image: &image docker.elastic.co/elasticsearch/elasticsearch:${ES_VERSION:-7.15.2}
container_name: es01
image: &image docker.elastic.co/elasticsearch/elasticsearch:${ES_VERSION:-8.11.1}
command: &command >
/bin/sh -c "(./bin/elasticsearch-plugin list | grep -q ingest-attachment || ./bin/elasticsearch-plugin install --batch ingest-attachment) && /usr/local/bin/docker-entrypoint.sh"
environment: &environment
Expand All @@ -28,6 +29,7 @@ services:
networks: &networks
- elastic
es02:
container_name: es02
image: *image
command: *command
environment:
Expand Down
1 change: 1 addition & 0 deletions docker/docker-compose.proxy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ version: '3.4'

services:
proxy:
container_name: proxy
image: nginx:1.17-alpine
volumes:
- ./nginx/nginx.conf:/etc/nginx/nginx.conf:ro
Expand Down
6 changes: 5 additions & 1 deletion docker/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@ version: '3.4'

services:
php:
build: php/
container_name: php
build:
dockerfile: php/Dockerfile
volumes:
- ../:/var/www/html
networks:
Expand All @@ -15,6 +17,8 @@ services:
- ES_HOST=es01
- PROXY_HOST=proxy
- ES_VERSION=${ES_VERSION}
stdin_open: true
tty: true

networks:
elastic:
Expand Down
2 changes: 2 additions & 0 deletions docker/php/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
FROM php:8.1-alpine

WORKDIR /var/www/html

COPY --from=composer /usr/bin/composer /usr/bin/composer

# Install requried packages for running Make and Phive
Expand Down
15 changes: 0 additions & 15 deletions phpstan-baseline.neon
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,6 @@ parameters:
count: 1
path: src/QueryBuilder.php

-
message: "#^Function GuzzleHttp\\\\Psr7\\\\modify_request not found\\.$#"
count: 1
path: src/Transport/AwsAuthV4.php

-
message: "#^Function GuzzleHttp\\\\Psr7\\\\stream_for not found\\.$#"
count: 1
path: src/Transport/Guzzle.php

-
message: "#^Parameter \\#1 \\$precision of method Elastica\\\\Aggregation\\\\GeohashGrid\\:\\:setPrecision\\(\\) expects int\\|string, float given\\.$#"
count: 1
Expand Down Expand Up @@ -180,11 +170,6 @@ parameters:
count: 1
path: tests/SearchTest.php

-
message: "#^Unreachable statement \\- code above always terminates\\.$#"
count: 1
path: tests/SnapshotTest.php

-
message: "#^Parameter \\#1 \\$suggestion of static method Elastica\\\\Suggest\\:\\:create\\(\\) expects Elastica\\\\Suggest\\|Elastica\\\\Suggest\\\\AbstractSuggest, Elastica\\\\Query\\\\BoolQuery given\\.$#"
count: 1
Expand Down
23 changes: 16 additions & 7 deletions src/Bulk.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,18 @@

namespace Elastica;

use Elastic\Elasticsearch\Exception\ClientResponseException;
use Elastic\Elasticsearch\Exception\MissingParameterException;
use Elastic\Elasticsearch\Exception\ServerResponseException;
use Elastic\Transport\Exception\NoNodeAvailableException;
use Elastica\Bulk\Action;
use Elastica\Bulk\Action\AbstractDocument as AbstractDocumentAction;
use Elastica\Bulk\Response as BulkResponse;
use Elastica\Bulk\ResponseSet;
use Elastica\Exception\Bulk\ResponseException as BulkResponseException;
use Elastica\Exception\ClientException;
use Elastica\Exception\ConnectionException;
use Elastica\Exception\InvalidException;
use Elastica\Exception\RequestEntityTooLargeException;
use Elastica\Exception\ResponseException;
use Elastica\Script\AbstractScript;

class Bulk
Expand Down Expand Up @@ -277,15 +279,22 @@ public function toArray(): array
}

/**
* @throws ClientException
* @throws ConnectionException
* @throws ResponseException
* @throws MissingParameterException if a required parameter is missing
* @throws NoNodeAvailableException if all the hosts are offline
* @throws ClientResponseException if the status code of response is 4xx
* @throws ServerResponseException if the status code of response is 5xx
* @throws BulkResponseException
* @throws InvalidException
* @throws ClientException
*/
public function send(): ResponseSet
{
$response = $this->_client->request($this->getPath(), Request::POST, (string) $this, $this->_requestParams, Request::NDJSON_CONTENT_TYPE);
$params = ['body' => (string) $this];

if ($this->hasIndex()) {
$params['index'] = $this->getIndex();
}

$response = $this->_client->baseBulk(\array_merge($params, $this->_requestParams));

return $this->_processResponse($response);
}
Expand Down
3 changes: 0 additions & 3 deletions src/Bulk/ResponseSet.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,6 @@ public function __construct(BaseResponse $response, array $bulkResponses)
{
parent::__construct($response->getData(), $response->getStatus());

$this->setQueryTime($response->getQueryTime());
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess this is not available anymore?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, i have to remove property $_queryTime from Response object.

$this->setTransferInfo($response->getTransferInfo());

$this->_bulkResponses = $bulkResponses;
}

Expand Down
Loading
Loading