Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
import org.elasticsearch.action.datastreams.lifecycle.GetDataStreamLifecycleAction;
import org.elasticsearch.action.datastreams.lifecycle.PutDataStreamLifecycleAction;
import org.elasticsearch.client.internal.OriginSettingClient;
import org.elasticsearch.cluster.metadata.DataStream;
import org.elasticsearch.cluster.metadata.IndexNameExpressionResolver;
import org.elasticsearch.cluster.node.DiscoveryNodes;
import org.elasticsearch.common.io.stream.NamedWriteableRegistry;
Expand Down Expand Up @@ -253,10 +252,8 @@ public List<ActionHandler> getActions() {
actions.add(new ActionHandler(DeleteDataStreamOptionsAction.INSTANCE, TransportDeleteDataStreamOptionsAction.class));
actions.add(new ActionHandler(GetDataStreamSettingsAction.INSTANCE, TransportGetDataStreamSettingsAction.class));
actions.add(new ActionHandler(UpdateDataStreamSettingsAction.INSTANCE, TransportUpdateDataStreamSettingsAction.class));
if (DataStream.LOGS_STREAM_FEATURE_FLAG) {
actions.add(new ActionHandler(GetDataStreamMappingsAction.INSTANCE, TransportGetDataStreamMappingsAction.class));
actions.add(new ActionHandler(UpdateDataStreamMappingsAction.INSTANCE, TransportUpdateDataStreamMappingsAction.class));
}
actions.add(new ActionHandler(GetDataStreamMappingsAction.INSTANCE, TransportGetDataStreamMappingsAction.class));
actions.add(new ActionHandler(UpdateDataStreamMappingsAction.INSTANCE, TransportUpdateDataStreamMappingsAction.class));
return actions;
}

Expand Down Expand Up @@ -294,10 +291,8 @@ public List<RestHandler> getRestHandlers(
handlers.add(new RestDeleteDataStreamOptionsAction());
handlers.add(new RestGetDataStreamSettingsAction());
handlers.add(new RestUpdateDataStreamSettingsAction());
if (DataStream.LOGS_STREAM_FEATURE_FLAG) {
handlers.add(new RestGetDataStreamMappingsAction());
handlers.add(new RestUpdateDataStreamMappingsAction());
}
handlers.add(new RestGetDataStreamMappingsAction());
handlers.add(new RestUpdateDataStreamMappingsAction());
return handlers;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,6 @@ setup:

---
"Test single data stream":
- requires:
cluster_features: [ "logs_stream" ]
reason: requires setting 'logs_stream' to get or set data stream settings
- do:
allowed_warnings:
- "index template [my-template] has index patterns [my-data-stream-*] matching patterns from existing older templates [global] with patterns (global => [*]); this template [my-template] will take precedence during new index creation"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@
"description":"Gets a data stream's mappings"
},
"stability":"stable",
"visibility": "feature_flag",
"feature_flag": "logs_stream",
"visibility": "public",
"headers":{
"accept": [ "application/json"]
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@
"description":"Updates a data stream's mappings"
},
"stability":"stable",
"visibility": "feature_flag",
"feature_flag": "logs_stream",
"visibility": "public",
"headers":{
"accept": [ "application/json"]
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -423,15 +423,13 @@ public XContentBuilder toXContent(
builder.startObject(SETTINGS_FIELD.getPreferredName());
dataStream.getSettings().toXContent(builder, params);
builder.endObject();
if (DataStream.LOGS_STREAM_FEATURE_FLAG) {
builder.field(MAPPINGS_FIELD.getPreferredName());
Map<String, Object> uncompressedMappings = XContentHelper.convertToMap(
dataStream.getMappings().uncompressed(),
true,
builder.contentType()
).v2();
builder.map(uncompressedMappings);
}
builder.field(MAPPINGS_FIELD.getPreferredName());
Map<String, Object> uncompressedMappings = XContentHelper.convertToMap(
dataStream.getMappings().uncompressed(),
true,
builder.contentType()
).v2();
builder.map(uncompressedMappings);
builder.startObject(DataStream.FAILURE_STORE_FIELD.getPreferredName());
builder.field(FAILURE_STORE_ENABLED.getPreferredName(), failureStoreEffectivelyEnabled);
builder.field(DataStream.ROLLOVER_ON_WRITE_FIELD.getPreferredName(), dataStream.getFailureComponent().isRolloverOnWrite());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,10 +66,8 @@ public void testDataStreamInfoToXContent() throws IOException {
assertThat(lifecycleResult.get("retention_determined_by"), equalTo("max_global_retention"));
Map<String, Map<String, Object>> settingsMap = (Map<String, Map<String, Object>>) resultMap.get("settings");
assertThat(Settings.builder().loadFromMap(settingsMap).build(), equalTo(dataStreamInfo.getDataStream().getSettings()));
if (DataStream.LOGS_STREAM_FEATURE_FLAG) {
Map<String, Object> mappingsMap = (Map<String, Object>) resultMap.get("mappings");
assertThat(new CompressedXContent(mappingsMap), equalTo(dataStreamInfo.getDataStream().getMappings()));
}
Map<String, Object> mappingsMap = (Map<String, Object>) resultMap.get("mappings");
assertThat(new CompressedXContent(mappingsMap), equalTo(dataStreamInfo.getDataStream().getMappings()));
}
}

Expand Down