remove old doc placeholder and migrate ilm docs to top-level (#34615)
we are restructuring the docs, this migrates ILM docs outside of the x-pack doc structure.
This commit is contained in:
parent
6880e2ad79
commit
e737ea7d4a
|
@ -10,7 +10,7 @@ Gets the current status for ILM.
|
|||
|
||||
==== Request
|
||||
|
||||
`POST /_ilm/status`
|
||||
`GET /_ilm/status`
|
||||
|
||||
==== Description
|
||||
|
||||
|
@ -42,7 +42,6 @@ The following example stops the ILM plugin.
|
|||
GET _ilm/status
|
||||
--------------------------------------------------
|
||||
// CONSOLE
|
||||
// TEST
|
||||
|
||||
If the request does not encounter errors, you receive the following result:
|
||||
|
|
@ -1,3 +1,4 @@
|
|||
[role="xpack"]
|
||||
[[get-index-lifecycle-information]]
|
||||
== Get index lifecycle information
|
||||
|
|
@ -1,3 +1,4 @@
|
|||
[role="xpack"]
|
||||
[[getting-started-index-lifecycle-management]]
|
||||
== Getting started with {ilm}
|
||||
|
|
@ -1,3 +1,5 @@
|
|||
[role="xpack"]
|
||||
[testenv="basic"]
|
||||
[[index-lifecycle-management]]
|
||||
= Managing Indices
|
||||
|
||||
|
@ -66,4 +68,4 @@ include::get-index-lifecycle-information.asciidoc[]
|
|||
include::start-stop-ilm.asciidoc[]
|
||||
|
||||
:edit_url: https://github.com/elastic/elasticsearch/edit/{branch}/x-pack/docs/en/ilm/apis/ilm-api.asciidoc
|
||||
include::{xes-repo-dir}/ilm/apis/ilm-api.asciidoc[]
|
||||
include::{es-repo-dir}/ilm/apis/ilm-api.asciidoc[]
|
|
@ -1,3 +1,5 @@
|
|||
[role="xpack"]
|
||||
[testenv="basic"]
|
||||
[[set-up-lifecycle-policy]]
|
||||
== Set up {ilm} policy
|
||||
|
|
@ -1,3 +1,5 @@
|
|||
[role="xpack"]
|
||||
[testenv="basic"]
|
||||
[[start-stop-ilm]]
|
||||
== Start And Stop {ilm}
|
||||
|
|
@ -1,3 +1,5 @@
|
|||
[role="xpack"]
|
||||
[testenv="basic"]
|
||||
[[update-lifecycle-policy]]
|
||||
== Update lifecycle policy
|
||||
|
|
@ -1,3 +1,5 @@
|
|||
[role="xpack"]
|
||||
[testenv="basic"]
|
||||
[[using-policies-rollover]]
|
||||
== Using policies to manage index rollover
|
||||
|
|
@ -55,7 +55,7 @@ include::index-modules.asciidoc[]
|
|||
|
||||
include::ingest.asciidoc[]
|
||||
|
||||
include::{xes-repo-dir}/ilm/index.asciidoc[]
|
||||
include::ilm/index.asciidoc[]
|
||||
|
||||
include::sql/index.asciidoc[]
|
||||
|
||||
|
|
|
@ -282,7 +282,8 @@ public abstract class ESRestTestCase extends ESTestCase {
|
|||
/**
|
||||
* Returns whether to preserve the state of the cluster upon completion of this test. Defaults to false. If true, overrides the value of
|
||||
* {@link #preserveIndicesUponCompletion()}, {@link #preserveTemplatesUponCompletion()}, {@link #preserveReposUponCompletion()},
|
||||
* {@link #preserveSnapshotsUponCompletion()}, and {@link #preserveRollupJobsUponCompletion()}.
|
||||
* {@link #preserveSnapshotsUponCompletion()},{@link #preserveRollupJobsUponCompletion()},
|
||||
* and {@link #preserveILMPoliciesUponCompletion()}.
|
||||
*
|
||||
* @return true if the state of the cluster should be preserved
|
||||
*/
|
||||
|
@ -347,6 +348,15 @@ public abstract class ESRestTestCase extends ESTestCase {
|
|||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns whether to preserve ILM Policies of this test. Defaults to not
|
||||
* preserviing them. Only runs at all if xpack is installed on the cluster
|
||||
* being tested.
|
||||
*/
|
||||
protected boolean preserveILMPoliciesUponCompletion() {
|
||||
return false;
|
||||
}
|
||||
|
||||
private void wipeCluster() throws Exception {
|
||||
if (preserveIndicesUponCompletion() == false) {
|
||||
// wipe indices
|
||||
|
@ -399,6 +409,10 @@ public abstract class ESRestTestCase extends ESTestCase {
|
|||
wipeRollupJobs();
|
||||
waitForPendingRollupTasks();
|
||||
}
|
||||
|
||||
if (hasXPack && false == preserveILMPoliciesUponCompletion()) {
|
||||
deleteAllPolicies();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -509,6 +523,29 @@ public abstract class ESRestTestCase extends ESTestCase {
|
|||
waitForPendingTasks(adminClient(), taskName -> taskName.startsWith("xpack/rollup/job") == false);
|
||||
}
|
||||
|
||||
private static void deleteAllPolicies() throws IOException {
|
||||
Map<String, Object> policies;
|
||||
|
||||
try {
|
||||
Response response = adminClient().performRequest(new Request("GET", "/_ilm"));
|
||||
policies = entityAsMap(response);
|
||||
} catch (ResponseException e) {
|
||||
if (RestStatus.BAD_REQUEST.getStatus() == e.getResponse().getStatusLine().getStatusCode()) {
|
||||
// If bad request returned, ILM is not enabled.
|
||||
return;
|
||||
}
|
||||
throw e;
|
||||
}
|
||||
|
||||
if (policies == null || policies.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
for (String policyName : policies.keySet()) {
|
||||
adminClient().performRequest(new Request("DELETE", "/_ilm/" + policyName));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Logs a message if there are still running tasks. The reasoning is that any tasks still running are state the is trying to bleed into
|
||||
* other tests.
|
||||
|
|
|
@ -96,4 +96,9 @@ public abstract class AbstractFullClusterRestartTestCase extends ESRestTestCase
|
|||
protected boolean preserveRollupJobsUponCompletion() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean preserveILMPoliciesUponCompletion() {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,63 +0,0 @@
|
|||
/*
|
||||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
||||
* or more contributor license agreements. Licensed under the Elastic License;
|
||||
* you may not use this file except in compliance with the Elastic License.
|
||||
*/
|
||||
package org.elasticsearch.xpack.core.indexlifecycle;
|
||||
|
||||
import org.elasticsearch.client.Request;
|
||||
import org.elasticsearch.client.Response;
|
||||
import org.elasticsearch.client.RestClient;
|
||||
import org.elasticsearch.test.rest.ESRestTestCase;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Map;
|
||||
|
||||
public class ILMRestTestStateCleaner {
|
||||
|
||||
public static void clearILMMetadata(RestClient adminClient) throws Exception {
|
||||
removePoliciesFromAllIndexes(adminClient);
|
||||
deleteAllPolicies(adminClient);
|
||||
// indices will be deleted by the ESRestTestCase class
|
||||
}
|
||||
|
||||
private static void removePoliciesFromAllIndexes(RestClient adminClient) throws IOException {
|
||||
Response response = adminClient.performRequest(new Request("GET", "/_all"));
|
||||
Map<String, Object> indexes = ESRestTestCase.entityAsMap(response);
|
||||
|
||||
if (indexes == null || indexes.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
for (String indexName : indexes.keySet()) {
|
||||
try {
|
||||
adminClient.performRequest(new Request("DELETE", indexName + "/_ilm/"));
|
||||
} catch (Exception e) {
|
||||
// ok
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static void deleteAllPolicies(RestClient adminClient) throws Exception {
|
||||
Map<String, Object> policies;
|
||||
|
||||
try {
|
||||
Response response = adminClient.performRequest(new Request("GET", "/_ilm"));
|
||||
policies = ESRestTestCase.entityAsMap(response);
|
||||
} catch (Exception e) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (policies == null || policies.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
for (String policyName : policies.keySet()) {
|
||||
try {
|
||||
adminClient.performRequest(new Request("DELETE", "/_ilm/" + policyName));
|
||||
} catch (Exception e) {
|
||||
// ok
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -22,7 +22,6 @@ import org.elasticsearch.test.rest.yaml.ClientYamlTestCandidate;
|
|||
import org.elasticsearch.test.rest.yaml.ClientYamlTestResponse;
|
||||
import org.elasticsearch.test.rest.yaml.ESClientYamlSuiteTestCase;
|
||||
import org.elasticsearch.test.rest.yaml.ObjectPath;
|
||||
import org.elasticsearch.xpack.core.indexlifecycle.ILMRestTestStateCleaner;
|
||||
import org.elasticsearch.xpack.core.ml.MlMetaIndex;
|
||||
import org.elasticsearch.xpack.core.ml.integration.MlRestTestStateCleaner;
|
||||
import org.elasticsearch.xpack.core.ml.job.persistence.AnomalyDetectorsIndex;
|
||||
|
@ -246,7 +245,6 @@ public class XPackRestIT extends ESClientYamlSuiteTestCase {
|
|||
public void cleanup() throws Exception {
|
||||
disableMonitoring();
|
||||
clearMlState();
|
||||
clearILMState();
|
||||
if (isWaitForPendingTasks()) {
|
||||
// This waits for pending tasks to complete, so must go last (otherwise
|
||||
// it could be waiting for pending tasks while monitoring is still running).
|
||||
|
@ -266,20 +264,6 @@ public class XPackRestIT extends ESClientYamlSuiteTestCase {
|
|||
}
|
||||
}
|
||||
|
||||
private void clearILMState() throws Exception {
|
||||
if (isILMTest()) {
|
||||
ILMRestTestStateCleaner.clearILMMetadata(adminClient());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
private void clearILMState() throws Exception {
|
||||
if (isILMTest()) {
|
||||
ILMRestTestStateCleaner.clearILMMetadata(adminClient());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Executes an API call using the admin context, waiting for it to succeed.
|
||||
*/
|
||||
|
@ -340,12 +324,6 @@ public class XPackRestIT extends ESClientYamlSuiteTestCase {
|
|||
return testName != null && (testName.contains("=ml/") || testName.contains("=ml\\"));
|
||||
}
|
||||
|
||||
protected boolean isILMTest() {
|
||||
String testName = getTestName();
|
||||
return testName != null && (testName.contains("=ilm/") || testName.contains("=ilm\\"))
|
||||
|| (testName.contains("/ilm/") || testName.contains("\\ilm\\"));
|
||||
}
|
||||
|
||||
/**
|
||||
* Should each test wait for pending tasks to finish after execution?
|
||||
* @return Wait for pending tasks
|
||||
|
|
|
@ -29,6 +29,11 @@ public abstract class AbstractUpgradeTestCase extends ESRestTestCase {
|
|||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean preserveILMPoliciesUponCompletion() {
|
||||
return true;
|
||||
}
|
||||
|
||||
enum CLUSTER_TYPE {
|
||||
OLD,
|
||||
MIXED,
|
||||
|
|
|
@ -43,6 +43,11 @@ public abstract class AbstractUpgradeTestCase extends ESRestTestCase {
|
|||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean preserveILMPoliciesUponCompletion() {
|
||||
return true;
|
||||
}
|
||||
|
||||
enum ClusterType {
|
||||
OLD,
|
||||
MIXED,
|
||||
|
|
|
@ -47,6 +47,11 @@ public class UpgradeClusterClientYamlTestSuiteIT extends ESClientYamlSuiteTestCa
|
|||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean preserveILMPoliciesUponCompletion() {
|
||||
return true;
|
||||
}
|
||||
|
||||
public UpgradeClusterClientYamlTestSuiteIT(ClientYamlTestCandidate testCandidate) {
|
||||
super(testCandidate);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue