Skip to content

Commit 74a3788

Browse files
add esql+dsl example
1 parent 89e00b4 commit 74a3788

File tree

6 files changed

+8
-8
lines changed

6 files changed

+8
-8
lines changed

elasticsearch/esql/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,4 @@
1616
# under the License.
1717

1818
from ..dsl import E # noqa: F401
19-
from .esql import ESQL, and_, not_, or_ # noqa: F401
19+
from .esql import ESQL, ESQLBase, and_, not_, or_ # noqa: F401

elasticsearch/esql/functions.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -649,7 +649,7 @@ def min_over_time(field: ExpressionType) -> InstrumentedExpression:
649649

650650

651651
def multi_match(
652-
query: ExpressionType, fields: ExpressionType, options: ExpressionType = None
652+
query: ExpressionType, *fields: ExpressionType, options: ExpressionType = None
653653
) -> InstrumentedExpression:
654654
"""Use `MULTI_MATCH` to perform a multi-match query on the specified field.
655655
The multi_match query builds on the match query to allow multi-field queries.
@@ -661,11 +661,11 @@ def multi_match(
661661
"""
662662
if options is not None:
663663
return InstrumentedExpression(
664-
f"MULTI_MATCH({_render(query)}, {_render(fields)}, {_render(options)})"
664+
f'MULTI_MATCH({_render(query)}, {", ".join([_render(c) for c in fields])}, {_render(options)})'
665665
)
666666
else:
667667
return InstrumentedExpression(
668-
f"MULTI_MATCH({_render(query)}, {_render(fields)})"
668+
f'MULTI_MATCH({_render(query)}, {", ".join([_render(c) for c in fields])})'
669669
)
670670

671671

examples/dsl/semantic_text.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
2222
Requirements:
2323
24-
$ pip install "elasticsearch" tqdm
24+
$ pip install elasticsearch tqdm
2525
2626
Before running this example, an ELSER inference endpoint must be created in the
2727
Elasticsearch cluster. This can be done manually from Kibana, or with the

examples/dsl/sparse_vectors.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
2121
Requirements:
2222
23-
$ pip install nltk tqdm "elasticsearch"
23+
$ pip install nltk tqdm elasticsearch
2424
2525
Before running this example, the ELSER v2 model must be downloaded and deployed
2626
to the Elasticsearch cluster, and an ingest pipeline must be defined. This can

examples/dsl/vectors.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
2121
Requirements:
2222
23-
$ pip install nltk sentence_transformers tqdm "elasticsearch"
23+
$ pip install nltk sentence_transformers tqdm elasticsearch
2424
2525
To run the example:
2626

utils/run-unasync-dsl.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ def main(check=False):
121121
[
122122
"sed",
123123
"-i.bak",
124-
"s/elasticsearch\\[async\\]/elasticsearch/",
124+
's/"elasticsearch\\[async\\]"/elasticsearch/',
125125
f"{output_dir}{file}",
126126
]
127127
)

0 commit comments

Comments
 (0)