Skip to content

Commit cd8264e

Browse files
authored
Merge branch 'main' into fix/fetch-phase-breaker-lifecycle
2 parents d3e2814 + ad268e0 commit cd8264e

File tree

25 files changed

+464
-133
lines changed

25 files changed

+464
-133
lines changed

docs/changelog/138047.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
pr: 138047
2+
summary: Add configurable `max_batch_size` for `GoogleVertexAI` embedding service
3+
settings
4+
area: Machine Learning
5+
type: bug
6+
issues: []

muted-tests.yml

Lines changed: 6 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -424,18 +424,9 @@ tests:
424424
- class: org.elasticsearch.xpack.security.authc.TokenServiceTests
425425
method: testSupersedingTokenEncryption
426426
issue: https://github.com/elastic/elasticsearch/issues/139031
427-
- class: org.elasticsearch.test.rest.yaml.CcsCommonYamlTestSuiteIT
428-
method: test {p0=search/370_profile/dfs knn vector profiling collector name}
429-
issue: https://github.com/elastic/elasticsearch/issues/139065
430-
- class: org.elasticsearch.test.rest.yaml.RcsCcsCommonYamlTestSuiteIT
431-
method: test {p0=search.highlight/50_synthetic_source/text multi unified from vectors}
432-
issue: https://github.com/elastic/elasticsearch/issues/139066
433427
- class: org.elasticsearch.xpack.search.AsyncSearchConcurrentStatusIT
434428
method: testConcurrentStatusFetchWhileTaskCloses
435429
issue: https://github.com/elastic/elasticsearch/issues/138543
436-
- class: org.elasticsearch.test.rest.yaml.CcsCommonYamlTestSuiteIT
437-
method: test {p0=search.vectors/130_knn_query_nested_search/nested kNN search pre-filtered on alias with filter on top level fields}
438-
issue: https://github.com/elastic/elasticsearch/issues/139131
439430
- class: org.elasticsearch.xpack.logsdb.RandomizedRollingUpgradeIT
440431
method: testIndexingSyntheticSource
441432
issue: https://github.com/elastic/elasticsearch/issues/139152
@@ -445,9 +436,6 @@ tests:
445436
- class: org.elasticsearch.xpack.core.security.authc.AuthenticationTests
446437
method: testMaybeRewriteForOlderVersionWithCrossClusterAccessRewritesAuthenticationInMetadata
447438
issue: https://github.com/elastic/elasticsearch/issues/139167
448-
- class: org.elasticsearch.test.rest.yaml.CcsCommonYamlTestSuiteIT
449-
method: test {p0=eql/10_basic/Sequence checking correct join key ordering.}
450-
issue: https://github.com/elastic/elasticsearch/issues/139173
451439
- class: org.elasticsearch.test.rest.yaml.RcsCcsCommonYamlTestSuiteIT
452440
method: test {p0=search.retrievers/result-diversification/10_mmr_result_diversification_retriever/Test MMR result diversification single index float type}
453441
issue: https://github.com/elastic/elasticsearch/issues/139195
@@ -457,12 +445,6 @@ tests:
457445
- class: org.elasticsearch.xpack.esql.ccq.MultiClusterSpecIT
458446
method: test {csv-spec:spatial.ConvertFromStringParseError}
459447
issue: https://github.com/elastic/elasticsearch/issues/139213
460-
- class: org.elasticsearch.test.rest.yaml.RcsCcsCommonYamlTestSuiteIT
461-
method: test {p0=search.vectors/180_update_dense_vector_type/Test update flat --> bbq_flat --> bbq_hnsw}
462-
issue: https://github.com/elastic/elasticsearch/issues/139253
463-
- class: org.elasticsearch.test.rest.yaml.CcsCommonYamlTestSuiteIT
464-
method: test {p0=search.vectors/41_knn_search_half_byte_quantized_bfloat16/Knn search with mip}
465-
issue: https://github.com/elastic/elasticsearch/issues/139254
466448
- class: org.elasticsearch.xpack.inference.integration.AuthorizationTaskExecutorIT
467449
method: testCreatesEisChatCompletionEndpoint
468450
issue: https://github.com/elastic/elasticsearch/issues/138764
@@ -478,9 +460,12 @@ tests:
478460
- class: org.elasticsearch.multiproject.test.CoreWithMultipleProjectsClientYamlTestSuiteIT
479461
method: test {yaml=search.retrievers/result-diversification/10_mmr_result_diversification_retriever/Test MMR result diversification single index float type}
480462
issue: https://github.com/elastic/elasticsearch/issues/139335
481-
- class: org.elasticsearch.test.rest.yaml.RcsCcsCommonYamlTestSuiteIT
482-
method: test {p0=search.vectors/200_dense_vector_docvalue_fields/dense_vector docvalues with bfloat16}
483-
issue: https://github.com/elastic/elasticsearch/issues/139368
463+
- class: org.elasticsearch.test.rest.yaml.CcsCommonYamlTestSuiteIT
464+
method: test {p0=search/140_pre_filter_search_shards/prefilter on non-indexed date fields}
465+
issue: https://github.com/elastic/elasticsearch/issues/139381
466+
- class: org.elasticsearch.xpack.downsample.DownsampleIT
467+
method: testAggregateMethod
468+
issue: https://github.com/elastic/elasticsearch/issues/139382
484469

485470
# Examples:
486471
#

rest-api-spec/src/yamlRestTest/resources/rest-api-spec/test/search.vectors/200_dense_vector_docvalue_fields.yml

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -298,38 +298,38 @@ setup:
298298
- length: {hits.hits.0.fields.vector7.0: 5}
299299
- length: {hits.hits.0.fields.vector8.0: 5}
300300

301-
- close_to: { hits.hits.0.fields.vector7.0.0: { value: 230.0, error: 0.4 } }
302-
- close_to: { hits.hits.0.fields.vector7.0.1: { value: 300.33, error: 0.4 } }
303-
- close_to: { hits.hits.0.fields.vector7.0.2: { value: -34.8988, error: 0.4 } }
304-
- close_to: { hits.hits.0.fields.vector7.0.3: { value: 15.555, error: 0.4 } }
305-
- close_to: { hits.hits.0.fields.vector7.0.4: { value: -200.0, error: 0.4 } }
306-
307-
- close_to: { hits.hits.0.fields.vector8.0.0: { value: 130.0, error: 0.4 } }
308-
- close_to: { hits.hits.0.fields.vector8.0.1: { value: 115.0, error: 0.4 } }
309-
- close_to: { hits.hits.0.fields.vector8.0.2: { value: -1.02, error: 0.4 } }
310-
- close_to: { hits.hits.0.fields.vector8.0.3: { value: 15.555, error: 0.4 } }
311-
- close_to: { hits.hits.0.fields.vector8.0.4: { value: -100.0, error: 0.4 } }
301+
- close_to: { hits.hits.0.fields.vector7.0.0: { value: 230.0, error: 1 } }
302+
- close_to: { hits.hits.0.fields.vector7.0.1: { value: 300.33, error: 1 } }
303+
- close_to: { hits.hits.0.fields.vector7.0.2: { value: -34.8988, error: 0.2 } }
304+
- close_to: { hits.hits.0.fields.vector7.0.3: { value: 15.555, error: 0.2 } }
305+
- close_to: { hits.hits.0.fields.vector7.0.4: { value: -200.0, error: 1 } }
306+
307+
- close_to: { hits.hits.0.fields.vector8.0.0: { value: 130.0, error: 1 } }
308+
- close_to: { hits.hits.0.fields.vector8.0.1: { value: 115.0, error: 1 } }
309+
- close_to: { hits.hits.0.fields.vector8.0.2: { value: -1.02, error: 0.2 } }
310+
- close_to: { hits.hits.0.fields.vector8.0.3: { value: 15.555, error: 0.2 } }
311+
- close_to: { hits.hits.0.fields.vector8.0.4: { value: -100.0, error: 1 } }
312312

313313
- match: {hits.hits.1._id: "2"}
314314
- match: {hits.hits.1.fields.name.0: "moose.jpg"}
315315

316316
- length: {hits.hits.1.fields.vector7.0: 5}
317317
- match: {hits.hits.1.fields.vector8: null}
318318

319-
- close_to: { hits.hits.1.fields.vector7.0.0: { value: -0.5, error: 0.4 } }
320-
- close_to: { hits.hits.1.fields.vector7.0.1: { value: 100.0, error: 0.4 } }
321-
- close_to: { hits.hits.1.fields.vector7.0.2: { value: -13, error: 0.4 } }
322-
- close_to: { hits.hits.1.fields.vector7.0.3: { value: 14.8, error: 0.4 } }
323-
- close_to: { hits.hits.1.fields.vector7.0.4: { value: -156.0, error: 0.4 } }
319+
- close_to: { hits.hits.1.fields.vector7.0.0: { value: -0.5, error: 0.2 } }
320+
- close_to: { hits.hits.1.fields.vector7.0.1: { value: 100.0, error: 1 } }
321+
- close_to: { hits.hits.1.fields.vector7.0.2: { value: -13, error: 0.2 } }
322+
- close_to: { hits.hits.1.fields.vector7.0.3: { value: 14.8, error: 0.2 } }
323+
- close_to: { hits.hits.1.fields.vector7.0.4: { value: -156.0, error: 1 } }
324324

325325
- match: {hits.hits.2._id: "3"}
326326
- match: {hits.hits.2.fields.name.0: "rabbit.jpg"}
327327

328328
- length: {hits.hits.2.fields.vector8.0: 5}
329329
- match: {hits.hits.2.fields.vector7: null}
330330

331-
- close_to: { hits.hits.2.fields.vector8.0.0: { value: 130.0, error: 0.4 } }
332-
- close_to: { hits.hits.2.fields.vector8.0.1: { value: 115.0, error: 0.4 } }
333-
- close_to: { hits.hits.2.fields.vector8.0.2: { value: -1.02, error: 0.4 } }
334-
- close_to: { hits.hits.2.fields.vector8.0.3: { value: 15.555, error: 0.4 } }
335-
- close_to: { hits.hits.2.fields.vector8.0.4: { value: -100.0, error: 0.4 } }
331+
- close_to: { hits.hits.2.fields.vector8.0.0: { value: 130.0, error: 1 } }
332+
- close_to: { hits.hits.2.fields.vector8.0.1: { value: 115.0, error: 1 } }
333+
- close_to: { hits.hits.2.fields.vector8.0.2: { value: -1.02, error: 0.2 } }
334+
- close_to: { hits.hits.2.fields.vector8.0.3: { value: 15.555, error: 0.2 } }
335+
- close_to: { hits.hits.2.fields.vector8.0.4: { value: -100.0, error: 1 } }

server/src/main/java/org/elasticsearch/action/search/RestOpenPointInTimeAction.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,6 @@ public RestChannelConsumer prepareRequest(final RestRequest request, final NodeC
5555
final OpenPointInTimeRequest openRequest = new OpenPointInTimeRequest(indices);
5656
final boolean crossProjectEnabled = crossProjectModeDecider.crossProjectEnabled();
5757
if (crossProjectEnabled) {
58-
openRequest.projectRouting(request.param("project_routing", null));
5958
openRequest.indicesOptions(IndicesOptions.fromRequest(request, OpenPointInTimeRequest.DEFAULT_CPS_INDICES_OPTIONS));
6059
} else {
6160
openRequest.indicesOptions(IndicesOptions.fromRequest(request, OpenPointInTimeRequest.DEFAULT_INDICES_OPTIONS));

server/src/main/java/org/elasticsearch/index/engine/ThreadPoolMergeExecutorService.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,9 @@ public Iterator<Setting<?>> settings() {
175175
* Initial value for IO write rate limit of individual merge tasks when doAutoIOThrottle is true
176176
*/
177177
static final ByteSizeValue START_IO_RATE = ByteSizeValue.ofMb(20L);
178+
179+
private static final Logger logger = LogManager.getLogger(ThreadPoolMergeExecutorService.class);
180+
178181
/**
179182
* Total number of submitted merge tasks that support IO auto throttling and that have not yet been run (or aborted).
180183
* This includes merge tasks that are currently running and that are backlogged (by their respective merge schedulers).
@@ -863,13 +866,15 @@ private static long newTargetIORateBytesPerSec(
863866
MIN_IO_RATE.getBytes(),
864867
currentTargetIORateBytesPerSec - currentTargetIORateBytesPerSec / 10L
865868
);
869+
logger.debug("Decreasing target IO rate for merges to {}", newTargetIORateBytesPerSec);
866870
} else if (currentlySubmittedIOThrottledMergeTasks > concurrentMergesCeilLimitForThrottling
867871
&& currentTargetIORateBytesPerSec < MAX_IO_RATE.getBytes()) {
868872
// increase target IO rate by 20% (capped)
869873
newTargetIORateBytesPerSec = Math.min(
870874
MAX_IO_RATE.getBytes(),
871875
currentTargetIORateBytesPerSec + currentTargetIORateBytesPerSec / 5L
872876
);
877+
logger.debug("Increasing target IO rate for merges to {}", newTargetIORateBytesPerSec);
873878
} else {
874879
newTargetIORateBytesPerSec = currentTargetIORateBytesPerSec;
875880
}

server/src/main/java/org/elasticsearch/inference/ServiceSettings.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@
1414
import org.elasticsearch.index.mapper.vectors.DenseVectorFieldMapper;
1515
import org.elasticsearch.xcontent.ToXContentObject;
1616

17+
import java.util.Map;
18+
1719
public interface ServiceSettings extends ToXContentObject, VersionedNamedWriteable, FilteredXContent {
1820

1921
/**
@@ -61,4 +63,8 @@ default DenseVectorFieldMapper.ElementType elementType() {
6163
*/
6264
@Nullable
6365
String modelId();
66+
67+
default ServiceSettings updateServiceSettings(Map<String, Object> serviceSettings) {
68+
return this;
69+
}
6470
}

server/src/main/java/org/elasticsearch/rest/action/RestFieldCapabilitiesAction.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,6 @@ public RestChannelConsumer prepareRequest(final RestRequest request, final NodeC
6262

6363
final boolean crossProjectEnabled = crossProjectModeDecider.crossProjectEnabled();
6464
if (crossProjectEnabled) {
65-
fieldRequest.projectRouting(request.param("project_routing", null));
6665
// Setting includeResolvedTo to always include index resolution data structure in the linked project responses,
6766
// in order to allow the coordinating node to call CrossProjectIndexResolutionValidator#validate
6867
fieldRequest.includeResolvedTo(true);

server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestResolveIndexAction.java

Lines changed: 62 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,11 @@
99

1010
package org.elasticsearch.rest.action.admin.indices;
1111

12+
import org.elasticsearch.ElasticsearchException;
1213
import org.elasticsearch.action.admin.indices.resolve.ResolveIndexAction;
1314
import org.elasticsearch.action.support.IndicesOptions;
1415
import org.elasticsearch.client.internal.node.NodeClient;
16+
import org.elasticsearch.common.ParsingException;
1517
import org.elasticsearch.common.Strings;
1618
import org.elasticsearch.common.settings.Settings;
1719
import org.elasticsearch.index.IndexMode;
@@ -20,22 +22,26 @@
2022
import org.elasticsearch.rest.Scope;
2123
import org.elasticsearch.rest.ServerlessScope;
2224
import org.elasticsearch.rest.action.RestToXContentListener;
25+
import org.elasticsearch.search.crossproject.CrossProjectModeDecider;
26+
import org.elasticsearch.xcontent.XContentParser;
2327

2428
import java.io.IOException;
2529
import java.util.Arrays;
2630
import java.util.EnumSet;
2731
import java.util.List;
2832
import java.util.Set;
33+
import java.util.concurrent.atomic.AtomicReference;
2934

3035
import static org.elasticsearch.rest.RestRequest.Method.GET;
36+
import static org.elasticsearch.rest.RestRequest.Method.POST;
3137

3238
@ServerlessScope(Scope.PUBLIC)
3339
public class RestResolveIndexAction extends BaseRestHandler {
3440
private static final Set<String> CAPABILITIES = Set.of("mode_filter");
35-
private final Settings settings;
41+
private final CrossProjectModeDecider crossProjectModeDecider;
3642

3743
public RestResolveIndexAction(Settings settings) {
38-
this.settings = settings;
44+
this.crossProjectModeDecider = new CrossProjectModeDecider(settings);
3945
}
4046

4147
@Override
@@ -45,7 +51,7 @@ public String getName() {
4551

4652
@Override
4753
public List<Route> routes() {
48-
return List.of(new Route(GET, "/_resolve/index/{name}"));
54+
return List.of(new Route(GET, "/_resolve/index/{name}"), new Route(POST, "/_resolve/index/{name}"));
4955
}
5056

5157
@Override
@@ -57,17 +63,28 @@ public Set<String> supportedCapabilities() {
5763
protected BaseRestHandler.RestChannelConsumer prepareRequest(RestRequest request, NodeClient client) throws IOException {
5864
String[] indices = Strings.splitStringByCommaToArray(request.param("name"));
5965
String modeParam = request.param("mode");
60-
final boolean crossProjectEnabled = settings != null && settings.getAsBoolean("serverless.cross_project.enabled", false);
61-
String projectRouting = null;
62-
if (crossProjectEnabled) {
63-
projectRouting = request.param("project_routing");
64-
}
66+
67+
final boolean crossProjectEnabled = crossProjectModeDecider.crossProjectEnabled();
68+
AtomicReference<String> projectRouting = new AtomicReference<>();
6569
IndicesOptions indicesOptions = IndicesOptions.fromRequest(request, ResolveIndexAction.Request.DEFAULT_INDICES_OPTIONS);
70+
6671
if (crossProjectEnabled) {
72+
request.withContentOrSourceParamParserOrNull(parser -> {
73+
try {
74+
// If parser is null, there's no request body. projectRouting will then yield `null`.
75+
if (parser != null) {
76+
projectRouting.set(parseProjectRouting(parser));
77+
}
78+
} catch (Exception e) {
79+
throw new ElasticsearchException("Couldn't parse request body", e);
80+
}
81+
});
82+
6783
indicesOptions = IndicesOptions.builder(indicesOptions)
6884
.crossProjectModeOptions(new IndicesOptions.CrossProjectModeOptions(true))
6985
.build();
7086
}
87+
7188
ResolveIndexAction.Request resolveRequest = new ResolveIndexAction.Request(
7289
indices,
7390
indicesOptions,
@@ -76,8 +93,44 @@ protected BaseRestHandler.RestChannelConsumer prepareRequest(RestRequest request
7693
: Arrays.stream(modeParam.split(","))
7794
.map(IndexMode::fromString)
7895
.collect(() -> EnumSet.noneOf(IndexMode.class), EnumSet::add, EnumSet::addAll),
79-
projectRouting
96+
projectRouting.get()
8097
);
8198
return channel -> client.admin().indices().resolveIndex(resolveRequest, new RestToXContentListener<>(channel));
8299
}
100+
101+
private static String parseProjectRouting(XContentParser parser) throws ParsingException {
102+
try {
103+
XContentParser.Token first = parser.nextToken();
104+
if (first == null) {
105+
return null;
106+
}
107+
108+
if (first != XContentParser.Token.START_OBJECT) {
109+
throw new ParsingException(
110+
parser.getTokenLocation(),
111+
"Expected [" + XContentParser.Token.START_OBJECT + "] but found [" + first + "]",
112+
parser.getTokenLocation()
113+
);
114+
}
115+
116+
String projectRouting = null;
117+
for (XContentParser.Token token = parser.nextToken(); token != XContentParser.Token.END_OBJECT; token = parser.nextToken()) {
118+
if (token == XContentParser.Token.FIELD_NAME) {
119+
String currentName = parser.currentName();
120+
if ("project_routing".equals(currentName)) {
121+
parser.nextToken();
122+
projectRouting = parser.text();
123+
} else {
124+
throw new ParsingException(parser.getTokenLocation(), "request does not support [" + parser.currentName() + "]");
125+
}
126+
}
127+
}
128+
129+
return projectRouting;
130+
} catch (ParsingException e) {
131+
throw e;
132+
} catch (Exception e) {
133+
throw new ParsingException(parser == null ? null : parser.getTokenLocation(), "Failed to parse", e);
134+
}
135+
}
83136
}

server/src/main/java/org/elasticsearch/rest/action/search/RestSearchAction.java

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -108,9 +108,6 @@ public RestChannelConsumer prepareRequest(final RestRequest request, final NodeC
108108
request.param("min_compatible_shard_node");
109109

110110
final boolean crossProjectEnabled = crossProjectModeDecider.crossProjectEnabled();
111-
if (crossProjectEnabled) {
112-
searchRequest.setProjectRouting(request.param("project_routing"));
113-
}
114111

115112
/*
116113
* We have to pull out the call to `source().size(size)` because
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
9241000

0 commit comments

Comments
 (0)