Skip to content

Commit aca442a

Browse files
committed
Merge branch 'main' into lucene_snapshot
2 parents 62283d5 + 444d148 commit aca442a

File tree

25 files changed

+3244
-121
lines changed

25 files changed

+3244
-121
lines changed

docs/changelog/128263.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
pr: 128263
2+
summary: Allow lookup join on mixed numeric fields
3+
area: ES|QL
4+
type: enhancement
5+
issues: []

docs/reference/aggregations/search-aggregations-bucket-significantterms-aggregation.md

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -253,8 +253,8 @@ Like most design decisions, this is the basis of a trade-off in which we have ch
253253
The JLH score can be used as a significance score by adding the parameter
254254

255255
```js
256-
"jlh": {
257-
}
256+
"jlh": {
257+
}
258258
```
259259

260260
The scores are derived from the doc frequencies in *foreground* and *background* sets. The *absolute* change in popularity (foregroundPercent - backgroundPercent) would favor common terms whereas the *relative* change in popularity (foregroundPercent/ backgroundPercent) would favor rare terms. Rare vs common is essentially a precision vs recall balance and so the absolute and relative changes are multiplied to provide a sweet spot between precision and recall.
@@ -265,9 +265,9 @@ The scores are derived from the doc frequencies in *foreground* and *background*
265265
Mutual information as described in "Information Retrieval", Manning et al., Chapter 13.5.1 can be used as significance score by adding the parameter
266266

267267
```js
268-
"mutual_information": {
269-
"include_negatives": true
270-
}
268+
"mutual_information": {
269+
"include_negatives": true
270+
}
271271
```
272272

273273
Mutual information does not differentiate between terms that are descriptive for the subset or for documents outside the subset. The significant terms therefore can contain terms that appear more or less frequent in the subset than outside the subset. To filter out the terms that appear less often in the subset than in documents outside the subset, `include_negatives` can be set to `false`.
@@ -284,8 +284,8 @@ Per default, the assumption is that the documents in the bucket are also contain
284284
Chi square as described in "Information Retrieval", Manning et al., Chapter 13.5.2 can be used as significance score by adding the parameter
285285

286286
```js
287-
"chi_square": {
288-
}
287+
"chi_square": {
288+
}
289289
```
290290

