Skip to content

Auto-generate aggregation classes #1918

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

Merged
merged 2 commits into from
Oct 4, 2024
Merged
Show file tree
Hide file tree
Changes from all 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
3,522 changes: 3,359 additions & 163 deletions elasticsearch_dsl/aggs.py

Large diffs are not rendered by default.

10 changes: 6 additions & 4 deletions elasticsearch_dsl/query.py
Original file line number Diff line number Diff line change
Expand Up @@ -624,7 +624,9 @@ def __init__(
Literal["multiply", "replace", "sum", "avg", "max", "min"], "DefaultType"
] = DEFAULT,
functions: Union[
Sequence["types.FunctionScoreContainer"], Dict[str, Any], "DefaultType"
Sequence["types.FunctionScoreContainer"],
Sequence[Dict[str, Any]],
"DefaultType",
] = DEFAULT,
max_boost: Union[float, "DefaultType"] = DEFAULT,
min_score: Union[float, "DefaultType"] = DEFAULT,
Expand Down Expand Up @@ -1688,7 +1690,7 @@ def __init__(
organic: Union[Query, "DefaultType"] = DEFAULT,
ids: Union[Sequence[str], "DefaultType"] = DEFAULT,
docs: Union[
Sequence["types.PinnedDoc"], Dict[str, Any], "DefaultType"
Sequence["types.PinnedDoc"], Sequence[Dict[str, Any]], "DefaultType"
] = DEFAULT,
boost: Union[float, "DefaultType"] = DEFAULT,
_name: Union[str, "DefaultType"] = DEFAULT,
Expand Down Expand Up @@ -2372,7 +2374,7 @@ def __init__(
self,
*,
clauses: Union[
Sequence["types.SpanQuery"], Dict[str, Any], "DefaultType"
Sequence["types.SpanQuery"], Sequence[Dict[str, Any]], "DefaultType"
] = DEFAULT,
in_order: Union[bool, "DefaultType"] = DEFAULT,
slop: Union[int, "DefaultType"] = DEFAULT,
Expand Down Expand Up @@ -2459,7 +2461,7 @@ def __init__(
self,
*,
clauses: Union[
Sequence["types.SpanQuery"], Dict[str, Any], "DefaultType"
Sequence["types.SpanQuery"], Sequence[Dict[str, Any]], "DefaultType"
] = DEFAULT,
boost: Union[float, "DefaultType"] = DEFAULT,
_name: Union[str, "DefaultType"] = DEFAULT,
Expand Down
6 changes: 3 additions & 3 deletions elasticsearch_dsl/search_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -949,7 +949,7 @@ def to_dict(self, count: bool = False, **kwargs: Any) -> Dict[str, Any]:
d = {}

if self.query:
d["query"] = self.query.to_dict()
d["query"] = recursive_to_dict(self.query)

if self._knn:
if len(self._knn) == 1:
Expand All @@ -963,10 +963,10 @@ def to_dict(self, count: bool = False, **kwargs: Any) -> Dict[str, Any]:
# count request doesn't care for sorting and other things
if not count:
if self.post_filter:
d["post_filter"] = self.post_filter.to_dict()
d["post_filter"] = recursive_to_dict(self.post_filter.to_dict())

if self.aggs.aggs:
d.update(self.aggs.to_dict())
d.update(recursive_to_dict(self.aggs.to_dict()))

if self._sort:
d["sort"] = self._sort
Expand Down
Loading
Loading