Skip to content

Commit c96b3e1

Browse files
Add explain filtering functionality for ISM docs (#11462) (#11487)
1 parent 0c0684f commit c96b3e1

File tree

1 file changed

+186
-0
lines changed

1 file changed

+186
-0
lines changed

_im-plugin/ism/api.md

Lines changed: 186 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -653,6 +653,192 @@ GET _plugins/_ism/explain/index_1?show_policy=true
653653

654654
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.
655655

656+
## Explain index with filtering
657+
**Introduced 2.12**
658+
{: .label .label-purple }
659+
660+
You can use the `POST` method with the Explain API to filter the results based on specific criteria. This allows you to query indexes based on their policy ID, current state, or action type.
661+
662+
#### Endpoints
663+
664+
```
665+
POST _plugins/_ism/explain/<index>
666+
```
667+
668+
#### Request body
669+
670+
The request body supports the following optional filters.
671+
672+
| Parameter | Type | Description |
673+
|:----------|:-----|:------------|
674+
| `policy_id` | String | Filter results to show only indexes managed by the specified policy ID. |
675+
| `state` | String | Filter results to show only indexes currently in the specified state. |
676+
| `action_type` | String | Filter results to show only indexes currently executing the specified action type. |
677+
| `failed` | Boolean | Filter results to show only failed managed indexes. |
678+
All filters are optional. If a filter is not specified, indexes with any value for that parameter will be included in the results. The API returns only indexes that match all specified filters.
679+
680+
#### Example request: Filter by policy ID
681+
682+
```json
683+
POST _plugins/_ism/explain/log-*
684+
{
685+
"filter": {
686+
"policy_id": "hot-warm-delete-policy"
687+
}
688+
}
689+
```
690+
{% include copy-curl.html %}
691+
692+
#### Example request: Filter by state and action type
693+
694+
```json
695+
POST _plugins/_ism/explain/app-*
696+
{
697+
"filter": {
698+
"state": "warm",
699+
"action_type": "allocation"
700+
}
701+
}
702+
```
703+
{% include copy-curl.html %}
704+
705+
#### Example request: Filter by all criteria
706+
707+
```json
708+
POST _plugins/_ism/explain/data-*
709+
{
710+
"filter": {
711+
"policy_id": "data-lifecycle-policy",
712+
"state": "hot",
713+
"action_type": "rollover"
714+
}
715+
}
716+
```
717+
{% include copy-curl.html %}
718+
719+
#### Example response
720+
721+
<details markdown="block">
722+
<summary>
723+
Response
724+
</summary>
725+
{: .text-delta}
726+
727+
```json
728+
{
729+
"test-logs-001": {
730+
"index.plugins.index_state_management.policy_id": "test-lifecycle-policy",
731+
"index": "test-logs-001",
732+
"index_uuid": "LmJgKNatQZWHQu-qIHlcJw",
733+
"policy_id": "test-lifecycle-policy",
734+
"enabled": true,
735+
"policy": {
736+
"policy_id": "test-lifecycle-policy",
737+
"description": "Lifecycle policy for log data: hot -> warm -> cold -> delete",
738+
"last_updated_time": 1730308440926,
739+
"schema_version": 18,
740+
"error_notification": null,
741+
"default_state": "hot",
742+
"states": [
743+
{
744+
"name": "hot",
745+
"actions": [
746+
{
747+
"rollover": {
748+
"min_doc_count": 10000,
749+
"min_size": "1gb",
750+
"min_index_age": "1d"
751+
}
752+
}
753+
],
754+
"transitions": [
755+
{
756+
"state_name": "warm",
757+
"conditions": {
758+
"min_index_age": "7d"
759+
}
760+
}
761+
]
762+
},
763+
{
764+
"name": "warm",
765+
"actions": [
766+
{
767+
"replica_count": {
768+
"number_of_replicas": 0
769+
}
770+
}
771+
],
772+
"transitions": [
773+
{
774+
"state_name": "cold",
775+
"conditions": {
776+
"min_index_age": "30d"
777+
}
778+
}
779+
]
780+
},
781+
{
782+
"name": "cold",
783+
"actions": [],
784+
"transitions": [
785+
{
786+
"state_name": "delete",
787+
"conditions": {
788+
"min_index_age": "90d"
789+
}
790+
}
791+
]
792+
},
793+
{
794+
"name": "delete",
795+
"actions": [
796+
{
797+
"delete": {}
798+
}
799+
],
800+
"transitions": []
801+
}
802+
],
803+
"ism_template": null
804+
},
805+
"policy_seq_no": 0,
806+
"policy_primary_term": 1,
807+
"rolled_over": false,
808+
"index_creation_date": 1730308447399,
809+
"state": {
810+
"name": "hot",
811+
"start_time": 1730308447644
812+
},
813+
"action": {
814+
"name": "rollover",
815+
"start_time": 1730308447644,
816+
"index": 0,
817+
"failed": false,
818+
"consumed_retries": 0,
819+
"last_retry_time": 0
820+
},
821+
"step": {
822+
"name": "attempt_rollover",
823+
"start_time": 1730308447644,
824+
"step_status": "starting"
825+
},
826+
"retry_info": {
827+
"failed": false,
828+
"consumed_retries": 0
829+
},
830+
"info": {
831+
"message": "Currently checking rollover conditions"
832+
},
833+
"enabled": true,
834+
"enabled_time": 1730308447644
835+
},
836+
"total_managed_indices": 1
837+
}
838+
```
839+
840+
</details>
841+
656842
---
657843

658844
## Delete policy

0 commit comments

Comments
 (0)