OpenSearch/docs/java-rest/high-level/indices/get_field_mappings.asciidoc

60 lines
2.0 KiB
Plaintext
Raw Normal View History

--
:api: get-field-mappings
:request: GetFieldMappingsRequest
:response: GetFieldMappingsResponse
--
[id="{upid}-{api}"]
=== Get Field Mappings API
[id="{upid}-{api}-request"]
==== Get Field Mappings Request
A +{request}+ can have an optional list of indices, optional list of types and the list of fields:
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-request]
--------------------------------------------------
<1> An empty request
<2> Setting the indices to fetch mapping for
<3> The fields to be returned
==== Optional arguments
The following arguments can also optionally be provided:
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-request-indicesOptions]
--------------------------------------------------
<1> Setting `IndicesOptions` controls how unavailable indices are resolved and
how wildcard expressions are expanded
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-request-local]
--------------------------------------------------
<1> The `local` flag (defaults to `false`) controls whether the aliases need
to be looked up in the local cluster state or in the cluster state held by
the elected master node
include::../execution.asciidoc[]
[id="{upid}-{api}-response"]
==== Get Field Mappings 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> Returning all requested indices fields' mappings
<2> Retrieving the mappings for a particular index
<3> Getting the mappings metadata for the `message` field
<4> Getting the full name of the field
<5> Getting the mapping source of the field