Module org.elasticsearch.server
Class PutMappingRequest
java.lang.Object
org.elasticsearch.transport.TransportMessage
org.elasticsearch.transport.TransportRequest
org.elasticsearch.action.ActionRequest
org.elasticsearch.action.LegacyActionRequest
org.elasticsearch.action.support.master.MasterNodeRequest<PutMappingRequest>
org.elasticsearch.action.support.master.AcknowledgedRequest<PutMappingRequest>
org.elasticsearch.action.admin.indices.mapping.put.PutMappingRequest
- All Implemented Interfaces:
IndicesRequest,IndicesRequest.Replaceable,Writeable,RefCounted,TaskAwareRequest
public class PutMappingRequest
extends AcknowledgedRequest<PutMappingRequest>
implements IndicesRequest.Replaceable
Puts mapping definition into one or more indices.
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.
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class org.elasticsearch.action.support.master.AcknowledgedRequest
AcknowledgedRequest.PlainNested classes/interfaces inherited from interface org.elasticsearch.action.IndicesRequest
IndicesRequest.RemoteClusterShardRequest, IndicesRequest.Replaceable, IndicesRequest.SingleIndexNoWildcardsNested 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_TIMEOUTFields inherited from class org.elasticsearch.action.support.master.MasterNodeRequest
TRAPPY_IMPLICIT_DEFAULT_MASTER_NODE_TIMEOUTFields inherited from interface org.elasticsearch.core.RefCounted
ALWAYS_REFERENCED -
Constructor Summary
ConstructorsConstructorDescriptionPutMappingRequest(String... indices) Constructs a new put mapping request against one or more indices. -
Method Summary
Modifier and TypeMethodDescriptionReturns a concrete index for this mapping ornullif no concrete index is definedbooleanDetermines whether the request should be applied to data streams.String[]indices()The indices the mappings will be put.Sets the indices this put mapping operation will execute on.Returns the indices options used to resolve indices.indicesOptions(IndicesOptions indicesOptions) origin()setConcreteIndex(Index index) Sets a concrete index for this put mapping request.static XContentBuildersimpleMapping(String... source) source()The mapping source definition.A specialized simplified mapping source method, takes the form of simple properties definition: ("field1", "type=string,store=true").source(String mappingSource, XContentType xContentType) The mapping source definition.The mapping source definition.source(BytesReference mappingSource, XContentType xContentType) The mapping source definition.source(XContentBuilder mappingBuilder) The mapping source definition.validate()booleanwriteIndexOnly(boolean writeIndexOnly) voidwriteTo(StreamOutput out) Write this into the StreamOutput.Methods inherited from class org.elasticsearch.action.support.master.AcknowledgedRequest
ackTimeout, ackTimeoutMethods inherited from class org.elasticsearch.action.support.master.MasterNodeRequest
infiniteMasterNodeTimeout, masterNodeTimeout, masterNodeTimeout, masterTermMethods inherited from class org.elasticsearch.action.ActionRequest
getShouldStoreResultMethods inherited from class org.elasticsearch.transport.TransportRequest
getParentTask, getRequestId, setParentTask, setRequestId, toStringMethods inherited from class org.elasticsearch.transport.TransportMessage
decRef, hasReferences, incRef, remoteAddress, remoteAddress, tryIncRefMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface org.elasticsearch.action.IndicesRequest.Replaceable
allowsRemoteIndicesMethods inherited from interface org.elasticsearch.core.RefCounted
mustIncRefMethods inherited from interface org.elasticsearch.tasks.TaskAwareRequest
createTask, getDescription, setParentTask
-
Constructor Details
-
PutMappingRequest
- Throws:
IOException
-
PutMappingRequest
public PutMappingRequest() -
PutMappingRequest
Constructs a new put mapping request against one or more indices. If nothing is set then it will be executed against all indices.
-
-
Method Details
-
validate
- Overrides:
validatein classAcknowledgedRequest<PutMappingRequest>
-
indices
Sets the indices this put mapping operation will execute on.- Specified by:
indicesin interfaceIndicesRequest.Replaceable
-
setConcreteIndex
Sets a concrete index for this put mapping request. -
getConcreteIndex
Returns a concrete index for this mapping ornullif no concrete index is defined -
indices
The indices the mappings will be put.- Specified by:
indicesin interfaceIndicesRequest
-
indicesOptions
Description copied from interface:IndicesRequestReturns 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:
indicesOptionsin interfaceIndicesRequest
-
indicesOptions
-
includeDataStreams
public boolean includeDataStreams()Description copied from interface:IndicesRequestDetermines whether the request should be applied to data streams. Whenfalse, none of the names or wildcard expressions inIndicesRequest.indices()should be applied to or expanded to any data streams. All layers involved in the request's fulfillment including security, name resolution, etc., should respect this flag.- Specified by:
includeDataStreamsin interfaceIndicesRequest
-
source
The mapping source definition. -
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
-
origin
-
simpleMapping
- Parameters:
source- consisting of field/properties pairs (e.g. "field1", "type=string,store=true")- Returns:
- the mappings definition
- Throws:
IllegalArgumentException- if the number of the source arguments is not divisible by two
-
source
The mapping source definition. -
source
The mapping source definition. -
source
The mapping source definition. -
source
The mapping source definition. -
writeIndexOnly
-
writeIndexOnly
public boolean writeIndexOnly() -
writeTo
Description copied from interface:WriteableWrite this into the StreamOutput.- Specified by:
writeToin interfaceWriteable- Overrides:
writeToin classAcknowledgedRequest<PutMappingRequest>- Throws:
IOException
-