Module org.elasticsearch.server
Class DataStreamLifecycle
java.lang.Object
org.elasticsearch.cluster.metadata.DataStreamLifecycle
- All Implemented Interfaces:
Diffable<DataStreamLifecycle>,SimpleDiffable<DataStreamLifecycle>,Writeable,ToXContent,ToXContentObject
public class DataStreamLifecycle
extends Object
implements SimpleDiffable<DataStreamLifecycle>, ToXContentObject
Holds the data stream lifecycle metadata that are configuring how a data stream is managed. Currently, it supports the following
configurations:
- enabled
- data retention
- downsampling
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classThis builder helps during the composition of the data stream lifecycle templates.static final recordDownsampling holds the configuration about when should elasticsearch downsample a backing index.static final recordRetention is the least amount of time that the data will be kept by elasticsearch.static enumThis enum represents all configuration sources that can influence the retention of a data stream.Nested classes/interfaces inherited from interface org.elasticsearch.cluster.SimpleDiffable
SimpleDiffable.CompleteDiff<T extends Diffable<T>>Nested classes/interfaces inherited from interface org.elasticsearch.xcontent.ToXContent
ToXContent.DelegatingMapParams, ToXContent.MapParams, ToXContent.ParamsNested classes/interfaces inherited from interface org.elasticsearch.common.io.stream.Writeable
Writeable.Reader<V>, Writeable.Writer<V> -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final TransportVersionstatic final Setting<RolloverConfiguration>static final ParseFieldstatic final Stringstatic final Stringstatic final DataStreamLifecyclestatic final ParseFieldstatic final ParseFieldstatic final ParseFieldstatic final Stringstatic final ConstructingObjectParser<DataStreamLifecycle,Void> static final ParseFieldFields inherited from interface org.elasticsearch.cluster.SimpleDiffable
EMPTYFields inherited from interface org.elasticsearch.xcontent.ToXContent
EMPTY, EMPTY_PARAMS -
Constructor Summary
ConstructorsConstructorDescriptionDataStreamLifecycle(DataStreamLifecycle.Retention dataRetention, DataStreamLifecycle.Downsampling downsampling, Boolean enabled) -
Method Summary
Modifier and TypeMethodDescriptionbooleanstatic DataStreamLifecyclefromXContent(XContentParser parser) The least amount of time data the data stream is requesting es to keep the data.The configured downsampling rounds with the `after` and the `fixed_interval` per round.getEffectiveDataRetention(DataStreamGlobalRetention globalRetention) The least amount of time data should be kept by elasticsearch.getEffectiveDataRetentionWithSource(DataStreamGlobalRetention globalRetention) The least amount of time data should be kept by elasticsearch.inthashCode()static booleanisDataStreamsLifecycleOnlyMode(Settings settings) Check ifDATA_STREAMS_LIFECYCLE_ONLY_SETTING_NAMEis present and set totrue, indicating that we're running in a cluster configuration that is only expecting to use data streams lifecycles.booleanReturns true, if this data stream lifecycle configuration is enabled and false otherwisestatic DataStreamLifecycle.Builderstatic DataStreamLifecycle.BuildernewBuilder(DataStreamLifecycle lifecycle) static Diff<DataStreamLifecycle>toString()toXContent(XContentBuilder builder, ToXContent.Params params) toXContent(XContentBuilder builder, ToXContent.Params params, RolloverConfiguration rolloverConfiguration, DataStreamGlobalRetention globalRetention) Converts the data stream lifecycle to XContent, enriches it with effective retention information when requested and injects the RolloverConditions if they exist.voidwriteTo(StreamOutput out) Write this into the StreamOutput.Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface org.elasticsearch.cluster.SimpleDiffable
diffMethods inherited from interface org.elasticsearch.xcontent.ToXContentObject
isFragment
-
Field Details
-
ADDED_ENABLED_FLAG_VERSION
-
DATA_STREAMS_LIFECYCLE_ONLY_SETTING_NAME
- See Also:
-
INCLUDE_EFFECTIVE_RETENTION_PARAM_NAME
- See Also:
-
INCLUDE_EFFECTIVE_RETENTION_PARAMS
-
CLUSTER_LIFECYCLE_DEFAULT_ROLLOVER_SETTING
-
DEFAULT
-
DATA_STREAM_LIFECYCLE_ORIGIN
- See Also:
-
ENABLED_FIELD
-
DATA_RETENTION_FIELD
-
EFFECTIVE_RETENTION_FIELD
-
RETENTION_SOURCE_FIELD
-
DOWNSAMPLING_FIELD
-
PARSER
-
-
Constructor Details
-
DataStreamLifecycle
public DataStreamLifecycle() -
DataStreamLifecycle
public DataStreamLifecycle(@Nullable DataStreamLifecycle.Retention dataRetention, @Nullable DataStreamLifecycle.Downsampling downsampling, @Nullable Boolean enabled) -
DataStreamLifecycle
- Throws:
IOException
-
-
Method Details
-
isDataStreamsLifecycleOnlyMode
Check ifDATA_STREAMS_LIFECYCLE_ONLY_SETTING_NAMEis present and set totrue, indicating that we're running in a cluster configuration that is only expecting to use data streams lifecycles.- Parameters:
settings- the node settings- Returns:
- true if
DATA_STREAMS_LIFECYCLE_ONLY_SETTING_NAMEis present and set
-
isEnabled
public boolean isEnabled()Returns true, if this data stream lifecycle configuration is enabled and false otherwise -
getEffectiveDataRetention
@Nullable public TimeValue getEffectiveDataRetention(@Nullable DataStreamGlobalRetention globalRetention) The least amount of time data should be kept by elasticsearch.- Returns:
- the time period or null, null represents that data should never be deleted.
-
getEffectiveDataRetentionWithSource
@Nullable public Tuple<TimeValue,DataStreamLifecycle.RetentionSource> getEffectiveDataRetentionWithSource(@Nullable DataStreamGlobalRetention globalRetention) The least amount of time data should be kept by elasticsearch.- Returns:
- the time period or null, null represents that data should never be deleted.
-
getDataStreamRetention
The least amount of time data the data stream is requesting es to keep the data. NOTE: this can be overridden by thegetEffectiveDataRetention(DataStreamGlobalRetention).- Returns:
- the time period or null, null represents that data should never be deleted.
-
getDownsamplingRounds
The configured downsampling rounds with the `after` and the `fixed_interval` per round. If downsampling is not configured then it returns null. -
equals
-
hashCode
public int hashCode() -
writeTo
Description copied from interface:WriteableWrite this into the StreamOutput.- Specified by:
writeToin interfaceWriteable- Throws:
IOException
-
readDiffFrom
- Throws:
IOException
-
toString
-
toXContent
public XContentBuilder toXContent(XContentBuilder builder, ToXContent.Params params) throws IOException - Specified by:
toXContentin interfaceToXContent- Throws:
IOException
-
toXContent
public XContentBuilder toXContent(XContentBuilder builder, ToXContent.Params params, @Nullable RolloverConfiguration rolloverConfiguration, @Nullable DataStreamGlobalRetention globalRetention) throws IOException Converts the data stream lifecycle to XContent, enriches it with effective retention information when requested and injects the RolloverConditions if they exist. In order to request the effective retention you need to setINCLUDE_EFFECTIVE_RETENTION_PARAM_NAMEto true in the XContent params.- Throws:
IOException
-
fromXContent
- Throws:
IOException
-
newBuilder
-
newBuilder
-