Class DataStream
java.lang.Object
org.elasticsearch.cluster.AbstractDiffable<DataStream>
org.elasticsearch.cluster.metadata.DataStream
- All Implemented Interfaces:
Diffable<DataStream>,Writeable,ToXContent,ToXContentObject
-
Nested Class Summary
Nested ClassesNested 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 Stringstatic final DateFormatterstatic final ParseFieldstatic final ParseFieldstatic final ParseFieldstatic final ParseFieldstatic final ParseFieldstatic final VersionThe version when data stream metadata, hidden and replicated data streams, and dates in backing index names was introduced.static final ParseFieldstatic final ParseFieldstatic Comparator<org.apache.lucene.index.LeafReader>static final ParseFieldFields inherited from interface org.elasticsearch.xcontent.ToXContent
EMPTY_PARAMS -
Constructor Summary
ConstructorsConstructorDescriptionDataStream(String name, DataStream.TimestampField timeStampField, List<Index> indices, long generation, Map<String, Object> metadata, boolean hidden, boolean replicated, boolean system) -
Method Summary
Modifier and TypeMethodDescriptionaddBackingIndex(Metadata clusterMetadata, Index index) Adds the specified index as a backing index and returns a newDataStreaminstance with the new combination of backing indices.booleanstatic DataStreamfromXContent(XContentParser parser) static StringgetDefaultBackingIndexName(String dataStreamName, long generation) Generates the name of the index that conforms to the default naming convention for backing indices on data streams given the specified data stream name and generation and the current system time.static StringgetDefaultBackingIndexName(String dataStreamName, long generation, long epochMillis) Generates the name of the index that conforms to the default naming convention for backing indices on data streams given the specified data stream name, generation, and time.static StringgetDefaultBackingIndexName(String dataStreamName, long generation, long epochMillis, Version minNodeVersion) static StringgetDefaultBackingIndexName(String dataStreamName, long generation, Version minNodeVersion) longstatic StringgetLegacyDefaultBackingIndexName(String dataStreamName, long generation) getName()inthashCode()booleanisHidden()booleanDetermines whether this data stream is replicated from elsewhere, for example a remote cluster.booleanisSystem()nextWriteIndexAndGeneration(Metadata clusterMetadata, Version minNodeVersion) Performs a dummy rollover on aDataStreaminstance and returns the tuple of the next write index name and next generation that thisDataStreamshould roll over to usingrollover(Index, long).static Diff<DataStream>removeBackingIndex(Index index) Removes the specified backing index and returns a newDataStreaminstance with the remaining backing indices.replaceBackingIndex(Index existingBackingIndex, Index newBackingIndex) Replaces the specified backing index with a new index and returns a newDataStreaminstance with the modified backing indices.Performs a rollover on aDataStreaminstance and returns a new instance containing the updated list of backing indices and incremented generation.snapshot(Collection<String> indicesInSnapshot) Reconciles this data stream with a list of indices available in a snapshot.toXContent(XContentBuilder builder, ToXContent.Params params) unsafeNextWriteIndexAndGeneration(Metadata clusterMetadata, Version minNodeVersion) LikenextWriteIndexAndGeneration(Metadata, Version), but does no validation, use with care only.unsafeRollover(Index writeIndex, long generation) Likerollover(Index, long), but does no validation, use with care only.voidwriteTo(StreamOutput out) Write this into the StreamOutput.Methods inherited from class org.elasticsearch.cluster.AbstractDiffable
diff, readDiffFromMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.elasticsearch.xcontent.ToXContentObject
isFragment
-
Field Details
-
BACKING_INDEX_PREFIX
- See Also:
-
DATE_FORMATTER
-
TIMESERIES_LEAF_READERS_SORTER
-
NEW_FEATURES_VERSION
The version when data stream metadata, hidden and replicated data streams, and dates in backing index names was introduced. -
NAME_FIELD
-
TIMESTAMP_FIELD_FIELD
-
INDICES_FIELD
-
GENERATION_FIELD
-
METADATA_FIELD
-
HIDDEN_FIELD
-
REPLICATED_FIELD
-
SYSTEM_FIELD
-
-
Constructor Details
-
DataStream
-
DataStream
- Throws:
IOException
-
-
Method Details
-
getName
-
getTimeStampField
-
getIndices
-
getGeneration
public long getGeneration() -
getWriteIndex
-
getMetadata
-
isHidden
public boolean isHidden() -
isReplicated
public boolean isReplicated()Determines whether this data stream is replicated from elsewhere, for example a remote cluster.- Returns:
- Whether this data stream is replicated.
-
isSystem
public boolean isSystem() -
rollover
Performs a rollover on aDataStreaminstance and returns a new instance containing the updated list of backing indices and incremented generation.- Parameters:
writeIndex- new write indexgeneration- new generation- Returns:
- new
DataStreaminstance with the rollover operation applied
-
unsafeRollover
Likerollover(Index, long), but does no validation, use with care only. -
nextWriteIndexAndGeneration
public Tuple<String,Long> nextWriteIndexAndGeneration(Metadata clusterMetadata, Version minNodeVersion) Performs a dummy rollover on aDataStreaminstance and returns the tuple of the next write index name and next generation that thisDataStreamshould roll over to usingrollover(Index, long).- Parameters:
clusterMetadata- Cluster metadata- Returns:
- new
DataStreaminstance with the dummy rollover operation applied
-
unsafeNextWriteIndexAndGeneration
public Tuple<String,Long> unsafeNextWriteIndexAndGeneration(Metadata clusterMetadata, Version minNodeVersion) LikenextWriteIndexAndGeneration(Metadata, Version), but does no validation, use with care only. -
removeBackingIndex
Removes the specified backing index and returns a newDataStreaminstance with the remaining backing indices.- Parameters:
index- the backing index to remove- Returns:
- new
DataStreaminstance with the remaining backing indices - Throws:
IllegalArgumentException- ifindexis not a backing index or is the current write index of the data stream
-
replaceBackingIndex
Replaces the specified backing index with a new index and returns a newDataStreaminstance with the modified backing indices. AnIllegalArgumentExceptionis thrown if the index to be replaced is not a backing index for this data stream or if it is theDataStream's write index.- Parameters:
existingBackingIndex- the backing index to be replacednewBackingIndex- the new index that will be part of theDataStream- Returns:
- new
DataStreaminstance with backing indices that contain replacement index instead of the specified existing index.
-
addBackingIndex
Adds the specified index as a backing index and returns a newDataStreaminstance with the new combination of backing indices.- Parameters:
index- index to add to the data stream- Returns:
- new
DataStreaminstance with the added backing index - Throws:
IllegalArgumentException- ifindexis ineligible to be a backing index for the data stream
-
promoteDataStream
-
snapshot
Reconciles this data stream with a list of indices available in a snapshot. Allows snapshots to store accurate data stream definitions that do not reference backing indices not contained in the snapshot.- Parameters:
indicesInSnapshot- List of indices in the snapshot- Returns:
- Reconciled
DataStreaminstance ornullif no reconciled version of this data stream could be built from the given indices
-
getDefaultBackingIndexName
Generates the name of the index that conforms to the default naming convention for backing indices on data streams given the specified data stream name and generation and the current system time.- Parameters:
dataStreamName- name of the data streamgeneration- generation of the data stream- Returns:
- backing index name
-
getDefaultBackingIndexName
-
getDefaultBackingIndexName
public static String getDefaultBackingIndexName(String dataStreamName, long generation, long epochMillis) Generates the name of the index that conforms to the default naming convention for backing indices on data streams given the specified data stream name, generation, and time.- Parameters:
dataStreamName- name of the data streamgeneration- generation of the data streamepochMillis- creation time for the backing index- Returns:
- backing index name
-
getDefaultBackingIndexName
-
getLegacyDefaultBackingIndexName
-
readDiffFrom
- Throws:
IOException
-
writeTo
Description copied from interface:WriteableWrite this into the StreamOutput.- Specified by:
writeToin interfaceWriteable- Throws:
IOException
-
fromXContent
- Throws:
IOException
-
toXContent
public XContentBuilder toXContent(XContentBuilder builder, ToXContent.Params params) throws IOException - Specified by:
toXContentin interfaceToXContent- Throws:
IOException
-
equals
-
hashCode
public int hashCode()
-