diff --git a/client/rest-high-level/src/main/java/org/elasticsearch/client/indices/DataStream.java b/client/rest-high-level/src/main/java/org/elasticsearch/client/indices/DataStream.java index 76b5136bedaa6..1f81b233f0162 100644 --- a/client/rest-high-level/src/main/java/org/elasticsearch/client/indices/DataStream.java +++ b/client/rest-high-level/src/main/java/org/elasticsearch/client/indices/DataStream.java @@ -36,6 +36,7 @@ public final class DataStream { private final String timeStampField; private final List indices; private final long generation; + private final boolean hidden; ClusterHealthStatus dataStreamStatus; @Nullable String indexTemplate; @@ -45,7 +46,8 @@ public final class DataStream { private final Map metadata; public DataStream(String name, String timeStampField, List indices, long generation, ClusterHealthStatus dataStreamStatus, - @Nullable String indexTemplate, @Nullable String ilmPolicyName, @Nullable Map metadata) { + @Nullable String indexTemplate, @Nullable String ilmPolicyName, @Nullable Map metadata, + boolean hidden) { this.name = name; this.timeStampField = timeStampField; this.indices = indices; @@ -54,6 +56,7 @@ public DataStream(String name, String timeStampField, List indices, long this.indexTemplate = indexTemplate; this.ilmPolicyName = ilmPolicyName; this.metadata = metadata; + this.hidden = hidden; } public String getName() { @@ -88,6 +91,10 @@ public Map getMetadata() { return metadata; } + public boolean isHidden() { + return hidden; + } + 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"); @@ -96,6 +103,7 @@ public Map getMetadata() { public static final ParseField INDEX_TEMPLATE_FIELD = new ParseField("template"); public static final ParseField ILM_POLICY_FIELD = new ParseField("ilm_policy"); public static final ParseField METADATA_FIELD = new ParseField("_meta"); + public static final ParseField HIDDEN_FIELD = new ParseField("hidden"); @SuppressWarnings("unchecked") private static final ConstructingObjectParser PARSER = new ConstructingObjectParser<>("data_stream", @@ -110,7 +118,9 @@ public Map getMetadata() { String indexTemplate = (String) args[5]; String ilmPolicy = (String) args[6]; Map metadata = (Map) args[7]; - return new DataStream(dataStreamName, timeStampField, indices, generation, status, indexTemplate, ilmPolicy, metadata); + Boolean hidden = (Boolean) args[8]; + hidden = hidden != null && hidden; + return new DataStream(dataStreamName, timeStampField, indices, generation, status, indexTemplate, ilmPolicy, metadata, hidden); }); static { @@ -122,6 +132,7 @@ public Map getMetadata() { PARSER.declareString(ConstructingObjectParser.optionalConstructorArg(), INDEX_TEMPLATE_FIELD); PARSER.declareString(ConstructingObjectParser.optionalConstructorArg(), ILM_POLICY_FIELD); PARSER.declareObject(ConstructingObjectParser.optionalConstructorArg(), (p, c) -> p.map(), METADATA_FIELD); + PARSER.declareBoolean(ConstructingObjectParser.optionalConstructorArg(), HIDDEN_FIELD); } public static DataStream fromXContent(XContentParser parser) throws IOException { diff --git a/docs/reference/data-streams/change-mappings-and-settings.asciidoc b/docs/reference/data-streams/change-mappings-and-settings.asciidoc index ddfada9a67281..9de3b893367a5 100644 --- a/docs/reference/data-streams/change-mappings-and-settings.asciidoc +++ b/docs/reference/data-streams/change-mappings-and-settings.asciidoc @@ -572,7 +572,8 @@ contains information about the stream's oldest backing index, ], "generation": 2, "status": "GREEN", - "template": "my-data-stream-template" + "template": "my-data-stream-template", + "hidden": false } ] } diff --git a/docs/reference/indices/get-data-stream.asciidoc b/docs/reference/indices/get-data-stream.asciidoc index 5f5e478cd6bb7..50768b9350ac1 100644 --- a/docs/reference/indices/get-data-stream.asciidoc +++ b/docs/reference/indices/get-data-stream.asciidoc @@ -209,7 +209,8 @@ The API returns the following response: "generation": 2, "status": "GREEN", "template": "my-index-template", - "ilm_policy": "my-lifecycle-policy" + "ilm_policy": "my-lifecycle-policy", + "hidden": false }, { "name": "my-data-stream_two", @@ -225,7 +226,8 @@ The API returns the following response: "generation": 1, "status": "YELLOW", "template": "my-index-template", - "ilm_policy": "my-lifecycle-policy" + "ilm_policy": "my-lifecycle-policy", + "hidden": false } ] } diff --git a/server/src/main/java/org/elasticsearch/action/support/IndicesOptions.java b/server/src/main/java/org/elasticsearch/action/support/IndicesOptions.java index e68c0f271e135..65fb2b75d693f 100644 --- a/server/src/main/java/org/elasticsearch/action/support/IndicesOptions.java +++ b/server/src/main/java/org/elasticsearch/action/support/IndicesOptions.java @@ -225,6 +225,13 @@ public EnumSet getExpandWildcards() { return EnumSet.copyOf(expandWildcards); } + /** + * @return a copy of the {@link Option}s that these indices options will use + */ + public EnumSet