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 class
This builder helps during the composition of the data stream lifecycle templates.static final record
Downsampling holds the configuration about when should elasticsearch downsample a backing index.static final record
Retention is the least amount of time that the data will be kept by elasticsearch.static enum
This 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.Params
Nested classes/interfaces inherited from interface org.elasticsearch.common.io.stream.Writeable
Writeable.Reader<V>, Writeable.Writer<V>
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final TransportVersion
static final Setting<RolloverConfiguration>
static final ParseField
static final String
static final String
static final DataStreamLifecycle
static final ParseField
static final ParseField
static final ParseField
static final String
static final ConstructingObjectParser<DataStreamLifecycle,
Void> static final ParseField
Fields inherited from interface org.elasticsearch.cluster.SimpleDiffable
EMPTY
Fields 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 TypeMethodDescriptionboolean
static DataStreamLifecycle
fromXContent
(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.int
hashCode()
static boolean
isDataStreamsLifecycleOnlyMode
(Settings settings) Check ifDATA_STREAMS_LIFECYCLE_ONLY_SETTING_NAME
is present and set totrue
, indicating that we're running in a cluster configuration that is only expecting to use data streams lifecycles.boolean
Returns true, if this data stream lifecycle configuration is enabled and false otherwisestatic DataStreamLifecycle.Builder
static DataStreamLifecycle.Builder
newBuilder
(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.void
writeTo
(StreamOutput out) Write this into the StreamOutput.Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface org.elasticsearch.cluster.SimpleDiffable
diff
Methods 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_NAME
is 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_NAME
is 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:Writeable
Write this into the StreamOutput.- Specified by:
writeTo
in interfaceWriteable
- Throws:
IOException
-
readDiffFrom
- Throws:
IOException
-
toString
-
toXContent
public XContentBuilder toXContent(XContentBuilder builder, ToXContent.Params params) throws IOException - Specified by:
toXContent
in 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_NAME
to true in the XContent params.- Throws:
IOException
-
fromXContent
- Throws:
IOException
-
newBuilder
-
newBuilder
-