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(skip_empty=False) doesn't work recursively #1577

Open
sirloon opened this issue Mar 16, 2022 · 0 comments
Open

to_dict(skip_empty=False) doesn't work recursively #1577

sirloon opened this issue Mar 16, 2022 · 0 comments
Labels
Category: Bug Something isn't right Priority: High

Comments

@sirloon
Copy link

sirloon commented Mar 16, 2022

Hi, consider the following document indexed on ES:

{'_id': 'id123',
 '_index': 'index123',
 '_source': {
  'one_field': {'entries': []},
 }
}

Calling to_dict(skip_empty=False) on the corresponding DSL Document created out of it will return:

{"one_field": {}}

instead of

{"one_field": {"entries": []}}

After few tests, I believe the issue comes from the fact the serialize() can sometimes call to_dict(), without passing skip_empty, ex: https://github.com/elastic/elasticsearch-dsl-py/blob/master/elasticsearch_dsl/field.py#L226

HTH. Thanks!

@miguelgrinberg miguelgrinberg added the Category: Bug Something isn't right label Apr 5, 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

No branches or pull requests

2 participants