Class SnapshotInfo

java.lang.Object
org.elasticsearch.snapshots.SnapshotInfo
All Implemented Interfaces:
Comparable<SnapshotInfo>, Writeable, org.elasticsearch.xcontent.ToXContent, org.elasticsearch.xcontent.ToXContentFragment

public final class SnapshotInfo extends Object implements Comparable<SnapshotInfo>, org.elasticsearch.xcontent.ToXContentFragment, Writeable
Information about a snapshot
  • Field Details

    • DATA_STREAMS_IN_SNAPSHOT

      public static final Version DATA_STREAMS_IN_SNAPSHOT
    • METADATA_FIELD_INTRODUCED

      public static final Version METADATA_FIELD_INTRODUCED
    • INDEX_DETAILS_XCONTENT_PARAM

      public static final String INDEX_DETAILS_XCONTENT_PARAM
      See Also:
    • INCLUDE_REPOSITORY_XCONTENT_PARAM

      public static final String INCLUDE_REPOSITORY_XCONTENT_PARAM
      See Also:
    • SNAPSHOT_INFO_PARSER

      public static final org.elasticsearch.xcontent.ObjectParser<SnapshotInfo.SnapshotInfoBuilder,Void> SNAPSHOT_INFO_PARSER
  • Constructor Details

  • Method Details

    • inProgress

      public static SnapshotInfo inProgress(SnapshotsInProgress.Entry entry)
    • readFrom

      public static SnapshotInfo readFrom(StreamInput in) throws IOException
      Constructs snapshot information from stream input
      Throws:
      IOException
    • basic

      public SnapshotInfo basic()
      Gets a new SnapshotInfo instance from the given SnapshotInfo with all information stripped out except the snapshot id, state, and indices.
    • snapshot

      public Snapshot snapshot()
    • snapshotId

      public SnapshotId snapshotId()
      Returns snapshot id
      Returns:
      snapshot id
    • repository

      public String repository()
    • state

      @Nullable public SnapshotState state()
      Returns snapshot state; null if the state is unknown.
      Returns:
      snapshot state
    • reason

      @Nullable public String reason()
      Returns snapshot failure reason; null if the snapshot succeeded.
      Returns:
      snapshot failure reason
    • indices

      public List<String> indices()
      Returns indices that were included in this snapshot.
      Returns:
      list of indices
    • dataStreams

      public List<String> dataStreams()
      Returns:
      list of data streams that were included in this snapshot.
    • startTime

      public long startTime()
      Returns time when snapshot started; a value of 0L will be returned if state() returns null.
      Returns:
      snapshot start time
    • endTime

      public long endTime()
      Returns time when snapshot ended; a value of 0L will be returned if the snapshot is still running or if state() returns null.
      Returns:
      snapshot end time
    • totalShards

      public int totalShards()
      Returns total number of shards that were snapshotted; a value of 0 will be returned if state() returns null.
      Returns:
      number of shards
    • failedShards

      public int failedShards()
      Number of failed shards; a value of 0 will be returned if there were no failed shards, or if state() returns null.
      Returns:
      number of failed shards
    • successfulShards

      public int successfulShards()
      Returns total number of shards that were successfully snapshotted; a value of 0 will be returned if state() returns null.
      Returns:
      number of successful shards
    • includeGlobalState

      public Boolean includeGlobalState()
    • shardFailures

      public List<SnapshotShardFailure> shardFailures()
      Returns shard failures; an empty list will be returned if there were no shard failures, or if state() returns null.
      Returns:
      shard failures
    • version

      @Nullable public Version version()
      Returns the version of elasticsearch that the snapshot was created with. Will only return null if state() returns null or SnapshotState.INCOMPATIBLE.
      Returns:
      version of elasticsearch that the snapshot was created with
    • userMetadata

      @Nullable public Map<String,Object> userMetadata()
      Returns the custom metadata that was attached to this snapshot at creation time.
      Returns:
      custom metadata
    • featureStates

      public List<SnapshotFeatureInfo> featureStates()
    • indexSnapshotDetails

      public Map<String,SnapshotInfo.IndexSnapshotDetails> indexSnapshotDetails()
      Returns:
      details of each index in the snapshot, if available, or an empty map otherwise.
    • compareTo

      public int compareTo(SnapshotInfo o)
      Compares two snapshots by their start time; if the start times are the same, then compares the two snapshots by their snapshot ids.
      Specified by:
      compareTo in interface Comparable<SnapshotInfo>
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • status

      public RestStatus status()
      Returns snapshot REST status
    • toXContentExternal

      public org.elasticsearch.xcontent.XContentBuilder toXContentExternal(org.elasticsearch.xcontent.XContentBuilder builder, org.elasticsearch.xcontent.ToXContent.Params params) throws IOException
      Serialize this SnapshotInfo for external consumption, i.e. REST responses, from which we don't need to be able to read it back again. This method builds a well-formed object, not a fragment like toXContent(org.elasticsearch.xcontent.XContentBuilder, org.elasticsearch.xcontent.ToXContent.Params) does.
      Throws:
      IOException
    • toXContent

      public org.elasticsearch.xcontent.XContentBuilder toXContent(org.elasticsearch.xcontent.XContentBuilder builder, org.elasticsearch.xcontent.ToXContent.Params params) throws IOException
      Specified by:
      toXContent in interface org.elasticsearch.xcontent.ToXContent
      Throws:
      IOException
    • fromXContentInternal

      public static SnapshotInfo fromXContentInternal(String repoName, org.elasticsearch.xcontent.XContentParser parser) throws IOException
      This method creates a SnapshotInfo from internal x-content. It does not handle x-content written with the external version as external x-content is only for display purposes and does not need to be parsed.
      Throws:
      IOException
    • writeTo

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

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object