You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This will be addressed after #1890 is merged. All query classes are going to have explicit arguments. Here is how Term is going to be defined:
classTerm(Query):
""" Returns documents that contain an exact term in a provided field. To return a document, the query term must exactly match the queried field's value, including whitespace and capitalization. :arg _field: The field to use in this query. :arg _value: The query value for the field. """name="term"def__init__(
self,
_field: Union[str, "InstrumentedField", "NotSet"] =NOT_SET,
_value: Union["i.TermQuery", Dict[str, Any], "NotSet"] =NOT_SET,
**kwargs: Any,
):
ifnotisinstance(_field, NotSet):
kwargs[str(_field)] =_valuesuper().__init__(**kwargs)
If you want to take advantage of typing, then you would call Term(field, value), but you can also use the current form and do Term(**kwargs). The _expand__to_dot will still be supported.
DslBase.__init__()
typing does not accept dict unpacking, hence allQuery
subclasses.elasticsearch-dsl-py/elasticsearch_dsl/utils.py
Line 326 in 318ea9a
For example,
Term(**my_dict)
will result in following mypy error:error: Argument 1 to "Term" has incompatible type "**Dict[str, str]"; expected "Optional[bool]
This is due to
_expand__to_dot
, mypy assumes allparams
have unified type. Maybe just use**params: Any
and pop_expand__to_dot
from there?The text was updated successfully, but these errors were encountered: