Skip to content

Commit 42dc6e9

Browse files
Fixes
1 parent a8e2733 commit 42dc6e9

File tree

3 files changed

+8
-5
lines changed

3 files changed

+8
-5
lines changed

x-pack/plugin/esql/qa/testFixtures/src/main/resources/qstr-function.csv-spec

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -193,11 +193,13 @@ qstrWithFieldAndOptions
193193
required_capability: qstr_function
194194
required_capability: query_string_function_options
195195

196+
// tag::qstr-with-options[]
196197
FROM books
197198
| WHERE QSTR("title: Hobbjt~", {"fuzziness": 2})
198199
| KEEP book_no, title
199200
| SORT book_no
200201
| LIMIT 5
202+
// end::qstr-with-options[]
201203
;
202204
ignoreOrder: true
203205

x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/expression/function/fulltext/QueryString.java

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,6 @@
6363
import static org.elasticsearch.index.query.QueryStringQueryBuilder.TIME_ZONE_FIELD;
6464
import static org.elasticsearch.xpack.esql.core.expression.TypeResolutions.ParamOrdinal.FIRST;
6565
import static org.elasticsearch.xpack.esql.core.expression.TypeResolutions.ParamOrdinal.SECOND;
66-
import static org.elasticsearch.xpack.esql.core.expression.TypeResolutions.ParamOrdinal.THIRD;
6766
import static org.elasticsearch.xpack.esql.core.expression.TypeResolutions.isFoldable;
6867
import static org.elasticsearch.xpack.esql.core.expression.TypeResolutions.isMapExpression;
6968
import static org.elasticsearch.xpack.esql.core.expression.TypeResolutions.isNotNull;
@@ -115,7 +114,9 @@ public class QueryString extends FullTextFunction implements OptionalArgument {
115114
preview = true,
116115
description = "Performs a <<query-dsl-query-string-query,query string query>>. "
117116
+ "Returns true if the provided query string matches the row.",
118-
examples = { @Example(file = "qstr-function", tag = "qstr-with-field") }
117+
examples = {
118+
@Example(file = "qstr-function", tag = "qstr-with-field"),
119+
@Example(file = "qstr-function", tag = "qstr-with-options") }
119120
)
120121
public QueryString(
121122
Source source,
@@ -349,12 +350,12 @@ private Map<String, Object> queryStringOptions() throws InvalidArgumentException
349350

350351
private TypeResolution resolveOptions() {
351352
if (options() != null) {
352-
TypeResolution resolution = isNotNull(options(), sourceText(), THIRD);
353+
TypeResolution resolution = isNotNull(options(), sourceText(), SECOND);
353354
if (resolution.unresolved()) {
354355
return resolution;
355356
}
356357
// MapExpression does not have a DataType associated with it
357-
resolution = isMapExpression(options(), sourceText(), THIRD);
358+
resolution = isMapExpression(options(), sourceText(), SECOND);
358359
if (resolution.unresolved()) {
359360
return resolution;
360361
}

x-pack/plugin/esql/src/test/java/org/elasticsearch/xpack/esql/expression/function/fulltext/QueryStringErrorTests.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ private static String errorMessageStringForMatch(
6464
if (validPerPosition.get(i).contains(signature.get(i)) == false) {
6565
// Map expressions have different error messages
6666
if (i == 1) {
67-
return format(null, "third argument of [{}] must be a map expression, received []", sourceForSignature(signature));
67+
return format(null, "second argument of [{}] must be a map expression, received []", sourceForSignature(signature));
6868
}
6969
break;
7070
}

0 commit comments

Comments
 (0)