org.elasticsearch.action.admin.indices.create
Class CreateIndexRequest

java.lang.Object
  extended by org.elasticsearch.action.support.master.MasterNodeOperationRequest
      extended by org.elasticsearch.action.admin.indices.create.CreateIndexRequest
All Implemented Interfaces:
ActionRequest, Streamable

public class CreateIndexRequest
extends MasterNodeOperationRequest

A request to create an index. Best created with Requests.createIndexRequest(String).

The index created can optionally be created with settings(org.elasticsearch.common.settings.Settings).

See Also:
IndicesAdminClient.create(CreateIndexRequest), Requests.createIndexRequest(String), CreateIndexResponse

Field Summary
 
Fields inherited from class org.elasticsearch.action.support.master.MasterNodeOperationRequest
DEFAULT_MASTER_NODE_TIMEOUT, masterNodeTimeout
 
Constructor Summary
CreateIndexRequest(String index)
          Constructs a new request to create an index with the specified name.
CreateIndexRequest(String index, Settings settings)
          Constructs a new request to create an index with the specified name and settings.
 
Method Summary
 CreateIndexRequest cause(String cause)
          The cause for this index creation.
 CreateIndexRequest custom(IndexMetaData.Custom custom)
           
 CreateIndexRequest index(String index)
           
 CreateIndexRequest mapping(String type, Map source)
          Adds mapping that will be added when the index gets created.
 CreateIndexRequest mapping(String type, String source)
          Adds mapping that will be added when the index gets created.
 CreateIndexRequest mapping(String type, XContentBuilder source)
          Adds mapping that will be added when the index gets created.
 CreateIndexRequest masterNodeTimeout(TimeValue timeout)
          A timeout value in case the master has not been discovered yet or disconnected.
 void readFrom(StreamInput in)
           
 CreateIndexRequest settings(Map source)
          The settings to crete the index with (either json/yaml/properties format)
 CreateIndexRequest settings(Settings.Builder settings)
          The settings to created the index with.
 CreateIndexRequest settings(Settings settings)
          The settings to created the index with.
 CreateIndexRequest settings(String source)
          The settings to crete the index with (either json/yaml/properties format)
 CreateIndexRequest settings(XContentBuilder builder)
          Allows to set the settings using a json builder.
 CreateIndexRequest source(byte[] source)
          Sets the settings and mappings as a single source.
 CreateIndexRequest source(byte[] source, int offset, int length)
           
 CreateIndexRequest source(BytesReference source)
          Sets the settings and mappings as a single source.
 CreateIndexRequest source(Map<String,Object> source)
          Sets the settings and mappings as a single source.
 CreateIndexRequest source(String source)
          Sets the settings and mappings as a single source.
 CreateIndexRequest source(XContentBuilder source)
          Sets the settings and mappings as a single source.
 CreateIndexRequest timeout(String timeout)
          Timeout to wait for the index creation to be acknowledged by current cluster nodes.
 CreateIndexRequest timeout(TimeValue timeout)
          Timeout to wait for the index creation to be acknowledged by current cluster nodes.
 ActionRequestValidationException validate()
           
 void writeTo(StreamOutput out)
           
 
Methods inherited from class org.elasticsearch.action.support.master.MasterNodeOperationRequest
listenerThreaded, listenerThreaded, masterNodeTimeout, masterNodeTimeout
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CreateIndexRequest

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


CreateIndexRequest

public CreateIndexRequest(String index,
                          Settings settings)
Constructs a new request to create an index with the specified name and settings.

Method Detail

validate

public ActionRequestValidationException validate()

index

public CreateIndexRequest index(String index)

settings

public CreateIndexRequest settings(Settings settings)
The settings to created the index with.


settings

public CreateIndexRequest settings(Settings.Builder settings)
The settings to created the index with.


settings

public CreateIndexRequest settings(String source)
The settings to crete the index with (either json/yaml/properties format)


settings

public CreateIndexRequest settings(XContentBuilder builder)
Allows to set the settings using a json builder.


settings

public CreateIndexRequest settings(Map source)
The settings to crete the index with (either json/yaml/properties format)


mapping

public CreateIndexRequest mapping(String type,
                                  String source)
Adds mapping that will be added when the index gets created.

Parameters:
type - The mapping type
source - The mapping source

cause

public CreateIndexRequest cause(String cause)
The cause for this index creation.


mapping

public CreateIndexRequest mapping(String type,
                                  XContentBuilder source)
Adds mapping that will be added when the index gets created.

Parameters:
type - The mapping type
source - The mapping source

mapping

public CreateIndexRequest mapping(String type,
                                  Map source)
Adds mapping that will be added when the index gets created.

Parameters:
type - The mapping type
source - The mapping source

source

public CreateIndexRequest source(String source)
Sets the settings and mappings as a single source.


source

public CreateIndexRequest source(XContentBuilder source)
Sets the settings and mappings as a single source.


source

public CreateIndexRequest source(byte[] source)
Sets the settings and mappings as a single source.


source

public CreateIndexRequest source(byte[] source,
                                 int offset,
                                 int length)

source

public CreateIndexRequest source(BytesReference source)
Sets the settings and mappings as a single source.


source

public CreateIndexRequest source(Map<String,Object> source)
Sets the settings and mappings as a single source.


custom

public CreateIndexRequest custom(IndexMetaData.Custom custom)

timeout

public CreateIndexRequest timeout(TimeValue timeout)
Timeout to wait for the index creation to be acknowledged by current cluster nodes. Defaults to 10s.


timeout

public CreateIndexRequest timeout(String timeout)
Timeout to wait for the index creation to be acknowledged by current cluster nodes. Defaults to 10s.


masterNodeTimeout

public CreateIndexRequest masterNodeTimeout(TimeValue timeout)
A timeout value in case the master has not been discovered yet or disconnected.

Overrides:
masterNodeTimeout in class MasterNodeOperationRequest

readFrom

public void readFrom(StreamInput in)
              throws IOException
Specified by:
readFrom in interface Streamable
Overrides:
readFrom in class MasterNodeOperationRequest
Throws:
IOException

writeTo

public void writeTo(StreamOutput out)
             throws IOException
Specified by:
writeTo in interface Streamable
Overrides:
writeTo in class MasterNodeOperationRequest
Throws:
IOException


Copyright © 2009-2012. All Rights Reserved.