Skip to content

Commit d99300c

Browse files
Merge branch 'main' into date-nanos-implicit-casting-behind-snapshot
2 parents cc4dac3 + 8acf94b commit d99300c

File tree

21 files changed

+448
-55
lines changed

21 files changed

+448
-55
lines changed

build-tools-internal/src/main/resources/checkstyle_suppressions.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@
3737
<suppress files="qa[/\\]rolling-upgrade[/\\]src[/\\]javaRestTest[/\\]java[/\\]org[/\\]elasticsearch[/\\]upgrades[/\\]TsdbIT.java" checks="LineLength" />
3838
<suppress files="qa[/\\]rolling-upgrade[/\\]src[/\\]javaRestTest[/\\]java[/\\]org[/\\]elasticsearch[/\\]upgrades[/\\]TsdbIndexingRollingUpgradeIT.java" checks="LineLength" />
3939
<suppress files="qa[/\\]rolling-upgrade[/\\]src[/\\]javaRestTest[/\\]java[/\\]org[/\\]elasticsearch[/\\]upgrades[/\\]LogsdbIndexingRollingUpgradeIT.java" checks="LineLength" />
40+
<suppress files="plugin[/\\]logsdb[/\\]qa[/\\]rolling-upgrade[/\\]src[/\\]javaRestTest[/\\]java[/\\]org[/\\]elasticsearch[/\\]upgrades[/\\]MatchOnlyTextRollingUpgradeIT.java" checks="LineLength" />
4041

4142
<!-- Gradle requires inputs to be seriablizable -->
4243
<suppress files="build-tools-internal[/\\]src[/\\]main[/\\]java[/\\]org[/\\]elasticsearch[/\\]gradle[/\\]internal[/\\]precommit[/\\]TestingConventionRule.java" checks="RegexpSinglelineJava" />

docs/reference/elasticsearch/configuration-reference/thread-pool-settings.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ $$$search-throttled$$$`search_throttled`
3333
: For analyze requests. Thread pool type is `fixed` with a size of `1`, queue size of `16`.
3434

3535
`write`
36-
: For write operations and ingest processors. Thread pool type is `fixed` with a size of [`# of allocated processors`](#node.processors), queue_size of `10000`. The maximum size for this pool is `1 + `[`# of allocated processors`](#node.processors).
36+
: For write operations and ingest processors. Thread pool type is `fixed` with a size of [`# of allocated processors`](#node.processors), queue_size of `max(10000, (`[`# of allocated processors`](#node.processors)`* 750))`. The maximum size for this pool is `1 + `[`# of allocated processors`](#node.processors).
3737

3838
`write_coordination`
3939
: For bulk request coordination operations. Thread pool type is `fixed` with a size of [`# of allocated processors`](#node.processors), queue_size of `10000`. The maximum size for this pool is `1 + `[`# of allocated processors`](#node.processors).

docs/reference/elasticsearch/rest-apis/api-conventions.md

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -421,6 +421,39 @@ GET /_nodes/ra*:2
421421
GET /_nodes/ra*:2*
422422
```
423423

424+
### Component Selectors [api-component-selectors]
425+
426+
A data stream component is a logical grouping of indices that help organize data inside a data stream. All data streams contain a `data` component by default. The `data` component comprises the data stream's backing indices. When searching, managing, or indexing into a data stream, the `data` component is what you are interacting with by default.
427+
428+
Some data stream features are exposed as additional components alongside its `data` component. These other components are comprised of separate sets of backing indices. These additional components store supplemental data independent of the data stream's regular backing indices. An example of another component is the `failures` component exposed by the data stream [failure store](docs-content://manage-data/data-store/data-streams/failure-store.md) feature, which captures documents that fail to be ingested in a separate set of backing indices on the data stream.
429+
430+
Some APIs that accept a `<data-stream>`, `<index>`, or `<target>` request path parameter also support *selector syntax* which defines which component on a data stream the API should operate on. To use a selector, it is appended to the index or data stream name. Selectors can be combined with other index pattern syntax like [date math](#api-date-math-index-names) and wildcards.
431+
432+
There are currently two selector suffixes supported by {{es}} APIs:
433+
434+
`::data`
435+
: Refers to a data stream's backing indices containing regular data. Data streams always contain a data component.
436+
437+
`::failures`
438+
: This component refers to the internal indices used for a data stream's [failure store](docs-content://manage-data/data-store/data-streams/failure-store.md).
439+
440+
As an example, [search]({{es-apis}}group/endpoint-search), [field capabilities]({{es-apis}}operation/operation-field-caps), and [index stats]({{es-apis}}operation/operation-indices-stats) APIs can all report results from a different component rather than from the default data.
441+
442+
```console
443+
# Search a data stream normally
444+
GET my-data-stream/_search
445+
# Search a data stream's failure data if present
446+
GET my-data-stream::failures/_search
447+
448+
# Syntax can be combined with other index pattern syntax (wildcards, multi-target, date math, cross cluster search, etc)
449+
GET logs-*::failures/_search
450+
GET logs-*::data,logs-*::failures/_count
451+
GET remote-cluster:logs-*-*::failures/_search
452+
GET *::data,*::failures,-logs-rdbms-*::failures/_stats
453+
GET <logs-{now/d}>::failures/_search
454+
```
455+
456+
424457
## Parameters [api-conventions-parameters]
425458

426459
Rest parameters (when using HTTP, map to HTTP URL parameters) follow the convention of using underscore casing.

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

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -222,9 +222,7 @@ private void updateSettingsOnIndices(
222222
Map<String, Object> settingsToApply = new HashMap<>();
223223
List<String> appliedToDataStreamOnly = new ArrayList<>();
224224
List<String> appliedToDataStreamAndBackingIndices = new ArrayList<>();
225-
Settings effectiveSettings = dataStream.getEffectiveSettings(
226-
clusterService.state().projectState(projectResolver.getProjectId()).metadata()
227-
);
225+
Settings effectiveSettings = dataStream.getEffectiveSettings(projectResolver.getProjectMetadata(clusterService.state()));
228226
for (String settingName : requestSettings.keySet()) {
229227
if (APPLY_TO_BACKING_INDICES.contains(settingName)) {
230228
settingsToApply.put(settingName, effectiveSettings.get(settingName));

modules/ingest-geoip/src/main/java/org/elasticsearch/ingest/geoip/EnterpriseGeoIpTaskState.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ public void writeTo(StreamOutput out) throws IOException {
151151
@FixForMultiProject(description = "Replace ProjectId.DEFAULT")
152152
static EnterpriseGeoIpTaskState getEnterpriseGeoIpTaskState(ClusterState state) {
153153
PersistentTasksCustomMetadata.PersistentTask<?> task = getTaskWithId(
154-
state.projectState(ProjectId.DEFAULT).metadata(),
154+
state.metadata().getProject(ProjectId.DEFAULT),
155155
EnterpriseGeoIpTask.ENTERPRISE_GEOIP_DOWNLOADER
156156
);
157157
return (task == null) ? null : (EnterpriseGeoIpTaskState) task.getState();

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

Lines changed: 41 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -362,10 +362,38 @@ public Query phrasePrefixQuery(TokenStream stream, int slop, int maxExpansions,
362362
return toQuery(query, queryShardContext);
363363
}
364364

365+
private static class BytesFromMixedStringsBytesRefBlockLoader extends BlockStoredFieldsReader.StoredFieldsBlockLoader {
366+
BytesFromMixedStringsBytesRefBlockLoader(String field) {
367+
super(field);
368+
}
369+
370+
@Override
371+
public Builder builder(BlockFactory factory, int expectedCount) {
372+
return factory.bytesRefs(expectedCount);
373+
}
374+
375+
@Override
376+
public RowStrideReader rowStrideReader(LeafReaderContext context) throws IOException {
377+
return new BlockStoredFieldsReader.Bytes(field) {
378+
private final BytesRef scratch = new BytesRef();
379+
380+
@Override
381+
protected BytesRef toBytesRef(Object v) {
382+
if (v instanceof BytesRef b) {
383+
return b;
384+
} else {
385+
assert v instanceof String;
386+
return BlockSourceReader.toBytesRef(scratch, v.toString());
387+
}
388+
}
389+
};
390+
}
391+
}
392+
365393
@Override
366394
public BlockLoader blockLoader(BlockLoaderContext blContext) {
367395
if (textFieldType.isSyntheticSource()) {
368-
return new BlockStoredFieldsReader.BytesFromBytesRefsBlockLoader(storedFieldNameForSyntheticSource());
396+
return new BytesFromMixedStringsBytesRefBlockLoader(storedFieldNameForSyntheticSource());
369397
}
370398
SourceValueFetcher fetcher = SourceValueFetcher.toString(blContext.sourcePaths(name()));
371399
// MatchOnlyText never has norms, so we have to use the field names field
@@ -386,7 +414,12 @@ public IndexFieldData.Builder fielddataBuilder(FieldDataContext fieldDataContext
386414
) {
387415
@Override
388416
protected BytesRef storedToBytesRef(Object stored) {
389-
return (BytesRef) stored;
417+
if (stored instanceof BytesRef storedBytes) {
418+
return storedBytes;
419+
} else {
420+
assert stored instanceof String;
421+
return new BytesRef(stored.toString());
422+
}
390423
}
391424
};
392425
}
@@ -477,7 +510,12 @@ protected SyntheticSourceSupport syntheticSourceSupport() {
477510
() -> new StringStoredFieldFieldLoader(fieldType().storedFieldNameForSyntheticSource(), fieldType().name(), leafName()) {
478511
@Override
479512
protected void write(XContentBuilder b, Object value) throws IOException {
480-
b.value(((BytesRef) value).utf8ToString());
513+
if (value instanceof BytesRef valueBytes) {
514+
b.value(valueBytes.utf8ToString());
515+
} else {
516+
assert value instanceof String;
517+
b.value(value.toString());
518+
}
481519
}
482520
}
483521
);

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

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@
1010
package org.elasticsearch.index.mapper.extras;
1111

1212
import org.apache.lucene.analysis.TokenStream;
13+
import org.apache.lucene.document.Field;
14+
import org.apache.lucene.document.StoredField;
15+
import org.apache.lucene.document.StringField;
1316
import org.apache.lucene.index.DirectoryReader;
1417
import org.apache.lucene.index.DocValuesType;
1518
import org.apache.lucene.index.IndexOptions;
@@ -21,6 +24,7 @@
2124
import org.apache.lucene.tests.analysis.CannedTokenStream;
2225
import org.apache.lucene.tests.analysis.Token;
2326
import org.apache.lucene.tests.index.RandomIndexWriter;
27+
import org.apache.lucene.util.BytesRef;
2428
import org.elasticsearch.common.Strings;
2529
import org.elasticsearch.core.Tuple;
2630
import org.elasticsearch.index.IndexSettings;
@@ -350,4 +354,29 @@ public void testStoreParameterDefaultsSyntheticSourceTextFieldIsMultiField() thr
350354
assertThat(fields, empty());
351355
}
352356
}
357+
358+
public void testLoadSyntheticSourceFromStringOrBytesRef() throws IOException {
359+
DocumentMapper mapper = createSytheticSourceMapperService(mapping(b -> {
360+
b.startObject("field1").field("type", "match_only_text").endObject();
361+
b.startObject("field2").field("type", "match_only_text").endObject();
362+
})).documentMapper();
363+
try (Directory directory = newDirectory()) {
364+
RandomIndexWriter iw = indexWriterForSyntheticSource(directory);
365+
366+
LuceneDocument document = new LuceneDocument();
367+
document.add(new StringField("field1", "foo", Field.Store.NO));
368+
document.add(new StoredField("field1._original", "foo"));
369+
370+
document.add(new StringField("field2", "bar", Field.Store.NO));
371+
document.add(new StoredField("field2._original", new BytesRef("bar")));
372+
373+
iw.addDocument(document);
374+
iw.close();
375+
376+
try (DirectoryReader indexReader = wrapInMockESDirectoryReader(DirectoryReader.open(directory))) {
377+
String syntheticSource = syntheticSource(mapper, null, indexReader, 0);
378+
assertEquals("{\"field1\":\"foo\",\"field2\":\"bar\"}", syntheticSource);
379+
}
380+
}
381+
}
353382
}

modules/streams/src/main/java/org/elasticsearch/rest/streams/logs/TransportLogsStreamsToggleActivation.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ protected void masterOperation(
7777
ActionListener<AcknowledgedResponse> listener
7878
) throws Exception {
7979
ProjectId projectId = projectResolver.getProjectId();
80-
StreamsMetadata streamsState = state.projectState(projectId).metadata().custom(StreamsMetadata.TYPE, StreamsMetadata.EMPTY);
80+
StreamsMetadata streamsState = state.metadata().getProject(projectId).custom(StreamsMetadata.TYPE, StreamsMetadata.EMPTY);
8181
boolean currentlyEnabled = streamsState.isLogsEnabled();
8282
boolean shouldEnable = request.shouldEnable();
8383
if (shouldEnable != currentlyEnabled) {

muted-tests.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -563,6 +563,12 @@ tests:
563563
- class: org.elasticsearch.xpack.esql.action.EnrichIT
564564
method: testTopN
565565
issue: https://github.com/elastic/elasticsearch/issues/130122
566+
- class: org.elasticsearch.action.support.ThreadedActionListenerTests
567+
method: testRejectionHandling
568+
issue: https://github.com/elastic/elasticsearch/issues/130129
569+
- class: org.elasticsearch.compute.aggregation.TopIntAggregatorFunctionTests
570+
method: testManyInitialManyPartialFinalRunnerThrowing
571+
issue: https://github.com/elastic/elasticsearch/issues/130145
566572

567573
# Examples:
568574
#

qa/vector/src/main/java/org/elasticsearch/test/knn/CmdLineArgs.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -262,8 +262,10 @@ public CmdLineArgs build() {
262262
if (docVectors == null) {
263263
throw new IllegalArgumentException("Document vectors path must be provided");
264264
}
265-
if (dimensions <= 0) {
266-
throw new IllegalArgumentException("dimensions must be a positive integer");
265+
if (dimensions <= 0 && dimensions != -1) {
266+
throw new IllegalArgumentException(
267+
"dimensions must be a positive integer or -1 for when dimension is available in the vector file"
268+
);
267269
}
268270
return new CmdLineArgs(
269271
docVectors,

0 commit comments

Comments
 (0)