Class CreateIndexRequest

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

public class CreateIndexRequest extends TimedRequest implements Validatable, org.elasticsearch.xcontent.ToXContentObject
A request to create an index.
  • Nested Class Summary

    Nested classes/interfaces inherited from interface org.elasticsearch.xcontent.ToXContent

    org.elasticsearch.xcontent.ToXContent.DelegatingMapParams, org.elasticsearch.xcontent.ToXContent.MapParams, org.elasticsearch.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.xcontent.ToXContent

    EMPTY_PARAMS

    Fields inherited from interface org.elasticsearch.client.Validatable

    EMPTY
  • Constructor Summary

    Constructors
    Constructor
    Description
    Constructs a new request to create an index with the specified name.
  • Method Summary

    Modifier and Type
    Method
    Description
    alias(org.elasticsearch.action.admin.indices.alias.Alias alias)
    Adds an alias that will be associated with the index when it gets created
    Set<org.elasticsearch.action.admin.indices.alias.Alias>
     
    aliases(String source, org.elasticsearch.xcontent.XContentType contentType)
    Sets the aliases that will be associated with the index when it gets created
    aliases(Collection<org.elasticsearch.action.admin.indices.alias.Alias> aliases)
    Adds aliases that will be associated with the index when it gets created
    aliases(Map<String,?> source)
    Sets the aliases that will be associated with the index when it gets created
    aliases(org.elasticsearch.common.bytes.BytesReference source, org.elasticsearch.xcontent.XContentType contentType)
    Sets the aliases that will be associated with the index when it gets created
    aliases(org.elasticsearch.xcontent.XContentBuilder source)
    Sets the aliases that will be associated with the index when it gets created
    The name of the index to create.
    org.elasticsearch.xcontent.XContentBuilder
    innerToXContent(org.elasticsearch.xcontent.XContentBuilder builder, org.elasticsearch.xcontent.ToXContent.Params params)
     
    mapping(String source, org.elasticsearch.xcontent.XContentType xContentType)
    Adds mapping that will be added when the index gets created.
    mapping(Map<String,?> source)
    Adds mapping that will be added when the index gets created.
    mapping(org.elasticsearch.common.bytes.BytesReference source, org.elasticsearch.xcontent.XContentType xContentType)
    Adds mapping that will be added when the index gets created.
    mapping(org.elasticsearch.xcontent.XContentBuilder source)
    Adds mapping that will be added when the index gets created.
    org.elasticsearch.common.bytes.BytesReference
     
    org.elasticsearch.xcontent.XContentType
     
    org.elasticsearch.common.settings.Settings
    The settings to create the index with.
    settings(String source, org.elasticsearch.xcontent.XContentType xContentType)
    The settings to create the index with (either json or yaml format)
    settings(Map<String,?> source)
    The settings to create the index with (either json/yaml/properties format)
    settings(org.elasticsearch.common.settings.Settings settings)
    The settings to create the index with.
    settings(org.elasticsearch.common.settings.Settings.Builder settings)
    The settings to create the index with.
    settings(org.elasticsearch.xcontent.XContentBuilder builder)
    Allows to set the settings using a json builder.
    source(String source, org.elasticsearch.xcontent.XContentType xContentType)
    Sets the settings and mappings as a single source.
    source(Map<String,?> source)
    Sets the settings and mappings as a single source.
    source(org.elasticsearch.common.bytes.BytesReference source, org.elasticsearch.xcontent.XContentType xContentType)
    Sets the settings and mappings as a single source.
    source(org.elasticsearch.xcontent.XContentBuilder source)
    Sets the settings and mappings as a single source.
    org.elasticsearch.xcontent.XContentBuilder
    toXContent(org.elasticsearch.xcontent.XContentBuilder builder, org.elasticsearch.xcontent.ToXContent.Params params)
     
    org.elasticsearch.action.support.ActiveShardCount
     
    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.xcontent.ToXContentObject

    isFragment

    Methods inherited from interface org.elasticsearch.client.Validatable

    validate
  • Constructor Details

    • CreateIndexRequest

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

    • index

      public 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(String source, org.elasticsearch.xcontent.XContentType xContentType)
      The settings to create the index with (either json or yaml format)
    • settings

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

      public CreateIndexRequest settings(Map<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.xcontent.XContentType mappingsXContentType()
    • mapping

      public CreateIndexRequest mapping(String source, org.elasticsearch.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.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(Map<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.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 Set<org.elasticsearch.action.admin.indices.alias.Alias> aliases()
    • aliases

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

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

      public CreateIndexRequest aliases(String source, org.elasticsearch.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.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(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(String source, org.elasticsearch.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.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.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(Map<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.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
    • innerToXContent

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