Add clarification to semantic_text documentation on default quantization and lexical search support (#128927)

* Add clarifications to semantic text documentation

* Regnerate match ESQL docs

* Fix whitespace

* PR feedback

* Update docs/reference/elasticsearch/mapping-reference/semantic-text.md

Co-authored-by: Liam Thompson <32779855+leemthompo@users.noreply.github.com>

---------

Co-authored-by: Liam Thompson <32779855+leemthompo@users.noreply.github.com>
This commit is contained in:
Kathleen DeRusso 2025-06-06 09:01:50 -04:00 committed by GitHub
parent 110bbe8683
commit 5d22ad6874
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 21 additions and 8 deletions

View file

@ -28,7 +28,10 @@ service.
Using `semantic_text`, you wont 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 cant 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).

View file

@ -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.

View file

@ -2,7 +2,7 @@
"comment" : "This is generated by ESQLs 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" : [

View file

@ -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.

View file

@ -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]

View file

@ -142,6 +142,7 @@ public class Match extends FullTextFunction implements OptionalArgument, PostAna
Match can be used on fields from the text family like <<text, text>> and <<semantic-text, semantic_text>>,
as well as other field types like keyword, boolean, dates, and numeric types.
When Match is used on a <<semantic-text, semantic_text>> field, it will perform a semantic query on the field.
Match can use <<esql-function-named-params,function named parameters>> to specify additional options for the match query.
All <<match-field-params,match query parameters>> are supported.