291291
Chi square behaves like mutual information and can be configured with the same parameters `include_negatives` and `background_is_superset`.
@@ -296,8 +296,8 @@ Chi square behaves like mutual information and can be configured with the same p
296296
Google normalized distance as described in ["The Google Similarity Distance", Cilibrasi and Vitanyi, 2007](https://arxiv.org/pdf/cs/0412098v3.pdf) can be used as significance score by adding the parameter
297297

298298
```js
299-
"gnd": {
300-
}
299+
"gnd": {
300+
}
301301
```
302302

303303
`gnd` also accepts the `background_is_superset` parameter.
@@ -394,8 +394,8 @@ The benefit of this heuristic is that the scoring logic is simple to explain to
394394
It would be hard for a seasoned boxer to win a championship if the prize was awarded purely on the basis of percentage of fights won - by these rules a newcomer with only one fight under their belt would be impossible to beat. Multiple observations are typically required to reinforce a view so it is recommended in these cases to set both `min_doc_count` and `shard_min_doc_count` to a higher value such as 10 in order to filter out the low-frequency terms that otherwise take precedence.
395395

396396
```js
397-
"percentage": {
398-
}
397+
"percentage": {
398+
}
399399
```
400400

401401

@@ -413,11 +413,11 @@ If none of the above measures suits your usecase than another option is to imple
413413
Customized scores can be implemented via a script:
414414

415415
```js
416-
"script_heuristic": {
416+
"script_heuristic": {
417417
"script": {
418-
"lang": "painless",
419-
"source": "params._subset_freq/(params._superset_freq - params._subset_freq + 1)"
420-
}
418+
"lang": "painless",
419+
"source": "params._subset_freq/(params._superset_freq - params._subset_freq + 1)"
420+
}
421421
}
422422
```
423423

docs/reference/elasticsearch-plugins/discovery-azure-classic-scale.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ mapped_pages:
33
- https://www.elastic.co/guide/en/elasticsearch/plugins/current/discovery-azure-classic-scale.html
44
---
55

6-
# Scaling out! [discovery-azure-classic-scale]
6+
# Scaling out [discovery-azure-classic-scale]
77

88
You need first to create an image of your previous machine. Disconnect from your machine and run locally the following commands:
99

muted-tests.yml

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -474,15 +474,9 @@ tests:
474474
- class: org.elasticsearch.packaging.test.TemporaryDirectoryConfigTests
475475
method: test21AcceptsCustomPathInDocker
476476
issue: https://github.com/elastic/elasticsearch/issues/128114
477-
- class: org.elasticsearch.reservedstate.service.FileSettingsServiceIT
478-
method: testSymlinkUpdateTriggerReload
479-
issue: https://github.com/elastic/elasticsearch/issues/128369
480477
- class: org.elasticsearch.xpack.esql.qa.single_node.PushQueriesIT
481478
method: testEqualityAndOther {semantic_text}
482479
issue: https://github.com/elastic/elasticsearch/issues/128414
483-
- class: org.elasticsearch.index.query.MultiMatchQueryBuilderTests
484-
method: testToQuery
485-
issue: https://github.com/elastic/elasticsearch/issues/128416
486480
- class: org.elasticsearch.xpack.ml.integration.InferenceIngestIT
487481
method: testPipelineIngestWithModelAliases
488482
issue: https://github.com/elastic/elasticsearch/issues/128417

server/src/internalClusterTest/java/org/elasticsearch/reservedstate/service/FileSettingsServiceIT.java

Lines changed: 19 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -196,21 +196,18 @@ public void clusterChanged(ClusterChangedEvent event) {
196196
return new Tuple<>(savedClusterState, metadataVersion);
197197
}
198198

199-
private Tuple<CountDownLatch, AtomicLong> setupClusterStateListener(String node) {
199+
private Tuple<CountDownLatch, AtomicLong> setupClusterStateListener(String node, long version) {
200200
ClusterService clusterService = internalCluster().clusterService(node);
201201
CountDownLatch savedClusterState = new CountDownLatch(1);
202202
AtomicLong metadataVersion = new AtomicLong(-1);
203203
clusterService.addListener(new ClusterStateListener() {
204204
@Override
205205
public void clusterChanged(ClusterChangedEvent event) {
206206
ReservedStateMetadata reservedState = event.state().metadata().reservedStateMetadata().get(FileSettingsService.NAMESPACE);
207-
if (reservedState != null) {
208-
ReservedStateHandlerMetadata handlerMetadata = reservedState.handlers().get(ReservedClusterSettingsAction.NAME);
209-
if (handlerMetadata != null && handlerMetadata.keys().contains("indices.recovery.max_bytes_per_sec")) {
210-
clusterService.removeListener(this);
211-
metadataVersion.set(event.state().metadata().version());
212-
savedClusterState.countDown();
213-
}
207+
if (reservedState != null && reservedState.version() == version) {
208+
clusterService.removeListener(this);
209+
metadataVersion.set(event.state().metadata().version());
210+
savedClusterState.countDown();
214211
}
215212
}
216213
});
@@ -258,14 +255,14 @@ public void testSettingsApplied() throws Exception {
258255
logger.info("--> start master node");
259256
final String masterNode = internalCluster().startMasterOnlyNode();
260257
assertMasterNode(internalCluster().nonMasterClient(), masterNode);
261-
var savedClusterState = setupClusterStateListener(masterNode);
258+
var savedClusterState = setupClusterStateListener(masterNode, versionCounter.incrementAndGet());
262259

263260
FileSettingsService masterFileSettingsService = internalCluster().getInstance(FileSettingsService.class, masterNode);
264261

265262
assertBusy(() -> assertTrue(masterFileSettingsService.watching()));
266263
assertFalse(dataFileSettingsService.watching());
267264

268-
writeJSONFile(masterNode, testJSON, logger, versionCounter.incrementAndGet());
265+
writeJSONFile(masterNode, testJSON, logger, versionCounter.get());
269266
assertClusterStateSaveOK(savedClusterState.v1(), savedClusterState.v2(), "50mb");
270267
}
271268

@@ -276,11 +273,11 @@ public void testSettingsAppliedOnStart() throws Exception {
276273
FileSettingsService dataFileSettingsService = internalCluster().getInstance(FileSettingsService.class, dataNode);
277274

278275
assertFalse(dataFileSettingsService.watching());
279-
var savedClusterState = setupClusterStateListener(dataNode);
276+
var savedClusterState = setupClusterStateListener(dataNode, versionCounter.incrementAndGet());
280277

281278
// In internal cluster tests, the nodes share the config directory, so when we write with the data node path
282279
// the master will pick it up on start
283-
writeJSONFile(dataNode, testJSON, logger, versionCounter.incrementAndGet());
280+
writeJSONFile(dataNode, testJSON, logger, versionCounter.get());
284281

285282
logger.info("--> start master node");
286283
final String masterNode = internalCluster().startMasterOnlyNode();
@@ -301,14 +298,14 @@ public void testReservedStatePersistsOnRestart() throws Exception {
301298
Settings.builder().put(INITIAL_STATE_TIMEOUT_SETTING.getKey(), "0s").build()
302299
);
303300
assertMasterNode(internalCluster().masterClient(), masterNode);
304-
var savedClusterState = setupClusterStateListener(masterNode);
301+
var savedClusterState = setupClusterStateListener(masterNode, versionCounter.incrementAndGet());
305302

306303
FileSettingsService masterFileSettingsService = internalCluster().getInstance(FileSettingsService.class, masterNode);
307304

308305
assertBusy(() -> assertTrue(masterFileSettingsService.watching()));
309306

310307
logger.info("--> write some settings");
311-
writeJSONFile(masterNode, testJSON, logger, versionCounter.incrementAndGet());
308+
writeJSONFile(masterNode, testJSON, logger, versionCounter.get());
312309
assertClusterStateSaveOK(savedClusterState.v1(), savedClusterState.v2(), "50mb");
313310

314311
logger.info("--> restart master");
@@ -476,12 +473,12 @@ public void testSettingsAppliedOnMasterReElection() throws Exception {
476473
assertFalse(master1FS.watching());
477474
assertFalse(master2FS.watching());
478475

479-
var savedClusterState = setupClusterStateListener(masterNode);
476+
var savedClusterState = setupClusterStateListener(masterNode, versionCounter.incrementAndGet());
480477
FileSettingsService masterFileSettingsService = internalCluster().getInstance(FileSettingsService.class, masterNode);
481478

482479
assertBusy(() -> assertTrue(masterFileSettingsService.watching()));
483480

484-
writeJSONFile(masterNode, testJSON, logger, versionCounter.incrementAndGet());
481+
writeJSONFile(masterNode, testJSON, logger, versionCounter.get());
485482
assertClusterStateSaveOK(savedClusterState.v1(), savedClusterState.v2(), "50mb");
486483

487484
internalCluster().stopCurrentMasterNode();
@@ -501,8 +498,8 @@ public void testSettingsAppliedOnMasterReElection() throws Exception {
501498
boolean awaitSuccessful = savedClusterState.v1().await(20, TimeUnit.SECONDS);
502499
assertTrue(awaitSuccessful);
503500

504-
savedClusterState = setupClusterStateListener(internalCluster().getMasterName());
505-
writeJSONFile(internalCluster().getMasterName(), testJSON43mb, logger, versionCounter.incrementAndGet());
501+
savedClusterState = setupClusterStateListener(internalCluster().getMasterName(), versionCounter.incrementAndGet());
502+
writeJSONFile(internalCluster().getMasterName(), testJSON43mb, logger, versionCounter.get());
506503

507504
assertClusterStateSaveOK(savedClusterState.v1(), savedClusterState.v2(), "43mb");
508505
}
@@ -515,21 +512,21 @@ public void testSymlinkUpdateTriggerReload() throws Exception {
515512
assertBusy(() -> assertTrue(masterFileSettingsService.watching()));
516513

517514
{
518-
var savedClusterState = setupClusterStateListener(masterNode);
515+
var savedClusterState = setupClusterStateListener(masterNode, versionCounter.incrementAndGet());
519516
// Create the settings.json as a symlink to simulate k8 setup
520517
// settings.json -> ..data/settings.json
521518
// ..data -> ..TIMESTAMP_TEMP_FOLDER_1
522519
var fileDir = Files.createDirectories(baseDir.resolve("..TIMESTAMP_TEMP_FOLDER_1"));
523-
writeJSONFile(masterNode, testJSON, logger, versionCounter.incrementAndGet(), fileDir.resolve("settings.json"));
520+
writeJSONFile(masterNode, testJSON, logger, versionCounter.get(), fileDir.resolve("settings.json"));
524521
var dataDir = Files.createSymbolicLink(baseDir.resolve("..data"), fileDir.getFileName());
525522
Files.createSymbolicLink(baseDir.resolve("settings.json"), dataDir.getFileName().resolve("settings.json"));
526523
assertClusterStateSaveOK(savedClusterState.v1(), savedClusterState.v2(), "50mb");
527524
}
528525
{
529-
var savedClusterState = setupClusterStateListener(masterNode);
526+
var savedClusterState = setupClusterStateListener(masterNode, versionCounter.incrementAndGet());
530527
// Update ..data symlink to ..data -> ..TIMESTAMP_TEMP_FOLDER_2 to simulate kubernetes secret update
531528
var fileDir = Files.createDirectories(baseDir.resolve("..TIMESTAMP_TEMP_FOLDER_2"));
532-
writeJSONFile(masterNode, testJSON43mb, logger, versionCounter.incrementAndGet(), fileDir.resolve("settings.json"));
529+
writeJSONFile(masterNode, testJSON43mb, logger, versionCounter.get(), fileDir.resolve("settings.json"));
533530
Files.deleteIfExists(baseDir.resolve("..data"));
534531
Files.createSymbolicLink(baseDir.resolve("..data"), fileDir.getFileName());
535532
assertClusterStateSaveOK(savedClusterState.v1(), savedClusterState.v2(), "43mb");

server/src/main/java/org/elasticsearch/index/codec/PerFieldFormatSupplier.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,10 +50,8 @@ public PerFieldFormatSupplier(MapperService mapperService, BigArrays bigArrays)
5050
this.mapperService = mapperService;
5151
this.bloomFilterPostingsFormat = new ES87BloomFilterPostingsFormat(bigArrays, this::internalGetPostingsFormatForField);
5252

53-
// TODO: temporarily disable feature flag for a few days to see effect in benchmarks
54-
boolean useDefaultLucenePostingsFormat = USE_DEFAULT_LUCENE_POSTINGS_FORMAT.isEnabled() && false;
5553
if (mapperService != null
56-
&& useDefaultLucenePostingsFormat
54+
&& USE_DEFAULT_LUCENE_POSTINGS_FORMAT.isEnabled()
5755
&& mapperService.getIndexSettings().getIndexVersionCreated().onOrAfter(IndexVersions.UPGRADE_TO_LUCENE_10_3_0)
5856
&& mapperService.getIndexSettings().getMode() == IndexMode.STANDARD) {
5957
defaultPostingsFormat = Elasticsearch92Lucene103Codec.DEFAULT_POSTINGS_FORMAT;

server/src/main/java/org/elasticsearch/index/codec/tsdb/es819/ES819TSDBDocValuesFormat.java

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
import org.apache.lucene.codecs.DocValuesProducer;
1414
import org.apache.lucene.index.SegmentReadState;
1515
import org.apache.lucene.index.SegmentWriteState;
16-
import org.elasticsearch.common.util.FeatureFlag;
1716

1817
import java.io.IOException;
1918

@@ -91,14 +90,10 @@ public class ES819TSDBDocValuesFormat extends org.apache.lucene.codecs.DocValues
9190

9291
// Default for escape hatch:
9392
static final boolean OPTIMIZED_MERGE_ENABLE_DEFAULT;
94-
static final FeatureFlag TSDB_DOC_VALUES_OPTIMIZED_MERGE = new FeatureFlag("tsdb_doc_values_optimized_merge");
9593
static final String OPTIMIZED_MERGE_ENABLED_NAME = ES819TSDBDocValuesConsumer.class.getName() + ".enableOptimizedMerge";
9694

9795
static {
98-
boolean optimizedMergeDefault = TSDB_DOC_VALUES_OPTIMIZED_MERGE.isEnabled();
99-
OPTIMIZED_MERGE_ENABLE_DEFAULT = Boolean.parseBoolean(
100-
System.getProperty(OPTIMIZED_MERGE_ENABLED_NAME, Boolean.toString(optimizedMergeDefault))
101-
);
96+
OPTIMIZED_MERGE_ENABLE_DEFAULT = Boolean.parseBoolean(System.getProperty(OPTIMIZED_MERGE_ENABLED_NAME, Boolean.TRUE.toString()));
10297
}
10398

10499
final int skipIndexIntervalSize;

server/src/test/java/org/elasticsearch/index/codec/PerFieldMapperCodecTests.java

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
package org.elasticsearch.index.codec;
1111

1212
import org.apache.lucene.codecs.PostingsFormat;
13+
import org.apache.lucene.codecs.lucene103.Lucene103PostingsFormat;
1314
import org.elasticsearch.cluster.metadata.IndexMetadata;
1415
import org.elasticsearch.common.compress.CompressedXContent;
1516
import org.elasticsearch.common.settings.Settings;
@@ -93,7 +94,8 @@ public void testUseBloomFilter() throws IOException {
9394
assertThat(perFieldMapperCodec.getPostingsFormatForField("_id"), instanceOf(ES87BloomFilterPostingsFormat.class));
9495
assertThat(perFieldMapperCodec.useBloomFilter("another_field"), is(false));
9596

96-
Class<? extends PostingsFormat> expectedPostingsFormat = ES812PostingsFormat.class;
97+
Class<? extends PostingsFormat> expectedPostingsFormat = PerFieldFormatSupplier.USE_DEFAULT_LUCENE_POSTINGS_FORMAT.isEnabled()
98+
&& timeSeries == false ? Lucene103PostingsFormat.class : ES812PostingsFormat.class;
9799
assertThat(perFieldMapperCodec.getPostingsFormatForField("another_field"), instanceOf(expectedPostingsFormat));
98100
}
99101

@@ -108,7 +110,9 @@ public void testUseBloomFilterWithTimestampFieldEnabled() throws IOException {
108110
public void testUseBloomFilterWithTimestampFieldEnabled_noTimeSeriesMode() throws IOException {
109111
PerFieldFormatSupplier perFieldMapperCodec = createFormatSupplier(true, false, false);
110112
assertThat(perFieldMapperCodec.useBloomFilter("_id"), is(false));
111-
Class<? extends PostingsFormat> expectedPostingsFormat = ES812PostingsFormat.class;
113+
Class<? extends PostingsFormat> expectedPostingsFormat = PerFieldFormatSupplier.USE_DEFAULT_LUCENE_POSTINGS_FORMAT.isEnabled()
114+
? Lucene103PostingsFormat.class
115+
: ES812PostingsFormat.class;
112116
assertThat(perFieldMapperCodec.getPostingsFormatForField("_id"), instanceOf(expectedPostingsFormat));
113117
}
114118

server/src/test/java/org/elasticsearch/index/query/MultiMatchQueryBuilderTests.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
import org.apache.lucene.search.DisjunctionMaxQuery;
1717
import org.apache.lucene.search.FuzzyQuery;
1818
import org.apache.lucene.search.IndexOrDocValuesQuery;
19+
import org.apache.lucene.search.IndexSortSortedNumericDocValuesRangeQuery;
1920
import org.apache.lucene.search.MatchAllDocsQuery;
2021
import org.apache.lucene.search.MatchNoDocsQuery;
2122
import org.apache.lucene.search.PhraseQuery;
@@ -170,7 +171,8 @@ protected void doAssertLuceneQuery(MultiMatchQueryBuilder queryBuilder, Query qu
170171
instanceOf(PhraseQuery.class),
171172
instanceOf(PointRangeQuery.class),
172173
instanceOf(IndexOrDocValuesQuery.class),
173-
instanceOf(PrefixQuery.class)
174+
instanceOf(PrefixQuery.class),
175+
instanceOf(IndexSortSortedNumericDocValuesRangeQuery.class)
174176
)
175177
)
176178
);

0 commit comments

Comments
 (0)