You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Merge remote-tracking branch 'upstream/main' into ilm-explain-invalid-json
* upstream/main:
Mute org.elasticsearch.xpack.inference.action.filter.ShardBulkInferenceActionFilterBasicLicenseIT testLicenseInvalidForInference {p0=false} elastic#137691
Mute org.elasticsearch.xpack.inference.action.filter.ShardBulkInferenceActionFilterBasicLicenseIT testLicenseInvalidForInference {p0=true} elastic#137690
[LTR] Fix feature display order when using explain. (elastic#137671)
Remove extra RemoteClusterService instances in unit test (elastic#137647)
Fix `ComponentTemplatesFileSettingsIT.testSettingsApplied` (elastic#137669)
Consolidates troubleshooting content into the "Returning semantic field embeddings in _source" section (elastic#137233)
Update bundled JDK to 25.0.1 (elastic#137640)
resolve indices for prefixed _all expressions (elastic#137330)
ESQL: Add TopN support for exponential histograms (elastic#137313)
allows field caps to be cross project (elastic#137530)
ESQL: Add exponential histogram percentile function (elastic#137553)
Wait for nodes to have downloaded databases in `GeoIpDownloaderIT` (elastic#137636)
Tighten on when THROTTLE decision can be returned (elastic#136794)
Mute org.elasticsearch.xpack.esql.qa.single_node.GenerativeMetricsIT test elastic#137655
Add a test for two little known conditional processor paths (elastic#137645)
Extract a common ORIGIN constant (elastic#137612)
Remove early phase failure in batched (elastic#136889)
Returning correct index mode from get data streams api (elastic#137646)
[ML] Manage AD results indices (elastic#136065)
: ([Dynamic](docs-content://deploy-manage/stack-settings.md#dynamic-cluster-setting)) The rate at which the nightly maintenance task deletes expired model snapshots and results. The setting is a proxy to the [`requests_per_second`](https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-delete-by-query) parameter used in the delete by query requests and controls throttling. When the {{operator-feature}} is enabled, this setting can be updated only by operator users. Valid values must be greater than `0.0` or equal to `-1.0`, where `-1.0` means a default value is used. Defaults to `-1.0`
88
88
89
+
`xpack.ml.results_index_rollover_max_size`
90
+
: ([Dynamic](docs-content://deploy-manage/stack-settings.md#dynamic-cluster-setting)) The maximum size the anomaly detection results indices can reach before being rolled over by the nightly maintenance task. When the {{operator-feature}} is enabled, this setting can be updated only by operator users. Valid values must be greater than or equal to `-1B`. A value of `-1B` means the indices will never be rolled over. A value of `0B` means the indices will always be rolled over, regardless of size. Defaults to `50GB`.
91
+
89
92
`xpack.ml.node_concurrent_job_allocations`
90
93
: ([Dynamic](docs-content://deploy-manage/stack-settings.md#dynamic-cluster-setting)) The maximum number of jobs that can concurrently be in the `opening` state on each node. Typically, jobs spend a small amount of time in this state before they move to `open` state. Jobs that must restore large models when they are opening spend more time in the `opening` state. When the {{operator-feature}} is enabled, this setting can be updated only by operator users. Defaults to `2`.
::::::{tab-item} Using the default ELSER on EIS endpoint on Serverless
51
+
::::::{tab-item} Default ELSER on EIS endpoint on {{serverless-short}}
52
52
53
53
```{applies_to}
54
54
serverless: ga
@@ -72,7 +72,7 @@ PUT my-index-000001
72
72
73
73
::::::
74
74
75
-
::::::{tab-item} Using the preconfigured ELSER on EIS endpoint in Cloud
75
+
::::::{tab-item} Preconfigured ELSER on EIS endpoint in Cloud
76
76
77
77
```{applies_to}
78
78
stack: ga 9.2
@@ -98,7 +98,7 @@ PUT my-index-000001
98
98
99
99
::::::
100
100
101
-
::::::{tab-item} Using the default ELSER endpoint
101
+
::::::{tab-item} Default ELSER endpoint
102
102
103
103
If you use the preconfigured `.elser-2-elasticsearch` endpoint, you can set up `semantic_text` with the following API request:
104
104
@@ -544,9 +544,14 @@ stack: ga 9.2
544
544
serverless: ga
545
545
```
546
546
547
+
:::{important}
548
+
Starting with {{es}} 9.2, the recommended method for retrieving embeddings has changed from that used in previous versions.
549
+
For instructions on retrieving embeddings in versions earlier than 9.2, refer to [Returning semantic field embeddings using `fields`](#return-embeddings-fields).
550
+
:::
551
+
547
552
By default, the embeddings generated for `semantic_text` fields are stored internally and **not included in `_source`** when retrieving documents.
548
553
549
-
To include the full inference fields, including their embeddings, in `_source`, set the `_source.exclude_vectors` option to `false`.
554
+
To include the full {{infer}} fields, including their embeddings, in `_source`, set the `_source.exclude_vectors` option to `false`.
The embeddings will appear under `_inference_fields` in `_source`.
571
576
572
577
**Use cases**
578
+
573
579
Including embeddings in `_source` is useful when you want to:
574
580
575
581
* Reindex documents into another index **with the same `inference_id`** without re-running inference.
576
582
* Export or migrate documents while preserving their embeddings.
577
583
* Inspect or debug the raw embeddings generated for your content.
578
584
579
585
### Example: Reindex while preserving embeddings
586
+
```{applies_to}
587
+
stack: ga 9.2
588
+
serverless: ga
589
+
```
580
590
581
591
```console
582
592
POST _reindex
@@ -592,7 +602,7 @@ POST _reindex
592
602
}
593
603
}
594
604
```
595
-
% TEST[skip:Requiresinference endpoint]
605
+
% TEST[skip:Requires{{infer}} endpoint]
596
606
597
607
1. Sends the source documents with their stored embeddings to the destination index.
598
608
@@ -602,16 +612,110 @@ the documents will **fail the reindex task**.
602
612
Matching `inference_id` values are required to reuse the existing embeddings.
603
613
::::
604
614
605
-
This allows documents to be re-indexed without triggering inference again, **as long as the target `semantic_text` field uses the same `inference_id` as the source**.
615
+
This allows documents to be re-indexed without triggering {{infer}} again, **as long as the target `semantic_text` field uses the same `inference_id` as the source**.
To verify that your embeddings look correct, you can retrieve the {{infer}} data that `semantic_text` normally hides from search results.
609
624
610
-
Older versions do not support the `exclude_vectors` option to retrieve the embeddings of the semantic text fields.
611
-
To return the `_inference_fields`, use the `fields` option in a search request instead:
625
+
To retrieve the stored embeddings in {{es}} 9.2 and later, set the `exclude_vectors` parameter to `false` in the `_source` field. This ensures that the vector data, which is excluded by default, is included in the search response.
612
626
613
627
```console
614
628
POST test-index/_search
629
+
{
630
+
"_source": {
631
+
"exclude_vectors": false
632
+
},
633
+
"query": {
634
+
"match": {
635
+
"my_semantic_field": "Which country is Paris in?"
636
+
}
637
+
}
638
+
}
639
+
```
640
+
% TEST[skip:Requires {{infer}} endpoint]
641
+
642
+
This will return verbose chunked embeddings content that is used to perform
643
+
semantic search for `semantic_text` fields:
644
+
645
+
```console-response
646
+
{
647
+
"took": 18,
648
+
"timed_out": false,
649
+
"_shards": {
650
+
"total": 1,
651
+
"successful": 1,
652
+
"skipped": 0,
653
+
"failed": 0
654
+
},
655
+
"hits": {
656
+
"total": { "value": 1, "relation": "eq" },
657
+
"max_score": 16.532316,
658
+
"hits": [
659
+
{
660
+
"_index": "test-index",
661
+
"_id": "1",
662
+
"_score": 16.532316,
663
+
"_source": {
664
+
"my_semantic_field": "Paris is the capital of France.",
665
+
"_inference_fields": {
666
+
"my_semantic_field": {
667
+
"inference": {
668
+
"inference_id": ".elser-2-elasticsearch", <1>
669
+
"model_settings": { <2>
670
+
"service": "elasticsearch",
671
+
"task_type": "sparse_embedding"
672
+
},
673
+
"chunks": {
674
+
"my_semantic_field": [
675
+
{
676
+
"start_offset": 0,
677
+
"end_offset": 31,
678
+
"embeddings": { <3>
679
+
"airport": 0.12011719,
680
+
"brussels": 0.032836914,
681
+
"capital": 2.1328125,
682
+
"capitals": 0.6386719,
683
+
"capitol": 1.2890625,
684
+
"cities": 0.78125,
685
+
"city": 1.265625,
686
+
"continent": 0.26953125,
687
+
"country": 0.59765625,
688
+
...
689
+
}
690
+
}
691
+
]
692
+
}
693
+
}
694
+
}
695
+
}
696
+
}
697
+
}
698
+
]
699
+
}
700
+
}
701
+
```
702
+
% TEST[skip:Requires {{infer}} endpoint]
703
+
1. The {{infer}} endpoint used to generate embeddings.
704
+
2. Lists details about the model used to generate embeddings, such as the service name and task type.
705
+
3. The embeddings generated for this chunk.
706
+
707
+
## Returning semantic field embeddings using `fields`[return-embeddings-fields]
708
+
709
+
:::{important}
710
+
This method for returning semantic field embeddings is recommended only for {{es}} versions earlier than 9.2.
711
+
For version 9.2 and later, use the [`exclude_vectors`](#troubleshooting-semantic-text-fields) parameter instead.
712
+
:::
713
+
714
+
To retrieve stored embeddings, use the `fields` parameter with `_inference_fields`. This lets you include the vector data that is not shown by default in the response.
715
+
The `fields` parameter only works with the `_search` endpoint.
716
+
717
+
```console
718
+
POST my-index/_search
615
719
{
616
720
"query": {
617
721
"match": {
@@ -623,11 +727,7 @@ POST test-index/_search
623
727
]
624
728
}
625
729
```
626
-
% TEST[skip:Requires inference endpoint]
627
-
628
-
This returns the chunked embeddings used for semantic search under `_inference_fields` in `_source`.
629
-
Note that the `fields` option is **not** available for the Reindex API.
@@ -741,30 +841,6 @@ You can query `semantic_text` fields using the following query types:
741
841
742
842
-[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.
If you want to verify that your embeddings look correct, you can view the
748
-
inference data that `semantic_text` typically hides using `fields`.
749
-
750
-
```console
751
-
POST test-index/_search
752
-
{
753
-
"query": {
754
-
"match": {
755
-
"my_semantic_field": "Which country is Paris in?"
756
-
}
757
-
},
758
-
"fields": [
759
-
"_inference_fields"
760
-
]
761
-
}
762
-
```
763
-
% TEST[skip:Requires inference endpoint]
764
-
765
-
This will return verbose chunked embeddings content that is used to perform
766
-
semantic search for `semantic_text` fields.
767
-
768
844
### Document count discrepancy in `_cat/indices`
769
845
770
846
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.
Copy file name to clipboardExpand all lines: modules/data-streams/src/main/java/org/elasticsearch/datastreams/action/TransportGetDataStreamsAction.java
0 commit comments