Skip to content

Commit a1d1a81

Browse files
authored
Add GA lifecycle and version metadata to Contains function (#133445)
* Add GA lifecycle and version metadata to `Contains` function * Adding documentation around null
1 parent f690a21 commit a1d1a81

File tree

6 files changed

+37
-19
lines changed

6 files changed

+37
-19
lines changed

docs/reference/query-languages/esql/_snippets/functions/description/contains.md

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/reference/query-languages/esql/_snippets/functions/layout/contains.md

Lines changed: 3 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/reference/query-languages/esql/_snippets/functions/parameters/contains.md

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/reference/query-languages/esql/kibana/definition/functions/contains.json

Lines changed: 9 additions & 9 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/reference/query-languages/esql/kibana/docs/functions/contains.md

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/expression/function/scalar/string/Contains.java

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@
1818
import org.elasticsearch.xpack.esql.core.tree.Source;
1919
import org.elasticsearch.xpack.esql.core.type.DataType;
2020
import org.elasticsearch.xpack.esql.expression.function.Example;
21+
import org.elasticsearch.xpack.esql.expression.function.FunctionAppliesTo;
22+
import org.elasticsearch.xpack.esql.expression.function.FunctionAppliesToLifecycle;
2123
import org.elasticsearch.xpack.esql.expression.function.FunctionInfo;
2224
import org.elasticsearch.xpack.esql.expression.function.OptionalArgument;
2325
import org.elasticsearch.xpack.esql.expression.function.Param;
@@ -41,13 +43,26 @@ public class Contains extends EsqlScalarFunction implements OptionalArgument {
4143
private final Expression str;
4244
private final Expression substr;
4345

44-
@FunctionInfo(returnType = "boolean", description = """
45-
Returns true if a keyword substring is within another string.
46-
Returns false if the substring cannot be found.""", examples = @Example(file = "string", tag = "contains"))
46+
@FunctionInfo(
47+
returnType = "boolean",
48+
description = """
49+
Returns a boolean that indicates whether a keyword substring is within another string.
50+
Returns `null` if either parameter is null.""",
51+
examples = @Example(file = "string", tag = "contains"),
52+
appliesTo = { @FunctionAppliesTo(lifeCycle = FunctionAppliesToLifecycle.GA, version = "9.2.0") }
53+
)
4754
public Contains(
4855
Source source,
49-
@Param(name = "string", type = { "keyword", "text" }, description = "An input string") Expression str,
50-
@Param(name = "substring", type = { "keyword", "text" }, description = "A substring to find in the input string") Expression substr
56+
@Param(
57+
name = "string",
58+
type = { "keyword", "text" },
59+
description = "String expression: input string to check against. If `null`, the function returns `null`."
60+
) Expression str,
61+
@Param(
62+
name = "substring",
63+
type = { "keyword", "text" },
64+
description = "String expression: A substring to find in the input string. If `null`, the function returns `null`."
65+
) Expression substr
5166
) {
5267
super(source, Arrays.asList(str, substr));
5368
this.str = str;

0 commit comments

Comments
 (0)