Skip to content

Generate typed JSON object structures and enums from the Elasticsearch Specification #1691

Open
@sethmlarson

Description

@sethmlarson

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.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions