Skip to content

Commit 818ec0d

Browse files
authored
Merge branch 'main' into fix_129911_DenseVectorFieldMapperTests
2 parents f1ed91c + 07f65e9 commit 818ec0d

File tree

21 files changed

+270
-97
lines changed

21 files changed

+270
-97
lines changed

build-tools-internal/src/main/resources/forbidden/es-all-signatures.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,3 +61,7 @@ org.apache.logging.log4j.message.ParameterizedMessage#<init>(java.lang.String, j
6161

6262
@defaultMessage Use WriteLoadForecaster#getForecastedWriteLoad instead
6363
org.elasticsearch.cluster.metadata.IndexMetadata#getForecastedWriteLoad()
64+
65+
@defaultMessage Use org.elasticsearch.index.codec.vectors.OptimizedScalarQuantizer instead
66+
org.apache.lucene.util.quantization.OptimizedScalarQuantizer#<init>(org.apache.lucene.index.VectorSimilarityFunction, float, int)
67+
org.apache.lucene.util.quantization.OptimizedScalarQuantizer#<init>(org.apache.lucene.index.VectorSimilarityFunction)

docs/changelog/128854.yaml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
pr: 128854
2+
summary: Mark token pruning for sparse vector as GA
3+
area: Machine Learning
4+
type: feature
5+
issues: []
6+
highlight:
7+
title: Mark Token Pruning for Sparse Vector as GA
8+
body: |-
9+
Token pruning for sparse_vector queries has been live since 8.13 as tech preview.
10+
As of 8.19.0 and 9.1.0, this is now generally available.
11+
notable: true

docs/reference/query-languages/esql/limitations.md

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -100,9 +100,6 @@ In addition, when [querying multiple indexes](docs-content://explore-analyze/que
100100

101101
{{esql}} does not support configurations where the [_source field](/reference/elasticsearch/mapping-reference/mapping-source-field.md) is [disabled](/reference/elasticsearch/mapping-reference/mapping-source-field.md#disable-source-field).
102102

103-
[preview] {{esql}}'s support for [synthetic `_source`](/reference/elasticsearch/mapping-reference/mapping-source-field.md#synthetic-source) is currently experimental.
104-
105-
106103
## Full-text search [esql-limitations-full-text-search]
107104

108105
One limitation of [full-text search](/reference/query-languages/esql/functions-operators/search-functions.md) is that it is necessary to use the search function,

docs/reference/query-languages/query-dsl/query-dsl-sparse-vector-query.md

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -62,28 +62,36 @@ GET _search
6262
`query_vector`
6363
: (Optional, dictionary) A dictionary of token-weight pairs representing the precomputed query vector to search. Searching using this query vector will bypass additional inference. Only one of `inference_id` and `query_vector` is allowed.
6464

65-
`prune`
66-
: (Optional, boolean) [preview] Whether to perform pruning, omitting the non-significant tokens from the query to improve query performance. If `prune` is true but the `pruning_config` is not specified, pruning will occur but default values will be used. Default: false.
65+
`prune` {applies_to}`stack: preview 9.0, ga 9.1`
66+
: (Optional, boolean) Whether to perform pruning, omitting the non-significant tokens from the query to improve query performance. If `prune` is true but the `pruning_config` is not specified, pruning will occur but default values will be used. Default: false.
6767

68-
`pruning_config`
69-
: (Optional, object) [preview] Optional pruning configuration. If enabled, this will omit non-significant tokens from the query in order to improve query performance. This is only used if `prune` is set to `true`. If `prune` is set to `true` but `pruning_config` is not specified, default values will be used.
68+
`pruning_config` {applies_to}`stack: preview 9.0, ga 9.1`
69+
: (Optional, object) Optional pruning configuration. If enabled, this will omit non-significant tokens from the query in order to improve query performance. This is only used if `prune` is set to `true`. If `prune` is set to `true` but `pruning_config` is not specified, default values will be used.
7070

7171
Parameters for `pruning_config` are:
7272

7373
`tokens_freq_ratio_threshold`
74-
: (Optional, integer) [preview] Tokens whose frequency is more than `tokens_freq_ratio_threshold` times the average frequency of all tokens in the specified field are considered outliers and pruned. This value must between 1 and 100. Default: `5`.
74+
: (Optional, integer) Tokens whose frequency is more than `tokens_freq_ratio_threshold` times the average frequency of all tokens in the specified field are considered outliers and pruned. This value must between 1 and 100. Default: `5`.
7575

7676
`tokens_weight_threshold`
77-
: (Optional, float) [preview] Tokens whose weight is less than `tokens_weight_threshold` are considered insignificant and pruned. This value must be between 0 and 1. Default: `0.4`.
77+
: (Optional, float) Tokens whose weight is less than `tokens_weight_threshold` are considered insignificant and pruned. This value must be between 0 and 1. Default: `0.4`.
7878

7979
`only_score_pruned_tokens`
80-
: (Optional, boolean) [preview] If `true` we only input pruned tokens into scoring, and discard non-pruned tokens. It is strongly recommended to set this to `false` for the main query, but this can be set to `true` for a rescore query to get more relevant results. Default: `false`.
80+
: (Optional, boolean) If `true` we only input pruned tokens into scoring, and discard non-pruned tokens. It is strongly recommended to set this to `false` for the main query, but this can be set to `true` for a rescore query to get more relevant results. Default: `false`.
8181

8282
::::{note}
8383
The default values for `tokens_freq_ratio_threshold` and `tokens_weight_threshold` were chosen based on tests using ELSERv2 that provided the most optimal results.
8484
::::
8585

86+
When token pruning is applied, non-significant tokens will be pruned from the query.
87+
Non-significant tokens can be defined as tokens that meet both of the following criteria:
88+
* The token appears much more frequently than most tokens, indicating that it is a very common word and may not benefit the overall search results much.
89+
* The weight/score is so low that the token is likely not very relevant to the original term
8690

91+
Both the token frequency threshold and weight threshold must show the token is non-significant in order for the token to be pruned.
92+
This ensures that:
93+
* The tokens that are kept are frequent enough and have significant scoring.
94+
* Very infrequent tokens that may not have as high of a score are removed.
8795

8896
## Example ELSER query [sparse-vector-query-example]
8997

@@ -198,7 +206,7 @@ GET my-index/_search
198206

199207
## Example ELSER query with pruning configuration and rescore [sparse-vector-query-with-pruning-config-and-rescore-example]
200208

201-
The following is an extension to the above example that adds a [preview] pruning configuration to the `sparse_vector` query. The pruning configuration identifies non-significant tokens to prune from the query in order to improve query performance.
209+
The following is an extension to the above example that adds a pruning configuration to the `sparse_vector` query. The pruning configuration identifies non-significant tokens to prune from the query in order to improve query performance.
202210

203211
Token pruning happens at the shard level. While this should result in the same tokens being labeled as insignificant across shards, this is not guaranteed based on the composition of each shard. Therefore, if you are running `sparse_vector` with a `pruning_config` on a multi-shard index, we strongly recommend adding a [Rescore filtered search results](/reference/elasticsearch/rest-apis/filter-search-results.md#rescore) function with the tokens that were originally pruned from the query. This will help mitigate any shard-level inconsistency with pruned tokens and provide better relevance overall.
204212

libs/entitlement/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ NotEntitledException: component [(server)], module [org.apache.lucene.misc], cla
3535

3636
### How to add an Elasticsearch module/plugin policy
3737

38-
A policy is defined in an `entitlements-policy.yaml` file within an Elasticsearch module/plugin under `src/main/plugin-metadata`. Policy files contain lists of entitlements that should be allowed, grouped by Java module name, which acts as the policy scope. For example, the `transport-netty4` Elasticsearch module's policy file contains an entitlement to accept `inbound_network` connections, limited to the `io.netty.transport` and `io.netty.common` Java modules.
38+
A policy is defined in an `entitlement-policy.yaml` file within an Elasticsearch module/plugin under `src/main/plugin-metadata`. Policy files contain lists of entitlements that should be allowed, grouped by Java module name, which acts as the policy scope. For example, the `transport-netty4` Elasticsearch module's policy file contains an entitlement to accept `inbound_network` connections, limited to the `io.netty.transport` and `io.netty.common` Java modules.
3939

4040
Elasticsearch modules/plugins that are not yet modularized (i.e. do not have `module-info.java`) will need to use single `ALL-UNNAMED` scope. For example, the `reindex` Elasticsearch module's policy file contains a single `ALL-UNNAMED` scope, with an entitlement to perform `outbound_network`; all code in `reindex` will be able to connect to the network. It is not possible to use the `ALL-UNNAMED` scope for modularized modules/plugins.
4141

modules/data-streams/src/main/java/org/elasticsearch/datastreams/action/TransportUpdateDataStreamSettingsAction.java

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ protected void masterOperation(
131131
new UpdateDataStreamSettingsAction.DataStreamSettingsResponse(
132132
dataStreamName,
133133
false,
134-
e.getMessage(),
134+
Strings.hasText(e.getMessage()) ? e.getMessage() : e.toString(),
135135
EMPTY,
136136
EMPTY,
137137
UpdateDataStreamSettingsAction.DataStreamSettingsResponse.IndicesSettingsResult.EMPTY
@@ -222,9 +222,12 @@ private void updateSettingsOnIndices(
222222
Map<String, Object> settingsToApply = new HashMap<>();
223223
List<String> appliedToDataStreamOnly = new ArrayList<>();
224224
List<String> appliedToDataStreamAndBackingIndices = new ArrayList<>();
225+
Settings effectiveSettings = dataStream.getEffectiveSettings(
226+
clusterService.state().projectState(projectResolver.getProjectId()).metadata()
227+
);
225228
for (String settingName : requestSettings.keySet()) {
226229
if (APPLY_TO_BACKING_INDICES.contains(settingName)) {
227-
settingsToApply.put(settingName, requestSettings.get(settingName));
230+
settingsToApply.put(settingName, effectiveSettings.get(settingName));
228231
appliedToDataStreamAndBackingIndices.add(settingName);
229232
} else if (APPLY_TO_DATA_STREAM_ONLY.contains(settingName)) {
230233
appliedToDataStreamOnly.add(settingName);
@@ -242,9 +245,7 @@ private void updateSettingsOnIndices(
242245
true,
243246
null,
244247
settingsFilter.filter(dataStream.getSettings()),
245-
settingsFilter.filter(
246-
dataStream.getEffectiveSettings(clusterService.state().projectState(projectResolver.getProjectId()).metadata())
247-
),
248+
settingsFilter.filter(effectiveSettings),
248249
new UpdateDataStreamSettingsAction.DataStreamSettingsResponse.IndicesSettingsResult(
249250
appliedToDataStreamOnly,
250251
appliedToDataStreamAndBackingIndices,

modules/data-streams/src/yamlRestTest/resources/rest-api-spec/test/data_stream/240_data_stream_settings.yml

Lines changed: 99 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -299,3 +299,102 @@ setup:
299299
- match: { .$idx0name.settings.index.lifecycle.name: "my-policy" }
300300
- match: { .$idx1name.settings.index.number_of_shards: "1" }
301301
- match: { .$idx1name.settings.index.lifecycle.name: "my-policy" }
302+
303+
---
304+
"Test null out settings":
305+
- requires:
306+
cluster_features: [ "logs_stream" ]
307+
reason: requires setting 'logs_stream' to get or set data stream settings
308+
- do:
309+
allowed_warnings:
310+
- "index template [my-template] has index patterns [my-data-stream-*] matching patterns from existing older templates [global] with patterns (global => [*]); this template [my-template] will take precedence during new index creation"
311+
indices.put_index_template:
312+
name: my-template
313+
body:
314+
index_patterns: [ my-data-stream-* ]
315+
data_stream: { }
316+
template:
317+
settings:
318+
number_of_replicas: 0
319+
lifecycle.name: my-policy
320+
321+
- do:
322+
indices.create_data_stream:
323+
name: my-data-stream-1
324+
325+
- do:
326+
cluster.health:
327+
index: "my-data-stream-1"
328+
wait_for_status: green
329+
330+
331+
332+
- do:
333+
indices.get_data_stream:
334+
name: my-data-stream-1
335+
- match: { data_streams.0.name: my-data-stream-1 }
336+
- match: { data_streams.0.settings: {} }
337+
- match: { data_streams.0.effective_settings: null }
338+
339+
- do:
340+
indices.put_data_stream_settings:
341+
name: my-data-stream-1
342+
body:
343+
index:
344+
number_of_shards: 2
345+
lifecycle:
346+
name: my-new-policy
347+
prefer_ilm: true
348+
- match: { data_streams.0.name: my-data-stream-1 }
349+
- match: { data_streams.0.applied_to_data_stream: true }
350+
- match: { data_streams.0.index_settings_results.applied_to_data_stream_only: [index.number_of_shards]}
351+
- length: { data_streams.0.index_settings_results.applied_to_data_stream_and_backing_indices: 2 }
352+
- match: { data_streams.0.settings.index.number_of_shards: "2" }
353+
- match: { data_streams.0.settings.index.lifecycle.name: "my-new-policy" }
354+
- match: { data_streams.0.settings.index.lifecycle.prefer_ilm: "true" }
355+
- match: { data_streams.0.effective_settings.index.number_of_shards: "2" }
356+
- match: { data_streams.0.effective_settings.index.number_of_replicas: "0" }
357+
- match: { data_streams.0.effective_settings.index.lifecycle.name: "my-new-policy" }
358+
- match: { data_streams.0.effective_settings.index.lifecycle.prefer_ilm: "true" }
359+
360+
- do:
361+
indices.put_data_stream_settings:
362+
name: my-data-stream-1
363+
body:
364+
index:
365+
number_of_shards: null
366+
lifecycle:
367+
name: null
368+
- match: { data_streams.0.name: my-data-stream-1 }
369+
- match: { data_streams.0.applied_to_data_stream: true }
370+
- match: { data_streams.0.index_settings_results.applied_to_data_stream_only: [index.number_of_shards]}
371+
- length: { data_streams.0.index_settings_results.applied_to_data_stream_and_backing_indices: 1 }
372+
- match: { data_streams.0.settings.index.number_of_shards: null }
373+
- match: { data_streams.0.settings.index.lifecycle.name: null }
374+
- match: { data_streams.0.settings.index.lifecycle.prefer_ilm: "true" }
375+
- match: { data_streams.0.effective_settings.index.number_of_shards: null }
376+
- match: { data_streams.0.effective_settings.index.number_of_replicas: "0" }
377+
- match: { data_streams.0.effective_settings.index.lifecycle.name: "my-policy" }
378+
- match: { data_streams.0.effective_settings.index.lifecycle.prefer_ilm: "true" }
379+
380+
- do:
381+
indices.get_data_stream_settings:
382+
name: my-data-stream-1
383+
- match: { data_streams.0.name: my-data-stream-1 }
384+
- match: { data_streams.0.settings.index.lifecycle.name: null }
385+
- match: { data_streams.0.settings.index.lifecycle.prefer_ilm: "true" }
386+
- match: { data_streams.0.effective_settings.index.number_of_shards: null }
387+
- match: { data_streams.0.effective_settings.index.number_of_replicas: "0" }
388+
- match: { data_streams.0.effective_settings.index.lifecycle.name: "my-policy" }
389+
390+
- do:
391+
indices.get_data_stream:
392+
name: my-data-stream-1
393+
- set: { data_streams.0.indices.0.index_name: idx0name }
394+
395+
- do:
396+
indices.get_settings:
397+
index: my-data-stream-1
398+
- match: { .$idx0name.settings.index.number_of_shards: "1" }
399+
- match: { .$idx0name.settings.index.lifecycle.name: "my-policy" }
400+
- match: { .$idx0name.settings.index.lifecycle.prefer_ilm: "true" }

modules/repository-s3/build.gradle

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -124,11 +124,6 @@ esplugin.bundleSpec.from('config/repository-s3') {
124124
into 'config'
125125
}
126126

127-
tasks.named("internalClusterTest").configure {
128-
// TODO: remove once https://github.com/elastic/elasticsearch/issues/101608 is fixed
129-
systemProperty 'es.insecure_network_trace_enabled', 'true'
130-
}
131-
132127
tasks.named("thirdPartyAudit").configure {
133128
ignoreMissingClasses(
134129
// missing/unused classes

modules/repository-s3/src/internalClusterTest/java/org/elasticsearch/repositories/s3/S3BlobStoreRepositoryTests.java

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,6 @@
6565
import org.elasticsearch.test.BackgroundIndexer;
6666
import org.elasticsearch.test.ESIntegTestCase;
6767
import org.elasticsearch.test.MockLog;
68-
import org.elasticsearch.test.junit.annotations.TestIssueLogging;
6968
import org.elasticsearch.threadpool.ThreadPool;
7069
import org.elasticsearch.xcontent.NamedXContentRegistry;
7170
import org.elasticsearch.xcontent.XContentFactory;
@@ -181,15 +180,6 @@ protected Settings nodeSettings(int nodeOrdinal, Settings otherSettings) {
181180
return builder.build();
182181
}
183182

184-
@Override
185-
@TestIssueLogging(
186-
issueUrl = "https://github.com/elastic/elasticsearch/issues/88841",
187-
value = "com.amazonaws.request:DEBUG,com.amazonaws.http.AmazonHttpClient:TRACE"
188-
)
189-
public void testRequestStats() throws Exception {
190-
super.testRequestStats();
191-
}
192-
193183
public void testAbortRequestStats() throws Exception {
194184
final String repository = createRepository(randomRepositoryName(), false);
195185

@@ -233,10 +223,6 @@ public void testAbortRequestStats() throws Exception {
233223
assertEquals(assertionErrorMsg, mockCalls, sdkRequestCounts);
234224
}
235225

236-
@TestIssueLogging(
237-
issueUrl = "https://github.com/elastic/elasticsearch/issues/101608",
238-
value = "com.amazonaws.request:DEBUG,com.amazonaws.http.AmazonHttpClient:TRACE"
239-
)
240226
public void testMetrics() throws Exception {
241227
// Create the repository and perform some activities
242228
final String repository = createRepository(randomRepositoryName(), false);

0 commit comments

Comments
 (0)