org.elasticsearch.action.admin.indices.mapping.put
Class PutMappingRequest

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

public class PutMappingRequest
extends MasterNodeOperationRequest

Puts mapping definition registered under a specific type into one or more indices. Best created with Requests.putMappingRequest(String...).

If the mappings already exists, the new mappings will be merged with the new one. If there are elements that can't be merged are detected, the request will be rejected unless the ignoreConflicts(boolean) is set. In such a case, the duplicate mappings will be rejected.

See Also:
Requests.putMappingRequest(String...), IndicesAdminClient.putMapping(PutMappingRequest), PutMappingResponse

Field Summary
 
Fields inherited from class org.elasticsearch.action.support.master.MasterNodeOperationRequest
DEFAULT_MASTER_NODE_TIMEOUT, masterNodeTimeout
 
Constructor Summary
PutMappingRequest(String... indices)
          Constructs a new put mapping request against one or more indices.
 
Method Summary
 boolean ignoreConflicts()
          If there is already a mapping definition registered against the type, then it will be merged.
 PutMappingRequest ignoreConflicts(boolean ignoreDuplicates)
          If there is already a mapping definition registered against the type, then it will be merged.
 String[] indices()
          The indices the mappings will be put.
 PutMappingRequest indices(String[] indices)
          Sets the indices this put mapping operation will execute on.
 void readFrom(StreamInput in)
           
 PutMappingRequest source(Map mappingSource)
          The mapping source definition.
 PutMappingRequest source(String mappingSource)
          The mapping source definition.
 PutMappingRequest source(XContentBuilder mappingBuilder)
          The mapping source definition.
 PutMappingRequest timeout(String timeout)
          Timeout to wait till the put mapping gets acknowledged of all current cluster nodes.
 PutMappingRequest timeout(TimeValue timeout)
          Timeout to wait till the put mapping gets acknowledged of all current cluster nodes.
 String type()
          The mapping type.
 PutMappingRequest type(String mappingType)
          The type of the mappings.
 ActionRequestValidationException validate()
           
 void writeTo(StreamOutput out)
           
 
Methods inherited from class org.elasticsearch.action.support.master.MasterNodeOperationRequest
listenerThreaded, listenerThreaded, masterNodeTimeout, masterNodeTimeout, masterNodeTimeout
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PutMappingRequest

public PutMappingRequest(String... indices)
Constructs a new put mapping request against one or more indices. If nothing is set then it will be executed against all indices.

Method Detail

validate

public ActionRequestValidationException validate()

indices

public PutMappingRequest indices(String[] indices)
Sets the indices this put mapping operation will execute on.


indices

public String[] indices()
The indices the mappings will be put.


type

public String type()
The mapping type.


type

@Required
public PutMappingRequest type(String mappingType)
The type of the mappings.


source

@Required
public PutMappingRequest source(XContentBuilder mappingBuilder)
The mapping source definition.


source

@Required
public PutMappingRequest source(Map mappingSource)
The mapping source definition.


source

@Required
public PutMappingRequest source(String mappingSource)
The mapping source definition.


timeout

public PutMappingRequest timeout(TimeValue timeout)
Timeout to wait till the put mapping gets acknowledged of all current cluster nodes. Defaults to 10s.


timeout

public PutMappingRequest timeout(String timeout)
Timeout to wait till the put mapping gets acknowledged of all current cluster nodes. Defaults to 10s.


ignoreConflicts

public boolean ignoreConflicts()
If there is already a mapping definition registered against the type, then it will be merged. If there are elements that can't be merged are detected, the request will be rejected unless the ignoreConflicts(boolean) is set. In such a case, the duplicate mappings will be rejected.


ignoreConflicts

public PutMappingRequest ignoreConflicts(boolean ignoreDuplicates)
If there is already a mapping definition registered against the type, then it will be merged. If there are elements that can't be merged are detected, the request will be rejected unless the ignoreConflicts(boolean) is set. In such a case, the duplicate mappings will be rejected.


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.