Skip to content

Commit e4f7a8d

Browse files
committed
Merge remote-tracking branch 'origin/main' into ES-10225-snapshots-service-multi-project
2 parents 132401f + bf2a283 commit e4f7a8d

File tree

29 files changed

+1041
-194
lines changed

29 files changed

+1041
-194
lines changed

docs/changelog/122497.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
pr: 122497
2+
summary: Check if index patterns conform to valid format before validation
3+
area: CCS
4+
type: enhancement
5+
issues: []

docs/changelog/129370.yaml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
pr: 129370
2+
summary: Avoid dropping aggregate groupings in local plans
3+
area: ES|QL
4+
type: bug
5+
issues:
6+
- 129811
7+
- 128054

docs/changelog/130032.yaml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
pr: 130032
2+
summary: ES|QL cross-cluster querying is now generally available
3+
area: ES|QL
4+
type: feature
5+
issues: []
6+
highlight:
7+
title: ES|QL cross-cluster querying is now generally available
8+
body: |-
9+
The ES|QL Cross-Cluster querying feature has been in technical preview since 8.13.
10+
As of releases 8.19.0 and 9.1.0 this is now generally available.
11+
This feature allows you to run ES|QL queries across multiple clusters.
12+
notable: true

docs/reference/elasticsearch/index-settings/slow-log.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ navigation_title: Slow log
88

99
The slow log records database searching and indexing events that have execution durations above specified thresholds. You can use these logs to investigate analyze or troubleshoot your cluster’s historical search and indexing performance.
1010

