java.lang.Object
org.elasticsearch.action.downsample.DownsampleConfig
- All Implemented Interfaces:
NamedWriteable
,Writeable
,ToXContent
,ToXContentObject
This class holds the configuration details of a DownsampleAction that downsamples time series
(TSDB) indices. We have made great effort to simplify the rollup configuration and currently
only requires a fixed time interval. So, it has the following format:
{
"fixed_interval" : "1d",
}
fixed_interval is one or multiples of SI units and has no calendar-awareness (e.g. doesn't account
for leap corrections, does not have variable length months, etc). Calendar-aware interval is not currently
supported.
Also, the rollup configuration uses the UTC time zone by default and the "@timestamp" field as
the index field that stores the timestamp of the time series index.
Finally, we have left methods such as
getTimestampField()
,
getTimeZone()
and getIntervalType()
for
future extensions.-
Nested Class Summary
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
FieldsFields inherited from interface org.elasticsearch.xcontent.ToXContent
EMPTY, EMPTY_PARAMS
-
Constructor Summary
ConstructorsConstructorDescriptionDownsampleConfig
(DateHistogramInterval fixedInterval) Create a newDownsampleConfig
using the given configuration parameters. -
Method Summary
Modifier and TypeMethodDescriptionCreate the rounding for this date histogramstatic Rounding.Prepared
createRounding
(String expr, String timeZone) boolean
static DownsampleConfig
fromXContent
(XContentParser parser) static String
generateDownsampleIndexName
(String prefix, IndexMetadata sourceIndexMetadata, DateHistogramInterval fixedInterval) Generates a downsample index name in the format prefix-fixedInterval-baseIndexName Note that this looks for the base index name of the provided index metadata via theIndexMetadata.INDEX_DOWNSAMPLE_ORIGIN_NAME_KEY
setting.Get the fixed_interval valueGet the interval valueGet the interval type.Get the timestamp field to be used for rolling up data.Get the timezone to applyReturns the name of the writeable objectint
hashCode()
toString()
toXContent
(XContentBuilder builder, ToXContent.Params params) toXContentFragment
(XContentBuilder builder) static void
validateSourceAndTargetIntervals
(DownsampleConfig source, DownsampleConfig target) This method validates the target downsampling configuration can be applied on an index that has been already downsampled from the source configuration.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.xcontent.ToXContentObject
isFragment
-
Field Details
-
FIXED_INTERVAL
- See Also:
-
TIME_ZONE
- See Also:
-
DEFAULT_TIMEZONE
-
-
Constructor Details
-
DownsampleConfig
Create a newDownsampleConfig
using the given configuration parameters.- Parameters:
fixedInterval
- the fixed interval to use for computing the date histogram for the rolled up documents (required).
-
DownsampleConfig
- Throws:
IOException
-
-
Method Details
-
validateSourceAndTargetIntervals
public static void validateSourceAndTargetIntervals(DownsampleConfig source, DownsampleConfig target) This method validates the target downsampling configuration can be applied on an index that has been already downsampled from the source configuration. The requirements are: - The target interval needs to be greater than source interval - The target interval needs to be a multiple of the source interval throws an IllegalArgumentException to signal that the target interval is not acceptable -
writeTo
Description copied from interface:Writeable
Write this into the StreamOutput.- Specified by:
writeTo
in interfaceWriteable
- Throws:
IOException
-
getTimestampField
Get the timestamp field to be used for rolling up data. Currently, only the "@timestamp" value is supported. -
getIntervalType
Get the interval type. Currently, only fixed_interval is supported -
getInterval
Get the interval value -
getFixedInterval
Get the fixed_interval value -
getTimeZone
Get the timezone to apply -
createRounding
Create the rounding for this date histogram -
getWriteableName
Description copied from interface:NamedWriteable
Returns the name of the writeable object- Specified by:
getWriteableName
in interfaceNamedWriteable
-
toXContent
public XContentBuilder toXContent(XContentBuilder builder, ToXContent.Params params) throws IOException - Specified by:
toXContent
in interfaceToXContent
- Throws:
IOException
-
toXContentFragment
- Throws:
IOException
-
fromXContent
- Throws:
IOException
-
equals
-
hashCode
public int hashCode() -
toString
-
createRounding
-
generateDownsampleIndexName
public static String generateDownsampleIndexName(String prefix, IndexMetadata sourceIndexMetadata, DateHistogramInterval fixedInterval) Generates a downsample index name in the format prefix-fixedInterval-baseIndexName Note that this looks for the base index name of the provided index metadata via theIndexMetadata.INDEX_DOWNSAMPLE_ORIGIN_NAME_KEY
setting. This means that in case the provided index was already downsampled, we'll use the original source index (of the current provided downsample index) as the base index name.
-