Skip to content
Merged
Changes from 3 commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
3ecd9c7
Consolidates the Troubleshooting section
kosabogi Oct 28, 2025
6b49e51
Merge branch 'main' into semantic-blend-troubleshooting-section
kosabogi Oct 28, 2025
7dae585
Merge branch 'main' into semantic-blend-troubleshooting-section
kosabogi Oct 29, 2025
fb44113
Update docs/reference/elasticsearch/mapping-reference/semantic-text.md
kosabogi Oct 30, 2025
96d7183
Test applies switch tabs
kosabogi Oct 30, 2025
fd7eb83
Adds version specific examples
kosabogi Oct 31, 2025
3767283
Syntax fix
kosabogi Oct 31, 2025
d26917b
Fixes syntax
kosabogi Oct 31, 2025
7fbdb71
Merge branch 'main' into semantic-blend-troubleshooting-section
kosabogi Oct 31, 2025
fc06c3f
Adds separate tabs for each versions
kosabogi Oct 31, 2025
4db8fb2
Adds only two version tahs
kosabogi Oct 31, 2025
e2a1224
Deletes tabs, uses section level applies-to instead
kosabogi Oct 31, 2025
cabbfee
Merge branch 'main' into semantic-blend-troubleshooting-section
kosabogi Oct 31, 2025
4ff57b9
Removes response block, adds intros and warning
kosabogi Nov 3, 2025
5be7634
Reorganizes content, adds applies_to where necessary
kosabogi Nov 4, 2025
60b518d
Merge branch 'main' into semantic-blend-troubleshooting-section
kosabogi Nov 4, 2025
037bbf7
Update docs/reference/elasticsearch/mapping-reference/semantic-text.md
kosabogi Nov 5, 2025
576d820
Update docs/reference/elasticsearch/mapping-reference/semantic-text.md
kosabogi Nov 5, 2025
457e7b8
Adds additional information, changes admonition types
kosabogi Nov 5, 2025
511f019
Update docs/reference/elasticsearch/mapping-reference/semantic-text.md
kosabogi Nov 6, 2025
a07dcb1
Shorten tab titles
kosabogi Nov 6, 2025
6618e0d
Merge branch 'main' into semantic-blend-troubleshooting-section
kosabogi Nov 6, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
106 changes: 82 additions & 24 deletions docs/reference/elasticsearch/mapping-reference/semantic-text.md
Original file line number Diff line number Diff line change
Expand Up @@ -532,6 +532,88 @@ This returns the chunked embeddings used for semantic search under `_inference_f
Note that the `fields` option is **not** available for the Reindex API.
::::

### Example: Troubleshooting semantic_text fields [troubleshooting-semantic-text-fields]

If you want to verify that your embeddings look correct, you can view the
inference data that `semantic_text` typically hides using `fields`.

```console
POST test-index/_search
{
"query": {
"match": {
"my_semantic_field": "Which country is Paris in?"
}
},
"fields": [
"_inference_fields"
]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please use the version with exclude_vectors to false, this is the preferred way to retrieve the field.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for your suggestions, @jimczi!
I deleted the unnecessary "_inference_fields" where we use exclude_vectors.
As Mike suggested in his comment, I created two versions of this: one for 9.0 and 9.1 versions and one for 9.2 since exclude_vectors: false was added only in the 9.2 version.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we start with the preferred and current way of doing things? We can document the old way but it should be a small warning section without needing to repeat the entire response (it's the same).

Copy link
Contributor Author

@kosabogi kosabogi Nov 3, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I’ve reordered the sections so that the 9.2 method appears first.
I also added a warning to the 9.0-9.1 method to emphasize that users on 9.2 or later should use the newer approach instead.

I thought it might work better to keep both methods as equivalent sections instead of putting the 9.0-9.1 version in a warning. Since this documentation set covers all versions starting from 9.0, it feels clearer to show both approaches while highlighting which versions they apply to. I labeled the current recommended method as applicable from version 9.2 to make that distinction clear.

Let me know what you think!

}
```
% TEST[skip:Requires inference endpoint]

This will return verbose chunked embeddings content that is used to perform
semantic search for `semantic_text` fields.

```console-response
{
"took": 179,
"timed_out": false,
"_shards": {
"total": 1,
"successful": 1,
"skipped": 0,
"failed": 0
},
"hits": {
"total": { "value": 1, "relation": "eq" },
"max_score": 16.532316,
"hits": [
{
"_index": "test-index",
"_id": "1",
"_score": 16.532316,
"_source": {
"my_semantic_field": "Paris is the capital of France.",
"_inference_fields": {
"my_semantic_field": {
"inference": {
"inference_id": ".elser-2-elasticsearch", <1>
"model_settings": { <2>
"service": "elasticsearch",
"task_type": "sparse_embedding"
},
"chunks": {
"my_semantic_field": [
{
"start_offset": 0,
"end_offset": 31,
"embeddings": { <3>
"paris": 2.5234375,
"france": 2.0,
"capital": 2.1328125,
"city": 1.265625,
"country": 0.59765625,
...
}
}
]
}
}
}
}
}
}
]
}
}
```
% TEST[skip:Requires inference endpoint]
1. The inference endpoint used to generate embeddings.
2. Lists the model’s service and task type, showing how the embeddings were generated.
3. The embeddings generated for this chunk.


## Customizing `semantic_text` indexing [custom-indexing]

`semantic_text` uses defaults for indexing data based on the {{infer}} endpoint
Expand Down Expand Up @@ -656,30 +738,6 @@ You can query `semantic_text` fields using the following query types:

- [Semantic query](/reference/query-languages/query-dsl/query-dsl-semantic-query.md): We don't recommend this legacy query type for _new_ projects, because the alternatives in this list enable more flexibility and customization. The `semantic` query remains available to support existing implementations.


## Troubleshooting semantic_text fields [troubleshooting-semantic-text-fields]

If you want to verify that your embeddings look correct, you can view the
inference data that `semantic_text` typically hides using `fields`.

```console
POST test-index/_search
{
"query": {
"match": {
"my_semantic_field": "Which country is Paris in?"
}
},
"fields": [
"_inference_fields"
]
}
```
% TEST[skip:Requires inference endpoint]

This will return verbose chunked embeddings content that is used to perform
semantic search for `semantic_text` fields.

### Document count discrepancy in `_cat/indices`

When an index contains a `semantic_text` field, the `docs.count` value returned by the [`_cat/indices`](https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-cat-indices) API may be higher than the number of documents you indexed.
Expand Down