123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778 |
- --
- :api: put-mapping
- :request: PutMappingRequest
- :response: PutMappingResponse
- --
- [id="{upid}-{api}"]
- === Update mapping API
- Adds new fields to an existing data stream or index. You can also use the API to
- change the search settings of existing fields.
- [id="{upid}-{api}-request"]
- ==== Request
- A +{request}+ requires an `index` argument:
- ["source","java",subs="attributes,callouts,macros"]
- --------------------------------------------------
- include-tagged::{doc-tests-file}[{api}-request]
- --------------------------------------------------
- <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"]
- --------------------------------------------------
- include-tagged::{doc-tests-file}[{api}-request-source]
- --------------------------------------------------
- <1> Mapping source provided as a `String`
- ==== 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"]
- --------------------------------------------------
- include-tagged::{doc-tests-file}[{api}-map]
- --------------------------------------------------
- <1> Mapping source provided as a `Map` which gets automatically converted
- to JSON format
- ["source","java",subs="attributes,callouts,macros"]
- --------------------------------------------------
- include-tagged::{doc-tests-file}[{api}-xcontent]
- --------------------------------------------------
- <1> Mapping source provided as an `XContentBuilder` object, the Elasticsearch
- built-in helpers to generate JSON content
- ==== Optional arguments
- The following arguments can optionally be provided:
- ["source","java",subs="attributes,callouts,macros"]
- --------------------------------------------------
- include-tagged::{doc-tests-file}[{api}-request-timeout]
- --------------------------------------------------
- <1> Timeout to wait for the all the nodes to acknowledge the index creation as a `TimeValue`
- ["source","java",subs="attributes,callouts,macros"]
- --------------------------------------------------
- include-tagged::{doc-tests-file}[{api}-request-masterTimeout]
- --------------------------------------------------
- <1> Timeout to connect to the master node as a `TimeValue`
- include::../execution.asciidoc[]
- [id="{upid}-{api}-response"]
- ==== Response
- The returned +{response}+ allows to retrieve information about the executed
- operation as follows:
- ["source","java",subs="attributes,callouts,macros"]
- --------------------------------------------------
- include-tagged::{doc-tests-file}[{api}-response]
- --------------------------------------------------
- <1> Indicates whether all of the nodes have acknowledged the request
|