Skip to content

Commit d3f721c

Browse files
authored
Merge branch 'main' into cps-expression-rewriter
2 parents b590601 + 2c20c49 commit d3f721c

File tree

53 files changed

+3906
-2369
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

53 files changed

+3906
-2369
lines changed

build-tools/src/main/java/org/elasticsearch/gradle/testclusters/ElasticsearchCluster.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@
6464
public class ElasticsearchCluster implements TestClusterConfiguration, Named {
6565

6666
private static final Logger LOGGER = Logging.getLogger(ElasticsearchNode.class);
67-
private static final int CLUSTER_UP_TIMEOUT = 40;
67+
private static final int CLUSTER_UP_TIMEOUT = 120;
6868
private static final TimeUnit CLUSTER_UP_TIMEOUT_UNIT = TimeUnit.SECONDS;
6969

7070
private final AtomicBoolean configurationFrozen = new AtomicBoolean(false);

docs/changelog/135262.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
pr: 135262
2+
summary: Add usage stats for `semantic_text` fields
3+
area: "Vector Search"
4+
type: enhancement
5+
issues: []

docs/changelog/135431.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
pr: 135431
2+
summary: "[Downsampling++] Allow merging of passthrough mappers with object mappers\
3+
\ under certain conditions"
4+
area: Mapping
5+
type: bug
6+
issues: []

docs/changelog/135603.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
pr: 135603
2+
summary: Make FUSE available in release builds
3+
area: ES|QL
4+
type: feature
5+
issues: []

muted-tests.yml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -606,9 +606,6 @@ tests:
606606
- class: org.elasticsearch.xpack.esql.qa.single_node.GenerativeIT
607607
method: test
608608
issue: https://github.com/elastic/elasticsearch/issues/134407
609-
- class: org.elasticsearch.xpack.test.rest.XPackRestIT
610-
method: test {p0=esql/60_usage/Basic ESQL usage output (telemetry) snapshot version}
611-
issue: https://github.com/elastic/elasticsearch/issues/135584
612609

613610
# Examples:
614611
#

server/src/main/java/org/elasticsearch/index/mapper/ContentPath.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,9 @@ public boolean isWithinLeafObject() {
5858
}
5959

6060
public String pathAsText(String name) {
61+
if (index == 0) {
62+
return name;
63+
}
6164
sb.setLength(0);
6265
for (int i = 0; i < index; i++) {
6366
sb.append(path[i]).append(DELIMITER);

server/src/main/java/org/elasticsearch/index/mapper/MapperErrors.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,12 @@ static void throwObjectMappingConflictError(String fieldName) throws IllegalArgu
1414
throw new IllegalArgumentException("can't merge a non object mapping [" + fieldName + "] with an object mapping");
1515
}
1616

17+
static void throwPassThroughMappingConflictError(String fieldName) throws IllegalArgumentException {
18+
throw new IllegalArgumentException(
19+
"can't merge a passthrough mapping [" + fieldName + "] with an object mapping that is either root or has subobjects enabled"
20+
);
21+
}
22+
1723
static void throwNestedMappingConflictError(String fieldName) throws IllegalArgumentException {
1824
throw new IllegalArgumentException("can't merge a non-nested mapping [" + fieldName + "] with a nested mapping");
1925
}

server/src/main/java/org/elasticsearch/index/mapper/ObjectMapper.java

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -577,6 +577,22 @@ public ObjectMapper merge(Mapper mergeWith, MapperMergeContext parentMergeContex
577577
MapperErrors.throwNestedMappingConflictError(mergeWith.fullPath());
578578
}
579579
var mergeResult = MergeResult.build(this, (ObjectMapper) mergeWith, parentMergeContext);
580+
if (mergeWith instanceof PassThroughObjectMapper passThroughObjectMapper) {
581+
if (PassThroughObjectMapper.isEligibleForMerge(this)) {
582+
return new PassThroughObjectMapper(
583+
leafName(),
584+
fullPath,
585+
mergeResult.enabled,
586+
mergeResult.sourceKeepMode,
587+
mergeResult.dynamic,
588+
mergeResult.mappers,
589+
passThroughObjectMapper.timeSeriesDimensionSubFields(),
590+
passThroughObjectMapper.priority()
591+
);
592+
} else {
593+
MapperErrors.throwPassThroughMappingConflictError(fullPath());
594+
}
595+
}
580596
return new ObjectMapper(
581597
leafName(),
582598
fullPath,

server/src/main/java/org/elasticsearch/index/mapper/PassThroughObjectMapper.java

Lines changed: 43 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,10 @@ public int priority() {
136136
return priority;
137137
}
138138

139+
public Explicit<Boolean> timeSeriesDimensionSubFields() {
140+
return timeSeriesDimensionSubFields;
141+
}
142+
139143
@Override
140144
public PassThroughObjectMapper.Builder newBuilder(IndexVersion indexVersionCreated) {
141145
PassThroughObjectMapper.Builder builder = new PassThroughObjectMapper.Builder(leafName());
@@ -148,29 +152,58 @@ public PassThroughObjectMapper.Builder newBuilder(IndexVersion indexVersionCreat
148152

149153
@Override
150154
public PassThroughObjectMapper merge(Mapper mergeWith, MapperMergeContext parentBuilderContext) {
151-
if (mergeWith instanceof PassThroughObjectMapper == false) {
155+
if (mergeWith instanceof ObjectMapper == false) {
152156
MapperErrors.throwObjectMappingConflictError(mergeWith.fullPath());
153157
}
158+
ObjectMapper mergeWithObjectMapper = (ObjectMapper) mergeWith;
159+
if (mergeWithObjectMapper instanceof PassThroughObjectMapper mergeWithPassThrough) {
160+
final var mergeResult = MergeResult.build(this, mergeWithPassThrough, parentBuilderContext);
161+
final Explicit<Boolean> containsDimensions = (mergeWithPassThrough.timeSeriesDimensionSubFields.explicit())
162+
? mergeWithPassThrough.timeSeriesDimensionSubFields
163+
: this.timeSeriesDimensionSubFields;
154164

155-
PassThroughObjectMapper mergeWithObject = (PassThroughObjectMapper) mergeWith;
156-
final var mergeResult = MergeResult.build(this, mergeWithObject, parentBuilderContext);
157-
158-
final Explicit<Boolean> containsDimensions = (mergeWithObject.timeSeriesDimensionSubFields.explicit())
159-
? mergeWithObject.timeSeriesDimensionSubFields
160-
: this.timeSeriesDimensionSubFields;
161-
165+
return new PassThroughObjectMapper(
166+
leafName(),
167+
fullPath(),
168+
mergeResult.enabled(),
169+
mergeResult.sourceKeepMode(),
170+
mergeResult.dynamic(),
171+
mergeResult.mappers(),
172+
containsDimensions,
173+
Math.max(priority, mergeWithPassThrough.priority)
174+
);
175+
}
176+
if (mergeWithObjectMapper instanceof NestedObjectMapper) {
177+
MapperErrors.throwNestedMappingConflictError(fullPath());
178+
}
179+
if (isEligibleForMerge(mergeWithObjectMapper) == false) {
180+
MapperErrors.throwPassThroughMappingConflictError(fullPath());
181+
}
182+
MergeResult mergeResult = MergeResult.build(this, mergeWithObjectMapper, parentBuilderContext);
162183
return new PassThroughObjectMapper(
163184
leafName(),
164185
fullPath(),
165186
mergeResult.enabled(),
166187
mergeResult.sourceKeepMode(),
167188
mergeResult.dynamic(),
168189
mergeResult.mappers(),
169-
containsDimensions,
170-
Math.max(priority, mergeWithObject.priority)
190+
timeSeriesDimensionSubFields,
191+
priority
171192
);
172193
}
173194

195+
/**
196+
* An object mapper is compatible to be merged with a passthrough mapper if
197+
* - It is not a root mapper
198+
* - If it does not have subobjects true
199+
*/
200+
static boolean isEligibleForMerge(ObjectMapper objectMapper) {
201+
return objectMapper.isRoot() == false
202+
&& (objectMapper.subobjects == null
203+
|| objectMapper.subobjects.explicit() == false
204+
|| objectMapper.subobjects.value().equals(Subobjects.DISABLED));
205+
}
206+
174207
@Override
175208
public XContentBuilder toXContent(XContentBuilder builder, Params params) throws IOException {
176209
builder.startObject(leafName());
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
9182000

0 commit comments

Comments
 (0)