Skip to content

Commit 5dded6d

Browse files
committed
Merge branch 'main' into enable-generic-vector-formats
2 parents 3ecf6ac + d02487e commit 5dded6d

File tree

69 files changed

+829
-175
lines changed

Some content is hidden

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

69 files changed

+829
-175
lines changed

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

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,8 +114,26 @@ public void stop() {
114114
}
115115

116116
class RootHandler implements HttpHandler {
117+
// checked by APM agent to identify the APM server version to adjust its behavior accordingly
118+
private static final String FAKE_VERSION = """
119+
{
120+
"build_date": "2021-12-18T19:59:06Z",
121+
"build_sha": "24fe620eeff5a19e2133c940c7e5ce1ceddb1445",
122+
"publish_ready": true,
123+
"version": "9.0.0"
124+
}
125+
""";
126+
117127
public void handle(HttpExchange t) {
118128
try {
129+
if ("GET".equals(t.getRequestMethod()) && "/".equals(t.getRequestURI().getPath())) {
130+
t.sendResponseHeaders(200, FAKE_VERSION.length());
131+
try (OutputStream os = t.getResponseBody()) {
132+
os.write(FAKE_VERSION.getBytes());
133+
}
134+
return;
135+
}
136+
119137
InputStream body = t.getRequestBody();
120138
if (metricFilter == null && transactionFilter == null) {
121139
logRequestBody(body);

docs/changelog/137966.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
pr: 137966
2+
summary: Allows PIT to be cross project
3+
area: Search
4+
type: enhancement
5+
issues: []

docs/changelog/138631.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
pr: 138631
2+
summary: Improved bulk loading for binary doc values
3+
area: Codec
4+
type: enhancement
5+
issues: []

docs/changelog/138681.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
pr: 138681
2+
summary: Field caps to support `project_routing` also in the body of the request
3+
area: Search
4+
type: enhancement
5+
issues: []

modules/apm/src/main/java/org/elasticsearch/telemetry/apm/internal/tracing/APMTracer.java

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -192,10 +192,14 @@ public void startTrace(TraceContext traceContext, Traceable traceable, String sp
192192
}
193193

194194
final Span span = spanBuilder.startSpan();
195-
// If not a root span (meaning a local parent exists) and the agent decided not to record the span, discard it immediately.
196-
// Root spans (transactions), however, have to be kept to correctly report their duration.
197-
if (localParentContext != null && span.isRecording() == false) {
198-
logger.trace("Span [{}] [{}] will not be recorded due to transaction_max_spans reached", spanId, spanName);
195+
if (span.isRecording() == false) {
196+
if (localParentContext == null) {
197+
// this root span (transactions) is dropped due to sampling; the agent might report these when connected to
198+
// very old versions of apm server, however (with an incorrect duration)
199+
logger.trace("Root span [{}] [{}] will not be recorded due to sampling", spanId, spanName);
200+
} else {
201+
logger.trace("Span [{}] [{}] will not be recorded due to transaction_max_spans reached", spanId, spanName);
202+
}
199203
span.end(); // end span immediately to release any resources.
200204
return null; // return null to discard and not record in map of spans
201205
}

modules/apm/src/test/java/org/elasticsearch/telemetry/apm/internal/tracing/APMTracerTests.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -109,9 +109,7 @@ public void test_onTraceStarted_ifNotRecorded_doesNotStartTracing() {
109109
apmTracer.startTrace(traceContext, TRACEABLE1, "name1_discard", null);
110110

111111
assertThat(traceContext.getTransient(Task.APM_TRACE_CONTEXT), nullValue());
112-
// the root span (transaction) is tracked
113-
assertThat(apmTracer.getSpans(), aMapWithSize(1));
114-
assertThat(apmTracer.getSpans(), hasKey(TRACEABLE1.getSpanId()));
112+
assertThat(apmTracer.getSpans(), anEmptyMap());
115113
}
116114

117115
/**

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

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -119,16 +119,6 @@ public void testValidateInvalidFieldType() {
119119
);
120120
}
121121

122-
public void testValidateNotIndexed() {
123-
Exception e = expectThrows(IllegalArgumentException.class, () -> createMapperService(timestampMapping(true, b -> {
124-
b.startObject("@timestamp");
125-
b.field("type", "date");
126-
b.field("index", false);
127-
b.endObject();
128-
})));
129-
assertThat(e.getMessage(), equalTo("data stream timestamp field [@timestamp] is not indexed"));
130-
}
131-
132122
public void testValidateNotDocValues() {
133123
Exception e = expectThrows(IllegalArgumentException.class, () -> createMapperService(timestampMapping(true, b -> {
134124
b.startObject("@timestamp");

modules/legacy-geo/src/test/java/org/elasticsearch/legacygeo/mapper/LegacyGeoShapeFieldMapperTests.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -671,4 +671,9 @@ protected IngestScriptSupport ingestScriptSupport() {
671671
protected List<SortShortcutSupport> getSortShortcutSupport() {
672672
return List.of();
673673
}
674+
675+
@Override
676+
protected boolean supportsDocValuesSkippers() {
677+
return false;
678+
}
674679
}

modules/mapper-extras/src/main/java/org/elasticsearch/index/mapper/extras/ScaledFloatFieldMapper.java

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -193,12 +193,23 @@ protected Parameter<?>[] getParameters() {
193193
return new Parameter<?>[] { indexed, hasDocValues, stored, ignoreMalformed, meta, scalingFactor, coerce, nullValue, metric };
194194
}
195195

196+
private IndexType indexType() {
197+
if (indexed.getValue()) {
198+
return IndexType.points(true, hasDocValues.getValue());
199+
}
200+
if (hasDocValues.getValue()
201+
&& indexSettings.getIndexVersionCreated().onOrAfter(IndexVersions.STANDARD_INDEXES_USE_SKIPPERS)
202+
&& indexSettings.useDocValuesSkipper()) {
203+
return IndexType.skippers();
204+
}
205+
return IndexType.points(false, hasDocValues.getValue());
206+
}
207+
196208
@Override
197209
public ScaledFloatFieldMapper build(MapperBuilderContext context) {
198-
IndexType indexType = IndexType.points(indexed.get(), hasDocValues.get());
199210
ScaledFloatFieldType type = new ScaledFloatFieldType(
200211
context.buildFullName(leafName()),
201-
indexType,
212+
indexType(),
202213
stored.getValue(),
203214
meta.getValue(),
204215
scalingFactor.getValue(),

modules/mapper-extras/src/test/java/org/elasticsearch/index/mapper/extras/MatchOnlyTextFieldMapperTests.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -390,4 +390,9 @@ public void testLoadSyntheticSourceFromStringOrBytesRef() throws IOException {
390390
protected List<SortShortcutSupport> getSortShortcutSupport() {
391391
return List.of();
392392
}
393+
394+
@Override
395+
protected boolean supportsDocValuesSkippers() {
396+
return false;
397+
}
393398
}

0 commit comments

Comments
 (0)