2018-11-20 15:03:24 +08:00
[role="xpack"]
[testenv="basic"]
[[freeze-index-api]]
2019-07-08 23:56:30 +08:00
=== Freeze index API
2018-11-20 15:03:24 +08:00
++++
2018-12-21 02:23:28 +08:00
<titleabbrev>Freeze index</titleabbrev>
2018-11-20 15:03:24 +08:00
++++
2021-05-13 00:54:20 +08:00
// tag::freeze-api-dep[]
2021-05-12 03:27:40 +08:00
deprecated::[7.14, Frozen indices are no longer useful due to https://www.elastic.co/blog/significantly-decrease-your-elasticsearch-heap-memory-usage[recent improvements in heap memory usage].]
2021-05-13 00:54:20 +08:00
// end::freeze-api-dep[]
2021-05-12 03:27:40 +08:00
2020-06-17 23:16:18 +08:00
Freezes an index.
2018-11-20 15:03:24 +08:00
2019-07-08 23:56:30 +08:00
[[freeze-index-api-request]]
==== {api-request-title}
2018-11-20 15:03:24 +08:00
`POST /<index>/_freeze`
2021-01-28 21:53:10 +08:00
[[freeze-index-api-prereqs]]
==== {api-prereq-title}
* If the {es} {security-features} are enabled, you must have the `manage`
<<privileges-list-indices,index privilege>> for the target index or index alias.
2019-07-08 23:56:30 +08:00
[[freeze-index-api-desc]]
==== {api-description-title}
2018-11-20 15:03:24 +08:00
2019-12-19 01:17:41 +08:00
A frozen index has almost no overhead on the cluster (except for maintaining its
metadata in memory) and is read-only. Read-only indices are blocked for write
operations, such as <<indexing,docs-index_>> or <<indices-forcemerge,force
2021-05-13 00:54:20 +08:00
merges>>. See <<unfreeze-index-api>>.
2018-11-20 15:03:24 +08:00
2020-06-17 23:16:18 +08:00
The current write index on a data stream cannot be frozen. In order to freeze
the current write index, the data stream must first be
2021-03-29 22:37:14 +08:00
<<data-streams-rollover,rolled over>> so that a new write index is created
2020-06-17 23:16:18 +08:00
and then the previous write index can be frozen.
2019-07-08 23:56:30 +08:00
IMPORTANT: Freezing an index will close the index and reopen it within the same
API call. This causes primaries to not be allocated for a short amount of time
and causes the cluster to go red until the primaries are allocated again. This
limitation might be removed in the future.
2018-11-20 15:03:24 +08:00
2019-07-08 23:56:30 +08:00
[[freeze-index-api-path-parms]]
==== {api-path-parms-title}
2018-11-20 15:03:24 +08:00
2019-07-12 23:26:31 +08:00
`<index>`::
(Required, string) Identifier for the index.
2018-11-20 15:03:24 +08:00
2019-07-08 23:56:30 +08:00
[[freeze-index-api-examples]]
==== {api-examples-title}
2018-11-20 15:03:24 +08:00
The following example freezes and unfreezes an index:
2019-09-06 22:55:16 +08:00
[source,console]
2018-11-20 15:03:24 +08:00
--------------------------------------------------
2020-07-28 02:46:39 +08:00
POST /my-index-000001/_freeze
POST /my-index-000001/_unfreeze
2018-11-20 15:03:24 +08:00
--------------------------------------------------
2021-05-28 04:14:50 +08:00
// TEST[skip:unable to ignore deprecation warning]
2020-07-28 02:46:39 +08:00
// TEST[s/^/PUT my-index-000001\n/]
2018-11-20 15:03:24 +08:00