Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions elasticsearch_dsl/document_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ def __init__(self, name: str, bases: Tuple[type, ...], attrs: Dict[str, Any]):
fields.update(annotations.keys())
field_defaults = {}
for name in fields:
value = None
value: Any = None
required = None
multi = None
if name in annotations:
Expand Down Expand Up @@ -201,7 +201,7 @@ def __init__(self, name: str, bases: Tuple[type, ...], attrs: Dict[str, Any]):
field_args = [type_]
elif type_ in self.type_annotation_map:
# use best field type for the type hint provided
field, field_kwargs = self.type_annotation_map[type_]
field, field_kwargs = self.type_annotation_map[type_] # type: ignore

if field:
field_kwargs = {
Expand Down
76 changes: 76 additions & 0 deletions elasticsearch_dsl/response/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,9 @@
Generic,
Iterator,
List,
Mapping,
Optional,
Sequence,
Tuple,
Union,
cast,
Expand All @@ -32,6 +34,7 @@
from .hit import Hit, HitMeta

if TYPE_CHECKING:
from .. import types
from ..aggs import Agg
from ..faceted_search_base import FacetedSearchBase
from ..search_base import Request, SearchBase
Expand All @@ -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.

:arg timed_out: (required)
:arg _shards: (required)
:arg hits: search results
:arg aggregations: aggregation results
:arg _clusters:
:arg fields:
:arg max_score:
:arg num_reduce_phases:
:arg profile:
:arg pit_id:
:arg _scroll_id:
:arg suggest:
:arg terminated_early:
"""

_search: "SearchBase[_R]"
_faceted_search: "FacetedSearchBase[_R]"
_doc_class: Optional[_R]
_hits: List[_R]

took: int
timed_out: bool
_shards: "types.ShardStatistics"
_clusters: "types.ClusterStatistics"
fields: Mapping[str, Any]
max_score: float
num_reduce_phases: int
profile: "types.Profile"
pit_id: str
_scroll_id: str
suggest: Mapping[
str,
Sequence[
Union["types.CompletionSuggest", "types.PhraseSuggest", "types.TermSuggest"]
],
]
terminated_early: bool

def __init__(
self,
search: "Request[_R]",
Expand Down Expand Up @@ -176,8 +215,45 @@ def __iter__(self) -> Iterator["Agg"]: # type: ignore[override]


class UpdateByQueryResponse(AttrDict[Any], Generic[_R]):
"""An Elasticsearch update by query response.

:arg batches:
:arg failures:
:arg noops:
:arg deleted:
:arg requests_per_second:
:arg retries:
:arg task:
:arg timed_out:
:arg took:
:arg total:
:arg updated:
:arg version_conflicts:
:arg throttled:
:arg throttled_millis:
:arg throttled_until:
:arg throttled_until_millis:
"""

_search: "UpdateByQueryBase[_R]"

batches: int
failures: Sequence["types.BulkIndexByScrollFailure"]
noops: int
deleted: int
requests_per_second: float
retries: "types.Retries"
task: Union[str, int]
timed_out: bool
took: Any
total: int
updated: int
version_conflicts: int
throttled: Any
throttled_millis: Any
throttled_until: Any
throttled_until_millis: Any

def __init__(
self,
search: "Request[_R]",
Expand Down
Loading
Loading