Skip to content

Commit 33d2e7f

Browse files
authored
Merge branch 'main' into fix-reporting_user-role
2 parents 427e47b + b53d5f7 commit 33d2e7f

File tree

63 files changed

+578
-167
lines changed

Some content is hidden

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

63 files changed

+578
-167
lines changed

benchmarks/src/main/java/org/elasticsearch/benchmark/_nightly/esql/QueryPlanningBenchmark.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,8 @@ public void setup() {
9292
var fields = 10_000;
9393
var mapping = LinkedHashMap.<String, EsField>newLinkedHashMap(fields);
9494
for (int i = 0; i < fields; i++) {
95-
mapping.put("field" + i, new EsField("field-" + i, TEXT, emptyMap(), true));
95+
// We're creating a standard index, so none of these fields should be marked as dimensions.
96+
mapping.put("field" + i, new EsField("field-" + i, TEXT, emptyMap(), true, EsField.TimeSeriesFieldType.NONE));
9697
}
9798

9899
var esIndex = new EsIndex("test", mapping, Map.of("test", IndexMode.STANDARD));

benchmarks/src/main/java/org/elasticsearch/benchmark/compute/operator/EvalBenchmark.java

Lines changed: 21 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,7 @@ private static EvalOperator.ExpressionEvaluator evaluator(String operation) {
212212
FieldAttribute timestamp = new FieldAttribute(
213213
Source.EMPTY,
214214
"timestamp",
215-
new EsField("timestamp", DataType.DATETIME, Map.of(), true)
215+
new EsField("timestamp", DataType.DATETIME, Map.of(), true, EsField.TimeSeriesFieldType.NONE)
216216
);
217217
yield EvalMapper.toEvaluator(
218218
FOLD_CONTEXT,
@@ -321,19 +321,35 @@ private static EvalOperator.ExpressionEvaluator evaluator(String operation) {
321321
}
322322

323323
private static FieldAttribute longField() {
324-
return new FieldAttribute(Source.EMPTY, "long", new EsField("long", DataType.LONG, Map.of(), true));
324+
return new FieldAttribute(
325+
Source.EMPTY,
326+
"long",
327+
new EsField("long", DataType.LONG, Map.of(), true, EsField.TimeSeriesFieldType.NONE)
328+
);
325329
}
326330

327331
private static FieldAttribute doubleField() {
328-
return new FieldAttribute(Source.EMPTY, "double", new EsField("double", DataType.DOUBLE, Map.of(), true));
332+
return new FieldAttribute(
333+
Source.EMPTY,
334+
"double",
335+
new EsField("double", DataType.DOUBLE, Map.of(), true, EsField.TimeSeriesFieldType.NONE)
336+
);
329337
}
330338

331339
private static FieldAttribute intField() {
332-
return new FieldAttribute(Source.EMPTY, "int", new EsField("int", DataType.INTEGER, Map.of(), true));
340+
return new FieldAttribute(
341+
Source.EMPTY,
342+
"int",
343+
new EsField("int", DataType.INTEGER, Map.of(), true, EsField.TimeSeriesFieldType.NONE)
344+
);
333345
}
334346

335347
private static FieldAttribute keywordField() {
336-
return new FieldAttribute(Source.EMPTY, "keyword", new EsField("keyword", DataType.KEYWORD, Map.of(), true));
348+
return new FieldAttribute(
349+
Source.EMPTY,
350+
"keyword",
351+
new EsField("keyword", DataType.KEYWORD, Map.of(), true, EsField.TimeSeriesFieldType.NONE)
352+
);
337353
}
338354

339355
private static Configuration configuration() {

docs/changelog/132858.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
pr: 132858
2+
summary: Add index mode to resolve index response
3+
area: Indices APIs
4+
type: feature
5+
issues: []

docs/changelog/132945.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
pr: 132945
2+
summary: Disable child span for streaming tasks
3+
area: Machine Learning
4+
type: bug
5+
issues: []

muted-tests.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -582,6 +582,9 @@ tests:
582582
- class: org.elasticsearch.upgrades.SyntheticSourceRollingUpgradeIT
583583
method: testIndexing {upgradedNodes=0}
584584
issue: https://github.com/elastic/elasticsearch/issues/133061
585+
- class: org.elasticsearch.xpack.test.rest.XPackRestIT
586+
method: test {p0=esql/60_usage/Basic ESQL usage output (telemetry) non-snapshot version}
587+
issue: https://github.com/elastic/elasticsearch/issues/133014
585588

586589
# Examples:
587590
#
Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
---
2+
setup:
3+
- do:
4+
indices.delete:
5+
index: my-std-index
6+
ignore_unavailable: true
7+
- do:
8+
indices.delete:
9+
index: my-ts-index
10+
ignore_unavailable: true
11+
12+
# Only run this test if the cluster supports time series indexing.
13+
# If your project uses a different feature flag name, adjust it here.
14+
---
15+
"resolve index returns mode for standard and time_series indices":
16+
- requires:
17+
cluster_features: ["gte_v8.5.0", "resolve_index_returns_mode"]
18+
reason: "Requires time series indexing support introduced in v8.5.0 & Node must support returning 'mode' in indices.resolve_index response"
19+
20+
# Create a standard index
21+
- do:
22+
indices.create:
23+
index: my-std-index
24+
body:
25+
settings:
26+
number_of_shards: 1
27+
number_of_replicas: 0
28+
29+
# Create a time-series index
30+
- do:
31+
indices.create:
32+
index: my-ts-index
33+
body:
34+
settings:
35+
index.mode: time_series
36+
number_of_shards: 1
37+
number_of_replicas: 0
38+
index.routing_path: ["host"]
39+
mappings:
40+
properties:
41+
"@timestamp":
42+
type: date
43+
host:
44+
type: keyword
45+
time_series_dimension: true
46+
metric:
47+
type: keyword
48+
value:
49+
type: double
50+
51+
# Resolve standard index and verify mode
52+
- do:
53+
indices.resolve_index:
54+
name: my-std-index
55+
- match: { indices.0.name: "my-std-index" }
56+
- match: { indices.0.mode: "standard" }
57+
58+
# Resolve time-series index and verify mode
59+
- do:
60+
indices.resolve_index:
61+
name: my-ts-index
62+
- match: { indices.0.name: "my-ts-index" }
63+
- match: { indices.0.mode: "time_series" }
64+
65+
---
66+
teardown:
67+
- do:
68+
indices.delete:
69+
index: my-std-index
70+
ignore_unavailable: true
71+
- do:
72+
indices.delete:
73+
index: my-ts-index
74+
ignore_unavailable: true

server/src/main/java/module-info.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -434,7 +434,8 @@
434434
org.elasticsearch.script.ScriptFeatures,
435435
org.elasticsearch.search.retriever.RetrieversFeatures,
436436
org.elasticsearch.action.admin.cluster.stats.ClusterStatsFeatures,
437-
org.elasticsearch.ingest.IngestFeatures;
437+
org.elasticsearch.ingest.IngestFeatures,
438+
org.elasticsearch.action.admin.indices.resolve.ResolveIndexFeatures;
438439

439440
uses org.elasticsearch.plugins.internal.SettingsExtension;
440441
uses RestExtension;

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -365,6 +365,7 @@ static TransportVersion def(int id) {
365365
public static final TransportVersion SIMULATE_INGEST_MAPPING_MERGE_TYPE = def(9_138_0_00);
366366
public static final TransportVersion ESQL_LOOKUP_JOIN_ON_MANY_FIELDS = def(9_139_0_00);
367367
public static final TransportVersion SIMULATE_INGEST_EFFECTIVE_MAPPING = def(9_140_0_00);
368+
public static final TransportVersion RESOLVE_INDEX_MODE_ADDED = def(9_141_0_00);
368369

369370
/*
370371
* STOP! READ THIS FIRST! No, really,

server/src/main/java/org/elasticsearch/action/admin/indices/resolve/ResolveIndexAction.java

Lines changed: 27 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99

1010
package org.elasticsearch.action.admin.indices.resolve;
1111

12+
import org.elasticsearch.TransportVersions;
1213
import org.elasticsearch.action.ActionListener;
1314
import org.elasticsearch.action.ActionRequestValidationException;
1415
import org.elasticsearch.action.ActionResponse;
@@ -39,6 +40,7 @@
3940
import org.elasticsearch.common.util.concurrent.EsExecutors;
4041
import org.elasticsearch.core.Nullable;
4142
import org.elasticsearch.index.Index;
43+
import org.elasticsearch.index.IndexMode;
4244
import org.elasticsearch.injection.guice.Inject;
4345
import org.elasticsearch.search.SearchService;
4446
import org.elasticsearch.tasks.Task;
@@ -176,27 +178,35 @@ public static class ResolvedIndex extends ResolvedIndexAbstraction implements Wr
176178
static final ParseField ALIASES_FIELD = new ParseField("aliases");
177179
static final ParseField ATTRIBUTES_FIELD = new ParseField("attributes");
178180
static final ParseField DATA_STREAM_FIELD = new ParseField("data_stream");
181+
static final ParseField MODE_FIELD = new ParseField("mode");
179182

180183
private final String[] aliases;
181184
private final String[] attributes;
182185
private final String dataStream;
186+
private final IndexMode mode;
183187

184188
ResolvedIndex(StreamInput in) throws IOException {
185189
setName(in.readString());
186190
this.aliases = in.readStringArray();
187191
this.attributes = in.readStringArray();
188192
this.dataStream = in.readOptionalString();
193+
if (in.getTransportVersion().onOrAfter(TransportVersions.RESOLVE_INDEX_MODE_ADDED)) {
194+
this.mode = IndexMode.readFrom(in);
195+
} else {
196+
this.mode = null;
197+
}
189198
}
190199

191-
ResolvedIndex(String name, String[] aliases, String[] attributes, @Nullable String dataStream) {
200+
ResolvedIndex(String name, String[] aliases, String[] attributes, @Nullable String dataStream, IndexMode mode) {
192201
super(name);
193202
this.aliases = aliases;
194203
this.attributes = attributes;
195204
this.dataStream = dataStream;
205+
this.mode = mode;
196206
}
197207

198208
public ResolvedIndex copy(String newName) {
199-
return new ResolvedIndex(newName, aliases, attributes, dataStream);
209+
return new ResolvedIndex(newName, aliases, attributes, dataStream, mode);
200210
}
201211

202212
public String[] getAliases() {
@@ -211,12 +221,19 @@ public String getDataStream() {
211221
return dataStream;
212222
}
213223

224+
public IndexMode getMode() {
225+
return mode;
226+
}
227+
214228
@Override
215229
public void writeTo(StreamOutput out) throws IOException {
216230
out.writeString(getName());
217231
out.writeStringArray(aliases);
218232
out.writeStringArray(attributes);
219233
out.writeOptionalString(dataStream);
234+
if (out.getTransportVersion().onOrAfter(TransportVersions.RESOLVE_INDEX_MODE_ADDED)) {
235+
IndexMode.writeTo(mode, out);
236+
}
220237
}
221238

222239
@Override
@@ -230,6 +247,9 @@ public XContentBuilder toXContent(XContentBuilder builder, Params params) throws
230247
if (Strings.isNullOrEmpty(dataStream) == false) {
231248
builder.field(DATA_STREAM_FIELD.getPreferredName(), dataStream);
232249
}
250+
if (mode != null) {
251+
builder.field(MODE_FIELD.getPreferredName(), mode.toString());
252+
}
233253
builder.endObject();
234254
return builder;
235255
}
@@ -242,12 +262,14 @@ public boolean equals(Object o) {
242262
return getName().equals(index.getName())
243263
&& Objects.equals(dataStream, index.dataStream)
244264
&& Arrays.equals(aliases, index.aliases)
245-
&& Arrays.equals(attributes, index.attributes);
265+
&& Arrays.equals(attributes, index.attributes)
266+
&& Objects.equals(mode, index.mode);
246267
}
247268

248269
@Override
249270
public int hashCode() {
250271
int result = Objects.hash(getName(), dataStream);
272+
result = 31 * result + Objects.hashCode(mode);
251273
result = 31 * result + Arrays.hashCode(aliases);
252274
result = 31 * result + Arrays.hashCode(attributes);
253275
return result;
@@ -639,7 +661,8 @@ private static void enrichIndexAbstraction(
639661
ia.getName(),
640662
aliasNames,
641663
attributes.stream().map(Enum::name).map(e -> e.toLowerCase(Locale.ROOT)).toArray(String[]::new),
642-
ia.getParentDataStream() == null ? null : ia.getParentDataStream().getName()
664+
ia.getParentDataStream() == null ? null : ia.getParentDataStream().getName(),
665+
writeIndex.getIndexMode() == null ? IndexMode.STANDARD : writeIndex.getIndexMode()
643666
)
644667
);
645668
}
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
/*
2+
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
3+
* or more contributor license agreements. Licensed under the "Elastic License
4+
* 2.0", the "GNU Affero General Public License v3.0 only", and the "Server Side
5+
* Public License v 1"; you may not use this file except in compliance with, at
6+
* your election, the "Elastic License 2.0", the "GNU Affero General Public
7+
* License v3.0 only", or the "Server Side Public License, v 1".
8+
*/
9+
10+
package org.elasticsearch.action.admin.indices.resolve;
11+
12+
import org.elasticsearch.features.FeatureSpecification;
13+
import org.elasticsearch.features.NodeFeature;
14+
15+
import java.util.Set;
16+
17+
public class ResolveIndexFeatures implements FeatureSpecification {
18+
19+
// Feature published by nodes that return "mode" in indices.resolve_index responses.
20+
public static final NodeFeature RESOLVE_INDEX_RETURNS_MODE = new NodeFeature("resolve_index_returns_mode");
21+
22+
@Override
23+
public Set<NodeFeature> getFeatures() {
24+
return Set.of(RESOLVE_INDEX_RETURNS_MODE);
25+
}
26+
27+
@Override
28+
public Set<NodeFeature> getTestFeatures() {
29+
return Set.of(RESOLVE_INDEX_RETURNS_MODE);
30+
}
31+
32+
}

0 commit comments

Comments
 (0)