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

Generate types for the Elasticsearch responses #1929

Merged
merged 4 commits into from
Oct 18, 2024

Conversation

miguelgrinberg
Copy link
Collaborator

@miguelgrinberg miguelgrinberg commented Oct 10, 2024

This change adds types to the search and update by query Elasticsearch response classes. Still to do are the aggregations and the Hit class, which will be added separately.

@miguelgrinberg miguelgrinberg force-pushed the autogenerate-responses branch 2 times, most recently from 50cb86b to 118ff63 Compare October 18, 2024 10:27
@miguelgrinberg miguelgrinberg marked this pull request as ready for review October 18, 2024 10:28
@@ -41,11 +44,47 @@


class Response(AttrDict[Any], Generic[_R]):
"""An Elasticsearch response.

:arg took: (required)
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sadly none of the response attributes appear to have documentation.

Copy link
Member

@pquentin pquentin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! LGTM. Happy to merge this, my comments are not blocking.

utils/templates/response.__init__.py.tpl Outdated Show resolved Hide resolved
utils/generator.py Outdated Show resolved Hide resolved
utils/generator.py Show resolved Hide resolved
examples/async/completion.py Show resolved Hide resolved
Co-authored-by: Quentin Pradet <quentin.pradet@gmail.com>
@miguelgrinberg miguelgrinberg added the backport 8.x Backport to 8.x label Oct 18, 2024
@miguelgrinberg miguelgrinberg merged commit 579f572 into elastic:main Oct 18, 2024
17 checks passed
@miguelgrinberg miguelgrinberg deleted the autogenerate-responses branch October 18, 2024 14:06
github-actions bot pushed a commit that referenced this pull request Oct 18, 2024
* generate types for the Elasticsearch response

* typing of the update by query response

* minor typing updates

* Update utils/templates/response.__init__.py.tpl

Co-authored-by: Quentin Pradet <quentin.pradet@gmail.com>

---------

Co-authored-by: Quentin Pradet <quentin.pradet@gmail.com>
(cherry picked from commit 579f572)
miguelgrinberg added a commit that referenced this pull request Oct 18, 2024
* generate types for the Elasticsearch response

* typing of the update by query response

* minor typing updates

* Update utils/templates/response.__init__.py.tpl

Co-authored-by: Quentin Pradet <quentin.pradet@gmail.com>

---------

Co-authored-by: Quentin Pradet <quentin.pradet@gmail.com>
(cherry picked from commit 579f572)

Co-authored-by: Miguel Grinberg <miguel.grinberg@gmail.com>
miguelgrinberg added a commit to miguelgrinberg/elasticsearch-dsl-py that referenced this pull request Dec 9, 2024
* generate types for the Elasticsearch response

* typing of the update by query response

* minor typing updates

* Update utils/templates/response.__init__.py.tpl

Co-authored-by: Quentin Pradet <quentin.pradet@gmail.com>

---------

Co-authored-by: Quentin Pradet <quentin.pradet@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport 8.x Backport to 8.x
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants