get-mapping.asciidoc 2.2 KB

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