Class CreateIndexRequest

    • 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 Settings settings()
        The settings to create the index with.
      • settings

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

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

        public XContentType mappingsXContentType()
      • mapping

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

        public CreateIndexRequest alias​(Alias alias)
        Adds an alias that will be associated with the index when it gets created
      • aliases

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

        public CreateIndexRequest source​(java.lang.String source,
                                         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​(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​(BytesReference source,
                                         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 CreateIndexRequest waitForActiveShards​(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