in elasticsearch/dsl/function.py [0:0]
def to_dict(self) -> Dict[str, Any]:
d = super().to_dict()
# filter and query dicts should be at the same level as us
for k in self._param_defs:
if self.name is not None:
val = d[self.name]
if isinstance(val, dict) and k in val:
d[k] = val.pop(k)
return d