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/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
Modifier and TypeFieldDescriptionstatic String
static DateFormatter
static org.elasticsearch.common.xcontent.ParseField
static org.elasticsearch.common.xcontent.ParseField
static org.elasticsearch.common.xcontent.ParseField
static org.elasticsearch.common.xcontent.ParseField
static org.elasticsearch.common.xcontent.ParseField
static Version
The version when data stream metadata, hidden and replicated data streams, and dates in backing index names was introduced.static org.elasticsearch.common.xcontent.ParseField
static org.elasticsearch.common.xcontent.ParseField
static org.elasticsearch.common.xcontent.ParseField
Fields inherited from interface org.elasticsearch.common.xcontent.ToXContent
EMPTY_PARAMS
-
Constructor Summary
ConstructorDescriptionDataStream(String name, DataStream.TimestampField timeStampField, List<Index> indices)
DataStream(String name, DataStream.TimestampField timeStampField, List<Index> indices, long generation, Map<String,Object> metadata)
DataStream(String name, DataStream.TimestampField timeStampField, List<Index> indices, long generation, Map<String,Object> metadata, boolean hidden, boolean replicated)
DataStream(String name, DataStream.TimestampField timeStampField, List<Index> indices, long generation, Map<String,Object> metadata, boolean hidden, boolean replicated, boolean system)
-
Method Summary
Modifier and TypeMethodDescriptionboolean
static DataStream
fromXContent(org.elasticsearch.common.xcontent.XContentParser parser)
static String
getDefaultBackingIndexName(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 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.static String
getDefaultBackingIndexName(String dataStreamName, long generation, long epochMillis, Version minNodeVersion)
static String
getDefaultBackingIndexName(String dataStreamName, long generation, Version minNodeVersion)
long
static String
getLegacyDefaultBackingIndexName(String dataStreamName, long generation)
getName()
int
hashCode()
boolean
isHidden()
boolean
Determines whether this data stream is replicated from elsewhere, for example a remote cluster.boolean
isSystem()
static Diff<DataStream>
removeBackingIndex(Index index)
Removes the specified backing index and returns a newDataStream
instance with the remaining backing indices.replaceBackingIndex(Index existingBackingIndex, Index newBackingIndex)
Replaces the specified backing index with a new index and returns a newDataStream
instance with the modified backing indices.Performs a rollover on aDataStream
instance 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.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
- See Also:
- Constant Field Values
-
DATE_FORMATTER
-
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.xcontent.ParseField NAME_FIELD -
TIMESTAMP_FIELD_FIELD
public static final org.elasticsearch.common.xcontent.ParseField TIMESTAMP_FIELD_FIELD -
INDICES_FIELD
public static final org.elasticsearch.common.xcontent.ParseField INDICES_FIELD -
GENERATION_FIELD
public static final org.elasticsearch.common.xcontent.ParseField GENERATION_FIELD -
METADATA_FIELD
public static final org.elasticsearch.common.xcontent.ParseField METADATA_FIELD -
HIDDEN_FIELD
public static final org.elasticsearch.common.xcontent.ParseField HIDDEN_FIELD -
REPLICATED_FIELD
public static final org.elasticsearch.common.xcontent.ParseField REPLICATED_FIELD -
SYSTEM_FIELD
public static final org.elasticsearch.common.xcontent.ParseField SYSTEM_FIELD
-
-
Constructor Details
-
DataStream
-
DataStream
-
DataStream
-
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 aDataStream
instance and returns a new instance containing the updated list of backing indices and incremented generation.- Parameters:
clusterMetadata
- Cluster metadatawriteIndexUuid
- UUID for the data stream's new write indexminNodeVersion
- minimum cluster node version- Returns:
- new
DataStream
instance with the rollover operation applied
-
removeBackingIndex
Removes the specified backing index and returns a newDataStream
instance with the remaining backing indices.- Parameters:
index
- the backing index to remove- Returns:
- new
DataStream
instance with the remaining backing indices
-
replaceBackingIndex
Replaces the specified backing index with a new index and returns a newDataStream
instance with the modified backing indices. AnIllegalArgumentException
is 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
DataStream
instance with backing indices that contain replacement index instead of the specified existing index.
-
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
DataStream
instance ornull
if 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:Writeable
Write this into the StreamOutput.- Specified by:
writeTo
in interfaceWriteable
- Throws:
IOException
-
fromXContent
public static DataStream fromXContent(org.elasticsearch.common.xcontent.XContentParser parser) throws IOException- Throws:
IOException
-
toXContent
public org.elasticsearch.common.xcontent.XContentBuilder toXContent(org.elasticsearch.common.xcontent.XContentBuilder builder, org.elasticsearch.common.xcontent.ToXContent.Params params) throws IOException- Specified by:
toXContent
in interfaceorg.elasticsearch.common.xcontent.ToXContent
- Throws:
IOException
-
equals
-
hashCode
public int hashCode()
-