Class DataStream

java.lang.Object
org.elasticsearch.cluster.AbstractDiffable<DataStream>
org.elasticsearch.cluster.metadata.DataStream
All Implemented Interfaces:
Diffable<DataStream>, Writeable, org.elasticsearch.common.xcontent.ToXContent, org.elasticsearch.common.xcontent.ToXContentObject

public final class DataStream
extends AbstractDiffable<DataStream>
implements org.elasticsearch.common.xcontent.ToXContentObject
  • Nested Class Summary

    Nested Classes
    Modifier and Type Class Description
    static class  DataStream.TimestampField  

    Nested classes/interfaces inherited from interface org.elasticsearch.common.xcontent.ToXContent

    org.elasticsearch.common.xcontent.ToXContent.DelegatingMapParams, org.elasticsearch.common.xcontent.ToXContent.MapParams, org.elasticsearch.common.xcontent.ToXContent.Params

    Nested classes/interfaces inherited from interface org.elasticsearch.common.io.stream.Writeable

    Writeable.Reader<V>, Writeable.Writer<V>
  • Field Summary

    Fields
    Modifier and Type Field Description
    static java.lang.String BACKING_INDEX_PREFIX  
    static DateFormatter DATE_FORMATTER  
    static org.elasticsearch.common.ParseField GENERATION_FIELD  
    static org.elasticsearch.common.ParseField HIDDEN_FIELD  
    static org.elasticsearch.common.ParseField INDICES_FIELD  
    static org.elasticsearch.common.ParseField METADATA_FIELD  
    static org.elasticsearch.common.ParseField NAME_FIELD  
    static Version NEW_FEATURES_VERSION
    The version when data stream metadata, hidden and replicated data streams, and dates in backing index names was introduced.
    static org.elasticsearch.common.ParseField REPLICATED_FIELD  
    static org.elasticsearch.common.ParseField TIMESTAMP_FIELD_FIELD  

    Fields inherited from interface org.elasticsearch.common.xcontent.ToXContent

    EMPTY_PARAMS
  • Constructor Summary

    Constructors
    Constructor Description
    DataStream​(java.lang.String name, DataStream.TimestampField timeStampField, java.util.List<Index> indices)  
    DataStream​(java.lang.String name, DataStream.TimestampField timeStampField, java.util.List<Index> indices, long generation, java.util.Map<java.lang.String,​java.lang.Object> metadata)  
    DataStream​(java.lang.String name, DataStream.TimestampField timeStampField, java.util.List<Index> indices, long generation, java.util.Map<java.lang.String,​java.lang.Object> metadata, boolean hidden, boolean replicated)  
    DataStream​(StreamInput in)  
  • Method Summary

    Modifier and Type Method Description
    boolean equals​(java.lang.Object o)  
    static DataStream fromXContent​(org.elasticsearch.common.xcontent.XContentParser parser)  
    static java.lang.String getDefaultBackingIndexName​(java.lang.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 java.lang.String getDefaultBackingIndexName​(java.lang.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 java.lang.String getDefaultBackingIndexName​(java.lang.String dataStreamName, long generation, long epochMillis, Version minNodeVersion)  
    static java.lang.String getDefaultBackingIndexName​(java.lang.String dataStreamName, long generation, Version minNodeVersion)  
    long getGeneration()  
    java.util.List<Index> getIndices()  
    static java.lang.String getLegacyDefaultBackingIndexName​(java.lang.String dataStreamName, long generation)  
    java.util.Map<java.lang.String,​java.lang.Object> getMetadata()  
    java.lang.String getName()  
    DataStream.TimestampField getTimeStampField()  
    Index getWriteIndex()  
    int hashCode()  
    boolean isHidden()  
    boolean isReplicated()
    Determines whether this data stream is replicated from elsewhere, for example a remote cluster.
    DataStream promoteDataStream()  
    static Diff<DataStream> readDiffFrom​(StreamInput in)  
    DataStream removeBackingIndex​(Index index)
    Removes the specified backing index and returns a new DataStream instance with the remaining backing indices.
    DataStream replaceBackingIndex​(Index existingBackingIndex, Index newBackingIndex)
    Replaces the specified backing index with a new index and returns a new DataStream instance with the modified backing indices.
    DataStream rollover​(Metadata clusterMetadata, java.lang.String writeIndexUuid, Version minNodeVersion)
    Performs a rollover on a DataStream instance and returns a new instance containing the updated list of backing indices and incremented generation.
    DataStream snapshot​(java.util.Collection<java.lang.String> indicesInSnapshot)
    Reconciles this data stream with a list of indices available in a snapshot.
    org.elasticsearch.common.xcontent.XContentBuilder toXContent​(org.elasticsearch.common.xcontent.XContentBuilder builder, org.elasticsearch.common.xcontent.ToXContent.Params params)  
    void writeTo​(StreamOutput out)
    Write this into the StreamOutput.

    Methods inherited from class org.elasticsearch.cluster.AbstractDiffable

    diff, readDiffFrom

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface org.elasticsearch.common.xcontent.ToXContentObject

    isFragment
  • Field Details

    • BACKING_INDEX_PREFIX

      public static final java.lang.String BACKING_INDEX_PREFIX
      See Also:
      Constant Field Values
    • DATE_FORMATTER

      public static final DateFormatter DATE_FORMATTER
    • NEW_FEATURES_VERSION

      public static final Version NEW_FEATURES_VERSION
      The version when data stream metadata, hidden and replicated data streams, and dates in backing index names was introduced.
    • NAME_FIELD

      public static final org.elasticsearch.common.ParseField NAME_FIELD
    • TIMESTAMP_FIELD_FIELD

      public static final org.elasticsearch.common.ParseField TIMESTAMP_FIELD_FIELD
    • INDICES_FIELD

      public static final org.elasticsearch.common.ParseField INDICES_FIELD
    • GENERATION_FIELD

      public static final org.elasticsearch.common.ParseField GENERATION_FIELD
    • METADATA_FIELD

      public static final org.elasticsearch.common.ParseField METADATA_FIELD
    • HIDDEN_FIELD

      public static final org.elasticsearch.common.ParseField HIDDEN_FIELD
    • REPLICATED_FIELD

      public static final org.elasticsearch.common.ParseField REPLICATED_FIELD
  • Constructor Details

    • DataStream

      public DataStream​(java.lang.String name, DataStream.TimestampField timeStampField, java.util.List<Index> indices, long generation, java.util.Map<java.lang.String,​java.lang.Object> metadata)
    • DataStream

      public DataStream​(java.lang.String name, DataStream.TimestampField timeStampField, java.util.List<Index> indices, long generation, java.util.Map<java.lang.String,​java.lang.Object> metadata, boolean hidden, boolean replicated)
    • DataStream

      public DataStream​(java.lang.String name, DataStream.TimestampField timeStampField, java.util.List<Index> indices)
    • DataStream

      public DataStream​(StreamInput in) throws java.io.IOException
      Throws:
      java.io.IOException
  • Method Details

    • getName

      public java.lang.String getName()
    • getTimeStampField

      public DataStream.TimestampField getTimeStampField()
    • getIndices

      public java.util.List<Index> getIndices()
    • getGeneration

      public long getGeneration()
    • getWriteIndex

      public Index getWriteIndex()
    • getMetadata

      @Nullable public java.util.Map<java.lang.String,​java.lang.Object> 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.
    • rollover

      public DataStream rollover​(Metadata clusterMetadata, java.lang.String writeIndexUuid, Version minNodeVersion)
      Performs a rollover on a DataStream instance and returns a new instance containing the updated list of backing indices and incremented generation.
      Parameters:
      clusterMetadata - Cluster metadata
      writeIndexUuid - UUID for the data stream's new write index
      minNodeVersion - minimum cluster node version
      Returns:
      new DataStream instance with the rollover operation applied
    • removeBackingIndex

      public DataStream removeBackingIndex​(Index index)
      Removes the specified backing index and returns a new DataStream instance with the remaining backing indices.
      Parameters:
      index - the backing index to remove
      Returns:
      new DataStream instance with the remaining backing indices
    • replaceBackingIndex

      public DataStream replaceBackingIndex​(Index existingBackingIndex, Index newBackingIndex)
      Replaces the specified backing index with a new index and returns a new DataStream instance with the modified backing indices. An IllegalArgumentException is thrown if the index to be replaced is not a backing index for this data stream or if it is the DataStream's write index.
      Parameters:
      existingBackingIndex - the backing index to be replaced
      newBackingIndex - the new index that will be part of the DataStream
      Returns:
      new DataStream instance with backing indices that contain replacement index instead of the specified existing index.
    • promoteDataStream

      public DataStream promoteDataStream()
    • snapshot

      @Nullable public DataStream snapshot​(java.util.Collection<java.lang.String> indicesInSnapshot)
      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 DataStream instance or null if no reconciled version of this data stream could be built from the given indices
    • getDefaultBackingIndexName

      public static java.lang.String getDefaultBackingIndexName​(java.lang.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.
      Parameters:
      dataStreamName - name of the data stream
      generation - generation of the data stream
      Returns:
      backing index name
    • getDefaultBackingIndexName

      public static java.lang.String getDefaultBackingIndexName​(java.lang.String dataStreamName, long generation, Version minNodeVersion)
    • getDefaultBackingIndexName

      public static java.lang.String getDefaultBackingIndexName​(java.lang.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 stream
      generation - generation of the data stream
      epochMillis - creation time for the backing index
      Returns:
      backing index name
    • getDefaultBackingIndexName

      public static java.lang.String getDefaultBackingIndexName​(java.lang.String dataStreamName, long generation, long epochMillis, Version minNodeVersion)
    • getLegacyDefaultBackingIndexName

      public static java.lang.String getLegacyDefaultBackingIndexName​(java.lang.String dataStreamName, long generation)
    • readDiffFrom

      public static Diff<DataStream> readDiffFrom​(StreamInput in) throws java.io.IOException
      Throws:
      java.io.IOException
    • writeTo

      public void writeTo​(StreamOutput out) throws java.io.IOException
      Description copied from interface: Writeable
      Write this into the StreamOutput.
      Specified by:
      writeTo in interface Writeable
      Throws:
      java.io.IOException
    • fromXContent

      public static DataStream fromXContent​(org.elasticsearch.common.xcontent.XContentParser parser) throws java.io.IOException
      Throws:
      java.io.IOException
    • toXContent

      public org.elasticsearch.common.xcontent.XContentBuilder toXContent​(org.elasticsearch.common.xcontent.XContentBuilder builder, org.elasticsearch.common.xcontent.ToXContent.Params params) throws java.io.IOException
      Specified by:
      toXContent in interface org.elasticsearch.common.xcontent.ToXContent
      Throws:
      java.io.IOException
    • equals

      public boolean equals​(java.lang.Object o)
      Overrides:
      equals in class java.lang.Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class java.lang.Object