Skip to content

Commit 6c32f9a

Browse files
generate types for the Elasticsearch response
1 parent fb18f38 commit 6c32f9a

File tree

9 files changed

+3400
-2376
lines changed

9 files changed

+3400
-2376
lines changed

elasticsearch_dsl/response/__init__.py

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,9 @@
2222
Generic,
2323
Iterator,
2424
List,
25+
Mapping,
2526
Optional,
27+
Sequence,
2628
Tuple,
2729
Union,
2830
cast,
@@ -32,6 +34,7 @@
3234
from .hit import Hit, HitMeta
3335

3436
if TYPE_CHECKING:
37+
from .. import types
3538
from ..aggs import Agg
3639
from ..faceted_search_base import FacetedSearchBase
3740
from ..search_base import Request, SearchBase
@@ -41,11 +44,47 @@
4144

4245

4346
class Response(AttrDict[Any], Generic[_R]):
47+
"""An Elasticsearch response.
48+
49+
:arg took: (required)
50+
:arg timed_out: (required)
51+
:arg _shards: (required)
52+
:arg hits: search results
53+
:arg aggregations: aggregation results
54+
:arg _clusters:
55+
:arg fields:
56+
:arg max_score:
57+
:arg num_reduce_phases:
58+
:arg profile:
59+
:arg pit_id:
60+
:arg _scroll_id:
61+
:arg suggest:
62+
:arg terminated_early:
63+
"""
64+
4465
_search: "SearchBase[_R]"
4566
_faceted_search: "FacetedSearchBase[_R]"
4667
_doc_class: Optional[_R]
4768
_hits: List[_R]
4869

70+
took: int
71+
timed_out: bool
72+
_shards: "types.ShardStatistics"
73+
_clusters: "types.ClusterStatistics"
74+
fields: Mapping[str, Any]
75+
max_score: float
76+
num_reduce_phases: int
77+
profile: "types.Profile"
78+
pit_id: str
79+
_scroll_id: str
80+
suggest: Mapping[
81+
str,
82+
Sequence[
83+
Union["types.CompletionSuggest", "types.PhraseSuggest", "types.TermSuggest"]
84+
],
85+
]
86+
terminated_early: bool
87+
4988
def __init__(
5089
self,
5190
search: "Request[_R]",

0 commit comments

Comments
 (0)