get-mapping.asciidoc 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. [[indices-get-mapping]]
  2. === Get mapping API
  3. ++++
  4. <titleabbrev>Get mapping</titleabbrev>
  5. ++++
  6. Retrieves <<mapping,mapping definitions>> for indices in a cluster.
  7. [source,console]
  8. --------------------------------------------------
  9. GET /twitter/_mapping
  10. --------------------------------------------------
  11. // TEST[setup:twitter]
  12. NOTE: Before 7.0.0, the 'mappings' definition used to include a type name. Although mappings
  13. in responses no longer contain a type name by default, you can still request the old format
  14. through the parameter `include_type_name`. For more details, please see <<removal-of-types>>.
  15. [[get-mapping-api-request]]
  16. ==== {api-request-title}
  17. `GET /_mapping`
  18. `GET /<index>/_mapping`
  19. [[get-mapping-api-path-params]]
  20. ==== {api-path-parms-title}
  21. include::{docdir}/rest-api/common-parms.asciidoc[tag=index]
  22. [[get-mapping-api-query-params]]
  23. ==== {api-query-parms-title}
  24. include::{docdir}/rest-api/common-parms.asciidoc[tag=allow-no-indices]
  25. include::{docdir}/rest-api/common-parms.asciidoc[tag=expand-wildcards]
  26. +
  27. Defaults to `open`.
  28. include::{docdir}/rest-api/common-parms.asciidoc[tag=include-type-name]
  29. include::{docdir}/rest-api/common-parms.asciidoc[tag=index-ignore-unavailable]
  30. include::{docdir}/rest-api/common-parms.asciidoc[tag=local]
  31. include::{docdir}/rest-api/common-parms.asciidoc[tag=master-timeout]
  32. [[get-mapping-api-example]]
  33. ==== {api-examples-title}
  34. [[get-mapping-api-multi-ex]]
  35. ===== Multiple indices
  36. The get mapping API can be used to get more than one index with a
  37. single call. General usage of the API follows the following syntax:
  38. `host:port/{index}/_mapping` where `{index}` can accept a comma-separated
  39. list of names. To get mappings for all indices you can use `_all` for `{index}`.
  40. The following are some examples:
  41. [source,console]
  42. --------------------------------------------------
  43. GET /twitter,kimchy/_mapping
  44. --------------------------------------------------
  45. // TEST[setup:twitter]
  46. // TEST[s/^/PUT kimchy\nPUT book\n/]
  47. If you want to get mappings of all indices and types then the following
  48. two examples are equivalent:
  49. [source,console]
  50. --------------------------------------------------
  51. GET /_all/_mapping
  52. GET /_mapping
  53. --------------------------------------------------
  54. // TEST[setup:twitter]