11-
Slow logs report task duration at the shard level for searches, and at the index level for indexing, but might not encompass the full task execution time observed on the client. For example, slow logs don’t surface HTTP network delays or the impact of [task queues](docs-content://troubleshoot/elasticsearch/task-queue-backlog.md).
11+
Slow logs report task duration at the shard level for searches, and at the index level for indexing, but might not encompass the full task execution time observed on the client. For example, slow logs don’t surface HTTP network delays or the impact of [task queues](docs-content://troubleshoot/elasticsearch/task-queue-backlog.md). For more information about the higher-level operations affecting response times, refer to [Reading and writing documents](docs-content://deploy-manage/distributed-architecture/reading-and-writing-documents.md).
1212

1313
Events that meet the specified threshold are emitted into [{{es}} logging](docs-content://deploy-manage/monitor/logging-configuration/update-elasticsearch-logging-levels.md) under the `fileset.name` of `slowlog`. These logs can be viewed in the following locations:
1414

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

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@
5454
import org.elasticsearch.threadpool.ThreadPool;
5555
import org.elasticsearch.transport.TransportService;
5656

57+
import java.io.IOException;
5758
import java.time.Instant;
5859
import java.util.ArrayList;
5960
import java.util.Arrays;
@@ -261,13 +262,17 @@ static GetDataStreamAction.Response innerOperation(
261262
Settings settings = dataStream.getEffectiveSettings(state.metadata());
262263
ilmPolicyName = settings.get(IndexMetadata.LIFECYCLE_NAME);
263264
if (indexMode == null && state.metadata().templatesV2().get(indexTemplate) != null) {
264-
indexMode = resolveMode(
265-
state,
266-
indexSettingProviders,
267-
dataStream,
268-
settings,
269-
dataStream.getEffectiveIndexTemplate(state.metadata())
270-
);
265+
try {
266+
indexMode = resolveMode(
267+
state,
268+
indexSettingProviders,
269+
dataStream,
270+
settings,
271+
dataStream.getEffectiveIndexTemplate(state.metadata())
272+
);
273+
} catch (IOException e) {
274+
throw new RuntimeException(e);
275+
}
271276
}
272277
indexTemplatePreferIlmValue = PREFER_ILM_SETTING.get(settings);
273278
} else {

modules/data-streams/src/test/java/org/elasticsearch/datastreams/UpdateTimeSeriesRangeServiceTests.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -258,6 +258,7 @@ public void testUpdateTimeSeriesTemporalOneBadDataStream() {
258258
2,
259259
ds2.getMetadata(),
260260
ds2.getSettings(),
261+
ds2.getMappings(),
261262
ds2.isHidden(),
262263
ds2.isReplicated(),
263264
ds2.isSystem(),

modules/ingest-geoip/qa/multi-project/build.gradle

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,3 +22,8 @@ dependencies {
2222
tasks.withType(Test).configureEach {
2323
it.systemProperty "tests.multi_project.enabled", true
2424
}
25+
26+
// Exclude multi-project tests from release build
27+
tasks.named { it == "javaRestTest" || it == "yamlRestTest" }.configureEach {
28+
it.onlyIf("snapshot build") { buildParams.snapshotBuild }
29+
}

muted-tests.yml

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -476,9 +476,6 @@ tests:
476476
- class: org.elasticsearch.index.engine.ThreadPoolMergeExecutorServiceDiskSpaceTests
477477
method: testAvailableDiskSpaceMonitorWhenFileSystemStatErrors
478478
issue: https://github.com/elastic/elasticsearch/issues/129149
479-
- class: org.elasticsearch.index.engine.ThreadPoolMergeExecutorServiceDiskSpaceTests
480-
method: testUnavailableBudgetBlocksNewMergeTasksFromStartingExecution
481-
issue: https://github.com/elastic/elasticsearch/issues/129148
482479
- class: org.elasticsearch.xpack.esql.qa.single_node.GenerativeForkIT
483480
method: test {lookup-join.EnrichLookupStatsBug ASYNC}
484481
issue: https://github.com/elastic/elasticsearch/issues/129228
@@ -570,6 +567,14 @@ tests:
570567
- class: org.elasticsearch.xpack.inference.qa.mixed.CohereServiceMixedIT
571568
method: testCohereEmbeddings
572569
issue: https://github.com/elastic/elasticsearch/issues/130010
570+
- class: org.elasticsearch.xpack.esql.qa.mixed.MixedClusterEsqlSpecIT
571+
issue: https://github.com/elastic/elasticsearch/issues/128224
572+
- class: org.elasticsearch.xpack.autoscaling.storage.ReactiveStorageIT
573+
method: testScaleDuringSplitOrClone
574+
issue: https://github.com/elastic/elasticsearch/issues/130044
575+
- class: org.elasticsearch.cluster.metadata.ComposableIndexTemplateTests
576+
method: testMergeEmptyMappingsIntoTemplateWithNonEmptySettings
577+
issue: https://github.com/elastic/elasticsearch/issues/130050
573578

574579
# Examples:
575580
#

server/src/main/java/org/elasticsearch/TransportVersions.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -323,6 +323,7 @@ static TransportVersion def(int id) {
323323
public static final TransportVersion ML_INFERENCE_ELASTIC_DENSE_TEXT_EMBEDDINGS_ADDED = def(9_109_00_0);
324324
public static final TransportVersion ML_INFERENCE_COHERE_API_VERSION = def(9_110_0_00);
325325
public static final TransportVersion ESQL_PROFILE_INCLUDE_PLAN = def(9_111_0_00);
326+
public static final TransportVersion MAPPINGS_IN_DATA_STREAMS = def(9_112_0_00);
326327

327328
/*
328329
* STOP! READ THIS FIRST! No, really,

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

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,18 +19,24 @@
1919
import org.elasticsearch.common.io.stream.StreamOutput;
2020
import org.elasticsearch.common.io.stream.Writeable;
2121
import org.elasticsearch.common.settings.Settings;
22+
import org.elasticsearch.common.xcontent.XContentHelper;
2223
import org.elasticsearch.core.Nullable;
2324
import org.elasticsearch.index.mapper.DataStreamTimestampFieldMapper;
2425
import org.elasticsearch.index.mapper.MapperService;
26+
import org.elasticsearch.index.mapper.Mapping;
2527
import org.elasticsearch.xcontent.ConstructingObjectParser;
2628
import org.elasticsearch.xcontent.ParseField;
2729
import org.elasticsearch.xcontent.ToXContentObject;
2830
import org.elasticsearch.xcontent.XContentBuilder;
31+
import org.elasticsearch.xcontent.XContentFactory;
2932
import org.elasticsearch.xcontent.XContentParser;
33+
import org.elasticsearch.xcontent.XContentParserConfiguration;
34+
import org.elasticsearch.xcontent.XContentType;
3035

3136
import java.io.IOException;
3237
import java.util.ArrayList;
3338
import java.util.Collections;
39+
import java.util.HashMap;
3440
import java.util.List;
3541
import java.util.Map;
3642
import java.util.Objects;
@@ -51,6 +57,14 @@ public class ComposableIndexTemplate implements SimpleDiffable<ComposableIndexTe
5157
private static final ParseField ALLOW_AUTO_CREATE = new ParseField("allow_auto_create");
5258
private static final ParseField IGNORE_MISSING_COMPONENT_TEMPLATES = new ParseField("ignore_missing_component_templates");
5359
private static final ParseField DEPRECATED = new ParseField("deprecated");
60+
public static final CompressedXContent EMPTY_MAPPINGS;
61+
static {
62+
try {
63+
EMPTY_MAPPINGS = new CompressedXContent(Map.of());
64+
} catch (IOException e) {
65+
throw new RuntimeException(e);
66+
}
67+
}
5468

5569
@SuppressWarnings("unchecked")
5670
public static final ConstructingObjectParser<ComposableIndexTemplate, Void> PARSER = new ConstructingObjectParser<>(
@@ -338,6 +352,64 @@ public ComposableIndexTemplate mergeSettings(Settings settings) {
338352
return mergedIndexTemplateBuilder.build();
339353
}
340354

355+
public ComposableIndexTemplate mergeMappings(CompressedXContent mappings) throws IOException {
356+
Objects.requireNonNull(mappings);
357+
if (Mapping.EMPTY.toCompressedXContent().equals(mappings) && this.template() != null && this.template().mappings() != null) {
358+
return this;
359+
}
360+
ComposableIndexTemplate.Builder mergedIndexTemplateBuilder = this.toBuilder();
361+
Template.Builder mergedTemplateBuilder;
362+
CompressedXContent templateMappings;
363+
if (this.template() == null) {
364+
mergedTemplateBuilder = Template.builder();
365+
templateMappings = null;
366+
} else {
367+
mergedTemplateBuilder = Template.builder(this.template());
368+
templateMappings = this.template().mappings();
369+
}
370+
mergedTemplateBuilder.mappings(templateMappings == null ? mappings : merge(templateMappings, mappings));
371+
mergedIndexTemplateBuilder.template(mergedTemplateBuilder);
372+
return mergedIndexTemplateBuilder.build();
373+
}
374+
375+
@SuppressWarnings("unchecked")
376+
private CompressedXContent merge(CompressedXContent originalMapping, CompressedXContent mappingAddition) throws IOException {
377+
Map<String, Object> mappingAdditionMap = XContentHelper.convertToMap(mappingAddition.uncompressed(), true, XContentType.JSON).v2();
378+
Map<String, Object> combinedMappingMap = new HashMap<>();
379+
if (originalMapping != null) {
380+
Map<String, Object> originalMappingMap = XContentHelper.convertToMap(originalMapping.uncompressed(), true, XContentType.JSON)
381+
.v2();
382+
if (originalMappingMap.containsKey(MapperService.SINGLE_MAPPING_NAME)) {
383+
combinedMappingMap.putAll((Map<String, ?>) originalMappingMap.get(MapperService.SINGLE_MAPPING_NAME));
384+
} else {
385+
combinedMappingMap.putAll(originalMappingMap);
386+
}
387+
}
388+
XContentHelper.update(combinedMappingMap, mappingAdditionMap, true);
389+
return convertMappingMapToXContent(combinedMappingMap);
390+
}
391+
392+
private static CompressedXContent convertMappingMapToXContent(Map<String, Object> rawAdditionalMapping) throws IOException {
393+
CompressedXContent compressedXContent;
394+
if (rawAdditionalMapping.isEmpty()) {
395+
compressedXContent = EMPTY_MAPPINGS;
396+
} else {
397+
try (var parser = XContentHelper.mapToXContentParser(XContentParserConfiguration.EMPTY, rawAdditionalMapping)) {
398+
compressedXContent = mappingFromXContent(parser);
399+
}
400+
}
401+
return compressedXContent;
402+
}
403+
404+
private static CompressedXContent mappingFromXContent(XContentParser parser) throws IOException {
405+
XContentParser.Token token = parser.nextToken();
406+
if (token == XContentParser.Token.START_OBJECT) {
407+
return new CompressedXContent(Strings.toString(XContentFactory.jsonBuilder().map(parser.mapOrdered())));
408+
} else {
409+
throw new IllegalArgumentException("Unexpected token: " + token);
410+
}
411+
}
412+
341413
@Override
342414
public int hashCode() {
343415
return Objects.hash(

0 commit comments

Comments
 (0)