2018-11-27 20:40:49 -05:00
|
|
|
--
|
|
|
|
:api: put-mapping
|
|
|
|
:request: PutMappingRequest
|
|
|
|
:response: PutMappingResponse
|
|
|
|
--
|
|
|
|
|
|
|
|
[id="{upid}-{api}"]
|
2018-01-23 05:03:32 -05:00
|
|
|
=== Put Mapping API
|
|
|
|
|
2018-11-27 20:40:49 -05:00
|
|
|
[id="{upid}-{api}-request"]
|
2018-01-23 05:03:32 -05:00
|
|
|
==== Put Mapping Request
|
|
|
|
|
2019-01-18 15:28:31 -05:00
|
|
|
A +{request}+ requires an `index` argument:
|
2018-01-23 05:03:32 -05:00
|
|
|
|
|
|
|
["source","java",subs="attributes,callouts,macros"]
|
|
|
|
--------------------------------------------------
|
2018-11-27 20:40:49 -05:00
|
|
|
include-tagged::{doc-tests-file}[{api}-request]
|
2018-01-23 05:03:32 -05:00
|
|
|
--------------------------------------------------
|
|
|
|
<1> The index to add the mapping to
|
|
|
|
|
|
|
|
==== Mapping source
|
|
|
|
A description of the fields to create on the mapping; if not defined, the mapping will default to empty.
|
|
|
|
|
|
|
|
["source","java",subs="attributes,callouts,macros"]
|
|
|
|
--------------------------------------------------
|
2018-11-27 20:40:49 -05:00
|
|
|
include-tagged::{doc-tests-file}[{api}-request-source]
|
2018-01-23 05:03:32 -05:00
|
|
|
--------------------------------------------------
|
2018-02-15 11:21:45 -05:00
|
|
|
<1> Mapping source provided as a `String`
|
2018-02-02 04:32:24 -05:00
|
|
|
|
|
|
|
==== Providing the mapping source
|
|
|
|
The mapping source can be provided in different ways in addition to
|
|
|
|
the `String` example shown above:
|
|
|
|
|
|
|
|
["source","java",subs="attributes,callouts,macros"]
|
|
|
|
--------------------------------------------------
|
2018-11-27 20:40:49 -05:00
|
|
|
include-tagged::{doc-tests-file}[{api}-map]
|
2018-02-02 04:32:24 -05:00
|
|
|
--------------------------------------------------
|
|
|
|
<1> Mapping source provided as a `Map` which gets automatically converted
|
|
|
|
to JSON format
|
|
|
|
|
|
|
|
["source","java",subs="attributes,callouts,macros"]
|
|
|
|
--------------------------------------------------
|
2018-11-27 20:40:49 -05:00
|
|
|
include-tagged::{doc-tests-file}[{api}-xcontent]
|
2018-02-02 04:32:24 -05:00
|
|
|
--------------------------------------------------
|
|
|
|
<1> Mapping source provided as an `XContentBuilder` object, the Elasticsearch
|
|
|
|
built-in helpers to generate JSON content
|
|
|
|
|
2018-01-23 05:03:32 -05:00
|
|
|
==== Optional arguments
|
|
|
|
The following arguments can optionally be provided:
|
|
|
|
|
|
|
|
["source","java",subs="attributes,callouts,macros"]
|
|
|
|
--------------------------------------------------
|
2018-11-27 20:40:49 -05:00
|
|
|
include-tagged::{doc-tests-file}[{api}-request-timeout]
|
2018-01-23 05:03:32 -05:00
|
|
|
--------------------------------------------------
|
|
|
|
<1> Timeout to wait for the all the nodes to acknowledge the index creation as a `TimeValue`
|
|
|
|
|
|
|
|
["source","java",subs="attributes,callouts,macros"]
|
|
|
|
--------------------------------------------------
|
2018-11-27 20:40:49 -05:00
|
|
|
include-tagged::{doc-tests-file}[{api}-request-masterTimeout]
|
2018-01-23 05:03:32 -05:00
|
|
|
--------------------------------------------------
|
|
|
|
<1> Timeout to connect to the master node as a `TimeValue`
|
|
|
|
|
2018-11-27 20:40:49 -05:00
|
|
|
include::../execution.asciidoc[]
|
2018-01-23 05:03:32 -05:00
|
|
|
|
2018-11-27 20:40:49 -05:00
|
|
|
[id="{upid}-{api}-response"]
|
2018-01-23 05:03:32 -05:00
|
|
|
==== Put Mapping Response
|
|
|
|
|
2018-11-27 20:40:49 -05:00
|
|
|
The returned +{response}+ allows to retrieve information about the executed
|
2018-01-23 05:03:32 -05:00
|
|
|
operation as follows:
|
|
|
|
|
|
|
|
["source","java",subs="attributes,callouts,macros"]
|
|
|
|
--------------------------------------------------
|
2018-11-27 20:40:49 -05:00
|
|
|
include-tagged::{doc-tests-file}[{api}-response]
|
2018-01-23 05:03:32 -05:00
|
|
|
--------------------------------------------------
|
|
|
|
<1> Indicates whether all of the nodes have acknowledged the request
|