Class CreateIndexRequest

java.lang.Object
org.elasticsearch.client.TimedRequest
org.elasticsearch.client.indices.CreateIndexRequest
All Implemented Interfaces:
Validatable, org.elasticsearch.common.xcontent.ToXContent, org.elasticsearch.common.xcontent.ToXContentObject

public class CreateIndexRequest
extends TimedRequest
implements Validatable, org.elasticsearch.common.xcontent.ToXContentObject
A request to create an index.
  • 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
  • Field Summary

    Fields inherited from class org.elasticsearch.client.TimedRequest

    DEFAULT_ACK_TIMEOUT, DEFAULT_MASTER_NODE_TIMEOUT

    Fields inherited from interface org.elasticsearch.common.xcontent.ToXContent

    EMPTY_PARAMS

    Fields inherited from interface org.elasticsearch.client.Validatable

    EMPTY
  • Constructor Summary

    Constructors
    Constructor Description
    CreateIndexRequest​(java.lang.String index)
    Constructs a new request to create an index with the specified name.
  • Method Summary

    Modifier and Type Method Description
    CreateIndexRequest alias​(org.elasticsearch.action.admin.indices.alias.Alias alias)
    Adds an alias that will be associated with the index when it gets created
    java.util.Set<org.elasticsearch.action.admin.indices.alias.Alias> aliases()  
    CreateIndexRequest aliases​(java.lang.String source, org.elasticsearch.common.xcontent.XContentType contentType)
    Sets the aliases that will be associated with the index when it gets created
    CreateIndexRequest aliases​(java.util.Collection<org.elasticsearch.action.admin.indices.alias.Alias> aliases)
    Adds aliases that will be associated with the index when it gets created
    CreateIndexRequest aliases​(java.util.Map<java.lang.String,​?> source)
    Sets the aliases that will be associated with the index when it gets created
    CreateIndexRequest aliases​(org.elasticsearch.common.bytes.BytesReference source, org.elasticsearch.common.xcontent.XContentType contentType)
    Sets the aliases that will be associated with the index when it gets created
    CreateIndexRequest aliases​(org.elasticsearch.common.xcontent.XContentBuilder source)
    Sets the aliases that will be associated with the index when it gets created
    java.lang.String index()
    The name of the index to create.
    org.elasticsearch.common.xcontent.XContentBuilder innerToXContent​(org.elasticsearch.common.xcontent.XContentBuilder builder, org.elasticsearch.common.xcontent.ToXContent.Params params)  
    CreateIndexRequest mapping​(java.lang.String source, org.elasticsearch.common.xcontent.XContentType xContentType)
    Adds mapping that will be added when the index gets created.
    CreateIndexRequest mapping​(java.util.Map<java.lang.String,​?> source)
    Adds mapping that will be added when the index gets created.
    CreateIndexRequest mapping​(org.elasticsearch.common.bytes.BytesReference source, org.elasticsearch.common.xcontent.XContentType xContentType)
    Adds mapping that will be added when the index gets created.
    CreateIndexRequest mapping​(org.elasticsearch.common.xcontent.XContentBuilder source)
    Adds mapping that will be added when the index gets created.
    org.elasticsearch.common.bytes.BytesReference mappings()  
    org.elasticsearch.common.xcontent.XContentType mappingsXContentType()  
    org.elasticsearch.common.settings.Settings settings()
    The settings to create the index with.
    CreateIndexRequest settings​(java.lang.String source, org.elasticsearch.common.xcontent.XContentType xContentType)
    The settings to create the index with (either json or yaml format)
    CreateIndexRequest settings​(java.util.Map<java.lang.String,​?> source)
    The settings to create the index with (either json/yaml/properties format)
    CreateIndexRequest settings​(org.elasticsearch.common.settings.Settings settings)
    The settings to create the index with.
    CreateIndexRequest settings​(org.elasticsearch.common.settings.Settings.Builder settings)
    The settings to create the index with.
    CreateIndexRequest settings​(org.elasticsearch.common.xcontent.XContentBuilder builder)
    Allows to set the settings using a json builder.
    CreateIndexRequest source​(java.lang.String source, org.elasticsearch.common.xcontent.XContentType xContentType)
    Sets the settings and mappings as a single source.
    CreateIndexRequest source​(java.util.Map<java.lang.String,​?> source)
    Sets the settings and mappings as a single source.
    CreateIndexRequest source​(org.elasticsearch.common.bytes.BytesReference source, org.elasticsearch.common.xcontent.XContentType xContentType)
    Sets the settings and mappings as a single source.
    CreateIndexRequest source​(org.elasticsearch.common.xcontent.XContentBuilder source)
    Sets the settings and mappings as a single source.
    org.elasticsearch.common.xcontent.XContentBuilder toXContent​(org.elasticsearch.common.xcontent.XContentBuilder builder, org.elasticsearch.common.xcontent.ToXContent.Params params)  
    org.elasticsearch.action.support.ActiveShardCount waitForActiveShards()  
    CreateIndexRequest waitForActiveShards​(org.elasticsearch.action.support.ActiveShardCount waitForActiveShards)
    Sets the number of shard copies that should be active for index creation to return.

    Methods inherited from class org.elasticsearch.client.TimedRequest

    masterNodeTimeout, setMasterTimeout, setTimeout, timeout

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface org.elasticsearch.common.xcontent.ToXContentObject

    isFragment

    Methods inherited from interface org.elasticsearch.client.Validatable

    validate
  • Constructor Details

    • CreateIndexRequest

      public CreateIndexRequest​(java.lang.String index)
      Constructs a new request to create an index with the specified name.
  • Method Details

    • index

      public java.lang.String index()
      The name of the index to create.
    • settings

      public org.elasticsearch.common.settings.Settings settings()
      The settings to create the index with.
    • settings

      public CreateIndexRequest settings​(org.elasticsearch.common.settings.Settings.Builder settings)
      The settings to create the index with.
    • settings

      public CreateIndexRequest settings​(org.elasticsearch.common.settings.Settings settings)
      The settings to create the index with.
    • settings

      public CreateIndexRequest settings​(java.lang.String source, org.elasticsearch.common.xcontent.XContentType xContentType)
      The settings to create the index with (either json or yaml format)
    • settings

      public CreateIndexRequest settings​(org.elasticsearch.common.xcontent.XContentBuilder builder)
      Allows to set the settings using a json builder.
    • settings

      public CreateIndexRequest settings​(java.util.Map<java.lang.String,​?> source)
      The settings to create the index with (either json/yaml/properties format)
    • mappings

      public org.elasticsearch.common.bytes.BytesReference mappings()
    • mappingsXContentType

      public org.elasticsearch.common.xcontent.XContentType mappingsXContentType()
    • mapping

      public CreateIndexRequest mapping​(java.lang.String source, org.elasticsearch.common.xcontent.XContentType xContentType)
      Adds mapping that will be added when the index gets created. Note that the definition should *not* be nested under a type name.
      Parameters:
      source - The mapping source
      xContentType - The content type of the source
    • mapping

      public CreateIndexRequest mapping​(org.elasticsearch.common.xcontent.XContentBuilder source)
      Adds mapping that will be added when the index gets created. Note that the definition should *not* be nested under a type name.
      Parameters:
      source - The mapping source
    • mapping

      public CreateIndexRequest mapping​(java.util.Map<java.lang.String,​?> source)
      Adds mapping that will be added when the index gets created. Note that the definition should *not* be nested under a type name.
      Parameters:
      source - The mapping source
    • mapping

      public CreateIndexRequest mapping​(org.elasticsearch.common.bytes.BytesReference source, org.elasticsearch.common.xcontent.XContentType xContentType)
      Adds mapping that will be added when the index gets created. Note that the definition should *not* be nested under a type name.
      Parameters:
      source - The mapping source
      xContentType - the content type of the mapping source
    • aliases

      public java.util.Set<org.elasticsearch.action.admin.indices.alias.Alias> aliases()
    • aliases

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

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

      public CreateIndexRequest aliases​(java.lang.String source, org.elasticsearch.common.xcontent.XContentType contentType)
      Sets the aliases that will be associated with the index when it gets created
    • aliases

      public CreateIndexRequest aliases​(org.elasticsearch.common.bytes.BytesReference source, org.elasticsearch.common.xcontent.XContentType contentType)
      Sets the aliases that will be associated with the index when it gets created
    • alias

      public CreateIndexRequest alias​(org.elasticsearch.action.admin.indices.alias.Alias alias)
      Adds an alias that will be associated with the index when it gets created
    • aliases

      public CreateIndexRequest aliases​(java.util.Collection<org.elasticsearch.action.admin.indices.alias.Alias> aliases)
      Adds aliases that will be associated with the index when it gets created
    • source

      public CreateIndexRequest source​(java.lang.String source, org.elasticsearch.common.xcontent.XContentType xContentType)
      Sets the settings and mappings as a single source. Note that the mapping definition should *not* be nested under a type name.
    • source

      public CreateIndexRequest source​(org.elasticsearch.common.xcontent.XContentBuilder source)
      Sets the settings and mappings as a single source. Note that the mapping definition should *not* be nested under a type name.
    • source

      public CreateIndexRequest source​(org.elasticsearch.common.bytes.BytesReference source, org.elasticsearch.common.xcontent.XContentType xContentType)
      Sets the settings and mappings as a single source. Note that the mapping definition should *not* be nested under a type name.
    • source

      public CreateIndexRequest source​(java.util.Map<java.lang.String,​?> source)
      Sets the settings and mappings as a single source. Note that the mapping definition should *not* be nested under a type name.
    • waitForActiveShards

      public org.elasticsearch.action.support.ActiveShardCount waitForActiveShards()
    • waitForActiveShards

      public CreateIndexRequest waitForActiveShards​(org.elasticsearch.action.support.ActiveShardCount waitForActiveShards)
      Sets the number of shard copies that should be active for index creation to return. Defaults to ActiveShardCount.DEFAULT, which will wait for one shard copy (the primary) to become active. Set this value to ActiveShardCount.ALL to wait for all shards (primary and all replicas) to be active before returning. Otherwise, use ActiveShardCount.from(int) to set this value to any non-negative integer, up to the number of copies per shard (number of replicas + 1), to wait for the desired amount of shard copies to become active before returning. Index creation will only wait up until the timeout value for the number of shard copies to be active before returning. Check ShardsAcknowledgedResponse.isShardsAcknowledged() to determine if the requisite shard copies were all started before returning or timing out.
      Parameters:
      waitForActiveShards - number of active shard copies to wait on
    • toXContent

      public org.elasticsearch.common.xcontent.XContentBuilder toXContent​(org.elasticsearch.common.xcontent.XContentBuilder builder, org.elasticsearch.common.xcontent.ToXContent.Params params) throws java.io.IOException
      Specified by:
      toXContent in interface org.elasticsearch.common.xcontent.ToXContent
      Throws:
      java.io.IOException
    • innerToXContent

      public org.elasticsearch.common.xcontent.XContentBuilder innerToXContent​(org.elasticsearch.common.xcontent.XContentBuilder builder, org.elasticsearch.common.xcontent.ToXContent.Params params) throws java.io.IOException
      Throws:
      java.io.IOException