-
Notifications
You must be signed in to change notification settings - Fork 737
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
UpdateByQuery issue #2226
Comments
Is my understanding correct that the info you are looking for is something like Line 146 in e2cb89b
|
Yep, something like that. But to be honest for clients of the library is more convenient way to use generic $response = $this->index->updateByQuery(...);
if ($response->isOk()) {
$response->getData();
} else {
$response->getErrorMessage();
} (This is just my IMO that is not consistent with ES API) |
@rtwent Would you be interested to take a stab at this and open a PR? |
It seems that my problem is in using the obsolete version of Your library. I investigated a bit. Elastica/src/Transport/Http.php Lines 177 to 179 in 8fe6176
since there is no error in the reponse body (only failures ) - the response is successfully populated. No exception is thrown.
I forked the project and tried to reproduce such behaviour on /**
* @group functional
*/
public function testUpdateByQueryFailure(): void
{
$index = $this->_createIndex();
$index->addDocument(new Document('1', ['name' => 'ruflin nicolas']),);
$index->refresh();
$this->assertEquals(1, $index->search('nicolas')->count());
$this->expectException(ClientResponseException::class);
// force updateByQuery failure by changing immutable field
$index->updateByQuery('*', new Script('ctx._source._id = "marc"'));
} I hope I understood everything correctly. Is there a sense to fix it for |
Given:
ES: 7.17
ruflin/elastica: 7.2.0 (but the issue is present on the dev version too)
Background: Due to architectural issues - we run
updateByQuery
in loop. Troubles in debugging had appeared.By the ES documentation the response of UpdateByQuery request is documented. It seems, for now, is impossible to retrieve the message, why request was failed.
Response::HasError()
will always returnfalse
, because oferror
property is not documented for_update_by_query
. As a result error message will be empty:Elastica/src/Response.php
Lines 134 to 139 in e2cb89b
isOk
is a way to identify the response status. But still, no error message will be provided.Example of failed response from elastic:
The text was updated successfully, but these errors were encountered: