Types¶
- ProjectedFieldArg = list[str] | set[str] | dict[str, typing.Literal[0]] | dict[str, typing.Literal[1]] | dict[str, typing.Literal[True]] | dict[str, typing.Literal[False]][source]¶
Represent a PEP 604 union type
E.g. for int | str
- SortListParam[source]¶
Built-in mutable sequence.
If no argument is given, the constructor creates a new empty list. The argument must be an iterable if specified.
alias of
list[tuple[str,Literal[1, -1]]]
- SortParam = str | list[tuple[str, typing.Literal[1, -1]]][source]¶
Represent a PEP 604 union type
E.g. for int | str
- class SearchArgs[source]¶
Dictionary containing Elasticsearch search arguments
This is for use with the .find methods in elastic clients
- source: str | dict¶
A JSON string containing an elasticsearch query
- q: str¶
A query string
- df: str¶
Default field, for use with the query string
- default_operator: str¶
Default operator, for use with the query string (defaults to “AND”)
- filter: str | dict¶
A JSON string containing bool query filters, to be applied to the elastic query
- filters: list[dict[str, Any]]¶
A list of dictionaries containing bool query filters, to be applied to the elastic query
- class SearchRequest(*, args: ~superdesk.core.types.search.SearchArgs | None = None, sort: str | list[tuple[str, ~typing.Literal[1, -1]]] | None = None, max_results: int = 25, page: int = 1, where: str | dict | None = None, aggregations: bool = False, highlight: bool = False, projection: list[str] | set[str] | dict[str, ~typing.Literal[0]] | dict[str, ~typing.Literal[1]] | dict[str, ~typing.Literal[True]] | dict[str, ~typing.Literal[False]] | None = None, version: int | None = None, use_mongo: bool | None = None, elastic: ~superdesk.core.types.search.ESQuery = <factory>, case_insensitive: bool | None = None, **extra_data: ~typing.Any)[source]¶
Dataclass containing Elasticsearch request arguments
- model_config: ClassVar[ConfigDict] = {'extra': 'allow'}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- args: SearchArgs | None¶
Argument for the search filters
- sort: str | list[tuple[str, Literal[1, -1]]] | None¶
Sorting to be used
- page: int¶
The page number to be returned
- where: str | dict | None¶
A JSON string contianing an Elasticsearch where query
- aggregations: bool¶
If True, will include aggregations with the result
- highlight: bool¶
If True, will include highlights with the result
- projection: list[str] | set[str] | dict[str, Literal[0]] | dict[str, Literal[1]] | dict[str, Literal[True]] | dict[str, Literal[False]] | None¶
The field projections to be applied
- case_insensitive: bool | None¶
If True it will make mongo query case-insensitive