Creating and Managing OpenSearch Index Policies
This topic describes how to create and manage index lifecycle policies for OpenSearch clusters.
Context
Index State Management (ISM) of OpenSearch is a plugin that allows you to automate periodic, administrative operations on indexes by triggering them based on changes in the index age, index size, or number of documents. With ISM, you can define custom policies to automate index rollovers and deletion, thus optimizing cluster search performance or cutting storage costs. The procedure for using ISM is as follows:
- Creating an Index Lifecycle Policy: Create an index lifecycle policy on OpenSearch Dashboards.
- Associating Indexes with a Lifecycle Policy: Associate indexes with a lifecycle policy.
- Managing Index Policies: Modify, retry, and change index lifecycle policies.
For more information about ISM, see Index State Management.
The OpenSearch Dashboards GUI may vary depending on the software version. OpenSearch Dashboards 1.3.6 is used as an example here.
Creating an Index Lifecycle Policy
- Log in to the CSS management console.
- In the navigation pane on the left, choose Clusters > OpenSearch.
- In the cluster list, find the target cluster, and click Dashboards in the Operation column to log in to OpenSearch Dashboards.
- Expand the OpenSearch Dashboards menu in the upper-left corner, and choose Index Management.
- Click Create policy to create an index policy. In the Configuration method dialog box, select JSON editor and click Continue. The page for creating an index policy is displayed.
- Policy ID: use a custom policy name.
- Define policy: define a custom policy based on the reference example provided.
Figure 1 Configuring a policy
In the following example, a policy named policy1 is created. The ism_template part specifies the indexes to apply the policy to. After the policy is created, indexes whose names start with test are automatically associated with this policy.
PUT _plugins/_ism/policies/policy1 { "policy": { "description": "an example policy", "default_state": "hot", "states": [ // Ignore the states part. ], "ism_template": { "index_patterns": [ "test*" ], "priority": 100 } } }
- Click Create.
Associating Indexes with a Lifecycle Policy
- On the Index Management page of the OpenSearch Dashboards, choose Indexes.
- In the Indexes list, select one or more indexes that you want to bind with a policy.
- Click Apply policy in the upper-right corner. In the displayed dialog box, select Policy ID.
Figure 2 Apply policyFigure 3 Selecting a policy
- Click Apply.
After you bind a policy to an index, ISM creates a job that runs every 5 minutes by default to execute the policy, check criteria, and change index states.
Managing Index Policies
- On the Index Management page of the OpenSearch Dashboards, choose Managed Indices.
The displayed page shows index policies configured for the current cluster.
- Manage policies in the index policy list.
- For a policy whose status is abnormal, click Retry policy.
- To update a policy for an index, select the associated index, and click Change policy. After the policy is updated, click Change to apply the new policy.
- To remove a policy from an index, select the index, and click Remove policy. In the displayed dialog box, click Remove.
For details, see Index State Management.
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot