Class CreateSnapshotRequest

All Implemented Interfaces:
IndicesRequest, IndicesRequest.Replaceable, Writeable, org.elasticsearch.common.xcontent.ToXContent, org.elasticsearch.common.xcontent.ToXContentObject, org.elasticsearch.core.RefCounted, TaskAwareRequest

public class CreateSnapshotRequest extends MasterNodeRequest<CreateSnapshotRequest> implements IndicesRequest.Replaceable, org.elasticsearch.common.xcontent.ToXContentObject
Create snapshot request

The only mandatory parameter is repository name. The repository name has to satisfy the following requirements

  • be a non-empty string
  • must not contain whitespace (tabs or spaces)
  • must not contain comma (',')
  • must not contain hash sign ('#')
  • must not start with underscore ('-')
  • must be lowercase
  • must not contain invalid file name characters Strings.INVALID_FILENAME_CHARS
  • Field Details

    • MAXIMUM_METADATA_BYTES

      public static int MAXIMUM_METADATA_BYTES
  • Constructor Details

    • CreateSnapshotRequest

      public CreateSnapshotRequest()
    • CreateSnapshotRequest

      public CreateSnapshotRequest(String repository, String snapshot)
      Constructs a new put repository request with the provided snapshot and repository names
      Parameters:
      repository - repository name
      snapshot - snapshot name
    • CreateSnapshotRequest

      public CreateSnapshotRequest(StreamInput in) throws IOException
      Throws:
      IOException
  • Method Details

    • writeTo

      public void writeTo(StreamOutput out) throws IOException
      Description copied from interface: Writeable
      Write this into the StreamOutput.
      Specified by:
      writeTo in interface Writeable
      Overrides:
      writeTo in class MasterNodeRequest<CreateSnapshotRequest>
      Throws:
      IOException
    • validate

      Specified by:
      validate in class ActionRequest
    • metadataSize

      public static int metadataSize(Map<String,Object> userMetadata)
    • snapshot

      public CreateSnapshotRequest snapshot(String snapshot)
      Sets the snapshot name
      Parameters:
      snapshot - snapshot name
    • snapshot

      public String snapshot()
      The snapshot name
      Returns:
      snapshot name
    • repository

      public CreateSnapshotRequest repository(String repository)
      Sets repository name
      Parameters:
      repository - name
      Returns:
      this request
    • repository

      public String repository()
      Returns repository name
      Returns:
      repository name
    • indices

      public CreateSnapshotRequest indices(String... indices)
      Sets a list of indices that should be included into the snapshot

      The list of indices supports multi-index syntax. For example: "+test*" ,"-test42" will index all indices with prefix "test" except index "test42". Aliases are supported. An empty list or {"_all"} will snapshot all open indices in the cluster.

      Specified by:
      indices in interface IndicesRequest.Replaceable
      Returns:
      this request
    • indices

      public CreateSnapshotRequest indices(List<String> indices)
      Sets a list of indices that should be included into the snapshot

      The list of indices supports multi-index syntax. For example: "+test*" ,"-test42" will index all indices with prefix "test" except index "test42". Aliases are supported. An empty list or {"_all"} will snapshot all open indices in the cluster.

      Returns:
      this request
    • indices

      public String[] indices()
      Returns a list of indices that should be included into the snapshot
      Specified by:
      indices in interface IndicesRequest
      Returns:
      list of indices
    • indicesOptions

      public IndicesOptions indicesOptions()
      Specifies the indices options. Like what type of requested indices to ignore. For example indices that don't exist.
      Specified by:
      indicesOptions in interface IndicesRequest
      Returns:
      the desired behaviour regarding indices options
    • indicesOptions

      public CreateSnapshotRequest indicesOptions(IndicesOptions indicesOptions)
      Specifies the indices options. Like what type of requested indices to ignore. For example indices that don't exist.
      Parameters:
      indicesOptions - the desired behaviour regarding indices options
      Returns:
      this request
    • includeDataStreams

      public boolean includeDataStreams()
      Description copied from interface: IndicesRequest
      Determines whether the request should be applied to data streams. When false, none of the names or wildcard expressions in IndicesRequest.indices() should be applied to or expanded to any data streams. All layers involved in the request's fulfillment including security, name resolution, etc., should respect this flag.
      Specified by:
      includeDataStreams in interface IndicesRequest
    • partial

      public boolean partial()
      Returns true if indices with unavailable shards should be be partially snapshotted.
      Returns:
      the desired behaviour regarding indices options
    • partial

      public CreateSnapshotRequest partial(boolean partial)
      Set to true to allow indices with unavailable shards to be partially snapshotted.
      Parameters:
      partial - true if indices with unavailable shards should be be partially snapshotted.
      Returns:
      this request
    • waitForCompletion

      public CreateSnapshotRequest waitForCompletion(boolean waitForCompletion)
      If set to true the operation should wait for the snapshot completion before returning. By default, the operation will return as soon as snapshot is initialized. It can be changed by setting this flag to true.
      Parameters:
      waitForCompletion - true if operation should wait for the snapshot completion
      Returns:
      this request
    • waitForCompletion

      public boolean waitForCompletion()
      Returns true if the request should wait for the snapshot completion before returning
      Returns:
      true if the request should wait for completion
    • settings

      public CreateSnapshotRequest settings(Settings settings)
      Sets repository-specific snapshot settings.

      See repository documentation for more information.

      Parameters:
      settings - repository-specific snapshot settings
      Returns:
      this request
    • settings

      public CreateSnapshotRequest settings(Settings.Builder settings)
      Sets repository-specific snapshot settings.

      See repository documentation for more information.

      Parameters:
      settings - repository-specific snapshot settings
      Returns:
      this request
    • settings

      public CreateSnapshotRequest settings(String source, org.elasticsearch.common.xcontent.XContentType xContentType)
      Sets repository-specific snapshot settings in JSON or YAML format

      See repository documentation for more information.

      Parameters:
      source - repository-specific snapshot settings
      xContentType - the content type of the source
      Returns:
      this request
    • settings

      public CreateSnapshotRequest settings(Map<String,Object> source)
      Sets repository-specific snapshot settings.

      See repository documentation for more information.

      Parameters:
      source - repository-specific snapshot settings
      Returns:
      this request
    • settings

      public Settings settings()
      Returns repository-specific snapshot settings
      Returns:
      repository-specific snapshot settings
    • includeGlobalState

      public CreateSnapshotRequest includeGlobalState(boolean includeGlobalState)
      Set to true if global state should be stored as part of the snapshot
      Parameters:
      includeGlobalState - true if global state should be stored
      Returns:
      this request
    • includeGlobalState

      public boolean includeGlobalState()
      Returns true if global state should be stored as part of the snapshot
      Returns:
      true if global state should be stored as part of the snapshot
    • userMetadata

      public Map<String,Object> userMetadata()
    • userMetadata

      public CreateSnapshotRequest userMetadata(Map<String,Object> userMetadata)
    • featureStates

      public String[] featureStates()
      Returns:
      Which plugin states should be included in the snapshot
    • featureStates

      public CreateSnapshotRequest featureStates(String[] featureStates)
      Parameters:
      featureStates - The plugin states to be included in the snapshot
    • featureStates

      public CreateSnapshotRequest featureStates(List<String> featureStates)
      Parameters:
      featureStates - The plugin states to be included in the snapshot
    • source

      public CreateSnapshotRequest source(Map<String,Object> source)
      Parses snapshot definition.
      Parameters:
      source - snapshot definition
      Returns:
      this request
    • 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 interface org.elasticsearch.common.xcontent.ToXContent
      Throws:
      IOException
    • getDescription

      public String getDescription()
      Description copied from interface: TaskAwareRequest
      Returns optional description of the request to be displayed by the task manager
      Specified by:
      getDescription in interface TaskAwareRequest
    • equals

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

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Overrides:
      toString in class TransportRequest