From 5bf8250fa0008e0a64c5c4ef80b219ff0e6b6d9f Mon Sep 17 00:00:00 2001 From: keithhc2 Date: Mon, 14 Mar 2022 12:48:30 -0700 Subject: [PATCH] Added show_policy to explain Signed-off-by: keithhc2 --- _im-plugin/ism/api.md | 83 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 83 insertions(+) diff --git a/_im-plugin/ism/api.md b/_im-plugin/ism/api.md index e655f252..d4ae2177 100644 --- a/_im-plugin/ism/api.md +++ b/_im-plugin/ism/api.md @@ -176,6 +176,8 @@ Introduced 1.0 Updates a policy. Use the `seq_no` and `primary_term` parameters to update an existing policy. If these numbers don't match the existing policy or the policy doesn't exist, ISM throws an error. +It's possible that the policy currently applied to your index isn't the most up-to-date policy available. To see what policy is currently applied to your index, see [Explain index]({{site.url}}{{site.baseurl}}/im-plugin/ism/api/#explain-index). To get the most up-to-date version of a policy, see [Get policy]({{site.url}}{{site.baseurl}}/im-plugin/ism/api/#get-policy). + #### Request ```json @@ -475,6 +477,87 @@ GET _plugins/_ism/explain/index_1 } ``` +Optionally, you can add the `show_policy` parameter to your request's path to get the policy that is currently applied to your index, which is useful for seeing whether the policy applied to your index is the latest one. To get the most up-to-date policy, see [Get Policy API]({{site.url}}{{site.baseurl}}/im-plugin/ism/api/#get-policy). + +#### Request + +```json +GET _plugins/_ism/explain/index_1?show_policy=true +``` + +#### Sample response + +```json +{ + "index_1": { + "index.plugins.index_state_management.policy_id": "sample-policy", + "index.opendistro.index_state_management.policy_id": "sample-policy", + "index": "index_1", + "index_uuid": "gCFlS_zcTdih8xyxf3jQ-A", + "policy_id": "sample-policy", + "enabled": true, + "policy": { + "policy_id": "sample-policy", + "description": "ingesting logs", + "last_updated_time": 1647284980148, + "schema_version": 13, + "error_notification": null, + "default_state": "ingest", + "states": [ + { + "name": "ingest", + "actions": [ + { + "retry": { + "count": 3, + "backoff": "exponential", + "delay": "1m" + }, + "rollover": { + "min_doc_count": 5 + } + } + ], + "transitions": [ + { + "state_name": "search" + } + ] + }, + { + "name": "search", + "actions": [], + "transitions": [ + { + "state_name": "delete", + "conditions": { + "min_index_age": "5m" + } + } + ] + }, + { + "name": "delete", + "actions": [ + { + "retry": { + "count": 3, + "backoff": "exponential", + "delay": "1m" + }, + "delete": {} + } + ], + "transitions": [] + } + ], + "ism_template": null + } + }, + "total_managed_indices": 1 +} +``` + The `plugins.index_state_management.policy_id` setting is deprecated starting from ODFE version 1.13.0. We retain this field in the response API for consistency. ---