Comments (5)
Yes, definitely agree. I'll fix this right now.
We should be able to catch just TransportException
, since all the Curl errors (OperationTimeoutException
, etc) and generic node-related errors (ServerErrorResponseException
, etc) are children of TransportException
I'll run some test and make sure it doesn't do anything funky. Thanks for filing this bug!
from elasticsearch-php.
Awesome changes, the b4e71ce commit is great too, thx!
from elasticsearch-php.
Sorry if I misunderstand the unit test, but if I changed the test as
public function testOneGoodOneBadHostNoException()
{
$params = array('hosts' => array (
'127.0.0.1:9201',
'127.0.0.1:9200',
));
$client = new Elasticsearch\Client($params);
$client->exists(array("index" => 'test', 'type' => 'test', 'id' => 'test'));
}
An exception may (as host is randomly selected, only 127.0.0.1:9201 will cause error) throw
- Elasticsearch\Tests\ClientTest::testOneGoodOneBadHostNoException
Elasticsearch\Common\Exceptions\Curl\CouldNotConnectToHost: Failed to connect to 127.0.0.1 port 9201: Connection refused
Two changes I have made to the
Elasticsearch\Tests\ClientTest::testOneGoodOneBadHostNoException
- change the first host as the one dead
- add $client->exists()
It seems to me that the ES client can not bypass the dead host and uses the one alive without exception throw.
from elasticsearch-php.
Good catch, thanks for the bug report!
I was bitten by the infamous PHP isset
vs null
issue. The retries
parameter is set to null in the default configurations so that the user can see what options are available. But because the default retry value depends on the number of hosts, it has to be dynamically configured on client initialization.
So in the default config, retries
is set to null. But when dynamically adjusting the value, I was only checking for isset()
, so retries was not being set correctly.
Code has been updated, and I tweaked your test to force the issue. I'll tag some releases in a few minutes so that this fix becomes generally available. While I was digging around, I also found another retry bug and an optimization. Thanks!
from elasticsearch-php.
I see it's working now.
Thanks Zachary for the quick fix.
BTW, I got another question about dead hosts and here is link
from elasticsearch-php.
Related Issues (20)
- check the index exsists ,it have a error HOT 1
- Connecting to Elasticsearch v8.x using the v7.17.x client HOT 1
- Received a 403 Forbidden error when attempting to index HOT 1
- `Response\Elasticsearch::offsetGet()` return type declaration HOT 2
- Need a new Release 6.8.3 HOT 4
- ServerError was not handled correctly. HOT 2
- Add support for Elasticsearch with Bulk API and data stream HOT 1
- How to pass specific characters password to ElasticSearch through Sulu/ArticleBundle HOT 5
- [Request feedback] Looking for feedback about the UX experience
- Calling static trait method ... is deprecated HOT 1
- Inquiries about version use HOT 2
- [Proposal] Add a mapTo(class) function for map ES|QL response into objects HOT 1
- Why Can't I update the mapping with Laravel Scout? HOT 1
- 使用PHP GET方法,不能获取到文档内容 HOT 4
- please help me change the php code from pagination from + size to search_after HOT 5
- failed to get the last sort using search_after HOT 1
- Add OpenTelemetry support HOT 1
- will elasticsearch-php pre-open the urls on the page when I visit it? HOT 3
- "Type: illegal_argument_exception Reason: "Fielddata is disabled on [pageCategory] in [elastic_web_index]. Text fields are not optimised for operations that require per-document field data like aggregations HOT 1
- PHP 8.4 Deprecations in ClientBuilder
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from elasticsearch-php.