Skip to content

Commit 941c806

Browse files
authored
Merge branch 'main' into legacy
2 parents 1404078 + 4f019d1 commit 941c806

File tree

37 files changed

+789
-155
lines changed

37 files changed

+789
-155
lines changed

docs/changelog/125916.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
pr: 125916
2+
summary: Re-enable parallel collection for field sorted top hits
3+
area: Search
4+
type: bug
5+
issues: []

docs/changelog/125930.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
pr: 125930
2+
summary: Infer the score mode to use from the Lucene collector
3+
area: "ES|QL"
4+
type: enhancement
5+
issues: []

muted-tests.yml

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -344,18 +344,12 @@ tests:
344344
- class: org.elasticsearch.xpack.ilm.actions.SearchableSnapshotActionIT
345345
method: testSearchableSnapshotsInHotPhasePinnedToHotNodes
346346
issue: https://github.com/elastic/elasticsearch/issues/125683
347-
- class: org.elasticsearch.backwards.MixedClusterClientYamlTestSuiteIT
348-
method: test {p0=cat.allocation/10_basic/Node forecasts}
349-
issue: https://github.com/elastic/elasticsearch/issues/125711
350347
- class: org.elasticsearch.xpack.migrate.action.ReindexDataStreamTransportActionIT
351348
method: testAlreadyUpToDateDataStream
352349
issue: https://github.com/elastic/elasticsearch/issues/125727
353350
- class: org.elasticsearch.index.engine.ThreadPoolMergeSchedulerStressTestIT
354351
method: testMergingFallsBehindAndThenCatchesUp
355352
issue: https://github.com/elastic/elasticsearch/issues/125744
356-
- class: org.elasticsearch.test.rest.ClientYamlTestSuiteIT
357-
method: test {yaml=cat.allocation/10_basic/Node forecasts}
358-
issue: https://github.com/elastic/elasticsearch/issues/125661
359353
- class: org.elasticsearch.xpack.esql.spatial.SpatialExtentAggregationNoLicenseIT
360354
method: testStExtentAggregationWithPoints
361355
issue: https://github.com/elastic/elasticsearch/issues/125735
@@ -380,9 +374,6 @@ tests:
380374
- class: org.elasticsearch.multiproject.test.CoreWithMultipleProjectsClientYamlTestSuiteIT
381375
method: test {yaml=search.vectors/41_knn_search_bbq_hnsw/Test index configured rescore vector score consistency}
382376
issue: https://github.com/elastic/elasticsearch/issues/125902
383-
- class: org.elasticsearch.smoketest.SmokeTestMultiNodeClientYamlTestSuiteIT
384-
method: test {yaml=cat.allocation/10_basic/Node forecasts}
385-
issue: https://github.com/elastic/elasticsearch/issues/125848
386377
- class: org.elasticsearch.xpack.test.rest.XPackRestIT
387378
method: test {p0=ml/start_data_frame_analytics/Test start given dest index is not empty}
388379
issue: https://github.com/elastic/elasticsearch/issues/125909

rest-api-spec/src/yamlRestTest/resources/rest-api-spec/test/cat.allocation/10_basic.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -295,7 +295,7 @@
295295
( [-\w.]+ \s+
296296
[-\w.]+ \s+
297297
[-\w.]+ \s+
298-
[\w]+
298+
[-\w.]+
299299
\n
300300
)+
301301
$/

server/src/main/java/org/elasticsearch/action/ResolvedIndices.java

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,15 @@
1111

1212
import org.elasticsearch.action.search.SearchContextId;
1313
import org.elasticsearch.action.support.IndicesOptions;
14+
import org.elasticsearch.cluster.metadata.DataStream;
1415
import org.elasticsearch.cluster.metadata.IndexMetadata;
1516
import org.elasticsearch.cluster.metadata.IndexNameExpressionResolver;
1617
import org.elasticsearch.cluster.metadata.ProjectMetadata;
1718
import org.elasticsearch.common.io.stream.NamedWriteableRegistry;
1819
import org.elasticsearch.core.Nullable;
1920
import org.elasticsearch.index.Index;
2021
import org.elasticsearch.index.IndexNotFoundException;
22+
import org.elasticsearch.indices.InvalidIndexNameException;
2123
import org.elasticsearch.search.builder.PointInTimeBuilder;
2224
import org.elasticsearch.transport.RemoteClusterAware;
2325
import org.elasticsearch.transport.RemoteClusterService;
@@ -176,6 +178,20 @@ public static ResolvedIndices resolveWithIndexNamesAndOptions(
176178
? Index.EMPTY_ARRAY
177179
: indexNameExpressionResolver.concreteIndices(projectMetadata, localIndices, startTimeInMillis);
178180

181+
// prevent using selectors with remote cluster patterns
182+
if (DataStream.isFailureStoreFeatureFlagEnabled()) {
183+
for (final var indicesPerRemoteClusterAlias : remoteClusterIndices.entrySet()) {
184+
final String[] indices = indicesPerRemoteClusterAlias.getValue().indices();
185+
if (indices != null) {
186+
for (final String index : indices) {
187+
if (IndexNameExpressionResolver.hasSelectorSuffix(index)) {
188+
throw new InvalidIndexNameException(index, "Selectors are not yet supported on remote cluster patterns");
189+
}
190+
}
191+
}
192+
}
193+
}
194+
179195
return new ResolvedIndices(
180196
remoteClusterIndices,
181197
localIndices,

server/src/main/java/org/elasticsearch/search/aggregations/metrics/TopHitsAggregationBuilder.java

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,6 @@
4949
import java.util.Objects;
5050
import java.util.Optional;
5151
import java.util.Set;
52-
import java.util.function.ToLongFunction;
5352

5453
public class TopHitsAggregationBuilder extends AbstractAggregationBuilder<TopHitsAggregationBuilder> {
5554
public static final String NAME = "top_hits";
@@ -823,18 +822,4 @@ public String getType() {
823822
public TransportVersion getMinimalSupportedVersion() {
824823
return TransportVersions.ZERO;
825824
}
826-
827-
@Override
828-
public boolean supportsParallelCollection(ToLongFunction<String> fieldCardinalityResolver) {
829-
if (sorts != null) {
830-
// the implicit sorting is by _score, which supports parallel collection
831-
for (SortBuilder<?> sortBuilder : sorts) {
832-
if (sortBuilder.supportsParallelCollection() == false) {
833-
return false;
834-
}
835-
}
836-
}
837-
838-
return super.supportsParallelCollection(fieldCardinalityResolver);
839-
}
840825
}

server/src/main/java/org/elasticsearch/search/sort/FieldSortBuilder.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -741,4 +741,11 @@ public FieldSortBuilder rewrite(QueryRewriteContext ctx) throws IOException {
741741
}
742742
return new FieldSortBuilder(this).setNestedSort(rewrite);
743743
}
744+
745+
@Override
746+
public boolean supportsParallelCollection() {
747+
// Disable parallel collection for sort by field.
748+
// It is supported but not optimized on the Lucene side to share info across collectors, and can cause regressions.
749+
return false;
750+
}
744751
}

server/src/main/java/org/elasticsearch/search/sort/GeoDistanceSortBuilder.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -721,4 +721,11 @@ public GeoDistanceSortBuilder rewrite(QueryRewriteContext ctx) throws IOExceptio
721721
}
722722
return new GeoDistanceSortBuilder(this).setNestedSort(rewrite);
723723
}
724+
725+
@Override
726+
public boolean supportsParallelCollection() {
727+
// Disable parallel collection for sort by field.
728+
// It is supported but not optimized on the Lucene side to share info across collectors, and can cause regressions.
729+
return false;
730+
}
724731
}

server/src/main/java/org/elasticsearch/search/sort/ScoreSortBuilder.java

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -172,9 +172,4 @@ public TransportVersion getMinimalSupportedVersion() {
172172
public ScoreSortBuilder rewrite(QueryRewriteContext ctx) {
173173
return this;
174174
}
175-
176-
@Override
177-
public boolean supportsParallelCollection() {
178-
return true;
179-
}
180175
}

server/src/main/java/org/elasticsearch/search/sort/ScriptSortBuilder.java

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -502,9 +502,4 @@ public ScriptSortBuilder rewrite(QueryRewriteContext ctx) throws IOException {
502502
}
503503
return new ScriptSortBuilder(this).setNestedSort(rewrite);
504504
}
505-
506-
@Override
507-
public boolean supportsParallelCollection() {
508-
return true;
509-
}
510505
}

0 commit comments

Comments
 (0)