Class PutIndexTemplateRequest

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

public class PutIndexTemplateRequest extends MasterNodeRequest<PutIndexTemplateRequest> implements IndicesRequest, org.elasticsearch.common.xcontent.ToXContentObject
A request to create an index template.
  • Constructor Details

    • PutIndexTemplateRequest

      public PutIndexTemplateRequest(StreamInput in) throws IOException
      Throws:
      IOException
    • PutIndexTemplateRequest

      public PutIndexTemplateRequest()
    • PutIndexTemplateRequest

      public PutIndexTemplateRequest(String name)
      Constructs a new put index template request with the provided name.
  • Method Details

    • validate

      Specified by:
      validate in class ActionRequest
    • name

      public PutIndexTemplateRequest name(String name)
      Sets the name of the index template.
    • name

      public String name()
      The name of the index template.
    • patterns

      public PutIndexTemplateRequest patterns(List<String> indexPatterns)
    • patterns

      public List<String> patterns()
    • order

      public PutIndexTemplateRequest order(int order)
    • order

      public int order()
    • version

      public PutIndexTemplateRequest version(Integer version)
    • version

      public Integer version()
    • create

      public PutIndexTemplateRequest create(boolean create)
      Set to true to force only creation, not an update of an index template. If it already exists, it will fail with an IllegalArgumentException.
    • create

      public boolean create()
    • settings

      public PutIndexTemplateRequest settings(Settings settings)
      The settings to create the index template with.
    • settings

      public PutIndexTemplateRequest settings(Settings.Builder settings)
      The settings to create the index template with.
    • settings

      public PutIndexTemplateRequest settings(String source, org.elasticsearch.common.xcontent.XContentType xContentType)
      The settings to create the index template with (either json/yaml format).
    • settings

      public PutIndexTemplateRequest settings(Map<String,​Object> source)
      The settings to create the index template with (either json or yaml format).
    • settings

      public Settings settings()
    • mapping

      public PutIndexTemplateRequest mapping(String type, String source, org.elasticsearch.common.xcontent.XContentType xContentType)
      Adds mapping that will be added when the index gets created.
      Parameters:
      type - The mapping type
      source - The mapping source
      xContentType - The type of content contained within the source
    • cause

      public PutIndexTemplateRequest cause(String cause)
      The cause for this index template creation.
    • cause

      public String cause()
    • mapping

      public PutIndexTemplateRequest mapping(String type, org.elasticsearch.common.xcontent.XContentBuilder source)
      Adds mapping that will be added when the index gets created.
      Parameters:
      type - The mapping type
      source - The mapping source
    • mapping

      public PutIndexTemplateRequest mapping(String type, BytesReference source, org.elasticsearch.common.xcontent.XContentType xContentType)
      Adds mapping that will be added when the index gets created.
      Parameters:
      type - The mapping type
      source - The mapping source
      xContentType - the source content type
    • mapping

      public PutIndexTemplateRequest mapping(String type, Map<String,​Object> source)
      Adds mapping that will be added when the index gets created.
      Parameters:
      type - The mapping type
      source - The mapping source
    • mapping

      public PutIndexTemplateRequest mapping(String type, Object... source)
      A specialized simplified mapping source method, takes the form of simple properties definition: ("field1", "type=string,store=true").
    • mappings

      public Map<String,​String> mappings()
    • source

      public PutIndexTemplateRequest source(org.elasticsearch.common.xcontent.XContentBuilder templateBuilder)
      The template source definition.
    • source

      public PutIndexTemplateRequest source(Map<String,​Object> templateSource)
      The template source definition.
    • source

      public PutIndexTemplateRequest source(String templateSource, org.elasticsearch.common.xcontent.XContentType xContentType)
      The template source definition.
    • source

      public PutIndexTemplateRequest source(byte[] source, org.elasticsearch.common.xcontent.XContentType xContentType)
      The template source definition.
    • source

      public PutIndexTemplateRequest source(byte[] source, int offset, int length, org.elasticsearch.common.xcontent.XContentType xContentType)
      The template source definition.
    • source

      public PutIndexTemplateRequest source(BytesReference source, org.elasticsearch.common.xcontent.XContentType xContentType)
      The template source definition.
    • aliases

      public Set<Alias> aliases()
    • aliases

      public PutIndexTemplateRequest aliases(Map<String,​?> source)
      Sets the aliases that will be associated with the index when it gets created
    • aliases

      public PutIndexTemplateRequest aliases(org.elasticsearch.common.xcontent.XContentBuilder source)
      Sets the aliases that will be associated with the index when it gets created
    • aliases

      public PutIndexTemplateRequest aliases(String source)
      Sets the aliases that will be associated with the index when it gets created
    • aliases

      public PutIndexTemplateRequest aliases(BytesReference source)
      Sets the aliases that will be associated with the index when it gets created
    • alias

      public PutIndexTemplateRequest alias(Alias alias)
      Adds an alias that will be added when the index gets created.
      Parameters:
      alias - The metadata for the new alias
      Returns:
      the index template creation request
    • indices

      public String[] indices()
      Description copied from interface: IndicesRequest
      Returns the array of indices that the action relates to
      Specified by:
      indices in interface IndicesRequest
    • indicesOptions

      public IndicesOptions indicesOptions()
      Description copied from interface: IndicesRequest
      Returns the indices options used to resolve indices. They tell for instance whether a single index is accepted, whether an empty array will be converted to _all, and how wildcards will be expanded if needed.
      Specified by:
      indicesOptions in interface IndicesRequest
    • 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<PutIndexTemplateRequest>
      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 interface org.elasticsearch.common.xcontent.ToXContent
      Throws:
      IOException