Class DataStreamAlias

java.lang.Object
org.elasticsearch.cluster.metadata.DataStreamAlias
All Implemented Interfaces:
Diffable<DataStreamAlias>, SimpleDiffable<DataStreamAlias>, Writeable, org.elasticsearch.xcontent.ToXContent, org.elasticsearch.xcontent.ToXContentFragment

public class DataStreamAlias extends Object implements SimpleDiffable<DataStreamAlias>, org.elasticsearch.xcontent.ToXContentFragment
  • Field Details

    • DATA_STREAMS_FIELD

      public static final org.elasticsearch.xcontent.ParseField DATA_STREAMS_FIELD
    • WRITE_DATA_STREAM_FIELD

      public static final org.elasticsearch.xcontent.ParseField WRITE_DATA_STREAM_FIELD
    • FILTER_FIELD

      public static final org.elasticsearch.xcontent.ParseField FILTER_FIELD
  • Constructor Details

  • Method Details

    • getName

      public String getName()
      Returns the name of this data stream alias.
    • getDataStreams

      public List<String> getDataStreams()
      Returns the data streams that are referenced
    • getWriteDataStream

      public String getWriteDataStream()
      Returns the write data stream this data stream alias is referring to. Write requests targeting this instance will resolve the write index of the write data stream this alias is referring to. Note that the write data stream is also included in getDataStreams().
    • getFilter

      public CompressedXContent getFilter()
    • filteringRequired

      public boolean filteringRequired()
    • update

      public DataStreamAlias update(String dataStream, Boolean isWriteDataStream, Map<String,Object> filterAsMap)
      Returns a new DataStreamAlias instance with the provided data stream name added to it as a new member. If the provided isWriteDataStream is set to true then the provided data stream is also set as write data stream. If the provided isWriteDataStream is set to false and the provided data stream is also the write data stream of this instance then the returned data stream alias instance's write data stream is unset. If the provided filter is the same as the filter of this alias then this instance isn't updated, otherwise it is updated. The same instance is returned if the attempted addition of the provided data stream didn't change this instance.
    • removeDataStream

      public DataStreamAlias removeDataStream(String dataStream)
      Returns a DataStreamAlias instance based on this instance but with the specified data stream no longer referenced. Returns null if because of the removal of the provided data stream name a new instance wouldn't reference to any data stream. The same instance is returned if the attempted removal of the provided data stream didn't change this instance.
    • intersect

      public DataStreamAlias intersect(Predicate<String> filter)
      Returns a new DataStreamAlias instance that contains a new intersection of data streams from this instance and the provided filter. The write data stream gets set to null in the returned instance if the write data stream no longer appears in the intersection.
    • restore

      public DataStreamAlias restore(DataStreamAlias previous, String renamePattern, String renameReplacement)
      Performs alias related restore operations for this instance as part of the entire restore operation. If a previous instance is provided then it merges the data streams referenced in this instance and the previous instance. If this instance doesn't have a write data stream then the write index of the other data stream becomes the write data stream of the returned instance. If both this and previous instances have a write data stream then these write data streams need to be the same. If a renamePattern and renameReplacement is provided then data streams this instance is referring to are renamed. Assuming that those data streams match with the specified renamePattern.
      Parameters:
      previous - Optionally, the alias instance that this alias instance is replacing.
      renamePattern - Optionally, the pattern that is required to match to rename data streams this alias is referring to.
      renameReplacement - Optionally, the replacement used to rename data streams this alias is referring to.
      Returns:
      a new alias instance that can be applied in the cluster state
    • readDiffFrom

      public static Diff<DataStreamAlias> readDiffFrom(StreamInput in) throws IOException
      Throws:
      IOException
    • fromXContent

      public static DataStreamAlias fromXContent(org.elasticsearch.xcontent.XContentParser parser) throws IOException
      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
    • 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
    • toString

      public String toString()
      Overrides:
      toString in class Object