put-repo-api.asciidoc 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123
  1. [[put-snapshot-repo-api]]
  2. === Create or update snapshot repository API
  3. ++++
  4. <titleabbrev>Create or update snapshot repository</titleabbrev>
  5. ++++
  6. .New API reference
  7. [sidebar]
  8. --
  9. For the most up-to-date API details, refer to {api-es}/group/endpoint-snapshot[Snapshot and restore APIs].
  10. --
  11. Registers or updates a <<snapshots-register-repository,snapshot repository>>.
  12. [source,console]
  13. ----
  14. PUT /_snapshot/my_repository
  15. {
  16. "type": "fs",
  17. "settings": {
  18. "location": "my_backup_location"
  19. }
  20. }
  21. ----
  22. IMPORTANT: If you're migrating {ref}/searchable-snapshots.html[searchable snapshots], the repository's name must be identical in the source and destination clusters.
  23. [[put-snapshot-repo-api-request]]
  24. ==== {api-request-title}
  25. `PUT /_snapshot/<repository>`
  26. `POST /_snapshot/<repository>`
  27. [[put-snapshot-repo-api-prereqs]]
  28. ==== {api-prereq-title}
  29. * If the {es} {security-features} are enabled, you must have the `manage`
  30. <<privileges-list-cluster,cluster privilege>> to use this API.
  31. // tag::put-repo-api-prereqs[]
  32. * To register a snapshot repository, the cluster's global metadata must be
  33. writeable. Ensure there aren't any <<cluster-read-only,cluster blocks>> that
  34. prevent write access.
  35. // end::put-repo-api-prereqs[]
  36. [[put-snapshot-repo-api-path-params]]
  37. ==== {api-path-parms-title}
  38. `<repository>`::
  39. (Required, string)
  40. Name of the snapshot repository to register or update.
  41. [[put-snapshot-repo-api-query-params]]
  42. ==== {api-query-parms-title}
  43. IMPORTANT: Several options for this API can be specified using a query parameter
  44. or a request body parameter. If both parameters are specified, only the query
  45. parameter is used.
  46. include::{es-ref-dir}/rest-api/common-parms.asciidoc[tag=timeoutparms]
  47. `verify`::
  48. (Optional, Boolean)
  49. If `true`, the request verifies the repository is functional on all master and
  50. data nodes in the cluster. If `false`, this verification is skipped. Defaults to
  51. `true`.
  52. +
  53. You can manually perform this verification using the
  54. <<verify-snapshot-repo-api,verify snapshot repository API>>.
  55. [role="child_attributes"]
  56. [[put-snapshot-repo-api-request-body]]
  57. ==== {api-request-body-title}
  58. [[put-snapshot-repo-api-request-type]]
  59. `type`::
  60. (Required, string)
  61. Repository type.
  62. +
  63. .Valid values for `type`
  64. [%collapsible%open]
  65. ====
  66. `azure`:: <<repository-azure>>
  67. `gcs`:: <<repository-gcs>>
  68. `s3`:: <<repository-s3>>
  69. `fs`:: <<snapshots-filesystem-repository>>
  70. `source`:: <<snapshots-source-only-repository>>
  71. `url`:: <<snapshots-read-only-repository>>
  72. Other repository types are available through official plugins:
  73. `hdfs`:: {plugins}/repository-hdfs.html[Hadoop Distributed File System (HDFS) repository]
  74. ====
  75. [[put-snapshot-repo-api-settings-param]]
  76. `settings`::
  77. (Required, object)
  78. Settings for the repository. Supported settings vary based on the repository
  79. type:
  80. +
  81. --
  82. * <<repository-azure>>
  83. * <<repository-gcs>>
  84. * <<repository-s3>>
  85. * <<snapshots-filesystem-repository>>
  86. * <<snapshots-read-only-repository>>
  87. * <<snapshots-source-only-repository>>
  88. Other repository types are available through official plugins:
  89. * {plugins}/repository-hdfs.html[Hadoop Distributed File System (HDFS) repository]
  90. --
  91. `verify`::
  92. (Optional, Boolean)
  93. If `true`, the request verifies the repository is functional on all master and
  94. data nodes in the cluster. If `false`, this verification is skipped. Defaults to
  95. `true`.
  96. +
  97. You can manually perform this verification using the
  98. <<snapshots-repository-verification,verify snapshot repository API>>.