Remove endpoint for freezing indices (#78918)
This commit is contained in:
parent
da25a35de4
commit
4a36d5cd79
|
@ -42,7 +42,6 @@ import org.elasticsearch.action.support.IndicesOptions;
|
|||
import org.elasticsearch.action.support.WriteRequest;
|
||||
import org.elasticsearch.action.support.broadcast.BroadcastResponse;
|
||||
import org.elasticsearch.action.support.master.AcknowledgedResponse;
|
||||
import org.elasticsearch.client.core.ShardsAcknowledgedResponse;
|
||||
import org.elasticsearch.client.indices.AnalyzeRequest;
|
||||
import org.elasticsearch.client.indices.AnalyzeResponse;
|
||||
import org.elasticsearch.client.indices.CloseIndexRequest;
|
||||
|
@ -58,7 +57,6 @@ import org.elasticsearch.client.indices.DataStreamsStatsResponse.DataStreamStats
|
|||
import org.elasticsearch.client.indices.DeleteAliasRequest;
|
||||
import org.elasticsearch.client.indices.DeleteComposableIndexTemplateRequest;
|
||||
import org.elasticsearch.client.indices.DeleteDataStreamRequest;
|
||||
import org.elasticsearch.client.indices.FreezeIndexRequest;
|
||||
import org.elasticsearch.client.indices.GetComposableIndexTemplateRequest;
|
||||
import org.elasticsearch.client.indices.GetComposableIndexTemplatesResponse;
|
||||
import org.elasticsearch.client.indices.GetDataStreamRequest;
|
||||
|
@ -80,7 +78,6 @@ import org.elasticsearch.client.indices.ReloadAnalyzersRequest;
|
|||
import org.elasticsearch.client.indices.ReloadAnalyzersResponse;
|
||||
import org.elasticsearch.client.indices.SimulateIndexTemplateRequest;
|
||||
import org.elasticsearch.client.indices.SimulateIndexTemplateResponse;
|
||||
import org.elasticsearch.client.indices.UnfreezeIndexRequest;
|
||||
import org.elasticsearch.client.indices.rollover.RolloverRequest;
|
||||
import org.elasticsearch.client.indices.rollover.RolloverResponse;
|
||||
import org.elasticsearch.cluster.metadata.AliasMetadata;
|
||||
|
@ -95,16 +92,16 @@ import org.elasticsearch.common.settings.Setting;
|
|||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.common.unit.ByteSizeUnit;
|
||||
import org.elasticsearch.common.unit.ByteSizeValue;
|
||||
import org.elasticsearch.core.TimeValue;
|
||||
import org.elasticsearch.xcontent.XContentBuilder;
|
||||
import org.elasticsearch.xcontent.XContentType;
|
||||
import org.elasticsearch.xcontent.json.JsonXContent;
|
||||
import org.elasticsearch.common.xcontent.support.XContentMapValues;
|
||||
import org.elasticsearch.core.TimeValue;
|
||||
import org.elasticsearch.index.IndexSettings;
|
||||
import org.elasticsearch.index.query.QueryBuilder;
|
||||
import org.elasticsearch.index.query.QueryBuilders;
|
||||
import org.elasticsearch.rest.RestStatus;
|
||||
import org.elasticsearch.rest.action.admin.indices.RestPutIndexTemplateAction;
|
||||
import org.elasticsearch.xcontent.XContentBuilder;
|
||||
import org.elasticsearch.xcontent.XContentType;
|
||||
import org.elasticsearch.xcontent.json.JsonXContent;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Arrays;
|
||||
|
@ -1535,24 +1532,6 @@ public class IndicesClientIT extends ESRestHighLevelClientTestCase {
|
|||
assertNotNull(detailsResponse.detail());
|
||||
}
|
||||
|
||||
public void testFreezeAndUnfreeze() throws IOException {
|
||||
createIndex("test", Settings.EMPTY);
|
||||
RestHighLevelClient client = highLevelClient();
|
||||
|
||||
final RequestOptions freezeIndexOptions = RequestOptions.DEFAULT.toBuilder()
|
||||
.setWarningsHandler(warnings -> List.of(FROZEN_INDICES_DEPRECATION_WARNING).equals(warnings) == false).build();
|
||||
|
||||
ShardsAcknowledgedResponse freeze = execute(new FreezeIndexRequest("test"), client.indices()::freeze,
|
||||
client.indices()::freezeAsync, freezeIndexOptions);
|
||||
assertTrue(freeze.isShardsAcknowledged());
|
||||
assertTrue(freeze.isAcknowledged());
|
||||
|
||||
ShardsAcknowledgedResponse unfreeze = execute(new UnfreezeIndexRequest("test"), client.indices()::unfreeze,
|
||||
client.indices()::unfreezeAsync, freezeIndexOptions);
|
||||
assertTrue(unfreeze.isShardsAcknowledged());
|
||||
assertTrue(unfreeze.isAcknowledged());
|
||||
}
|
||||
|
||||
public void testReloadAnalyzer() throws IOException {
|
||||
createIndex("test", Settings.EMPTY);
|
||||
RestHighLevelClient client = highLevelClient();
|
||||
|
|
|
@ -55,22 +55,21 @@ import org.elasticsearch.client.indices.CreateIndexResponse;
|
|||
import org.elasticsearch.client.indices.DeleteAliasRequest;
|
||||
import org.elasticsearch.client.indices.DeleteComposableIndexTemplateRequest;
|
||||
import org.elasticsearch.client.indices.DetailAnalyzeResponse;
|
||||
import org.elasticsearch.client.indices.FreezeIndexRequest;
|
||||
import org.elasticsearch.client.indices.GetComposableIndexTemplateRequest;
|
||||
import org.elasticsearch.client.indices.GetComposableIndexTemplatesResponse;
|
||||
import org.elasticsearch.client.indices.GetFieldMappingsRequest;
|
||||
import org.elasticsearch.client.indices.GetFieldMappingsResponse;
|
||||
import org.elasticsearch.client.indices.GetIndexRequest;
|
||||
import org.elasticsearch.client.indices.GetIndexResponse;
|
||||
import org.elasticsearch.client.indices.GetComposableIndexTemplateRequest;
|
||||
import org.elasticsearch.client.indices.GetIndexTemplatesRequest;
|
||||
import org.elasticsearch.client.indices.GetIndexTemplatesResponse;
|
||||
import org.elasticsearch.client.indices.GetComposableIndexTemplatesResponse;
|
||||
import org.elasticsearch.client.indices.GetMappingsRequest;
|
||||
import org.elasticsearch.client.indices.GetMappingsResponse;
|
||||
import org.elasticsearch.client.indices.IndexTemplateMetadata;
|
||||
import org.elasticsearch.client.indices.IndexTemplatesExistRequest;
|
||||
import org.elasticsearch.client.indices.PutComponentTemplateRequest;
|
||||
import org.elasticsearch.client.indices.PutIndexTemplateRequest;
|
||||
import org.elasticsearch.client.indices.PutComposableIndexTemplateRequest;
|
||||
import org.elasticsearch.client.indices.PutIndexTemplateRequest;
|
||||
import org.elasticsearch.client.indices.PutMappingRequest;
|
||||
import org.elasticsearch.client.indices.ReloadAnalyzersRequest;
|
||||
import org.elasticsearch.client.indices.ReloadAnalyzersResponse;
|
||||
|
@ -90,13 +89,13 @@ import org.elasticsearch.common.settings.Settings;
|
|||
import org.elasticsearch.common.unit.ByteSizeUnit;
|
||||
import org.elasticsearch.common.unit.ByteSizeValue;
|
||||
import org.elasticsearch.core.TimeValue;
|
||||
import org.elasticsearch.xcontent.XContentBuilder;
|
||||
import org.elasticsearch.xcontent.XContentFactory;
|
||||
import org.elasticsearch.xcontent.XContentType;
|
||||
import org.elasticsearch.index.IndexSettings;
|
||||
import org.elasticsearch.index.query.QueryBuilder;
|
||||
import org.elasticsearch.index.query.QueryBuilders;
|
||||
import org.elasticsearch.rest.RestStatus;
|
||||
import org.elasticsearch.xcontent.XContentBuilder;
|
||||
import org.elasticsearch.xcontent.XContentFactory;
|
||||
import org.elasticsearch.xcontent.XContentType;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Collections;
|
||||
|
@ -108,7 +107,6 @@ import java.util.concurrent.CountDownLatch;
|
|||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import static org.elasticsearch.client.IndicesClientIT.FROZEN_INDICES_DEPRECATION_WARNING;
|
||||
import static org.elasticsearch.client.IndicesClientIT.IGNORE_THROTTLED_DEPRECATION_WARNING;
|
||||
import static org.elasticsearch.client.IndicesClientIT.LEGACY_TEMPLATE_OPTIONS;
|
||||
import static org.hamcrest.Matchers.containsInAnyOrder;
|
||||
import static org.hamcrest.Matchers.equalTo;
|
||||
|
@ -2874,89 +2872,6 @@ public class IndicesClientDocumentationIT extends ESRestHighLevelClientTestCase
|
|||
|
||||
}
|
||||
|
||||
public void testFreezeIndex() throws Exception {
|
||||
RestHighLevelClient client = highLevelClient();
|
||||
|
||||
{
|
||||
CreateIndexResponse createIndexResponse = client.indices().create(new CreateIndexRequest("index"), RequestOptions.DEFAULT);
|
||||
assertTrue(createIndexResponse.isAcknowledged());
|
||||
}
|
||||
|
||||
{
|
||||
// tag::freeze-index-request
|
||||
FreezeIndexRequest request = new FreezeIndexRequest("index"); // <1>
|
||||
// end::freeze-index-request
|
||||
|
||||
// tag::freeze-index-request-timeout
|
||||
request.setTimeout(TimeValue.timeValueMinutes(2)); // <1>
|
||||
// end::freeze-index-request-timeout
|
||||
// tag::freeze-index-request-masterTimeout
|
||||
request.setMasterTimeout(TimeValue.timeValueMinutes(1)); // <1>
|
||||
// end::freeze-index-request-masterTimeout
|
||||
// tag::freeze-index-request-waitForActiveShards
|
||||
request.setWaitForActiveShards(ActiveShardCount.DEFAULT); // <1>
|
||||
// end::freeze-index-request-waitForActiveShards
|
||||
|
||||
// tag::freeze-index-request-indicesOptions
|
||||
request.setIndicesOptions(IndicesOptions.strictExpandOpen()); // <1>
|
||||
// end::freeze-index-request-indicesOptions
|
||||
|
||||
final RequestOptions freezeIndexOptions = RequestOptions.DEFAULT.toBuilder()
|
||||
.setWarningsHandler(
|
||||
warnings -> List.of(FROZEN_INDICES_DEPRECATION_WARNING, IGNORE_THROTTLED_DEPRECATION_WARNING).equals(warnings) == false
|
||||
).build();
|
||||
|
||||
// tag::freeze-index-execute
|
||||
ShardsAcknowledgedResponse openIndexResponse = client.indices().freeze(request, freezeIndexOptions);
|
||||
// end::freeze-index-execute
|
||||
|
||||
// tag::freeze-index-response
|
||||
boolean acknowledged = openIndexResponse.isAcknowledged(); // <1>
|
||||
boolean shardsAcked = openIndexResponse.isShardsAcknowledged(); // <2>
|
||||
// end::freeze-index-response
|
||||
assertTrue(acknowledged);
|
||||
assertTrue(shardsAcked);
|
||||
|
||||
// tag::freeze-index-execute-listener
|
||||
ActionListener<ShardsAcknowledgedResponse> listener =
|
||||
new ActionListener<ShardsAcknowledgedResponse>() {
|
||||
@Override
|
||||
public void onResponse(ShardsAcknowledgedResponse freezeIndexResponse) {
|
||||
// <1>
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(Exception e) {
|
||||
// <2>
|
||||
}
|
||||
};
|
||||
// end::freeze-index-execute-listener
|
||||
|
||||
// Replace the empty listener by a blocking listener in test
|
||||
final CountDownLatch latch = new CountDownLatch(1);
|
||||
listener = new LatchedActionListener<>(listener, latch);
|
||||
|
||||
// tag::freeze-index-execute-async
|
||||
client.indices().freezeAsync(request, RequestOptions.DEFAULT, listener); // <1>
|
||||
// end::freeze-index-execute-async
|
||||
|
||||
assertTrue(latch.await(30L, TimeUnit.SECONDS));
|
||||
}
|
||||
|
||||
{
|
||||
// tag::freeze-index-notfound
|
||||
try {
|
||||
FreezeIndexRequest request = new FreezeIndexRequest("does_not_exist");
|
||||
client.indices().freeze(request, RequestOptions.DEFAULT);
|
||||
} catch (ElasticsearchException exception) {
|
||||
if (exception.status() == RestStatus.BAD_REQUEST) {
|
||||
// <1>
|
||||
}
|
||||
}
|
||||
// end::freeze-index-notfound
|
||||
}
|
||||
}
|
||||
|
||||
public void testUnfreezeIndex() throws Exception {
|
||||
RestHighLevelClient client = highLevelClient();
|
||||
|
||||
|
|
|
@ -47,3 +47,11 @@ See <<java-rest-high-start-transform>>.
|
|||
=== Stop {transform} API
|
||||
|
||||
See <<java-rest-high-stop-transform>>.
|
||||
|
||||
[role="exclude",id="java-rest-high-freeze-index"]
|
||||
=== Freeze index API
|
||||
|
||||
The freeze index API was removed in 8.0. 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].
|
||||
|
|
|
@ -67,7 +67,6 @@ such as:
|
|||
|
||||
* <<indices-clone-index,Clone>>
|
||||
* <<indices-delete-index,Delete>>
|
||||
* <<freeze-index-api,Freeze>>
|
||||
* <<indices-shrink-index,Shrink>>
|
||||
* <<indices-split-index,Split>>
|
||||
|
||||
|
|
|
@ -1,34 +0,0 @@
|
|||
[role="xpack"]
|
||||
[[ilm-freeze]]
|
||||
=== Freeze
|
||||
|
||||
Phases allowed: cold.
|
||||
|
||||
<<freeze-index-api, Freezes>> an index.
|
||||
|
||||
deprecated[7.x,"The ILM Freeze action was deprecated in 7.x and will be treated as a no-op in 8.0+."]
|
||||
|
||||
[[ilm-freeze-options]]
|
||||
==== Options
|
||||
|
||||
None.
|
||||
|
||||
[[ilm-freeze-ex]]
|
||||
==== Example
|
||||
|
||||
[source,console]
|
||||
--------------------------------------------------
|
||||
PUT _ilm/policy/my_policy
|
||||
{
|
||||
"policy": {
|
||||
"phases": {
|
||||
"cold": {
|
||||
"actions": {
|
||||
"freeze" : { }
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
--------------------------------------------------
|
||||
|
|
@ -18,7 +18,7 @@ index>> to the frozen tier. In other phases, the action mounts a
|
|||
<<fully-mounted,fully mounted index>> to the corresponding data tier.
|
||||
|
||||
If the `searchable_snapshot` action is used in the hot phase the subsequent
|
||||
phases cannot include the `shrink`, `forcemerge`, or `freeze` actions.
|
||||
phases cannot include the `shrink` or `forcemerge` actions.
|
||||
|
||||
This action cannot be performed on a data stream's write index. Attempts to do
|
||||
so will fail. To convert the index to a searchable snapshot, first
|
||||
|
|
|
@ -14,9 +14,6 @@ Permanently remove the index.
|
|||
Reduce the number of index segments and purge deleted documents.
|
||||
Makes the index read-only.
|
||||
|
||||
<<ilm-freeze,Freeze>>::
|
||||
Freeze the index to minimize its memory footprint.
|
||||
|
||||
<<ilm-migrate,Migrate>>::
|
||||
Move the index shards to the <<data-tiers, data tier>> that corresponds
|
||||
to the current {ilm-init} phase.
|
||||
|
@ -49,7 +46,6 @@ Ensure that a snapshot exists before deleting the index.
|
|||
include::actions/ilm-allocate.asciidoc[]
|
||||
include::actions/ilm-delete.asciidoc[]
|
||||
include::actions/ilm-forcemerge.asciidoc[]
|
||||
include::actions/ilm-freeze.asciidoc[]
|
||||
include::actions/ilm-migrate.asciidoc[]
|
||||
include::actions/ilm-readonly.asciidoc[]
|
||||
include::actions/ilm-rollover.asciidoc[]
|
||||
|
|
|
@ -106,7 +106,6 @@ actions in the order listed.
|
|||
- <<ilm-searchable-snapshot, Searchable Snapshot>>
|
||||
- <<ilm-allocate,Allocate>>
|
||||
- <<ilm-migrate,Migrate>>
|
||||
- <<ilm-freeze,Freeze>>
|
||||
* Frozen
|
||||
- <<ilm-searchable-snapshot, Searchable Snapshot>>
|
||||
* Delete
|
||||
|
|
|
@ -7,8 +7,8 @@
|
|||
<titleabbrev>Overview</titleabbrev>
|
||||
++++
|
||||
|
||||
You can create and apply {ilm-cap} ({ilm-init}) policies to automatically manage your indices
|
||||
according to your performance, resiliency, and retention requirements.
|
||||
You can create and apply {ilm-cap} ({ilm-init}) policies to automatically manage your indices
|
||||
according to your performance, resiliency, and retention requirements.
|
||||
|
||||
Index lifecycle policies can trigger actions such as:
|
||||
|
||||
|
@ -17,7 +17,6 @@ size, number of docs, or age.
|
|||
* **Shrink**: Reduces the number of primary shards in an index.
|
||||
* **Force merge**: Triggers a <<indices-forcemerge,force merge>> to reduce the
|
||||
number of segments in an index's shards.
|
||||
* **Freeze**: <<freeze-index-api, Freezes>> an index and makes it read-only.
|
||||
* **Delete**: Permanently remove an index, including all of its data and
|
||||
metadata.
|
||||
|
||||
|
@ -48,9 +47,9 @@ hardware.
|
|||
|
||||
[IMPORTANT]
|
||||
===========================
|
||||
To use {ilm-init}, all nodes in a cluster must run the same version.
|
||||
Although it might be possible to create and apply policies in a mixed-version cluster,
|
||||
To use {ilm-init}, all nodes in a cluster must run the same version.
|
||||
Although it might be possible to create and apply policies in a mixed-version cluster,
|
||||
there is no guarantee they will work as intended.
|
||||
Attempting to use a policy that contains actions that aren't
|
||||
supported on all nodes in a cluster will cause errors.
|
||||
supported on all nodes in a cluster will cause errors.
|
||||
===========================
|
||||
|
|
|
@ -18,7 +18,6 @@ index settings, aliases, mappings, and index templates.
|
|||
* <<indices-split-index>>
|
||||
* <<indices-clone-index>>
|
||||
* <<indices-rollover-index>>
|
||||
* <<freeze-index-api>>
|
||||
* <<unfreeze-index-api>>
|
||||
* <<indices-resolve-index-api>>
|
||||
|
||||
|
@ -53,9 +52,9 @@ index settings, aliases, mappings, and index templates.
|
|||
=== Index templates:
|
||||
|
||||
Index templates automatically apply settings, mappings, and aliases to new indices.
|
||||
They are most often used to configure rolling indices for time series data to
|
||||
ensure that each new index has the same configuration as the previous one.
|
||||
The index template associated with a data stream configures its backing indices.
|
||||
They are most often used to configure rolling indices for time series data to
|
||||
ensure that each new index has the same configuration as the previous one.
|
||||
The index template associated with a data stream configures its backing indices.
|
||||
For more information, see <<index-templates, Index Templates>>.
|
||||
|
||||
* <<indices-put-template>>
|
||||
|
@ -113,7 +112,6 @@ include::indices/indices-exists.asciidoc[]
|
|||
include::indices/field-usage-stats.asciidoc[]
|
||||
include::indices/flush.asciidoc[]
|
||||
include::indices/forcemerge.asciidoc[]
|
||||
include::indices/apis/freeze.asciidoc[]
|
||||
include::indices/get-alias.asciidoc[]
|
||||
include::indices/get-component-template.asciidoc[]
|
||||
include::indices/get-field-mapping.asciidoc[]
|
||||
|
|
|
@ -1,62 +0,0 @@
|
|||
[role="xpack"]
|
||||
[testenv="basic"]
|
||||
[[freeze-index-api]]
|
||||
=== Freeze index API
|
||||
++++
|
||||
<titleabbrev>Freeze index</titleabbrev>
|
||||
++++
|
||||
|
||||
// tag::freeze-api-dep[]
|
||||
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].]
|
||||
// end::freeze-api-dep[]
|
||||
|
||||
Freezes an index.
|
||||
|
||||
[[freeze-index-api-request]]
|
||||
==== {api-request-title}
|
||||
|
||||
`POST /<index>/_freeze`
|
||||
|
||||
[[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.
|
||||
|
||||
[[freeze-index-api-desc]]
|
||||
==== {api-description-title}
|
||||
|
||||
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
|
||||
merges>>. See <<unfreeze-index-api>>.
|
||||
|
||||
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
|
||||
<<data-streams-rollover,rolled over>> so that a new write index is created
|
||||
and then the previous write index can be frozen.
|
||||
|
||||
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.
|
||||
|
||||
[[freeze-index-api-path-parms]]
|
||||
==== {api-path-parms-title}
|
||||
|
||||
`<index>`::
|
||||
(Required, string) Identifier for the index.
|
||||
|
||||
[[freeze-index-api-examples]]
|
||||
==== {api-examples-title}
|
||||
|
||||
The following example freezes and unfreezes an index:
|
||||
|
||||
[source,console]
|
||||
--------------------------------------------------
|
||||
POST /my-index-000001/_freeze
|
||||
POST /my-index-000001/_unfreeze
|
||||
--------------------------------------------------
|
||||
// TEST[skip:unable to ignore deprecation warning]
|
||||
// TEST[s/^/PUT my-index-000001\n/]
|
||||
|
|
@ -6,7 +6,17 @@
|
|||
<titleabbrev>Unfreeze index</titleabbrev>
|
||||
++++
|
||||
|
||||
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].]
|
||||
[WARNING]
|
||||
.Deprecated in 7.14
|
||||
====
|
||||
In 8.0, we removed the ability to freeze an index. In previous versions,
|
||||
freezing an index reduced its memory overhead. However, 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].
|
||||
You can use this API to unfreeze indices that were frozen in 7.x. Frozen indices
|
||||
are not related to the frozen data tier.
|
||||
====
|
||||
|
||||
Unfreezes an index.
|
||||
|
||||
|
@ -25,12 +35,7 @@ Unfreezes an index.
|
|||
==== {api-description-title}
|
||||
|
||||
When a frozen index is unfrozen, the index goes through the normal recovery
|
||||
process and becomes writeable again. See <<freeze-index-api>>.
|
||||
|
||||
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.
|
||||
process and becomes writeable again.
|
||||
|
||||
[[unfreeze-index-api-path-parms]]
|
||||
==== {api-path-parms-title}
|
||||
|
@ -41,11 +46,10 @@ limitation might be removed in the future.
|
|||
[[unfreeze-index-api-examples]]
|
||||
==== {api-examples-title}
|
||||
|
||||
The following example freezes and unfreezes an index:
|
||||
The following example unfreezes an index:
|
||||
|
||||
[source,console]
|
||||
--------------------------------------------------
|
||||
POST /my-index-000001/_freeze
|
||||
POST /my-index-000001/_unfreeze
|
||||
--------------------------------------------------
|
||||
// TEST[s/^/PUT my-index-000001\n/]
|
||||
|
|
|
@ -15,7 +15,7 @@ You'll learn how to:
|
|||
|
||||
* View and edit index settings.
|
||||
* View mappings and statistics for an index.
|
||||
* Perform index-level operations, such as refreshes and freezes.
|
||||
* Perform index-level operations, such as refreshes.
|
||||
* View and manage data streams.
|
||||
* Create index templates to automatically configure new data streams and indices.
|
||||
|
||||
|
@ -43,9 +43,8 @@ Open {kib}'s main menu and click *Stack Management > Index Management*.
|
|||
image::images/index-mgmt/management_index_labels.png[Index Management UI]
|
||||
|
||||
The *Index Management* page contains an overview of your indices.
|
||||
Badges indicate if an index is <<freeze-index-api,frozen>>, a
|
||||
<<ccr-put-follow,follower index>>, or a
|
||||
<<rollup-get-rollup-index-caps,rollup index>>.
|
||||
Badges indicate if an index is a <<ccr-put-follow,follower index>>, a
|
||||
<<rollup-get-rollup-index-caps,rollup index>>, or <<unfreeze-index-api,frozen>>.
|
||||
|
||||
Clicking a badge narrows the list to only indices of that type.
|
||||
You can also filter indices using the search bar.
|
||||
|
@ -68,7 +67,6 @@ indices on the overview page. The menu includes the following actions:
|
|||
* <<indices-forcemerge,*Force merge index*>>
|
||||
* <<indices-refresh,*Refresh index*>>
|
||||
* <<indices-flush,*Flush index*>>
|
||||
* <<freeze-index-api,*Freeze index*>>
|
||||
* <<indices-delete-index,*Delete index*>>
|
||||
* *Add* <<set-up-lifecycle-policy,*lifecycle policy*>>
|
||||
|
||||
|
|
|
@ -18,8 +18,6 @@ PUT /remotecluster-bar-01
|
|||
|
||||
PUT /freeze-index
|
||||
|
||||
POST /freeze-index/_freeze
|
||||
|
||||
PUT /my-index-000001
|
||||
|
||||
PUT /freeze-index/_alias/f-alias
|
||||
|
@ -110,7 +108,6 @@ The API returns the following response:
|
|||
"f-alias"
|
||||
],
|
||||
"attributes": [
|
||||
"frozen",
|
||||
"open"
|
||||
]
|
||||
},
|
||||
|
|
|
@ -85,13 +85,6 @@ PUT my-index-000001/_mapping
|
|||
------------
|
||||
// TEST[continued]
|
||||
|
||||
IMPORTANT: On a <<freeze-index-api,frozen index>>, global ordinals are discarded
|
||||
after each search and rebuilt again when they're requested. This means that
|
||||
`eager_global_ordinals` should not be used on frozen indices: it would
|
||||
cause global ordinals to be reloaded on every search. Instead, the index should
|
||||
be force-merged to a single segment before being frozen. This avoids building
|
||||
global ordinals altogether (more details can be found in the next section).
|
||||
|
||||
==== Avoiding global ordinal loading
|
||||
|
||||
Usually, global ordinals do not present a large overhead in terms of their
|
||||
|
|
|
@ -52,6 +52,28 @@ Refer to <<remote-clusters-settings,Remote clusters settings>>.
|
|||
|
||||
See <<restore-entire-cluster>>.
|
||||
|
||||
[role="exclude",id="freeze-index-api"]
|
||||
=== Freeze index API
|
||||
|
||||
The freeze index API was removed in 8.0.
|
||||
// tag::frozen-removal-explanation[]
|
||||
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].
|
||||
// end::frozen-removal-explanation[]
|
||||
|
||||
[role="exclude",id="ilm-freeze"]
|
||||
=== Freeze {ilm-init} action
|
||||
|
||||
The freeze {ilm-init} action was removed in 8.0.
|
||||
include::redirects.asciidoc[tag=frozen-removal-explanation]
|
||||
|
||||
[role="exclude",id="ilm-freeze-action"]
|
||||
=== Freeze {ilm-init} action
|
||||
|
||||
The freeze {ilm-init} action was removed in 8.0.
|
||||
include::redirects.asciidoc[tag=frozen-removal-explanation]
|
||||
|
||||
[role="exclude",id="alias"]
|
||||
=== Aliases
|
||||
|
||||
|
@ -1039,11 +1061,6 @@ See <<ilm-delete>>.
|
|||
|
||||
See <<ilm-forcemerge>>.
|
||||
|
||||
[role="exclude",id="ilm-freeze-action"]
|
||||
==== Freeze action
|
||||
|
||||
See <<ilm-freeze>>.
|
||||
|
||||
[role="exclude",id="ilm-migrate-action"]
|
||||
==== Migrate action
|
||||
|
||||
|
@ -1636,9 +1653,8 @@ See <<search-terms-enum>>.
|
|||
=== Frozen indices
|
||||
|
||||
// tag::frozen-index-redirect[]
|
||||
include::{es-repo-dir}/indices/apis/freeze.asciidoc[tag=freeze-api-dep]
|
||||
|
||||
For API documentation, see <<freeze-index-api>> and <<unfreeze-index-api>>.
|
||||
For API documentation, see <<unfreeze-index-api>>.
|
||||
// end::frozen-index-redirect[]
|
||||
|
||||
[role="exclude",id="best_practices"]
|
||||
|
@ -1663,16 +1679,16 @@ See the {glossary}/terms.html[Elastic glossary].
|
|||
[role="exclude",id="multi-index"]
|
||||
=== Multi-target syntax
|
||||
|
||||
See <<api-multi-index>>.
|
||||
See <<api-multi-index>>.
|
||||
|
||||
[float]
|
||||
[[hidden]]
|
||||
==== Hidden data streams and indices
|
||||
|
||||
See <<multi-hidden>>.
|
||||
See <<multi-hidden>>.
|
||||
|
||||
[role="exclude",id="date-math-index-names"]
|
||||
=== Date math support in system and index alias names
|
||||
=== Date math support in system and index alias names
|
||||
|
||||
See <<api-date-math-index-names>>.
|
||||
|
||||
|
|
|
@ -5,8 +5,7 @@
|
|||
|
||||
{es} generally allows you to quickly search across big amounts of data. There are
|
||||
situations where a search executes on many shards, possibly against
|
||||
<<freeze-index-api,frozen indices>> and spanning multiple
|
||||
<<remote-clusters,remote clusters>>, for which
|
||||
large data sets or multiple <<remote-clusters,remote clusters>>, for which
|
||||
results are not expected to be returned in milliseconds. When you need to
|
||||
execute long-running searches, synchronously
|
||||
waiting for its results to be returned is not ideal. Instead, Async search lets
|
||||
|
|
|
@ -220,8 +220,7 @@ _synchronous_ by default. The search request waits for complete results before
|
|||
returning a response.
|
||||
|
||||
However, complete results can take longer for searches across
|
||||
<<freeze-index-api,frozen indices>> or <<modules-cross-cluster-search,multiple
|
||||
clusters>>.
|
||||
large data sets or <<modules-cross-cluster-search,multiple clusters>>.
|
||||
|
||||
To avoid long waits, you can run an _asynchronous_, or _async_, search
|
||||
instead. An <<async-search-intro,async search>> lets you retrieve partial
|
||||
|
|
|
@ -145,7 +145,7 @@ will be - typically the first in natural ascending order) for fields with multip
|
|||
|
||||
[discrete]
|
||||
==== Index
|
||||
`index.include.frozen` (default `false`):: Whether to include <<freeze-index-api, frozen-indices>> in the query execution or not (default).
|
||||
`index.include.frozen` (default `false`):: Whether to include frozen indices in the query execution or not (default).
|
||||
|
||||
[discrete]
|
||||
==== Additional
|
||||
|
|
|
@ -49,7 +49,7 @@ Using `SHOW TABLES` command again:
|
|||
include-tagged::{sql-specs}/docs/docs.csv-spec[showTablesLikeWildcard]
|
||||
----
|
||||
|
||||
The pattern matches all tables that start with `emp`.
|
||||
The pattern matches all tables that start with `emp`.
|
||||
|
||||
This command supports _escaping_ as well, for example:
|
||||
|
||||
|
@ -88,7 +88,7 @@ requires the keyword `LIKE` for SQL `LIKE` pattern.
|
|||
[[sql-index-frozen]]
|
||||
=== Frozen Indices
|
||||
|
||||
By default, {es-sql} doesn't search <<freeze-index-api,frozen indices>>. To
|
||||
By default, {es-sql} doesn't search <<unfreeze-index-api,frozen indices>>. To
|
||||
search frozen indices, use one of the following features:
|
||||
|
||||
dedicated configuration parameter::
|
||||
|
@ -108,4 +108,4 @@ include-tagged::{sql-specs}/docs/docs.csv-spec[showTablesIncludeFrozen]
|
|||
include-tagged::{sql-specs}/docs/docs.csv-spec[fromTableIncludeFrozen]
|
||||
----
|
||||
|
||||
Unless enabled, frozen indices are completely ignored; it is as if they do not exist and as such, queries ran against them are likely to fail.
|
||||
Unless enabled, frozen indices are completely ignored; it is as if they do not exist and as such, queries ran against them are likely to fail.
|
||||
|
|
|
@ -1,67 +0,0 @@
|
|||
{
|
||||
"indices.freeze":{
|
||||
"documentation":{
|
||||
"url":"https://www.elastic.co/guide/en/elasticsearch/reference/current/freeze-index-api.html",
|
||||
"description":"Freezes an index. A frozen index has almost no overhead on the cluster (except for maintaining its metadata in memory) and is read-only."
|
||||
},
|
||||
"stability":"stable",
|
||||
"visibility":"public",
|
||||
"headers":{
|
||||
"accept": [ "application/json"]
|
||||
},
|
||||
"url":{
|
||||
"paths":[
|
||||
{
|
||||
"path":"/{index}/_freeze",
|
||||
"methods":[
|
||||
"POST"
|
||||
],
|
||||
"parts":{
|
||||
"index":{
|
||||
"type":"string",
|
||||
"description":"The name of the index to freeze"
|
||||
}
|
||||
},
|
||||
"deprecated":{
|
||||
"version":"7.14.0",
|
||||
"description":"Frozen indices are deprecated because they provide no benefit given improvements in heap memory utilization. They will be removed in a future release."
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"params":{
|
||||
"timeout":{
|
||||
"type":"time",
|
||||
"description":"Explicit operation timeout"
|
||||
},
|
||||
"master_timeout":{
|
||||
"type":"time",
|
||||
"description":"Specify timeout for connection to master"
|
||||
},
|
||||
"ignore_unavailable":{
|
||||
"type":"boolean",
|
||||
"description":"Whether specified concrete indices should be ignored when unavailable (missing or closed)"
|
||||
},
|
||||
"allow_no_indices":{
|
||||
"type":"boolean",
|
||||
"description":"Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes `_all` string or when no indices have been specified)"
|
||||
},
|
||||
"expand_wildcards":{
|
||||
"type":"enum",
|
||||
"options":[
|
||||
"open",
|
||||
"closed",
|
||||
"hidden",
|
||||
"none",
|
||||
"all"
|
||||
],
|
||||
"default":"closed",
|
||||
"description":"Whether to expand wildcard expression to concrete indices that are open, closed or both."
|
||||
},
|
||||
"wait_for_active_shards":{
|
||||
"type":"string",
|
||||
"description":"Sets the number of active shards to wait for before the operation returns."
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -108,6 +108,11 @@ tasks.named("yamlRestTestV7CompatTransform").configure{ task ->
|
|||
task.skipTest("rollup/put_job/Test basic put_job", "rollup was an experimental feature, also see #41227")
|
||||
task.skipTest("rollup/start_job/Test start job twice", "rollup was an experimental feature, also see #41227")
|
||||
task.skipTest("ml/trained_model_cat_apis/Test cat trained models", "A type field was added to cat.ml_trained_models #73660, this is a backwards compatible change. Still this is a cat api, and we don't support them with rest api compatibility. (the test would be very hard to transform too)")
|
||||
task.skipTest("api_key/10_basic/Test invalidate api keys with single id", "waiting for https://github.com/elastic/elasticsearch/pull/78664")
|
||||
task.skipTest("indices.freeze/30_usage/Usage stats on frozen indices", "#70192 -- the freeze index API is removed from 8.0")
|
||||
task.skipTest("indices.freeze/20_stats/Translog stats on frozen indices", "#70192 -- the freeze index API is removed from 8.0")
|
||||
task.skipTest("indices.freeze/10_basic/Basic", "#70192 -- the freeze index API is removed from 8.0")
|
||||
task.skipTest("indices.freeze/10_basic/Test index options", "#70192 -- the freeze index API is removed from 8.0")
|
||||
task.skipTest("ml/categorization_agg/Test categorization aggregation with poor settings", "https://github.com/elastic/elasticsearch/pull/79586")
|
||||
|
||||
task.replaceValueInMatch("_type", "_doc")
|
||||
|
|
|
@ -29,15 +29,11 @@ public final class RestFreezeIndexAction extends BaseRestHandler {
|
|||
|
||||
@Override
|
||||
public List<Route> routes() {
|
||||
return List.of(
|
||||
Route.builder(POST, "/{index}/_freeze").deprecated(DEPRECATION_WARNING, DEPRECATION_VERSION).build(),
|
||||
Route.builder(POST, "/{index}/_unfreeze").deprecated(DEPRECATION_WARNING, DEPRECATION_VERSION).build()
|
||||
);
|
||||
return List.of(Route.builder(POST, "/{index}/_unfreeze").deprecated(DEPRECATION_WARNING, DEPRECATION_VERSION).build());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected RestChannelConsumer prepareRequest(RestRequest request, NodeClient client) {
|
||||
boolean freeze = request.path().endsWith("/_freeze");
|
||||
FreezeRequest freezeRequest = new FreezeRequest(Strings.splitStringByCommaToArray(request.param("index")));
|
||||
freezeRequest.timeout(request.paramAsTime("timeout", freezeRequest.timeout()));
|
||||
freezeRequest.masterNodeTimeout(request.paramAsTime("master_timeout", freezeRequest.masterNodeTimeout()));
|
||||
|
@ -46,7 +42,7 @@ public final class RestFreezeIndexAction extends BaseRestHandler {
|
|||
if (waitForActiveShards != null) {
|
||||
freezeRequest.waitForActiveShards(ActiveShardCount.parseString(waitForActiveShards));
|
||||
}
|
||||
freezeRequest.setFreeze(freeze);
|
||||
freezeRequest.setFreeze(false);
|
||||
return channel -> client.execute(FreezeIndexAction.INSTANCE, freezeRequest, new RestToXContentListener<>(channel));
|
||||
}
|
||||
|
||||
|
|
|
@ -44,13 +44,9 @@ import static org.hamcrest.Matchers.greaterThan;
|
|||
import static org.hamcrest.Matchers.greaterThanOrEqualTo;
|
||||
import static org.hamcrest.Matchers.lessThanOrEqualTo;
|
||||
import static org.hamcrest.Matchers.notNullValue;
|
||||
import static org.hamcrest.Matchers.nullValue;
|
||||
|
||||
public abstract class AbstractSearchableSnapshotsRestTestCase extends ESRestTestCase {
|
||||
|
||||
public static final String FROZEN_INDICES_WARNING = "Frozen indices are deprecated because they provide no benefit given "
|
||||
+ "improvements in heap memory utilization. They will be removed in a future release.";
|
||||
|
||||
private static final String WRITE_REPOSITORY_NAME = "repository";
|
||||
private static final String READ_REPOSITORY_NAME = "read-repository";
|
||||
private static final String SNAPSHOT_NAME = "searchable-snapshot";
|
||||
|
@ -179,30 +175,6 @@ public abstract class AbstractSearchableSnapshotsRestTestCase extends ESRestTest
|
|||
});
|
||||
}
|
||||
|
||||
public void testSearchResultsWhenFrozen() throws Exception {
|
||||
runSearchableSnapshotsTest((restoredIndexName, numDocs) -> {
|
||||
final Request freezeRequest = new Request(HttpPost.METHOD_NAME, restoredIndexName + "/_freeze");
|
||||
freezeRequest.setOptions(expectWarnings(FROZEN_INDICES_WARNING));
|
||||
assertOK(client().performRequest(freezeRequest));
|
||||
ensureGreen(restoredIndexName);
|
||||
assertSearchResults(restoredIndexName, numDocs, Boolean.FALSE);
|
||||
final Map<String, Object> frozenIndexSettings = indexSettings(restoredIndexName);
|
||||
assertThat(Boolean.valueOf(extractValue(frozenIndexSettings, "index.frozen")), equalTo(true));
|
||||
assertThat(Boolean.valueOf(extractValue(frozenIndexSettings, "index.search.throttled")), equalTo(true));
|
||||
assertThat(Boolean.valueOf(extractValue(frozenIndexSettings, "index.blocks.write")), equalTo(true));
|
||||
|
||||
final Request unfreezeRequest = new Request(HttpPost.METHOD_NAME, restoredIndexName + "/_unfreeze");
|
||||
unfreezeRequest.setOptions(expectWarnings(FROZEN_INDICES_WARNING));
|
||||
assertOK(client().performRequest(unfreezeRequest));
|
||||
ensureGreen(restoredIndexName);
|
||||
assertSearchResults(restoredIndexName, numDocs, Boolean.FALSE);
|
||||
final Map<String, Object> unfrozenIndexSettings = indexSettings(restoredIndexName);
|
||||
assertThat(extractValue(unfrozenIndexSettings, "index.frozen"), nullValue());
|
||||
assertThat(extractValue(unfrozenIndexSettings, "index.search.throttled"), nullValue());
|
||||
assertThat(Boolean.valueOf(extractValue(frozenIndexSettings, "index.blocks.write")), equalTo(true));
|
||||
});
|
||||
}
|
||||
|
||||
public void testSourceOnlyRepository() throws Exception {
|
||||
runSearchableSnapshotsTest((indexName, numDocs) -> {
|
||||
for (int i = 0; i < 10; i++) {
|
||||
|
@ -292,14 +264,6 @@ public abstract class AbstractSearchableSnapshotsRestTestCase extends ESRestTest
|
|||
public void testSnapshotOfSearchableSnapshot() throws Exception {
|
||||
runSearchableSnapshotsTest((restoredIndexName, numDocs) -> {
|
||||
|
||||
final boolean frozen = randomBoolean();
|
||||
if (frozen) {
|
||||
logger.info("--> freezing index [{}]", restoredIndexName);
|
||||
final Request freezeRequest = new Request(HttpPost.METHOD_NAME, restoredIndexName + "/_freeze");
|
||||
freezeRequest.setOptions(expectWarnings(FROZEN_INDICES_WARNING));
|
||||
assertOK(client().performRequest(freezeRequest));
|
||||
}
|
||||
|
||||
if (randomBoolean()) {
|
||||
logger.info("--> closing index [{}]", restoredIndexName);
|
||||
final Request closeRequest = new Request(HttpPost.METHOD_NAME, restoredIndexName + "/_close");
|
||||
|
@ -347,7 +311,7 @@ public abstract class AbstractSearchableSnapshotsRestTestCase extends ESRestTest
|
|||
|
||||
deleteSnapshot(snapshot2Name, false);
|
||||
|
||||
assertSearchResults(restoredIndexName, numDocs, frozen ? Boolean.FALSE : randomFrom(Boolean.TRUE, Boolean.FALSE, null));
|
||||
assertSearchResults(restoredIndexName, numDocs, randomFrom(Boolean.TRUE, Boolean.FALSE, null));
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
@ -18,6 +18,7 @@ def remoteClusterReg = testClusters.register('remote-cluster') {
|
|||
setting 'xpack.security.autoconfiguration.enabled', 'false'
|
||||
|
||||
user username: "test_user", password: "x-pack-test-password"
|
||||
plugin ':x-pack:qa:freeze-plugin'
|
||||
}
|
||||
|
||||
def integTestClusterReg = testClusters.register('integTest') {
|
||||
|
@ -33,6 +34,7 @@ def integTestClusterReg = testClusters.register('integTest') {
|
|||
setting 'xpack.security.autoconfiguration.enabled', 'false'
|
||||
|
||||
user username: "test_user", password: "x-pack-test-password"
|
||||
plugin ':x-pack:qa:freeze-plugin'
|
||||
}
|
||||
|
||||
tasks.register("startRemoteCluster", DefaultTestClustersTask.class) {
|
||||
|
|
|
@ -10,4 +10,5 @@ testClusters.matching { it.name == "integTest" }.configureEach {
|
|||
numberOfNodes = 2
|
||||
setting 'xpack.security.enabled', 'false'
|
||||
setting 'xpack.license.self_generated.type', 'trial'
|
||||
plugin ':x-pack:qa:freeze-plugin'
|
||||
}
|
||||
|
|
|
@ -36,6 +36,7 @@ subprojects {
|
|||
user username: "user1", password: 'x-pack-test-password', role: "user1"
|
||||
user username: "user2", password: 'x-pack-test-password', role: "user2"
|
||||
user username: "manage_user", password: 'x-pack-test-password', role: "manage_user"
|
||||
plugin ':x-pack:qa:freeze-plugin'
|
||||
}
|
||||
|
||||
File testArtifactsDir = project.file("$buildDir/testArtifacts")
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
testClusters.matching { it.name == "integTest" }.configureEach {
|
||||
testDistribution = 'DEFAULT'
|
||||
setting 'xpack.security.enabled', 'false'
|
||||
setting 'xpack.license.self_generated.type', 'trial'
|
||||
plugin ':x-pack:qa:freeze-plugin'
|
||||
}
|
||||
|
|
|
@ -28,8 +28,6 @@ import java.util.LinkedHashMap;
|
|||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import static org.elasticsearch.test.rest.ESRestTestCase.expectWarnings;
|
||||
|
||||
public class DataLoader {
|
||||
|
||||
public static void main(String[] args) throws Exception {
|
||||
|
@ -405,12 +403,6 @@ public class DataLoader {
|
|||
protected static void freeze(RestClient client, String... indices) throws Exception {
|
||||
for (String index : indices) {
|
||||
Request freezeRequest = new Request("POST", "/" + index + "/_freeze");
|
||||
freezeRequest.setOptions(
|
||||
expectWarnings(
|
||||
"Frozen indices are deprecated because they provide no benefit given improvements in "
|
||||
+ "heap memory utilization. They will be removed in a future release."
|
||||
)
|
||||
);
|
||||
client.performRequest(freezeRequest);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,186 +0,0 @@
|
|||
---
|
||||
"Basic":
|
||||
- skip:
|
||||
features: [ "warnings" ]
|
||||
|
||||
- do:
|
||||
index:
|
||||
index: test
|
||||
id: "1"
|
||||
body: { "foo": "Hello: 1" }
|
||||
- do:
|
||||
index:
|
||||
index: test
|
||||
id: "2"
|
||||
body: { "foo": "Hello: 2" }
|
||||
|
||||
- do:
|
||||
warnings:
|
||||
- "Frozen indices are deprecated because they provide no benefit given improvements in heap memory utilization. They will be removed in a future release."
|
||||
indices.freeze:
|
||||
index: test
|
||||
|
||||
- do:
|
||||
warnings:
|
||||
- "[ignore_throttled] parameter is deprecated because frozen indices have been deprecated. Consider cold or frozen tiers in place of frozen indices."
|
||||
- "Searching frozen indices [test] is deprecated. Consider cold or frozen tiers in place of frozen indices. The frozen feature will be removed in a feature release."
|
||||
search:
|
||||
rest_total_hits_as_int: true
|
||||
index: test
|
||||
ignore_throttled: false
|
||||
body:
|
||||
query:
|
||||
match:
|
||||
foo: hello
|
||||
|
||||
- match: {hits.total: 2}
|
||||
|
||||
# unfreeze
|
||||
- do:
|
||||
warnings:
|
||||
- "Frozen indices are deprecated because they provide no benefit given improvements in heap memory utilization. They will be removed in a future release."
|
||||
indices.unfreeze:
|
||||
index: test
|
||||
|
||||
- do:
|
||||
search:
|
||||
rest_total_hits_as_int: true
|
||||
index: _all
|
||||
body:
|
||||
query:
|
||||
match:
|
||||
foo: hello
|
||||
|
||||
- match: {hits.total: 2}
|
||||
|
||||
- do:
|
||||
index:
|
||||
index: test-01
|
||||
id: "1"
|
||||
body: { "foo": "Hello: 01" }
|
||||
|
||||
|
||||
- do:
|
||||
warnings:
|
||||
- "Frozen indices are deprecated because they provide no benefit given improvements in heap memory utilization. They will be removed in a future release."
|
||||
indices.freeze:
|
||||
index: test*
|
||||
|
||||
- do:
|
||||
warnings:
|
||||
- "[ignore_throttled] parameter is deprecated because frozen indices have been deprecated. Consider cold or frozen tiers in place of frozen indices."
|
||||
- "Searching frozen indices [test,test-01] is deprecated. Consider cold or frozen tiers in place of frozen indices. The frozen feature will be removed in a feature release."
|
||||
search:
|
||||
rest_total_hits_as_int: true
|
||||
index: _all
|
||||
ignore_throttled: false
|
||||
body:
|
||||
query:
|
||||
match:
|
||||
foo: hello
|
||||
|
||||
- match: {hits.total: 3}
|
||||
|
||||
- do:
|
||||
search:
|
||||
rest_total_hits_as_int: true
|
||||
index: _all
|
||||
body:
|
||||
query:
|
||||
match:
|
||||
foo: hello
|
||||
|
||||
- match: {hits.total: 0}
|
||||
|
||||
---
|
||||
"Test index options":
|
||||
- skip:
|
||||
features: ["allowed_warnings", "warnings"]
|
||||
|
||||
- do:
|
||||
index:
|
||||
index: test
|
||||
id: "1"
|
||||
body: { "foo": "Hello: 1" }
|
||||
|
||||
- do:
|
||||
index:
|
||||
index: test-close
|
||||
id: "1"
|
||||
body: { "foo": "Hello: 1" }
|
||||
|
||||
- do:
|
||||
indices.close:
|
||||
index: test-close
|
||||
allowed_warnings:
|
||||
- "the default value for the ?wait_for_active_shards parameter will change from '0' to 'index-setting' in version 8; specify '?wait_for_active_shards=index-setting' to adopt the future default behaviour, or '?wait_for_active_shards=0' to preserve today's behaviour"
|
||||
|
||||
- do:
|
||||
warnings:
|
||||
- "Frozen indices are deprecated because they provide no benefit given improvements in heap memory utilization. They will be removed in a future release."
|
||||
indices.freeze:
|
||||
index: test*,not_available
|
||||
ignore_unavailable: true
|
||||
|
||||
- do:
|
||||
search:
|
||||
rest_total_hits_as_int: true
|
||||
index: _all
|
||||
body:
|
||||
query:
|
||||
match:
|
||||
foo: hello
|
||||
|
||||
- match: {hits.total: 0}
|
||||
|
||||
- do:
|
||||
warnings:
|
||||
- "[ignore_throttled] parameter is deprecated because frozen indices have been deprecated. Consider cold or frozen tiers in place of frozen indices."
|
||||
- "Searching frozen indices [test] is deprecated. Consider cold or frozen tiers in place of frozen indices. The frozen feature will be removed in a feature release."
|
||||
search:
|
||||
rest_total_hits_as_int: true
|
||||
index: _all
|
||||
ignore_throttled: false
|
||||
body:
|
||||
query:
|
||||
match:
|
||||
foo: hello
|
||||
|
||||
- match: {hits.total: 1}
|
||||
|
||||
---
|
||||
"Cannot freeze write index for data stream":
|
||||
- skip:
|
||||
version: " - 7.9.99"
|
||||
reason: "enable in 7.9+ when backported"
|
||||
features: allowed_warnings
|
||||
|
||||
- do:
|
||||
allowed_warnings:
|
||||
- "index template [my-template1] has index patterns [simple-data-stream1] matching patterns from existing older templates [global] with patterns (global => [*]); this template [my-template1] will take precedence during new index creation"
|
||||
indices.put_index_template:
|
||||
name: my-template1
|
||||
body:
|
||||
index_patterns: [simple-data-stream1]
|
||||
template:
|
||||
mappings:
|
||||
properties:
|
||||
'@timestamp':
|
||||
type: date
|
||||
data_stream: {}
|
||||
|
||||
- do:
|
||||
indices.create_data_stream:
|
||||
name: simple-data-stream1
|
||||
- is_true: acknowledged
|
||||
|
||||
- do:
|
||||
catch: bad_request
|
||||
indices.freeze:
|
||||
index: ".ds-simple-data-stream1-*000001"
|
||||
|
||||
- do:
|
||||
indices.delete_data_stream:
|
||||
name: simple-data-stream1
|
||||
- is_true: acknowledged
|
||||
|
|
@ -1,67 +0,0 @@
|
|||
---
|
||||
setup:
|
||||
- do:
|
||||
indices.create:
|
||||
index: test
|
||||
- do:
|
||||
cluster.health:
|
||||
wait_for_no_initializing_shards: true
|
||||
|
||||
---
|
||||
"Translog stats on frozen indices":
|
||||
- skip:
|
||||
features: warnings
|
||||
version: " - 7.3.99"
|
||||
reason: "start ignoring translog retention policy with soft-deletes enabled in 7.4"
|
||||
|
||||
- do:
|
||||
index:
|
||||
index: test
|
||||
id: 1
|
||||
body: { "foo": "bar" }
|
||||
|
||||
- do:
|
||||
index:
|
||||
index: test
|
||||
id: 2
|
||||
body: { "foo": "bar" }
|
||||
|
||||
- do:
|
||||
index:
|
||||
index: test
|
||||
id: 3
|
||||
body: { "foo": "bar" }
|
||||
|
||||
- do:
|
||||
indices.stats:
|
||||
metric: [ translog ]
|
||||
- match: { indices.test.primaries.translog.operations: 3 }
|
||||
- match: { indices.test.primaries.translog.uncommitted_operations: 3 }
|
||||
|
||||
# freeze index
|
||||
- do:
|
||||
warnings:
|
||||
- "Frozen indices are deprecated because they provide no benefit given improvements in heap memory utilization. They will be removed in a future release."
|
||||
indices.freeze:
|
||||
index: test
|
||||
- is_true: acknowledged
|
||||
|
||||
- do:
|
||||
indices.stats:
|
||||
metric: [ translog ]
|
||||
- match: { indices.test.primaries.translog.operations: 0 }
|
||||
- match: { indices.test.primaries.translog.uncommitted_operations: 0 }
|
||||
|
||||
# unfreeze index
|
||||
- do:
|
||||
warnings:
|
||||
- "Frozen indices are deprecated because they provide no benefit given improvements in heap memory utilization. They will be removed in a future release."
|
||||
indices.unfreeze:
|
||||
index: test
|
||||
- is_true: acknowledged
|
||||
|
||||
- do:
|
||||
indices.stats:
|
||||
metric: [ translog ]
|
||||
- match: { indices.test.primaries.translog.operations: 0 }
|
||||
- match: { indices.test.primaries.translog.uncommitted_operations: 0 }
|
|
@ -1,65 +0,0 @@
|
|||
---
|
||||
setup:
|
||||
- do:
|
||||
indices.create:
|
||||
index: test
|
||||
- do:
|
||||
cluster.health:
|
||||
wait_for_no_initializing_shards: true
|
||||
|
||||
---
|
||||
"Usage stats on frozen indices":
|
||||
- skip:
|
||||
features: [ "warnings" ]
|
||||
version: " - 7.3.99"
|
||||
reason: "frozen indices have usage stats starting in version 7.4"
|
||||
|
||||
- do:
|
||||
index:
|
||||
index: test
|
||||
id: 1
|
||||
body: { "foo": "bar" }
|
||||
|
||||
- do:
|
||||
index:
|
||||
index: test
|
||||
id: 2
|
||||
body: { "foo": "bar" }
|
||||
|
||||
- do:
|
||||
index:
|
||||
index: test
|
||||
id: 3
|
||||
body: { "foo": "bar" }
|
||||
|
||||
- do: {xpack.usage: {}}
|
||||
- match: { frozen_indices.available: true }
|
||||
- match: { frozen_indices.enabled: true }
|
||||
- match: { frozen_indices.indices_count: 0 }
|
||||
|
||||
# freeze index
|
||||
- do:
|
||||
warnings:
|
||||
- "Frozen indices are deprecated because they provide no benefit given improvements in heap memory utilization. They will be removed in a future release."
|
||||
indices.freeze:
|
||||
index: test
|
||||
- is_true: acknowledged
|
||||
|
||||
|
||||
- do: {xpack.usage: {}}
|
||||
- match: { frozen_indices.available: true }
|
||||
- match: { frozen_indices.enabled: true }
|
||||
- match: { frozen_indices.indices_count: 1 }
|
||||
|
||||
# unfreeze index
|
||||
- do:
|
||||
warnings:
|
||||
- "Frozen indices are deprecated because they provide no benefit given improvements in heap memory utilization. They will be removed in a future release."
|
||||
indices.unfreeze:
|
||||
index: test
|
||||
- is_true: acknowledged
|
||||
|
||||
- do: {xpack.usage: {}}
|
||||
- match: { frozen_indices.available: true }
|
||||
- match: { frozen_indices.enabled: true }
|
||||
- match: { frozen_indices.indices_count: 0 }
|
|
@ -0,0 +1,25 @@
|
|||
/*
|
||||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
||||
* or more contributor license agreements. Licensed under the Elastic License
|
||||
* 2.0; you may not use this file except in compliance with the Elastic License
|
||||
* 2.0.
|
||||
*/
|
||||
|
||||
|
||||
apply plugin: 'elasticsearch.internal-es-plugin'
|
||||
|
||||
|
||||
esplugin {
|
||||
name = 'freeze-plugin'
|
||||
description = 'Provides freeze-index endpoint for testing purposes only'
|
||||
classname = 'org.elasticsearch.plugin.freeze.FreezeIndexPlugin'
|
||||
extendedPlugins = ['x-pack-core']
|
||||
}
|
||||
|
||||
dependencies {
|
||||
compileOnly project(":server")
|
||||
compileOnly project(path: xpackModule('core'))
|
||||
}
|
||||
|
||||
//this plugin is only for testing purposes -- there are no unit tests
|
||||
tasks.named("testingConventions").configure { enabled = false }
|
|
@ -0,0 +1,85 @@
|
|||
/*
|
||||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
||||
* or more contributor license agreements. Licensed under the Elastic License
|
||||
* 2.0; you may not use this file except in compliance with the Elastic License
|
||||
* 2.0.
|
||||
*/
|
||||
|
||||
package org.elasticsearch.plugin.freeze;
|
||||
|
||||
import org.elasticsearch.action.support.ActiveShardCount;
|
||||
import org.elasticsearch.action.support.IndicesOptions;
|
||||
import org.elasticsearch.client.node.NodeClient;
|
||||
import org.elasticsearch.cluster.metadata.IndexNameExpressionResolver;
|
||||
import org.elasticsearch.cluster.node.DiscoveryNodes;
|
||||
import org.elasticsearch.common.Strings;
|
||||
import org.elasticsearch.common.settings.ClusterSettings;
|
||||
import org.elasticsearch.common.settings.IndexScopedSettings;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.common.settings.SettingsFilter;
|
||||
import org.elasticsearch.plugins.ActionPlugin;
|
||||
import org.elasticsearch.plugins.Plugin;
|
||||
import org.elasticsearch.protocol.xpack.frozen.FreezeRequest;
|
||||
import org.elasticsearch.rest.BaseRestHandler;
|
||||
import org.elasticsearch.rest.RestController;
|
||||
import org.elasticsearch.rest.RestHandler;
|
||||
import org.elasticsearch.rest.RestRequest;
|
||||
import org.elasticsearch.rest.action.RestToXContentListener;
|
||||
import org.elasticsearch.xpack.core.frozen.action.FreezeIndexAction;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
import java.util.function.Supplier;
|
||||
|
||||
import static org.elasticsearch.rest.RestRequest.Method.POST;
|
||||
|
||||
/**
|
||||
* Restores the REST endpoint for freezing indices so that the JDBC tests can still freeze indices
|
||||
* for testing purposes until frozen indices are no longer supported.
|
||||
*/
|
||||
public class FreezeIndexPlugin extends Plugin implements ActionPlugin {
|
||||
|
||||
@Override
|
||||
public List<RestHandler> getRestHandlers(
|
||||
Settings settings,
|
||||
RestController restController,
|
||||
ClusterSettings clusterSettings,
|
||||
IndexScopedSettings indexScopedSettings,
|
||||
SettingsFilter settingsFilter,
|
||||
IndexNameExpressionResolver indexNameExpressionResolver,
|
||||
Supplier<DiscoveryNodes> nodesInCluster
|
||||
) {
|
||||
return List.of(new FreezeIndexRestEndpoint());
|
||||
}
|
||||
|
||||
/**
|
||||
* Used by the {@link FreezeIndexPlugin} above.
|
||||
*/
|
||||
static class FreezeIndexRestEndpoint extends BaseRestHandler {
|
||||
@Override
|
||||
public String getName() {
|
||||
return "freeze-for-testing-only";
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Route> routes() {
|
||||
return List.of(new Route(POST, "/{index}/_freeze"));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected RestChannelConsumer prepareRequest(RestRequest request, NodeClient client) throws IOException {
|
||||
boolean freeze = request.path().endsWith("/_freeze");
|
||||
FreezeRequest freezeRequest = new FreezeRequest(Strings.splitStringByCommaToArray(request.param("index")));
|
||||
freezeRequest.timeout(request.paramAsTime("timeout", freezeRequest.timeout()));
|
||||
freezeRequest.masterNodeTimeout(request.paramAsTime("master_timeout", freezeRequest.masterNodeTimeout()));
|
||||
freezeRequest.indicesOptions(IndicesOptions.fromRequest(request, freezeRequest.indicesOptions()));
|
||||
String waitForActiveShards = request.param("wait_for_active_shards");
|
||||
if (waitForActiveShards != null) {
|
||||
freezeRequest.waitForActiveShards(ActiveShardCount.parseString(waitForActiveShards));
|
||||
}
|
||||
freezeRequest.setFreeze(freeze);
|
||||
return channel -> client.execute(FreezeIndexAction.INSTANCE, freezeRequest, new RestToXContentListener<>(channel));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -19,6 +19,12 @@ import org.elasticsearch.cluster.metadata.DataStreamTestHelper;
|
|||
import org.elasticsearch.common.Strings;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.common.util.concurrent.ThreadContext;
|
||||
import org.elasticsearch.common.xcontent.support.XContentMapValues;
|
||||
import org.elasticsearch.rest.RestStatus;
|
||||
import org.elasticsearch.rest.action.search.RestSearchAction;
|
||||
import org.elasticsearch.test.StreamsUtils;
|
||||
import org.elasticsearch.test.rest.ESRestTestCase;
|
||||
import org.elasticsearch.upgrades.AbstractFullClusterRestartTestCase;
|
||||
import org.elasticsearch.xcontent.DeprecationHandler;
|
||||
import org.elasticsearch.xcontent.NamedXContentRegistry;
|
||||
import org.elasticsearch.xcontent.ObjectPath;
|
||||
|
@ -26,13 +32,6 @@ import org.elasticsearch.xcontent.XContentBuilder;
|
|||
import org.elasticsearch.xcontent.XContentParser;
|
||||
import org.elasticsearch.xcontent.XContentType;
|
||||
import org.elasticsearch.xcontent.json.JsonXContent;
|
||||
import org.elasticsearch.common.xcontent.support.XContentMapValues;
|
||||
import org.elasticsearch.index.IndexSettings;
|
||||
import org.elasticsearch.rest.RestStatus;
|
||||
import org.elasticsearch.rest.action.search.RestSearchAction;
|
||||
import org.elasticsearch.test.StreamsUtils;
|
||||
import org.elasticsearch.test.rest.ESRestTestCase;
|
||||
import org.elasticsearch.upgrades.AbstractFullClusterRestartTestCase;
|
||||
import org.elasticsearch.xpack.core.slm.SnapshotLifecyclePolicy;
|
||||
import org.elasticsearch.xpack.core.slm.SnapshotLifecycleStats;
|
||||
import org.hamcrest.Matcher;
|
||||
|
@ -703,61 +702,6 @@ public class FullClusterRestartIT extends AbstractFullClusterRestartTestCase {
|
|||
return null;
|
||||
}
|
||||
|
||||
public void testFrozenIndexAfterRestarted() throws Exception {
|
||||
final String index = "test_frozen_index";
|
||||
if (isRunningAgainstOldCluster()) {
|
||||
Settings.Builder settings = Settings.builder();
|
||||
if (minimumNodeVersion().before(Version.V_8_0_0) && randomBoolean()) {
|
||||
settings.put(IndexSettings.INDEX_SOFT_DELETES_SETTING.getKey(), randomBoolean());
|
||||
}
|
||||
String mappings = randomBoolean() ? "\"_source\": { \"enabled\": false}" : null;
|
||||
createIndex(index, settings.build(), mappings);
|
||||
ensureGreen(index);
|
||||
int numDocs = randomIntBetween(10, 500);
|
||||
for (int i = 0; i < numDocs; i++) {
|
||||
int id = randomIntBetween(0, 100);
|
||||
final Request indexRequest = new Request("POST", "/" + index + "/" + "_doc/" + id);
|
||||
indexRequest.setJsonEntity(Strings.toString(JsonXContent.contentBuilder().startObject().field("f", "v").endObject()));
|
||||
assertOK(client().performRequest(indexRequest));
|
||||
if (rarely()) {
|
||||
flush(index, randomBoolean());
|
||||
}
|
||||
}
|
||||
} else {
|
||||
ensureGreen(index);
|
||||
final int totalHits = (int) XContentMapValues.extractValue("hits.total.value",
|
||||
entityAsMap(client().performRequest(new Request("GET", "/" + index + "/_search"))));
|
||||
Request freezeRequest = new Request("POST", index + "/_freeze");
|
||||
freezeRequest.setOptions(
|
||||
expectWarnings(
|
||||
"Frozen indices are deprecated because they provide no benefit given "
|
||||
+ "improvements in heap memory utilization. They will be removed in a future release."
|
||||
)
|
||||
);
|
||||
assertOK(client().performRequest(freezeRequest));
|
||||
ensureGreen(index);
|
||||
assertNoFileBasedRecovery(index, n -> true);
|
||||
final Request request = new Request("GET", "/" + index + "/_search");
|
||||
request.setOptions(expectWarnings("[ignore_throttled] parameter is deprecated because frozen " +
|
||||
"indices have been deprecated. Consider cold or frozen tiers in place of frozen indices.",
|
||||
"Searching frozen indices [" + index + "] is deprecated. " +
|
||||
"Consider cold or frozen tiers in place of frozen indices. The frozen feature will be removed in a feature release."));
|
||||
request.addParameter("ignore_throttled", "false");
|
||||
assertThat(XContentMapValues.extractValue("hits.total.value", entityAsMap(client().performRequest(request))),
|
||||
equalTo(totalHits));
|
||||
final Request unfreezeRequest = new Request("POST", index + "/_unfreeze");
|
||||
unfreezeRequest.setOptions(
|
||||
expectWarnings(
|
||||
"Frozen indices are deprecated because they provide no benefit given "
|
||||
+ "improvements in heap memory utilization. They will be removed in a future release."
|
||||
)
|
||||
);
|
||||
assertOK(client().performRequest(unfreezeRequest));
|
||||
ensureGreen(index);
|
||||
assertNoFileBasedRecovery(index, n -> true);
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public void testDataStreams() throws Exception {
|
||||
assumeTrue("no data streams in versions before " + Version.V_7_9_0, getOldClusterVersion().onOrAfter(Version.V_7_9_0));
|
||||
|
|
Loading…
Reference in New Issue