-
Notifications
You must be signed in to change notification settings - Fork 736
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
Does RetryOnConflict suppose to work with Bulk updates #2182
Comments
Can you share the exact code snippet you are using and the version of Elastica? There was in one version a change from Line 694 in 0f6b04b
|
Actually I'm using FOSElasticaBundle and they have added support for RetryOnConflict parameter per connection (FriendsOfSymfony/FOSElasticaBundle#965) long time ago. My config looks like: fos_elastica:
clients:
default: { url: '%env(ELASTICSEARCH_URL)%', retryOnConflict: 5 }
indexes: which sets However I can't see if the |
Having a quick look at the code, this might be a bug / missing feature in Elastica. I couldn't find a place where the retry_on_conflict from the agent it taken into account in bulk :-( When adding a document, to bulk, it should be checked if it is an update and if retry on conflict is set on the client side. If yes, it should add it: https://github.com/ruflin/Elastica/tree/8.x/src#L134 Could you by chance make this modification to your version of Elastica and see if it solves the problem? |
Sure, I will give a try. In the mean time, could you check the link (https://github.com/ruflin/Elastica/tree/8.x/src#L134). You might want to point to a file in the repo, but it got somehow removed. |
This is the file and line I wanted to link to: https://github.com/ruflin/Elastica/blob/8.x/src/Bulk.php#L134 Not sure where the file name was lost :-( |
Please see my PR. It adds the RetryOnConflict value (if exists) from the Client's connection configuration. With this change, I was able to generate the similar output (with this attribute) which was pasted in the opening message. |
This PR is created to solve the issue on the missing RetryOnConflict (retry_on_conflict) metadata attribute when adding documents in bulk (detailed at #2182)
I have an application which updates documents in bulk through multiple workers. I'd like to use the
retry_on_conflict
feature, but even if I have the setting at the ClientConfiguration,Bulk::addDocuments()
does not seem to add the necessary piece to the Document metadata in order to get the proper update action as it is described at https://www.elastic.co/guide/en/elasticsearch/reference/7.17/docs-bulk.html#bulk-updateThey say, every update should contain the
retry_on_conflict
attribute like this:I only get the
_id
and_index
values added to the document metadata. What do I do wrong?The text was updated successfully, but these errors were encountered: