-
Notifications
You must be signed in to change notification settings - Fork 185
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
[BUG] Bulk operation throwing 'action_request_validation_exception" when doing bulk delete. #873
Comments
Looks like a bug. Want to try and write a (failing) test for this @ausmanlumeris? |
Facing the same issue at my day job. I can volunteer writing a failing test case. |
@dblock @ausmanlumeris Well it's actually not a bug. We are supposed to use docs = [{"delete": {"_index": "<index name", "_id": "<id>"}}]
client.bulk(docs) This shall pass what we are trying to do. Coming to the bulk in helper it is only for the purpose of bulk indexing. It just takes your data object as it is and pushes it to index. so it actually isn't detecting your operation. (Maybe the name of that bulk method inside helper is confusing us ? Or we can have some comments on the separation of bulk from client and helper) But for what we intend to do the above solution works the best. @dblock I have also updated the PR with passing test case with client implementation so that we have a sanity on it's working. Will be happy to coordinate further in case if there is something else we need to do. |
Does it make sense to add support for deletions in the bulk helper or do something in code that prevents future errors? Either way do take a look at the documentation, maybe a few words added can help the next person? |
Yes, Actually documentation made me realize that we were using it in wrong way. There is no mention of helpers in documentation https://opensearch.org/docs/latest/clients/python-low-level/ and also it makes more sense to use client instead.
Ah, I am not sure. I would like to learn why helpers exist ? What's the purpose of helpers in codebase ? Becase we are allowing same methods in client. Maybe it could be an abstraction somewhere? Cannot learn about them from documentations anywhere. This will then give a better idea if we should add delete to it or not. |
@Harshil-Jani It's all legacy from when OpenSearch forked 3 years ago. I am 100% with you that helpers should really not exist and be wrappers on top of existing APIs. If you want to undertake that kind of change, please do! That said, progress > perfection, so if you think you can contribute something/anything that would have prevented you from wasting a lot of time debugging a non-existent problem that would be very much appreciated. |
What is the bug?
When using helpers.bulk to delete objects in bulk, the helpers.bulk function throws the exception shown below. I noticed there are no examples of doing a delete in the documentation.
How can one reproduce the bug?
Use this code.
What is the expected behavior?
The bulk function should be able to delete objects in bulk. The same request works fine from postman when going directly against the opensearch '_bulk' API.
What is your host/environment?
OS: MacOS 14.7.1 (23H222)
Python 3.12.3
opensearch-py: 2.8.0
The text was updated successfully, but these errors were encountered: