Skip to content

Commit 394f43a

Browse files
Merge branch 'main' into fix-semantic-query-rewrite-boost-issue
2 parents c81f184 + 789101b commit 394f43a

File tree

15 files changed

+2560
-2462
lines changed

15 files changed

+2560
-2462
lines changed

muted-tests.yml

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,6 @@ tests:
6464
- class: org.elasticsearch.xpack.shutdown.NodeShutdownIT
6565
method: testAllocationPreventedForRemoval
6666
issue: https://github.com/elastic/elasticsearch/issues/116363
67-
- class: org.elasticsearch.xpack.security.authc.ldap.ActiveDirectoryGroupsResolverTests
68-
issue: https://github.com/elastic/elasticsearch/issues/116182
6967
- class: org.elasticsearch.xpack.test.rest.XPackRestIT
7068
method: test {p0=snapshot/20_operator_privileges_disabled/Operator only settings can be set and restored by non-operator user when operator privileges is disabled}
7169
issue: https://github.com/elastic/elasticsearch/issues/116775
@@ -114,8 +112,6 @@ tests:
114112
- class: org.elasticsearch.xpack.ml.integration.ForecastIT
115113
method: testOverflowToDisk
116114
issue: https://github.com/elastic/elasticsearch/issues/117740
117-
- class: org.elasticsearch.xpack.security.authc.ldap.MultiGroupMappingIT
118-
issue: https://github.com/elastic/elasticsearch/issues/119599
119115
- class: org.elasticsearch.multi_cluster.MultiClusterYamlTestSuiteIT
120116
issue: https://github.com/elastic/elasticsearch/issues/119983
121117
- class: org.elasticsearch.xpack.test.rest.XPackRestIT
@@ -138,8 +134,6 @@ tests:
138134
- class: org.elasticsearch.xpack.inference.DefaultEndPointsIT
139135
method: testMultipleInferencesTriggeringDownloadAndDeploy
140136
issue: https://github.com/elastic/elasticsearch/issues/120668
141-
- class: org.elasticsearch.xpack.security.authc.ldap.ADLdapUserSearchSessionFactoryTests
142-
issue: https://github.com/elastic/elasticsearch/issues/119882
143137
- class: org.elasticsearch.xpack.test.rest.XPackRestIT
144138
method: test {p0=ml/3rd_party_deployment/Test start deployment fails while model download in progress}
145139
issue: https://github.com/elastic/elasticsearch/issues/120810
@@ -166,8 +160,6 @@ tests:
166160
issue: https://github.com/elastic/elasticsearch/issues/120950
167161
- class: org.elasticsearch.xpack.ml.integration.PyTorchModelIT
168162
issue: https://github.com/elastic/elasticsearch/issues/121165
169-
- class: org.elasticsearch.xpack.security.authc.ldap.ActiveDirectorySessionFactoryTests
170-
issue: https://github.com/elastic/elasticsearch/issues/121285
171163
- class: org.elasticsearch.test.rest.yaml.CcsCommonYamlTestSuiteIT
172164
issue: https://github.com/elastic/elasticsearch/issues/121407
173165
- class: org.elasticsearch.analysis.common.CommonAnalysisClientYamlTestSuiteIT
@@ -446,9 +438,6 @@ tests:
446438
- class: org.elasticsearch.xpack.profiling.action.GetStatusActionIT
447439
method: testWaitsUntilResourcesAreCreated
448440
issue: https://github.com/elastic/elasticsearch/issues/129486
449-
- class: org.elasticsearch.xpack.security.PermissionsIT
450-
method: testWhenUserLimitedByOnlyAliasOfIndexCanWriteToIndexWhichWasRolledoverByILMPolicy
451-
issue: https://github.com/elastic/elasticsearch/issues/129481
452441
- class: org.elasticsearch.upgrades.MlJobSnapshotUpgradeIT
453442
method: testSnapshotUpgrader
454443
issue: https://github.com/elastic/elasticsearch/issues/98560
@@ -549,6 +538,9 @@ tests:
549538
- class: org.elasticsearch.xpack.esql.ccq.MultiClustersIT
550539
method: testLookupJoinAliases
551540
issue: https://github.com/elastic/elasticsearch/issues/131166
541+
- class: org.elasticsearch.test.rest.yaml.RcsCcsCommonYamlTestSuiteIT
542+
method: test {p0=field_caps/40_time_series/Get simple time series field caps}
543+
issue: https://github.com/elastic/elasticsearch/issues/131225
552544

553545
# Examples:
554546
#

server/src/internalClusterTest/java/org/elasticsearch/action/bulk/TransportSimulateBulkActionIT.java

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
import org.elasticsearch.action.search.SearchResponse;
2525
import org.elasticsearch.cluster.metadata.ComponentTemplate;
2626
import org.elasticsearch.cluster.metadata.ComposableIndexTemplate;
27+
import org.elasticsearch.cluster.metadata.ProjectId;
2728
import org.elasticsearch.cluster.metadata.Template;
2829
import org.elasticsearch.common.compress.CompressedXContent;
2930
import org.elasticsearch.common.settings.Settings;
@@ -85,7 +86,8 @@ public void testMappingValidationIndexExists() {
8586
assertThat(searchResponse.getHits().getTotalHits().value(), equalTo(0L));
8687
searchResponse.decRef();
8788
ClusterStateResponse clusterStateResponse = admin().cluster().state(new ClusterStateRequest(TEST_REQUEST_TIMEOUT)).actionGet();
88-
Map<String, Object> indexMapping = clusterStateResponse.getState().metadata().getProject().index(indexName).mapping().sourceAsMap();
89+
final var project = clusterStateResponse.getState().metadata().getProject(ProjectId.DEFAULT);
90+
Map<String, Object> indexMapping = project.index(indexName).mapping().sourceAsMap();
8991
Map<String, Object> fields = (Map<String, Object>) indexMapping.get("properties");
9092
assertThat(fields.size(), equalTo(1));
9193
}
@@ -142,7 +144,8 @@ public void testMappingValidationIndexExistsTemplateSubstitutions() throws IOExc
142144
assertThat(searchResponse.getHits().getTotalHits().value(), equalTo(0L));
143145
searchResponse.decRef();
144146
ClusterStateResponse clusterStateResponse = admin().cluster().state(new ClusterStateRequest(TEST_REQUEST_TIMEOUT)).actionGet();
145-
Map<String, Object> indexMapping = clusterStateResponse.getState().metadata().getProject().index(indexName).mapping().sourceAsMap();
147+
final var project = clusterStateResponse.getState().metadata().getProject(ProjectId.DEFAULT);
148+
Map<String, Object> indexMapping = project.index(indexName).mapping().sourceAsMap();
146149
Map<String, Object> fields = (Map<String, Object>) indexMapping.get("properties");
147150
assertThat(fields.size(), equalTo(1));
148151
}

server/src/main/java/org/elasticsearch/action/bulk/TransportAbstractBulkAction.java

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -26,15 +26,13 @@
2626
import org.elasticsearch.cluster.block.ClusterBlockLevel;
2727
import org.elasticsearch.cluster.metadata.ComponentTemplate;
2828
import org.elasticsearch.cluster.metadata.ComposableIndexTemplate;
29-
import org.elasticsearch.cluster.metadata.Metadata;
3029
import org.elasticsearch.cluster.metadata.ProjectId;
3130
import org.elasticsearch.cluster.metadata.ProjectMetadata;
3231
import org.elasticsearch.cluster.project.ProjectResolver;
3332
import org.elasticsearch.cluster.service.ClusterService;
3433
import org.elasticsearch.common.io.stream.Writeable;
3534
import org.elasticsearch.common.util.concurrent.EsExecutors;
3635
import org.elasticsearch.core.Assertions;
37-
import org.elasticsearch.core.FixForMultiProject;
3836
import org.elasticsearch.core.Releasable;
3937
import org.elasticsearch.core.TimeValue;
4038
import org.elasticsearch.index.IndexingPressure;
@@ -193,34 +191,33 @@ private boolean applyPipelines(Task task, BulkRequest bulkRequest, Executor exec
193191
boolean hasIndexRequestsWithPipelines = false;
194192
ClusterState state = clusterService.state();
195193
ProjectId projectId = projectResolver.getProjectId();
196-
final Metadata metadata;
194+
final ProjectMetadata project;
197195
Map<String, ComponentTemplate> componentTemplateSubstitutions = bulkRequest.getComponentTemplateSubstitutions();
198196
Map<String, ComposableIndexTemplate> indexTemplateSubstitutions = bulkRequest.getIndexTemplateSubstitutions();
199197
if (bulkRequest.isSimulated()
200198
&& (componentTemplateSubstitutions.isEmpty() == false || indexTemplateSubstitutions.isEmpty() == false)) {
201199
/*
202-
* If this is a simulated request, and there are template substitutions, then we want to create and use a new metadata that has
200+
* If this is a simulated request, and there are template substitutions, then we want to create and use a new project that has
203201
* those templates. That is, we want to add the new templates (which will replace any that already existed with the same name),
204202
* and remove the indices and data streams that are referred to from the bulkRequest so that we get settings from the templates
205203
* rather than from the indices/data streams.
206204
*/
207-
Metadata originalMetadata = state.metadata();
208-
@FixForMultiProject // properly ensure simulated actions work with MP
209-
Metadata.Builder simulatedMetadataBuilder = Metadata.builder(originalMetadata);
205+
ProjectMetadata originalProject = state.metadata().getProject(projectId);
206+
ProjectMetadata.Builder simulatedMetadataBuilder = ProjectMetadata.builder(originalProject);
210207
if (componentTemplateSubstitutions.isEmpty() == false) {
211208
Map<String, ComponentTemplate> updatedComponentTemplates = new HashMap<>();
212-
updatedComponentTemplates.putAll(originalMetadata.getProject(projectId).componentTemplates());
209+
updatedComponentTemplates.putAll(originalProject.componentTemplates());
213210
updatedComponentTemplates.putAll(componentTemplateSubstitutions);
214211
simulatedMetadataBuilder.componentTemplates(updatedComponentTemplates);
215212
}
216213
if (indexTemplateSubstitutions.isEmpty() == false) {
217214
Map<String, ComposableIndexTemplate> updatedIndexTemplates = new HashMap<>();
218-
updatedIndexTemplates.putAll(originalMetadata.getProject(projectId).templatesV2());
215+
updatedIndexTemplates.putAll(originalProject.templatesV2());
219216
updatedIndexTemplates.putAll(indexTemplateSubstitutions);
220217
simulatedMetadataBuilder.indexTemplates(updatedIndexTemplates);
221218
}
222219
/*
223-
* We now remove the index from the simulated metadata to force the templates to be used. Note that simulated requests are
220+
* We now remove the index from the simulated project to force the templates to be used. Note that simulated requests are
224221
* always index requests -- no other type of request is supported.
225222
*/
226223
for (DocWriteRequest<?> actionRequest : bulkRequest.requests) {
@@ -236,12 +233,11 @@ private boolean applyPipelines(Task task, BulkRequest bulkRequest, Executor exec
236233
}
237234
}
238235
}
239-
metadata = simulatedMetadataBuilder.build();
236+
project = simulatedMetadataBuilder.build();
240237
} else {
241-
metadata = state.getMetadata();
238+
project = state.metadata().getProject(projectId);
242239
}
243240

244-
ProjectMetadata project = metadata.getProject(projectId);
245241
Map<String, IngestService.Pipelines> resolvedPipelineCache = new HashMap<>();
246242
for (DocWriteRequest<?> actionRequest : bulkRequest.requests) {
247243
IndexRequest indexRequest = getIndexWriteRequest(actionRequest);

server/src/main/java/org/elasticsearch/cluster/metadata/Metadata.java

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1499,12 +1499,6 @@ public Builder put(String name, ComponentTemplate componentTemplate) {
14991499
return this;
15001500
}
15011501

1502-
@Deprecated(forRemoval = true)
1503-
public Builder removeComponentTemplate(String name) {
1504-
getSingleProject().removeComponentTemplate(name);
1505-
return this;
1506-
}
1507-
15081502
@Deprecated(forRemoval = true)
15091503
public Builder componentTemplates(Map<String, ComponentTemplate> componentTemplates) {
15101504
getSingleProject().componentTemplates(componentTemplates);
@@ -1523,12 +1517,6 @@ public Builder put(String name, ComposableIndexTemplate indexTemplate) {
15231517
return this;
15241518
}
15251519

1526-
@Deprecated(forRemoval = true)
1527-
public Builder removeIndexTemplate(String name) {
1528-
getSingleProject().removeIndexTemplate(name);
1529-
return this;
1530-
}
1531-
15321520
@Deprecated(forRemoval = true)
15331521
public Builder dataStreams(Map<String, DataStream> dataStreams, Map<String, DataStreamAlias> dataStreamAliases) {
15341522
getSingleProject().dataStreams(dataStreams, dataStreamAliases);
@@ -1557,11 +1545,6 @@ public Builder removeDataStream(String name) {
15571545
return this;
15581546
}
15591547

1560-
@Deprecated(forRemoval = true)
1561-
public boolean removeDataStreamAlias(String aliasName, String dataStreamName, boolean mustExist) {
1562-
return getSingleProject().removeDataStreamAlias(aliasName, dataStreamName, mustExist);
1563-
}
1564-
15651548
public Builder putCustom(String type, ClusterCustom custom) {
15661549
customs.put(type, Objects.requireNonNull(custom, type));
15671550
return this;

server/src/test/java/org/elasticsearch/action/bulk/TransportSimulateBulkActionTests.java

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,8 @@
1919
import org.elasticsearch.cluster.metadata.ComposableIndexTemplate;
2020
import org.elasticsearch.cluster.metadata.IndexMetadata;
2121
import org.elasticsearch.cluster.metadata.IndexTemplateMetadata;
22-
import org.elasticsearch.cluster.metadata.Metadata;
22+
import org.elasticsearch.cluster.metadata.ProjectId;
23+
import org.elasticsearch.cluster.metadata.ProjectMetadata;
2324
import org.elasticsearch.cluster.node.DiscoveryNode;
2425
import org.elasticsearch.cluster.node.DiscoveryNodeUtils;
2526
import org.elasticsearch.cluster.project.TestProjectResolvers;
@@ -229,7 +230,7 @@ public void testIndexDataWithValidation() throws IOException {
229230
Map<String, IndexMetadata> indicesMap = new HashMap<>();
230231
Map<String, IndexTemplateMetadata> v1Templates = new HashMap<>();
231232
Map<String, ComposableIndexTemplate> v2Templates = new HashMap<>();
232-
Metadata.Builder metadataBuilder = new Metadata.Builder();
233+
ProjectMetadata.Builder projectBuilder = ProjectMetadata.builder(ProjectId.DEFAULT);
233234
Set<String> indicesWithInvalidMappings = new HashSet<>();
234235
for (int i = 0; i < bulkItemCount; i++) {
235236
Map<String, ?> source = Map.of(randomAlphaOfLength(10), randomAlphaOfLength(5));
@@ -275,10 +276,10 @@ public void testIndexDataWithValidation() throws IOException {
275276
default -> throw new AssertionError("Illegal branch");
276277
}
277278
}
278-
metadataBuilder.indices(indicesMap);
279-
metadataBuilder.templates(v1Templates);
280-
metadataBuilder.indexTemplates(v2Templates);
281-
ClusterServiceUtils.setState(clusterService, new ClusterState.Builder(clusterService.state()).metadata(metadataBuilder));
279+
projectBuilder.indices(indicesMap);
280+
projectBuilder.templates(v1Templates);
281+
projectBuilder.indexTemplates(v2Templates);
282+
ClusterServiceUtils.setState(clusterService, ClusterState.builder(clusterService.state()).putProjectMetadata(projectBuilder));
282283
AtomicBoolean onResponseCalled = new AtomicBoolean(false);
283284
ActionListener<BulkResponse> listener = new ActionListener<>() {
284285
@Override

0 commit comments

Comments
 (0)