Skip to content

Commit 1c47d3b

Browse files
authored
Merge pull request #34 from scorday/esquery_multi_match
Added multi_match query support
2 parents 766e926 + 4a46f84 commit 1c47d3b

File tree

1 file changed

+25
-1
lines changed

1 file changed

+25
-1
lines changed

esorm/query.py

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
"""
22
Elasticsearch query type definitions for ESORM
33
"""
4-
from typing import TypedDict, List, Dict, Union, Optional, Any
4+
from typing import Literal, TypedDict, List, Dict, Union, Optional, Any
55
from typing_extensions import TypeAlias
66
from . import aggs
77

@@ -240,6 +240,28 @@ class ESMatchNone(TypedDict):
240240
pass
241241

242242

243+
class ESMultiMatch(TypedDict, total=False):
244+
"""
245+
Represents a multi_match query in Elasticsearch.
246+
"""
247+
query: str
248+
""" Query string """
249+
250+
type: Optional[Literal[
251+
"best_fields",
252+
"most_fields",
253+
"cross_fields",
254+
"phrase",
255+
"phrase_prefix",
256+
"bool_prefix",
257+
]]
258+
""" Type of multi_match query """
259+
260+
fields: Optional[List[str]]
261+
""" Optional fields list to match on """
262+
263+
264+
243265
class FieldESMatchNone(TypedDict):
244266
"""
245267
Represents a match_none query for matching no documents in Elasticsearch.
@@ -369,6 +391,8 @@ class ESQuery(TypedDict, total=False):
369391
""" Match all query structure """
370392
match_none: ESMatchNone
371393
""" Match none query structure """
394+
multi_match: ESMultiMatch
395+
""" MultiMatch query structure """
372396
knn: ESKnnQuery
373397
""" KNN query structure """
374398
aggs: aggs.ESAggs

0 commit comments

Comments
 (0)