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 typed JSON object structures and enums from the Elasticsearch Specification #1691

Open
sethmlarson opened this issue Aug 25, 2021 · 0 comments

Comments

@sethmlarson
Copy link
Contributor

Generate these structures using https://github.com/elastic/elasticsearch-specification and make them available through elasticsearch.types.* modules. This will allow having type-hints for APIs, especially useful for complex structures like query DSL:

from elasticsearch import Elasticsearch
from elasticsearch.types import ExpandWildcards, MatchQuery

client = Elasticsearch()
client.search(
    index="index",
    expand_wildcards=[ExpandWildcards.OPEN, ExpandWildcards.CLOSED],
    query={
        "match": {
            "field": MatchQuery(query="text")
        }
    }
)

All of these structures would be serialized to the proper JSON/HTTP structures before being handed to the transport layer.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant