1
0

put-repo-api.asciidoc 3.6 KB

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