-
Notifications
You must be signed in to change notification settings - Fork 25k
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
Expose version type to Update & Delete by query #18750
Conversation
This commit adds a `version_type` option to the request body for both Update-by-query and Delete-by-query. The option can take the value `internal` (default) and `force`. This last one can help to update or delete documents that have been created with an external version number equal to zero. closes elastic#16654
@nik9000 Do you want to review this one? |
We did a ton of talking about version_type in #15125 and I think we came to the conclusion that exposing The trouble with update and delete by query is that they sort of imply internal versioning - you are letting Elasticsearch pick the next version. If you were syncing from an external source and you marked that source as "no longer visible" then it should get a version bump and whatever mechanism you have to syncing it with Elasticsearch should just pick it up and sync again, deleting it based on the change in the external source. |
Thanks for the precisions Nik. I understand this decision but I'm still kind of mixed about this. Elasticsearch allows the documents to have an external version potentially starting from 0 where internal versionning starts from 1. Depending of the value of the version number, Update-By-Query and Delete-By-Query will work (in case of version > 0) or report a version conflict (for version = 0). We know the implementation details and why it works like this but from a end-user point of view this might looks like a bug. I'm OK to not expose Anyway, this pull request can be changed to either: but we must not let the situation as it is. |
The main thing that makes this complicated is that strictly speaking, delete is an operation just like any other one and therefore the only safe version types are As @nik9000 already said, when we discussed the potential options with delete/update by query we decided to not get into all of this complexity. Long term, when we have seq# and they are used for replication versioning, we can expose this type of operations safely. For now I would opt for option b you describe - just doc things properly. |
This could possibly be worked around by allowing |
Closed in favor of #19180 which documents this special case. |
This commit adds a
version_type
option to the request body for both Update-by-query and Delete-by-query. The option can take the valueinternal
(default) andforce
. This last one can help to update or delete documents that have been created with an external version number equal to zero.closes #16654