Class CreateIndexRequest

  • All Implemented Interfaces:
    Validatable, org.opensearch.common.xcontent.ToXContent, org.opensearch.common.xcontent.ToXContentObject

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

      • Nested classes/interfaces inherited from interface org.opensearch.common.xcontent.ToXContent

        org.opensearch.common.xcontent.ToXContent.DelegatingMapParams, org.opensearch.common.xcontent.ToXContent.MapParams, org.opensearch.common.xcontent.ToXContent.Params
    • Constructor Summary

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

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      CreateIndexRequest alias​(org.opensearch.action.admin.indices.alias.Alias alias)
      Adds an alias that will be associated with the index when it gets created
      java.util.Set<org.opensearch.action.admin.indices.alias.Alias> aliases()  
      CreateIndexRequest aliases​(java.lang.String source, org.opensearch.common.xcontent.XContentType contentType)
      Sets the aliases that will be associated with the index when it gets created
      CreateIndexRequest aliases​(java.util.Collection<org.opensearch.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.opensearch.common.bytes.BytesReference source, org.opensearch.common.xcontent.XContentType contentType)
      Sets the aliases that will be associated with the index when it gets created
      CreateIndexRequest aliases​(org.opensearch.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.opensearch.common.xcontent.XContentBuilder innerToXContent​(org.opensearch.common.xcontent.XContentBuilder builder, org.opensearch.common.xcontent.ToXContent.Params params)  
      CreateIndexRequest mapping​(java.lang.String source, org.opensearch.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.opensearch.common.bytes.BytesReference source, org.opensearch.common.xcontent.XContentType xContentType)
      Adds mapping that will be added when the index gets created.
      CreateIndexRequest mapping​(org.opensearch.common.xcontent.XContentBuilder source)
      Adds mapping that will be added when the index gets created.
      org.opensearch.common.bytes.BytesReference mappings()  
      org.opensearch.common.xcontent.XContentType mappingsXContentType()  
      org.opensearch.common.settings.Settings settings()
      The settings to create the index with.
      CreateIndexRequest settings​(java.lang.String source, org.opensearch.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.opensearch.common.settings.Settings settings)
      The settings to create the index with.
      CreateIndexRequest settings​(org.opensearch.common.settings.Settings.Builder settings)
      The settings to create the index with.
      CreateIndexRequest settings​(org.opensearch.common.xcontent.XContentBuilder builder)
      Allows to set the settings using a json builder.
      CreateIndexRequest source​(java.lang.String source, org.opensearch.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.opensearch.common.bytes.BytesReference source, org.opensearch.common.xcontent.XContentType xContentType)
      Sets the settings and mappings as a single source.
      CreateIndexRequest source​(org.opensearch.common.xcontent.XContentBuilder source)
      Sets the settings and mappings as a single source.
      org.opensearch.common.xcontent.XContentBuilder toXContent​(org.opensearch.common.xcontent.XContentBuilder builder, org.opensearch.common.xcontent.ToXContent.Params params)  
      org.opensearch.action.support.ActiveShardCount waitForActiveShards()  
      CreateIndexRequest waitForActiveShards​(org.opensearch.action.support.ActiveShardCount waitForActiveShards)
      Sets the number of shard copies that should be active for index creation to return.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • Methods inherited from interface org.opensearch.common.xcontent.ToXContentObject

        isFragment
    • Constructor Detail

      • CreateIndexRequest

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

      • index

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

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

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

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

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

        public CreateIndexRequest settings​(org.opensearch.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.opensearch.common.bytes.BytesReference mappings()
      • mappingsXContentType

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

        public CreateIndexRequest mapping​(java.lang.String source,
                                          org.opensearch.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.opensearch.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.opensearch.common.bytes.BytesReference source,
                                          org.opensearch.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.opensearch.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.opensearch.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.opensearch.common.xcontent.XContentType contentType)
        Sets the aliases that will be associated with the index when it gets created
      • aliases

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

        public CreateIndexRequest alias​(org.opensearch.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.opensearch.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.opensearch.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.opensearch.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.opensearch.common.bytes.BytesReference source,
                                         org.opensearch.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.opensearch.action.support.ActiveShardCount waitForActiveShards()
      • waitForActiveShards

        public CreateIndexRequest waitForActiveShards​(org.opensearch.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.opensearch.common.xcontent.XContentBuilder toXContent​(org.opensearch.common.xcontent.XContentBuilder builder,
                                                                         org.opensearch.common.xcontent.ToXContent.Params params)
                                                                  throws java.io.IOException
        Specified by:
        toXContent in interface org.opensearch.common.xcontent.ToXContent
        Throws:
        java.io.IOException
      • innerToXContent

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