Class PutMappingRequest
- java.lang.Object
-
- org.elasticsearch.transport.TransportMessage
-
- org.elasticsearch.transport.TransportRequest
-
- org.elasticsearch.action.ActionRequest
-
- org.elasticsearch.action.support.master.MasterNodeRequest<Request>
-
- org.elasticsearch.action.support.master.AcknowledgedRequest<PutMappingRequest>
-
- org.elasticsearch.action.admin.indices.mapping.put.PutMappingRequest
-
- All Implemented Interfaces:
IndicesRequest
,IndicesRequest.Replaceable
,AckedRequest
,Streamable
,Writeable
,ToXContent
,ToXContentObject
,TaskAwareRequest
public class PutMappingRequest extends AcknowledgedRequest<PutMappingRequest> implements IndicesRequest.Replaceable, ToXContentObject
Puts mapping definition registered under a specific type into one or more indices. Best created withRequests.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.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.elasticsearch.transport.TransportRequest
TransportRequest.Empty
-
Nested classes/interfaces inherited from interface org.elasticsearch.action.IndicesRequest
IndicesRequest.Replaceable
-
Nested classes/interfaces inherited from interface org.elasticsearch.common.xcontent.ToXContent
ToXContent.DelegatingMapParams, ToXContent.MapParams, ToXContent.Params
-
Nested classes/interfaces inherited from interface org.elasticsearch.common.io.stream.Writeable
Writeable.Reader<V>, Writeable.Writer<V>
-
-
Field Summary
-
Fields inherited from class org.elasticsearch.action.support.master.AcknowledgedRequest
DEFAULT_ACK_TIMEOUT, timeout
-
Fields inherited from class org.elasticsearch.action.support.master.MasterNodeRequest
DEFAULT_MASTER_NODE_TIMEOUT, masterNodeTimeout
-
Fields inherited from interface org.elasticsearch.common.xcontent.ToXContent
EMPTY_PARAMS
-
-
Constructor Summary
Constructors Constructor Description PutMappingRequest()
PutMappingRequest(java.lang.String... indices)
Constructs a new put mapping request against one or more indices.
-
Method Summary
Modifier and Type Method Description static XContentBuilder
buildFromSimplifiedDef(java.lang.String type, java.lang.Object... source)
Index
getConcreteIndex()
Returns a concrete index for this mapping ornull
if no concrete index is definedjava.lang.String[]
indices()
The indices the mappings will be put.PutMappingRequest
indices(java.lang.String... indices)
Sets the indices this put mapping operation will execute on.IndicesOptions
indicesOptions()
Returns the indices options used to resolve indices.PutMappingRequest
indicesOptions(IndicesOptions indicesOptions)
java.lang.String
origin()
PutMappingRequest
origin(java.lang.String origin)
void
readFrom(StreamInput in)
Set this object's fields from a StreamInput.PutMappingRequest
setConcreteIndex(Index index)
Sets a concrete index for this put mapping request.java.lang.String
source()
The mapping source definition.PutMappingRequest
source(java.lang.Object... source)
A specialized simplified mapping source method, takes the form of simple properties definition: ("field1", "type=string,store=true").PutMappingRequest
source(java.lang.String mappingSource, XContentType xContentType)
The mapping source definition.PutMappingRequest
source(java.util.Map mappingSource)
The mapping source definition.PutMappingRequest
source(BytesReference mappingSource, XContentType xContentType)
The mapping source definition.PutMappingRequest
source(XContentBuilder mappingBuilder)
The mapping source definition.XContentBuilder
toXContent(XContentBuilder builder, ToXContent.Params params)
java.lang.String
type()
The mapping type.PutMappingRequest
type(java.lang.String type)
The type of the mappings.boolean
updateAllTypes()
True if all fields that span multiple types should be updated, false otherwisePutMappingRequest
updateAllTypes(boolean updateAllTypes)
Deprecated.useless with 6.x indices which may only have one typeActionRequestValidationException
validate()
void
writeTo(StreamOutput out)
Write this object's fields to a StreamOutput.-
Methods inherited from class org.elasticsearch.action.support.master.AcknowledgedRequest
ackTimeout, timeout, timeout, timeout
-
Methods inherited from class org.elasticsearch.action.support.master.MasterNodeRequest
masterNodeTimeout, masterNodeTimeout, masterNodeTimeout
-
Methods inherited from class org.elasticsearch.action.ActionRequest
getShouldStoreResult
-
Methods inherited from class org.elasticsearch.transport.TransportRequest
getParentTask, setParentTask
-
Methods inherited from class org.elasticsearch.transport.TransportMessage
remoteAddress, remoteAddress
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.elasticsearch.cluster.ack.AckedRequest
masterNodeTimeout
-
Methods inherited from interface org.elasticsearch.tasks.TaskAwareRequest
createTask, getDescription, setParentTask
-
Methods inherited from interface org.elasticsearch.common.xcontent.ToXContentObject
isFragment
-
-
-
-
Method Detail
-
validate
public ActionRequestValidationException validate()
- Specified by:
validate
in classActionRequest
-
indices
public PutMappingRequest indices(java.lang.String... indices)
Sets the indices this put mapping operation will execute on.- Specified by:
indices
in interfaceIndicesRequest.Replaceable
-
setConcreteIndex
public PutMappingRequest setConcreteIndex(Index index)
Sets a concrete index for this put mapping request.
-
getConcreteIndex
public Index getConcreteIndex()
Returns a concrete index for this mapping ornull
if no concrete index is defined
-
indices
public java.lang.String[] indices()
The indices the mappings will be put.- Specified by:
indices
in interfaceIndicesRequest
-
indicesOptions
public IndicesOptions indicesOptions()
Description copied from interface:IndicesRequest
Returns the indices options used to resolve indices. They tell for instance whether a single index is accepted, whether an empty array will be converted to _all, and how wildcards will be expanded if needed.- Specified by:
indicesOptions
in interfaceIndicesRequest
-
indicesOptions
public PutMappingRequest indicesOptions(IndicesOptions indicesOptions)
-
type
public java.lang.String type()
The mapping type.
-
type
public PutMappingRequest type(java.lang.String type)
The type of the mappings.
-
source
public java.lang.String source()
The mapping source definition.
-
source
public PutMappingRequest source(java.lang.Object... source)
A specialized simplified mapping source method, takes the form of simple properties definition: ("field1", "type=string,store=true"). Also supports metadata mapping fields such as `_all` and `_parent` as property definition, these metadata mapping fields will automatically be put on the top level mapping object.
-
origin
public java.lang.String origin()
-
origin
public PutMappingRequest origin(java.lang.String origin)
-
buildFromSimplifiedDef
public static XContentBuilder buildFromSimplifiedDef(java.lang.String type, java.lang.Object... source)
- Parameters:
type
- the mapping typesource
- consisting of field/properties pairs (e.g. "field1", "type=string,store=true")- Returns:
- the mappings definition
- Throws:
java.lang.IllegalArgumentException
- if the number of the source arguments is not divisible by two
-
source
public PutMappingRequest source(XContentBuilder mappingBuilder)
The mapping source definition.
-
source
public PutMappingRequest source(java.util.Map mappingSource)
The mapping source definition.
-
source
public PutMappingRequest source(java.lang.String mappingSource, XContentType xContentType)
The mapping source definition.
-
source
public PutMappingRequest source(BytesReference mappingSource, XContentType xContentType)
The mapping source definition.
-
updateAllTypes
public boolean updateAllTypes()
True if all fields that span multiple types should be updated, false otherwise
-
updateAllTypes
@Deprecated public PutMappingRequest updateAllTypes(boolean updateAllTypes)
Deprecated.useless with 6.x indices which may only have one typeTrue if all fields that span multiple types should be updated, false otherwise.
-
readFrom
public void readFrom(StreamInput in) throws java.io.IOException
Description copied from interface:Streamable
Set this object's fields from a StreamInput.- Specified by:
readFrom
in interfaceStreamable
- Overrides:
readFrom
in classAcknowledgedRequest<PutMappingRequest>
- Throws:
java.io.IOException
-
writeTo
public void writeTo(StreamOutput out) throws java.io.IOException
Description copied from interface:Streamable
Write this object's fields to a StreamOutput.- Specified by:
writeTo
in interfaceStreamable
- Specified by:
writeTo
in interfaceWriteable
- Overrides:
writeTo
in classAcknowledgedRequest<PutMappingRequest>
- Throws:
java.io.IOException
-
toXContent
public XContentBuilder toXContent(XContentBuilder builder, ToXContent.Params params) throws java.io.IOException
- Specified by:
toXContent
in interfaceToXContent
- Throws:
java.io.IOException
-
-