Browse Source

ES|QL: Add default values for match function options (#125282) (#125405)

(cherry picked from commit 160ac698d724970a5e2871be6e2ddb711abae799)

# Conflicts:
#	docs/reference/query-languages/esql/_snippets/functions/functionNamedParams/match.md
Carlos Delgado 6 months ago
parent
commit
4dbed7e220

+ 10 - 10
docs/reference/esql/functions/functionNamedParams/match.asciidoc

@@ -6,15 +6,15 @@
 |===
 name | types | description
 fuzziness | [keyword] | Maximum edit distance allowed for matching.
-auto_generate_synonyms_phrase_query | [boolean] | If true, match phrase queries are automatically created for multi-term synonyms.
-analyzer | [keyword] | Analyzer used to convert the text in the query value into token.
+auto_generate_synonyms_phrase_query | [boolean] | If true, match phrase queries are automatically created for multi-term synonyms. Defaults to true.
+analyzer | [keyword] | Analyzer used to convert the text in the query value into token. Defaults to the index-time analyzer mapped for the field. If no analyzer is mapped, the index’s default analyzer is used.
 minimum_should_match | [integer] | Minimum number of clauses that must match for a document to be returned.
-zero_terms_query | [keyword] | Number of beginning characters left unchanged for fuzzy matching.
-boost | [float] | Floating point number used to decrease or increase the relevance scores of the query.
-fuzzy_transpositions | [boolean] | If true, edits for fuzzy matching include transpositions of two adjacent characters (ab → ba).
-fuzzy_rewrite | [keyword] | Method used to rewrite the query. See the rewrite parameter for valid values and more information.
-prefix_length | [integer] | Number of beginning characters left unchanged for fuzzy matching.
-lenient | [boolean] | If false, format-based errors, such as providing a text query value for a numeric field, are returned.
-operator | [keyword] | Boolean logic used to interpret text in the query value.
-max_expansions | [integer] | Maximum number of terms to which the query will expand.
+zero_terms_query | [keyword] | Indicates whether all documents or none are returned if the analyzer removes all tokens, such as when using a stop filter. Defaults to none.
+boost | [float] | Floating point number used to decrease or increase the relevance scores of the query. Defaults to 1.0.
+fuzzy_transpositions | [boolean] | If true, edits for fuzzy matching include transpositions of two adjacent characters (ab → ba). Defaults to true.
+fuzzy_rewrite | [keyword] | Method used to rewrite the query. See the rewrite parameter for valid values and more information. If the fuzziness parameter is not 0, the match query uses a fuzzy_rewrite method of top_terms_blended_freqs_${max_expansions} by default.
+prefix_length | [integer] | Number of beginning characters left unchanged for fuzzy matching. Defaults to 0.
+lenient | [boolean] | If false, format-based errors, such as providing a text query value for a numeric field, are returned. Defaults to false.
+operator | [keyword] | Boolean logic used to interpret text in the query value. Defaults to OR.
+max_expansions | [integer] | Maximum number of terms to which the query will expand. Defaults to 50.
 |===

File diff suppressed because it is too large
+ 0 - 1
docs/reference/esql/functions/kibana/definition/match.json


+ 16 - 10
x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/expression/function/fulltext/Match.java

@@ -180,13 +180,14 @@ public class Match extends FullTextFunction implements OptionalArgument, PostAna
                     name = "analyzer",
                     type = "keyword",
                     valueHint = { "standard" },
-                    description = "Analyzer used to convert the text in the query value into token."
+                    description = "Analyzer used to convert the text in the query value into token. Defaults to the index-time analyzer"
+                        + " mapped for the field. If no analyzer is mapped, the index’s default analyzer is used."
                 ),
                 @MapParam.MapParamEntry(
                     name = "auto_generate_synonyms_phrase_query",
                     type = "boolean",
                     valueHint = { "true", "false" },
-                    description = "If true, match phrase queries are automatically created for multi-term synonyms."
+                    description = "If true, match phrase queries are automatically created for multi-term synonyms. Defaults to true."
                 ),
                 @MapParam.MapParamEntry(
                     name = "fuzziness",
@@ -198,13 +199,14 @@ public class Match extends FullTextFunction implements OptionalArgument, PostAna
                     name = "boost",
                     type = "float",
                     valueHint = { "2.5" },
-                    description = "Floating point number used to decrease or increase the relevance scores of the query."
+                    description = "Floating point number used to decrease or increase the relevance scores of the query. Defaults to 1.0."
                 ),
                 @MapParam.MapParamEntry(
                     name = "fuzzy_transpositions",
                     type = "boolean",
                     valueHint = { "true", "false" },
-                    description = "If true, edits for fuzzy matching include transpositions of two adjacent characters (ab → ba)."
+                    description = "If true, edits for fuzzy matching include transpositions of two adjacent characters (ab → ba). "
+                        + "Defaults to true."
                 ),
                 @MapParam.MapParamEntry(
                     name = "fuzzy_rewrite",
@@ -216,19 +218,22 @@ public class Match extends FullTextFunction implements OptionalArgument, PostAna
                         "top_terms_blended_freqs_N",
                         "top_terms_boost_N",
                         "top_terms_N" },
-                    description = "Method used to rewrite the query. See the rewrite parameter for valid values and more information."
+                    description = "Method used to rewrite the query. See the rewrite parameter for valid values and more information. "
+                        + "If the fuzziness parameter is not 0, the match query uses a fuzzy_rewrite method of "
+                        + "top_terms_blended_freqs_${max_expansions} by default."
                 ),
                 @MapParam.MapParamEntry(
                     name = "lenient",
                     type = "boolean",
                     valueHint = { "true", "false" },
-                    description = "If false, format-based errors, such as providing a text query value for a numeric field, are returned."
+                    description = "If false, format-based errors, such as providing a text query value for a numeric field, are returned. "
+                        + "Defaults to false."
                 ),
                 @MapParam.MapParamEntry(
                     name = "max_expansions",
                     type = "integer",
                     valueHint = { "50" },
-                    description = "Maximum number of terms to which the query will expand."
+                    description = "Maximum number of terms to which the query will expand. Defaults to 50."
                 ),
                 @MapParam.MapParamEntry(
                     name = "minimum_should_match",
@@ -240,19 +245,20 @@ public class Match extends FullTextFunction implements OptionalArgument, PostAna
                     name = "operator",
                     type = "keyword",
                     valueHint = { "AND", "OR" },
-                    description = "Boolean logic used to interpret text in the query value."
+                    description = "Boolean logic used to interpret text in the query value. Defaults to OR."
                 ),
                 @MapParam.MapParamEntry(
                     name = "prefix_length",
                     type = "integer",
                     valueHint = { "1" },
-                    description = "Number of beginning characters left unchanged for fuzzy matching."
+                    description = "Number of beginning characters left unchanged for fuzzy matching. Defaults to 0."
                 ),
                 @MapParam.MapParamEntry(
                     name = "zero_terms_query",
                     type = "keyword",
                     valueHint = { "none", "all" },
-                    description = "Number of beginning characters left unchanged for fuzzy matching."
+                    description = "Indicates whether all documents or none are returned if the analyzer removes all tokens, such as "
+                        + "when using a stop filter. Defaults to none."
                 ) },
             description = "(Optional) Match additional options as <<esql-function-named-params,function named parameters>>."
                 + " See <<query-dsl-match-query,match query>> for more information.",

Some files were not shown because too many files changed in this diff