Skip to content

Commit

Permalink
Drop own Connection and Connection Pool clases. Use Node Pool from th…
Browse files Browse the repository at this point in the history
…e official elasticsearch package
  • Loading branch information
sidz committed Jan 25, 2024
1 parent b713330 commit a0e63b3
Show file tree
Hide file tree
Showing 25 changed files with 205 additions and 2,166 deletions.
13 changes: 5 additions & 8 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,9 @@
"require": {
"php": "~8.0.0 || ~8.1.0 || ~8.2.0",
"ext-json": "*",
"elastic/transport": "^8.4",
"elastic/transport": "^8.8",
"elasticsearch/elasticsearch": "^8.4.1",
"guzzlehttp/psr7": "^2.0",
"nyholm/dsn": "^2.0.0",
"psr/log": "^1.0 || ^2.0 || ^3.0",
"symfony/deprecation-contracts": "^3.0"
"psr/log": "^1.0 || ^2.0 || ^3.0"
},
"require-dev": {
"guzzlehttp/guzzle": "^7.2",
Expand All @@ -33,7 +30,6 @@
},
"suggest": {
"aws/aws-sdk-php": "Allow using IAM authentication with Amazon ElasticSearch Service",
"guzzlehttp/guzzle": "Allow using guzzle as transport",
"monolog/monolog": "Logging request"
},
"autoload": {
Expand All @@ -49,11 +45,12 @@
"config": {
"allow-plugins": {
"php-http/discovery": true
}
},
"sort-packages": true
},
"extra": {
"branch-alias": {
"dev-master": "7.0.x-dev"
"dev-master": "8.0.x-dev"
}
}
}
5 changes: 0 additions & 5 deletions phpstan-baseline.neon
Original file line number Diff line number Diff line change
Expand Up @@ -60,11 +60,6 @@ parameters:
count: 1
path: tests/ClientFunctionalTest.php

-
message: "#^Parameter \\#1 \\$params of static method Elastica\\\\Connection\\:\\:create\\(\\) expects array\\|Elastica\\\\Connection, string given\\.$#"
count: 1
path: tests/ConnectionTest.php

-
message: "#^Access to an undefined property Elastica\\\\Document\\:\\:\\$field1\\.$#"
count: 1
Expand Down
16 changes: 12 additions & 4 deletions src/Bulk.php
Original file line number Diff line number Diff line change
Expand Up @@ -133,8 +133,12 @@ public function getActions(): array
*/
public function addDocument(Document $document, ?string $opType = null): self
{
if (!$document->hasRetryOnConflict() && $this->_client->hasConnection() && $this->_client->getConnection()->hasParam('retryOnConflict') && ($retry = $this->_client->getConnection()->getParam('retryOnConflict')) > 0) {
$document->setRetryOnConflict($retry);
if (!$document->hasRetryOnConflict()) {
$retry = $this->_client->getConfigValue('retryOnConflict', 0);

if ($retry > 0) {
$document->setRetryOnConflict($retry);
}
}

$action = AbstractDocumentAction::create($document, $opType);
Expand All @@ -161,8 +165,12 @@ public function addDocuments(array $documents, ?string $opType = null): self
*/
public function addScript(AbstractScript $script, ?string $opType = null): self
{
if (!$script->hasRetryOnConflict() && $this->_client->hasConnection() && $this->_client->getConnection()->hasParam('retryOnConflict') && ($retry = $this->_client->getConnection()->getParam('retryOnConflict')) > 0) {
$script->setRetryOnConflict($retry);
if (!$script->hasRetryOnConflict()) {
$retry = $this->_client->getConfigValue('retryOnConflict', 0);

if ($retry > 0) {
$script->setRetryOnConflict($retry);
}
}

$action = AbstractDocumentAction::create($script, $opType);
Expand Down
Loading

0 comments on commit a0e63b3

Please sign in to comment.