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 @@ -34,6 +34,7 @@ public final class DataStream {
String ilmPolicyName;
@Nullable
private final Map<String, Object> metadata;
private final boolean replicated;

public DataStream(
String name,
Expand All @@ -45,7 +46,8 @@ public DataStream(
@Nullable String ilmPolicyName,
@Nullable Map<String, Object> metadata,
boolean hidden,
boolean system
boolean system,
boolean replicated
) {
this.name = name;
this.timeStampField = timeStampField;
Expand All @@ -57,6 +59,7 @@ public DataStream(
this.metadata = metadata;
this.hidden = hidden;
this.system = system;
this.replicated = replicated;
}

public String getName() {
Expand Down Expand Up @@ -99,6 +102,10 @@ public boolean isSystem() {
return system;
}

public boolean isReplicated() {
return replicated;
}

public static final ParseField NAME_FIELD = new ParseField("name");
public static final ParseField TIMESTAMP_FIELD_FIELD = new ParseField("timestamp_field");
public static final ParseField INDICES_FIELD = new ParseField("indices");
Expand All @@ -109,6 +116,7 @@ public boolean isSystem() {
public static final ParseField METADATA_FIELD = new ParseField("_meta");
public static final ParseField HIDDEN_FIELD = new ParseField("hidden");
public static final ParseField SYSTEM_FIELD = new ParseField("system");
public static final ParseField REPLICATED = new ParseField("replicated");

@SuppressWarnings("unchecked")
private static final ConstructingObjectParser<DataStream, Void> PARSER = new ConstructingObjectParser<>("data_stream", args -> {
Expand All @@ -123,6 +131,7 @@ public boolean isSystem() {
Map<String, Object> metadata = (Map<String, Object>) args[7];
boolean hidden = args[8] != null && (boolean) args[8];
boolean system = args[9] != null && (boolean) args[9];
boolean replicated = args[10] != null && (boolean) args[10];
return new DataStream(
dataStreamName,
timeStampField,
Expand All @@ -133,7 +142,8 @@ public boolean isSystem() {
ilmPolicy,
metadata,
hidden,
system
system,
replicated
);
});

Expand All @@ -148,6 +158,7 @@ public boolean isSystem() {
PARSER.declareObject(ConstructingObjectParser.optionalConstructorArg(), (p, c) -> p.map(), METADATA_FIELD);
PARSER.declareBoolean(ConstructingObjectParser.optionalConstructorArg(), HIDDEN_FIELD);
PARSER.declareBoolean(ConstructingObjectParser.optionalConstructorArg(), SYSTEM_FIELD);
PARSER.declareBoolean(ConstructingObjectParser.optionalConstructorArg(), REPLICATED);
}

public static DataStream fromXContent(XContentParser parser) throws IOException {
Expand All @@ -168,7 +179,8 @@ public boolean equals(Object o) {
&& system == that.system
&& Objects.equals(indexTemplate, that.indexTemplate)
&& Objects.equals(ilmPolicyName, that.ilmPolicyName)
&& Objects.equals(metadata, that.metadata);
&& Objects.equals(metadata, that.metadata)
&& replicated == that.replicated;
}

@Override
Expand All @@ -183,7 +195,8 @@ public int hashCode() {
ilmPolicyName,
metadata,
hidden,
system
system,
replicated
);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -577,7 +577,8 @@ stream's oldest backing index.
"status": "GREEN",
"template": "my-data-stream-template",
"hidden": false,
"system": false
"system": false,
"replicated": false
}
]
}
Expand Down
11 changes: 9 additions & 2 deletions docs/reference/indices/get-data-stream.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,11 @@ use the <<indices-get-settings,get index settings API>>.
(Boolean)
If `true`, the data stream is created and managed by an Elastic stack component
and cannot be modified through normal user interaction.

`replicated`::
(Boolean)
If `true`, the data stream is created and managed by {ccr} and the local
cluster can not write into this data stream or change its mappings.
====

[[get-data-stream-api-example]]
Expand Down Expand Up @@ -246,7 +251,8 @@ The API returns the following response:
"template": "my-index-template",
"ilm_policy": "my-lifecycle-policy",
"hidden": false,
"system": false
"system": false,
"replicated": false
},
{
"name": "my-data-stream-two",
Expand All @@ -267,7 +273,8 @@ The API returns the following response:
"template": "my-index-template",
"ilm_policy": "my-lifecycle-policy",
"hidden": false,
"system": false
"system": false,
"replicated": false
}
]
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@ public static class DataStreamInfo extends AbstractDiffable<DataStreamInfo> impl
public static final ParseField ILM_POLICY_FIELD = new ParseField("ilm_policy");
public static final ParseField HIDDEN_FIELD = new ParseField("hidden");
public static final ParseField SYSTEM_FIELD = new ParseField("system");
public static final ParseField REPLICATED = new ParseField("replicated");

DataStream dataStream;
ClusterHealthStatus dataStreamStatus;
Expand Down Expand Up @@ -192,6 +193,7 @@ public XContentBuilder toXContent(XContentBuilder builder, Params params) throws
}
builder.field(HIDDEN_FIELD.getPreferredName(), dataStream.isHidden());
builder.field(SYSTEM_FIELD.getPreferredName(), dataStream.isSystem());
builder.field(REPLICATED.getPreferredName(), dataStream.isReplicated());
builder.endObject();
return builder;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,13 +54,15 @@ setup:
- match: { data_streams.0.status: 'GREEN' }
- match: { data_streams.0.template: 'my-template1' }
- match: { data_streams.0.hidden: false }
- match: { data_streams.0.replicated: false }
- match: { data_streams.1.name: simple-data-stream2 }
- match: { data_streams.1.timestamp_field.name: '@timestamp' }
- match: { data_streams.0.generation: 1 }
- match: { data_streams.1.generation: 1 }
- length: { data_streams.1.indices: 1 }
- match: { data_streams.1.indices.0.index_name: '/\.ds-simple-data-stream2-(\d{4}\.\d{2}\.\d{2}-)?000001/' }
- match: { data_streams.1.template: 'my-template2' }
- match: { data_streams.0.hidden: false }
- match: { data_streams.1.hidden: false }
- match: { data_streams.1.replicated: false }

# save the backing index names for later use
- set: { data_streams.0.indices.0.index_name: idx0name }
Expand Down