Skip to content

Commit f8d1d2a

Browse files
authored
[TSDB] Rename rollup public API to downsample (#89809)
This PR renames all public APIs for downsampling so that they contain the downsample keyword instead of the rollup that we had until now. 1. The API endpoint for the downsampling action is renamed to: /source-index/_downsample/target-index 2. The ILM action is renamed to PUT _ilm/policy/my_policy { "policy": { "phases": { "warm": { "actions": { "downsample": { "fixed_interval": "24h" } } } } } } 3. unsupported_aggregation_on_rollup_index was renamed to unsupported_aggregation_on_downsampled_index 4. Internal trasport actions were renamed: indices:admin/xpack/rollup -> indices:admin/xpack/downsample indices:admin/xpack/rollup_indexer -> indices:admin/xpack/downsample_indexer 5. Renamed the following index settings: index.rollup.source.uuid -> index.downsample.source.uuid index.rollup.source.name -> index.downsample.source.name index.rollup.status -> index.downsample.status Finally, we renamed many internal variables and classes from *Rollup* to *Downsample*. However, this effort will be completed in more than one PRs so that we minimize conflicts with other in-flight PRs. Relates to #74660
1 parent 8abd1e1 commit f8d1d2a

File tree

47 files changed

+365
-343
lines changed

Some content is hidden

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

47 files changed

+365
-343
lines changed

rest-api-spec/src/main/resources/rest-api-spec/api/rollup.rollup.json renamed to rest-api-spec/src/main/resources/rest-api-spec/api/indices.downsample.json

+7-7
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
{
2-
"rollup.rollup":{
2+
"indices.downsample":{
33
"documentation":{
44
"url":"https://www.elastic.co/guide/en/elasticsearch/reference/current/xpack-rollup.html",
5-
"description":"Rollup an index"
5+
"description":"Downsample an index"
66
},
77
"stability":"experimental",
88
"visibility":"public",
@@ -13,19 +13,19 @@
1313
"url": {
1414
"paths": [
1515
{
16-
"path": "/{index}/_rollup/{rollup_index}",
16+
"path": "/{index}/_downsample/{target_index}",
1717
"methods": [
1818
"POST"
1919
],
2020
"parts": {
2121
"index": {
2222
"type": "string",
23-
"description": "The index to roll up",
23+
"description": "The index to downsample",
2424
"required": true
2525
},
26-
"rollup_index": {
26+
"target_index": {
2727
"type": "string",
28-
"description": "The name of the rollup index to create",
28+
"description": "The name of the target index to store downsampled data",
2929
"required": true
3030
}
3131
}
@@ -34,7 +34,7 @@
3434
},
3535
"params":{},
3636
"body":{
37-
"description":"The rollup configuration",
37+
"description":"The downsampling configuration",
3838
"required":true
3939
}
4040
}

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

+4-4
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
import org.elasticsearch.rest.RestStatus;
2424
import org.elasticsearch.search.SearchException;
2525
import org.elasticsearch.search.aggregations.MultiBucketConsumerService;
26-
import org.elasticsearch.search.aggregations.UnsupportedAggregationOnRollupIndex;
26+
import org.elasticsearch.search.aggregations.UnsupportedAggregationOnDownsampledIndex;
2727
import org.elasticsearch.transport.TcpTransport;
2828
import org.elasticsearch.xcontent.ParseField;
2929
import org.elasticsearch.xcontent.ToXContentFragment;
@@ -1580,9 +1580,9 @@ private enum ElasticsearchExceptionHandle {
15801580
166,
15811581
Version.V_8_5_0
15821582
),
1583-
UNSUPPORTED_AGGREGATION_ON_DOWNSAMPLED_FIELD_EXCEPTION(
1584-
UnsupportedAggregationOnRollupIndex.class,
1585-
UnsupportedAggregationOnRollupIndex::new,
1583+
UNSUPPORTED_AGGREGATION_ON_DOWNSAMPLED_INDEX_EXCEPTION(
1584+
UnsupportedAggregationOnDownsampledIndex.class,
1585+
UnsupportedAggregationOnDownsampledIndex::new,
15861586
167,
15871587
Version.V_8_5_0
15881588
);

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

+19-19
Original file line numberDiff line numberDiff line change
@@ -128,14 +128,14 @@ public class IndexMetadata implements Diffable<IndexMetadata>, ToXContentFragmen
128128
EnumSet.of(ClusterBlockLevel.WRITE)
129129
);
130130

131-
// TODO: refactor this method after adding more rollup metadata
132-
public boolean isRollupIndex() {
133-
final String sourceIndex = settings.get(IndexMetadata.INDEX_ROLLUP_SOURCE_NAME_KEY);
134-
final String indexRollupStatus = settings.get(IndexMetadata.INDEX_ROLLUP_STATUS_KEY);
135-
final boolean rollupSuccess = IndexMetadata.RollupTaskStatus.SUCCESS.name()
131+
// TODO: refactor this method after adding more downsampling metadata
132+
public boolean isDownsampledIndex() {
133+
final String sourceIndex = settings.get(IndexMetadata.INDEX_DOWNSAMPLE_SOURCE_NAME_KEY);
134+
final String indexDownsamplingStatus = settings.get(IndexMetadata.INDEX_DOWNSAMPLE_STATUS_KEY);
135+
final boolean downsamplingSuccess = DownsampleTaskStatus.SUCCESS.name()
136136
.toLowerCase(Locale.ROOT)
137-
.equals(indexRollupStatus != null ? indexRollupStatus.toLowerCase(Locale.ROOT) : IndexMetadata.RollupTaskStatus.UNKNOWN);
138-
return Strings.isNullOrEmpty(sourceIndex) == false && rollupSuccess;
137+
.equals(indexDownsamplingStatus != null ? indexDownsamplingStatus.toLowerCase(Locale.ROOT) : DownsampleTaskStatus.UNKNOWN);
138+
return Strings.isNullOrEmpty(sourceIndex) == false && downsamplingSuccess;
139139
}
140140

141141
public enum State implements Writeable {
@@ -1132,22 +1132,22 @@ public Index getResizeSourceIndex() {
11321132
: null;
11331133
}
11341134

1135-
public static final String INDEX_ROLLUP_SOURCE_UUID_KEY = "index.rollup.source.uuid";
1136-
public static final String INDEX_ROLLUP_SOURCE_NAME_KEY = "index.rollup.source.name";
1135+
public static final String INDEX_DOWNSAMPLE_SOURCE_UUID_KEY = "index.downsample.source.uuid";
1136+
public static final String INDEX_DOWNSAMPLE_SOURCE_NAME_KEY = "index.downsample.source.name";
11371137

1138-
public static final String INDEX_ROLLUP_STATUS_KEY = "index.rollup.status";
1139-
public static final Setting<String> INDEX_ROLLUP_SOURCE_UUID = Setting.simpleString(
1140-
INDEX_ROLLUP_SOURCE_UUID_KEY,
1138+
public static final String INDEX_DOWNSAMPLE_STATUS_KEY = "index.downsample.status";
1139+
public static final Setting<String> INDEX_DOWNSAMPLE_SOURCE_UUID = Setting.simpleString(
1140+
INDEX_DOWNSAMPLE_SOURCE_UUID_KEY,
11411141
Property.IndexScope,
11421142
Property.PrivateIndex
11431143
);
1144-
public static final Setting<String> INDEX_ROLLUP_SOURCE_NAME = Setting.simpleString(
1145-
INDEX_ROLLUP_SOURCE_NAME_KEY,
1144+
public static final Setting<String> INDEX_DOWNSAMPLE_SOURCE_NAME = Setting.simpleString(
1145+
INDEX_DOWNSAMPLE_SOURCE_NAME_KEY,
11461146
Property.IndexScope,
11471147
Property.PrivateIndex
11481148
);
11491149

1150-
public enum RollupTaskStatus {
1150+
public enum DownsampleTaskStatus {
11511151
UNKNOWN,
11521152
STARTED,
11531153
SUCCESS;
@@ -1158,10 +1158,10 @@ public String toString() {
11581158
}
11591159
}
11601160

1161-
public static final Setting<RollupTaskStatus> INDEX_ROLLUP_STATUS = Setting.enumSetting(
1162-
RollupTaskStatus.class,
1163-
INDEX_ROLLUP_STATUS_KEY,
1164-
RollupTaskStatus.UNKNOWN,
1161+
public static final Setting<DownsampleTaskStatus> INDEX_DOWNSAMPLE_STATUS = Setting.enumSetting(
1162+
DownsampleTaskStatus.class,
1163+
INDEX_DOWNSAMPLE_STATUS_KEY,
1164+
DownsampleTaskStatus.UNKNOWN,
11651165
Property.IndexScope,
11661166
Property.InternalIndex
11671167
);

server/src/main/java/org/elasticsearch/common/settings/IndexScopedSettings.java

+3-3
Original file line numberDiff line numberDiff line change
@@ -71,9 +71,9 @@ public final class IndexScopedSettings extends AbstractScopedSettings {
7171
IndexMetadata.INDEX_DATA_PATH_SETTING,
7272
IndexMetadata.INDEX_HIDDEN_SETTING,
7373
IndexMetadata.INDEX_FORMAT_SETTING,
74-
IndexMetadata.INDEX_ROLLUP_SOURCE_NAME,
75-
IndexMetadata.INDEX_ROLLUP_SOURCE_UUID,
76-
IndexMetadata.INDEX_ROLLUP_STATUS,
74+
IndexMetadata.INDEX_DOWNSAMPLE_SOURCE_NAME,
75+
IndexMetadata.INDEX_DOWNSAMPLE_SOURCE_UUID,
76+
IndexMetadata.INDEX_DOWNSAMPLE_STATUS,
7777
SearchSlowLog.INDEX_SEARCH_SLOWLOG_THRESHOLD_FETCH_DEBUG_SETTING,
7878
SearchSlowLog.INDEX_SEARCH_SLOWLOG_THRESHOLD_FETCH_WARN_SETTING,
7979
SearchSlowLog.INDEX_SEARCH_SLOWLOG_THRESHOLD_FETCH_INFO_SETTING,

server/src/main/java/org/elasticsearch/search/aggregations/UnsupportedAggregationOnRollupIndex.java renamed to server/src/main/java/org/elasticsearch/search/aggregations/UnsupportedAggregationOnDownsampledIndex.java

+3-3
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,13 @@
2020
* Downsampling uses specific types while aggregating some fields (like 'aggregate_metric_double').
2121
* Such field types do not support some aggregations.
2222
*/
23-
public class UnsupportedAggregationOnRollupIndex extends AggregationExecutionException {
23+
public class UnsupportedAggregationOnDownsampledIndex extends AggregationExecutionException {
2424

25-
public UnsupportedAggregationOnRollupIndex(final String msg) {
25+
public UnsupportedAggregationOnDownsampledIndex(final String msg) {
2626
super(msg);
2727
}
2828

29-
public UnsupportedAggregationOnRollupIndex(final StreamInput in) throws IOException {
29+
public UnsupportedAggregationOnDownsampledIndex(final StreamInput in) throws IOException {
3030
super(in);
3131
}
3232

server/src/main/java/org/elasticsearch/search/aggregations/bucket/histogram/DateHistogramAggregationBuilder.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -419,7 +419,7 @@ protected ValuesSourceAggregatorFactory innerBuild(
419419
) throws IOException {
420420
final DateIntervalWrapper.IntervalTypeEnum dateHistogramIntervalType = dateHistogramInterval.getIntervalType();
421421

422-
if (context.getIndexSettings().getIndexMetadata().isRollupIndex()
422+
if (context.getIndexSettings().getIndexMetadata().isDownsampledIndex()
423423
&& DateIntervalWrapper.IntervalTypeEnum.CALENDAR.equals(dateHistogramIntervalType)) {
424424
throw new IllegalArgumentException(
425425
config.getDescription()
@@ -432,7 +432,7 @@ protected ValuesSourceAggregatorFactory innerBuild(
432432
}
433433

434434
final ZoneId tz = timeZone();
435-
if (context.getIndexSettings().getIndexMetadata().isRollupIndex() && tz != null && ZoneId.of("UTC").equals(tz) == false) {
435+
if (context.getIndexSettings().getIndexMetadata().isDownsampledIndex() && tz != null && ZoneId.of("UTC").equals(tz) == false) {
436436
throw new IllegalArgumentException(
437437
config.getDescription() + " is not supported for aggregation [" + getName() + "] with timezone [" + tz + "]"
438438
);

server/src/test/java/org/elasticsearch/ExceptionSerializationTests.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@
7373
import org.elasticsearch.search.SearchParseException;
7474
import org.elasticsearch.search.SearchShardTarget;
7575
import org.elasticsearch.search.aggregations.MultiBucketConsumerService;
76-
import org.elasticsearch.search.aggregations.UnsupportedAggregationOnRollupIndex;
76+
import org.elasticsearch.search.aggregations.UnsupportedAggregationOnDownsampledIndex;
7777
import org.elasticsearch.search.internal.ShardSearchContextId;
7878
import org.elasticsearch.snapshots.Snapshot;
7979
import org.elasticsearch.snapshots.SnapshotException;
@@ -832,7 +832,7 @@ public void testIds() {
832832
ids.put(164, VersionConflictException.class);
833833
ids.put(165, SnapshotNameAlreadyInUseException.class);
834834
ids.put(166, HealthNodeNotDiscoveredException.class);
835-
ids.put(167, UnsupportedAggregationOnRollupIndex.class);
835+
ids.put(167, UnsupportedAggregationOnDownsampledIndex.class);
836836

837837
Map<Class<? extends ElasticsearchException>, Integer> reverse = new HashMap<>();
838838
for (Map.Entry<Integer, Class<? extends ElasticsearchException>> entry : ids.entrySet()) {

x-pack/plugin/core/src/main/java/module-info.java

+1
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@
5353
exports org.elasticsearch.xpack.core.common;
5454
exports org.elasticsearch.xpack.core.datastreams;
5555
exports org.elasticsearch.xpack.core.deprecation;
56+
exports org.elasticsearch.xpack.core.downsample;
5657
exports org.elasticsearch.xpack.core.enrich.action;
5758
exports org.elasticsearch.xpack.core.enrich;
5859
exports org.elasticsearch.xpack.core.eql;

x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/XPackClientPlugin.java

+4-5
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@
4040
import org.elasticsearch.xpack.core.async.DeleteAsyncResultAction;
4141
import org.elasticsearch.xpack.core.ccr.AutoFollowMetadata;
4242
import org.elasticsearch.xpack.core.datastreams.DataStreamFeatureSetUsage;
43+
import org.elasticsearch.xpack.core.downsample.RollupIndexerAction;
4344
import org.elasticsearch.xpack.core.enrich.EnrichFeatureSetUsage;
4445
import org.elasticsearch.xpack.core.enrich.action.ExecuteEnrichPolicyStatus;
4546
import org.elasticsearch.xpack.core.eql.EqlFeatureSetUsage;
@@ -49,6 +50,7 @@
4950
import org.elasticsearch.xpack.core.graph.action.GraphExploreAction;
5051
import org.elasticsearch.xpack.core.ilm.AllocateAction;
5152
import org.elasticsearch.xpack.core.ilm.DeleteAction;
53+
import org.elasticsearch.xpack.core.ilm.DownsampleAction;
5254
import org.elasticsearch.xpack.core.ilm.ForceMergeAction;
5355
import org.elasticsearch.xpack.core.ilm.FreezeAction;
5456
import org.elasticsearch.xpack.core.ilm.IndexLifecycleFeatureSetUsage;
@@ -58,7 +60,6 @@
5860
import org.elasticsearch.xpack.core.ilm.MigrateAction;
5961
import org.elasticsearch.xpack.core.ilm.ReadOnlyAction;
6062
import org.elasticsearch.xpack.core.ilm.RolloverAction;
61-
import org.elasticsearch.xpack.core.ilm.RollupILMAction;
6263
import org.elasticsearch.xpack.core.ilm.SearchableSnapshotAction;
6364
import org.elasticsearch.xpack.core.ilm.SetPriorityAction;
6465
import org.elasticsearch.xpack.core.ilm.ShrinkAction;
@@ -150,8 +151,6 @@
150151
import org.elasticsearch.xpack.core.rollup.action.GetRollupCapsAction;
151152
import org.elasticsearch.xpack.core.rollup.action.GetRollupJobsAction;
152153
import org.elasticsearch.xpack.core.rollup.action.PutRollupJobAction;
153-
import org.elasticsearch.xpack.core.rollup.action.RollupAction;
154-
import org.elasticsearch.xpack.core.rollup.action.RollupIndexerAction;
155154
import org.elasticsearch.xpack.core.rollup.action.RollupSearchAction;
156155
import org.elasticsearch.xpack.core.rollup.action.StartRollupJobAction;
157156
import org.elasticsearch.xpack.core.rollup.action.StopRollupJobAction;
@@ -416,7 +415,7 @@ public List<ActionType<? extends ActionResponse>> getClientActions() {
416415
// TSDB Downsampling / Rollup
417416
if (IndexSettings.isTimeSeriesModeEnabled()) {
418417
actions.add(RollupIndexerAction.INSTANCE);
419-
actions.add(RollupAction.INSTANCE);
418+
actions.add(org.elasticsearch.xpack.core.downsample.DownsampleAction.INSTANCE);
420419
}
421420

422421
return actions;
@@ -574,7 +573,7 @@ public List<NamedWriteableRegistry.Entry> getNamedWriteables() {
574573

575574
// TSDB Downsampling / Rollup
576575
if (IndexSettings.isTimeSeriesModeEnabled()) {
577-
namedWriteables.add(new NamedWriteableRegistry.Entry(LifecycleAction.class, RollupILMAction.NAME, RollupILMAction::new));
576+
namedWriteables.add(new NamedWriteableRegistry.Entry(LifecycleAction.class, DownsampleAction.NAME, DownsampleAction::new));
578577
}
579578

580579
return namedWriteables;

0 commit comments

Comments
 (0)