diff --git a/docs/reference/elasticsearch/mapping-reference/semantic-text.md b/docs/reference/elasticsearch/mapping-reference/semantic-text.md index 0529b809733a..47a3439ce5b9 100644 --- a/docs/reference/elasticsearch/mapping-reference/semantic-text.md +++ b/docs/reference/elasticsearch/mapping-reference/semantic-text.md @@ -28,7 +28,10 @@ service. Using `semantic_text`, you won’t need to specify how to generate embeddings for your data, or how to index it. The {{infer}} endpoint automatically determines -the embedding generation, indexing, and query to use. +the embedding generation, indexing, and query to use. +Newly created indices with `semantic_text` fields using dense embeddings will be +[quantized](/reference/elasticsearch/mapping-reference/dense-vector.md#dense-vector-quantization) +to `bbq_hnsw` automatically. If you use the preconfigured `.elser-2-elasticsearch` endpoint, you can set up `semantic_text` with the following API request: @@ -246,10 +249,15 @@ is not supported for querying the field data. ## Updates to `semantic_text` fields [update-script] -For indices containing `semantic_text` fields, updates that use scripts have the following behavior: +For indices containing `semantic_text` fields, updates that use scripts have the +following behavior: -* Are supported through the [Update API](https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-update). -* Are not supported through the [Bulk API](https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-bulk-1) and will fail. Even if the script targets non-`semantic_text` fields, the update will fail when the index contains a `semantic_text` field. +* Are supported through + the [Update API](https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-update). +* Are not supported through + the [Bulk API](https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-bulk-1) + and will fail. Even if the script targets non-`semantic_text` fields, the + update will fail when the index contains a `semantic_text` field. ## `copy_to` and multi-fields support [copy-to-support] @@ -311,4 +319,5 @@ PUT test-index of [nested fields](/reference/elasticsearch/mapping-reference/nested.md). * `semantic_text` fields can’t currently be set as part of [Dynamic templates](docs-content://manage-data/data-store/mapping/dynamic-templates.md). -* `semantic_text` fields are not supported with Cross-Cluster Search (CCS) or Cross-Cluster Replication (CCR). +* `semantic_text` fields are not supported with Cross-Cluster Search (CCS) or + Cross-Cluster Replication (CCR). diff --git a/docs/reference/query-languages/esql/_snippets/functions/description/match.md b/docs/reference/query-languages/esql/_snippets/functions/description/match.md index 8dd64d967150..6d9a8d80f726 100644 --- a/docs/reference/query-languages/esql/_snippets/functions/description/match.md +++ b/docs/reference/query-languages/esql/_snippets/functions/description/match.md @@ -2,5 +2,5 @@ **Description** -Use `MATCH` to perform a [match query](/reference/query-languages/query-dsl/query-dsl-match-query.md) on the specified field. Using `MATCH` is equivalent to using the `match` query in the Elasticsearch Query DSL. Match can be used on fields from the text family like [text](/reference/elasticsearch/mapping-reference/text.md) and [semantic_text](/reference/elasticsearch/mapping-reference/semantic-text.md), as well as other field types like keyword, boolean, dates, and numeric types. Match can use [function named parameters](/reference/query-languages/esql/esql-syntax.md#esql-function-named-params) to specify additional options for the match query. All [match query parameters](/reference/query-languages/query-dsl/query-dsl-match-query.md#match-field-params) are supported. For a simplified syntax, you can use the [match operator](/reference/query-languages/esql/functions-operators/operators.md#esql-match-operator) `:` operator instead of `MATCH`. `MATCH` returns true if the provided query matches the row. +Use `MATCH` to perform a [match query](/reference/query-languages/query-dsl/query-dsl-match-query.md) on the specified field. Using `MATCH` is equivalent to using the `match` query in the Elasticsearch Query DSL. Match can be used on fields from the text family like [text](/reference/elasticsearch/mapping-reference/text.md) and [semantic_text](/reference/elasticsearch/mapping-reference/semantic-text.md), as well as other field types like keyword, boolean, dates, and numeric types. When Match is used on a [semantic_text](/reference/elasticsearch/mapping-reference/semantic-text.md) field, it will perform a semantic query on the field. Match can use [function named parameters](/reference/query-languages/esql/esql-syntax.md#esql-function-named-params) to specify additional options for the match query. All [match query parameters](/reference/query-languages/query-dsl/query-dsl-match-query.md#match-field-params) are supported. For a simplified syntax, you can use the [match operator](/reference/query-languages/esql/functions-operators/operators.md#esql-match-operator) `:` operator instead of `MATCH`. `MATCH` returns true if the provided query matches the row. diff --git a/docs/reference/query-languages/esql/kibana/definition/functions/match.json b/docs/reference/query-languages/esql/kibana/definition/functions/match.json index 18048a909155..fa3583cf115d 100644 --- a/docs/reference/query-languages/esql/kibana/definition/functions/match.json +++ b/docs/reference/query-languages/esql/kibana/definition/functions/match.json @@ -2,7 +2,7 @@ "comment" : "This is generated by ESQL’s AbstractFunctionTestCase. Do no edit it. See ../README.md for how to regenerate it.", "type" : "scalar", "name" : "match", - "description" : "Use `MATCH` to perform a match query on the specified field.\nUsing `MATCH` is equivalent to using the `match` query in the Elasticsearch Query DSL.\n\nMatch can be used on fields from the text family like text and semantic_text,\nas well as other field types like keyword, boolean, dates, and numeric types.\n\nMatch can use function named parameters to specify additional options for the match query.\nAll match query parameters are supported.\n\nFor a simplified syntax, you can use the match operator `:` operator instead of `MATCH`.\n\n`MATCH` returns true if the provided query matches the row.", + "description" : "Use `MATCH` to perform a match query on the specified field.\nUsing `MATCH` is equivalent to using the `match` query in the Elasticsearch Query DSL.\n\nMatch can be used on fields from the text family like text and semantic_text,\nas well as other field types like keyword, boolean, dates, and numeric types.\nWhen Match is used on a semantic_text field, it will perform a semantic query on the field.\n\nMatch can use function named parameters to specify additional options for the match query.\nAll match query parameters are supported.\n\nFor a simplified syntax, you can use the match operator `:` operator instead of `MATCH`.\n\n`MATCH` returns true if the provided query matches the row.", "signatures" : [ { "params" : [ diff --git a/docs/reference/query-languages/esql/kibana/docs/functions/match.md b/docs/reference/query-languages/esql/kibana/docs/functions/match.md index 9e63e998afd7..4a2e01fc527a 100644 --- a/docs/reference/query-languages/esql/kibana/docs/functions/match.md +++ b/docs/reference/query-languages/esql/kibana/docs/functions/match.md @@ -6,6 +6,7 @@ Using `MATCH` is equivalent to using the `match` query in the Elasticsearch Quer Match can be used on fields from the text family like [text](https://www.elastic.co/docs/reference/elasticsearch/mapping-reference/text) and [semantic_text](https://www.elastic.co/docs/reference/elasticsearch/mapping-reference/semantic-text), as well as other field types like keyword, boolean, dates, and numeric types. +When Match is used on a [semantic_text](https://www.elastic.co/docs/reference/elasticsearch/mapping-reference/semantic-text) field, it will perform a semantic query on the field. Match can use [function named parameters](https://www.elastic.co/docs/reference/query-languages/esql/esql-syntax#esql-function-named-params) to specify additional options for the match query. All [match query parameters](https://www.elastic.co/docs/reference/query-languages/query-dsl/query-dsl-match-query#match-field-params) are supported. diff --git a/docs/reference/query-languages/query-dsl/query-dsl-match-query.md b/docs/reference/query-languages/query-dsl/query-dsl-match-query.md index 2baf9fbb5205..1eb26dd7dedf 100644 --- a/docs/reference/query-languages/query-dsl/query-dsl-match-query.md +++ b/docs/reference/query-languages/query-dsl/query-dsl-match-query.md @@ -11,7 +11,9 @@ Returns documents that match a provided text, number, date or boolean value. The The `match` query is the standard query for performing a full-text search, including options for fuzzy matching. -`Match` will also work against [semantic_text](/reference/elasticsearch/mapping-reference/semantic-text.md) fields, however when performing `match` queries against `semantic_text` fields options that specifically target lexical search such as `fuzziness` or `analyzer` will be ignored. +`Match` will also work against [semantic_text](/reference/elasticsearch/mapping-reference/semantic-text.md) fields. +As `semantic_text` does not support lexical text search, `match` queries against `semantic_text` fields will automatically perform the correct semantic search. +Because of this, options that specifically target lexical search such as `fuzziness` or `analyzer` will be ignored. ## Example request [match-query-ex-request] diff --git a/x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/expression/function/fulltext/Match.java b/x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/expression/function/fulltext/Match.java index da42e7e60af9..12193a9e2bf2 100644 --- a/x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/expression/function/fulltext/Match.java +++ b/x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/expression/function/fulltext/Match.java @@ -142,6 +142,7 @@ public class Match extends FullTextFunction implements OptionalArgument, PostAna Match can be used on fields from the text family like <> and <>, as well as other field types like keyword, boolean, dates, and numeric types. + When Match is used on a <> field, it will perform a semantic query on the field. Match can use <> to specify additional options for the match query. All <> are supported.