Skip to content
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

Allow ignoring of missing documents (404) for get and delete #44

Merged
merged 2 commits into from
Nov 22, 2020

Conversation

joosterman
Copy link
Contributor

@joosterman joosterman commented Nov 3, 2020

Change

This PR adds functionality to the get and delete method adhere to the ignore parameter in case the document is not found. Previously a NotFoundError was raised. Now we check if we need to ignore 404 errors and if so, simply return an object where the found flag is False.

Documentation: https://elasticsearch-py.readthedocs.io/en/latest/api.html#ignore

@joosterman joosterman changed the title Ignore 404 Allow ignoring of missing documents (404) for get and delete Nov 3, 2020
@joosterman
Copy link
Contributor Author

joosterman commented Nov 3, 2020

I now implemented ignoring for the obvious two candidates. However ignoring in ES works for more than these. Basically in all cases we throw a NotFoundError the ignore=404 should result in a valid JSON response with the error field set.

@vrcmarcos What are your thoughts on making ignoring complete for the currently mocked functions?

@vrcmarcos
Copy link
Owner

Awesome addition, @joosterman ! The last time I used elasticsearch was 3 yeras ago, I was not aware of that feature. Don't even known if it is an old feature or not.

If ES supports on more methods, it make sense to add it to the other mocked functions too! Your PR looks great! Will merge it

@vrcmarcos vrcmarcos merged commit cbf604f into vrcmarcos:master Nov 22, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants