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

to_dict() doesn't convert inner_hits #1520

Closed
command-tab opened this issue Jul 28, 2021 · 1 comment · Fixed by #1892
Closed

to_dict() doesn't convert inner_hits #1520

command-tab opened this issue Jul 28, 2021 · 1 comment · Fixed by #1892
Labels
Category: Bug Something isn't right Priority: High

Comments

@command-tab
Copy link

Maybe related to #291, I'm attempting to dump my elasticsearch-dsl response by calling to_dict(), but it doesn't appear to walk the entire structure. inner_hits appear to be Response instances, but calling to_dict() on the top-level response doesn't convert them. Why does it convert hits but not inner_hits? Is there a simple way to convert the entire response without having to pick apart the structure and manually call to_dict() as needed?

I'm using Python 3.8 and elasticsearch-dsl 7.4.0.

Thanks so much for this library! ❤️ It's incredibly useful.

@srikanthmanvi srikanthmanvi added the Category: Bug Something isn't right label Feb 21, 2024
miguelgrinberg added a commit to miguelgrinberg/elasticsearch-dsl-py that referenced this issue Aug 30, 2024
miguelgrinberg added a commit to miguelgrinberg/elasticsearch-dsl-py that referenced this issue Aug 30, 2024
miguelgrinberg added a commit to miguelgrinberg/elasticsearch-dsl-py that referenced this issue Aug 30, 2024
miguelgrinberg added a commit to miguelgrinberg/elasticsearch-dsl-py that referenced this issue Aug 30, 2024
miguelgrinberg added a commit to miguelgrinberg/elasticsearch-dsl-py that referenced this issue Aug 30, 2024
github-actions bot pushed a commit that referenced this issue Sep 3, 2024
@miguelgrinberg
Copy link
Collaborator

miguelgrinberg commented Sep 3, 2024

With this fix, you can use response.to_dict(recursive=True) to ensure that the entire tree is converted to dict. The default for recursive is False.

miguelgrinberg added a commit that referenced this issue Sep 3, 2024
Fixes #1520

(cherry picked from commit 318ea9a)

Co-authored-by: Miguel Grinberg <miguel.grinberg@gmail.com>
miguelgrinberg added a commit to miguelgrinberg/elasticsearch-dsl-py that referenced this issue Dec 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Category: Bug Something isn't right Priority: High
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants