mirror of
https://github.com/elastic/elasticsearch.git
synced 2025-04-24 15:17:30 -04:00
[7.16] Add replicated field to get data stream api response. (#81140)
* [7.16] Add replicated field to get data stream api response. Backporting #80988 to 7.16 branch. Internally we already kept track of whether a data stream is replicated by CCR. It is part of the `DataStream` class. This just adds it to the xcontent serialization of the get data stream api response class. Relates to elastic/kibana#118899 * adjust to 7.16 reality
This commit is contained in:
parent
af5fa3f649
commit
deb0d4c8c7
5 changed files with 34 additions and 9 deletions
|
@ -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,
|
||||
|
@ -45,7 +46,8 @@ public final class DataStream {
|
|||
@Nullable String ilmPolicyName,
|
||||
@Nullable Map<String, Object> metadata,
|
||||
boolean hidden,
|
||||
boolean system
|
||||
boolean system,
|
||||
boolean replicated
|
||||
) {
|
||||
this.name = name;
|
||||
this.timeStampField = timeStampField;
|
||||
|
@ -57,6 +59,7 @@ public final class DataStream {
|
|||
this.metadata = metadata;
|
||||
this.hidden = hidden;
|
||||
this.system = system;
|
||||
this.replicated = replicated;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
|
@ -99,6 +102,10 @@ public final class DataStream {
|
|||
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");
|
||||
|
@ -109,6 +116,7 @@ public final class DataStream {
|
|||
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 -> {
|
||||
|
@ -123,6 +131,7 @@ public final class DataStream {
|
|||
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,
|
||||
|
@ -133,7 +142,8 @@ public final class DataStream {
|
|||
ilmPolicy,
|
||||
metadata,
|
||||
hidden,
|
||||
system
|
||||
system,
|
||||
replicated
|
||||
);
|
||||
});
|
||||
|
||||
|
@ -148,6 +158,7 @@ public final class DataStream {
|
|||
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 {
|
||||
|
@ -168,7 +179,8 @@ public final class DataStream {
|
|||
&& 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
|
||||
|
@ -183,7 +195,8 @@ public final class DataStream {
|
|||
ilmPolicyName,
|
||||
metadata,
|
||||
hidden,
|
||||
system
|
||||
system,
|
||||
replicated
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue