add-alias.asciidoc 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. [[indices-add-alias]]
  2. === Create or update alias API
  3. ++++
  4. <titleabbrev>Create or update alias</titleabbrev>
  5. ++++
  6. Adds a data stream or index to an <<aliases,alias>>.
  7. [source,console]
  8. ----
  9. PUT my-data-stream/_alias/my-alias
  10. ----
  11. // TEST[setup:my_data_stream]
  12. // TEST[teardown:data_stream_cleanup]
  13. [[add-alias-api-request]]
  14. ==== {api-request-title}
  15. `POST <target>/_alias/<alias>`
  16. `POST <target>/_aliases/<alias>`
  17. `PUT <target>/_alias/<alias>`
  18. `PUT <target>/_aliases/<alias>`
  19. [[add-alias-api-prereqs]]
  20. ==== {api-prereq-title}
  21. * If the {es} {security-features} are enabled, you must have the `manage`
  22. <<privileges-list-indices,index privilege>> for the alias and its data streams
  23. or indices.
  24. [[add-alias-api-path-params]]
  25. ==== {api-path-parms-title}
  26. `<alias>`::
  27. (Required, string) Alias to update. If the alias doesn't exist, the request
  28. creates it. Index alias names support <<date-math-index-names,date math>>.
  29. `<target>`::
  30. (Required, string) Comma-separated list of data streams or indices to add.
  31. Supports wildcards (`*`). Wildcard patterns that match both data streams and
  32. indices return an error.
  33. [[add-alias-api-query-params]]
  34. ==== {api-query-parms-title}
  35. include::{es-repo-dir}/rest-api/common-parms.asciidoc[tag=timeoutparms]
  36. [[add-alias-api-request-body]]
  37. ==== {api-request-body-title}
  38. include::aliases.asciidoc[tag=alias-options]