본문 바로가기
WIKI 기술 지식 베이스

ISM API

원문 보기 위키 갱신

출처: 문서

본문

ISM API

인덱스 상태 관리(ISM) API를 사용하여 정책과 관리 인덱스를 프로그래밍 방식으로 다룰 수 있어요.


목차

  • TOC {:toc}

정책 생성

Introduced 1.0 {: .label .label-purple }

정책을 생성해요.

엔드포인트

PUT _plugins/_ism/policies/{policy_id}

요청 예시

PUT _plugins/_ism/policies/policy_1
{
  "policy": {
    "description": "ingesting logs",
    "default_state": "ingest",
    "states": [
      {
        "name": "ingest",
        "actions": [
          {
            "rollover": {
              "min_doc_count": 5
            }
          }
        ],
        "transitions": [
          {
            "state_name": "search"
          }
        ]
      },
      {
        "name": "search",
        "actions": [],
        "transitions": [
          {
            "state_name": "delete",
            "conditions": {
              "min_index_age": "5m"
            }
          }
        ]
      },
      {
        "name": "delete",
        "actions": [
          {
            "delete": {}
          }
        ],
        "transitions": []
      }
    ]
  }
}

{% include copy-curl.html %}

응답 예시

{
  "_id": "policy_1",
  "_version": 1,
  "_primary_term": 1,
  "_seq_no": 7,
  "policy": {
    "policy": {
      "policy_id": "policy_1",
      "description": "ingesting logs",
      "last_updated_time": 1577990761311,
      "schema_version": 1,
      "error_notification": null,
      "default_state": "ingest",
      "states": [
        {
          "name": "ingest",
          "actions": [
            {
              "retry": {
                "count": 3,
                "backoff": "exponential",
                "delay": "1m"
              },
              "rollover": {
                "min_doc_count": 5,
                "copy_alias": false
              }
            }
          ],
          "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
    }
  }
}

응답은 ISM이 채운 기본값과 함께 정책을 반영해요. 따라서 각 액션에는 retry 객체가 추가되고 각 작업에는 설정하지 않은 매개변수가 추가돼요.


정책 추가

Introduced 1.0 {: .label .label-purple }

인덱스에 정책을 추가해요. 이미 정책이 있는 인덱스의 정책을 변경하려면 대신 관리 인덱스 정책 업데이트를 사용하세요.

엔드포인트

POST _plugins/_ism/add/{index}

요청 예시

먼저 인덱스를 생성해요:

PUT index_1

{% include copy-curl.html %}

그런 다음 인덱스에 정책을 추가해요:

POST _plugins/_ism/add/index_1
{
  "policy_id": "policy_1"
}

{% include copy-curl.html %}

응답 예시

{
  "updated_indices": 1,
  "failures": false,
  "failed_indices": []
}

이미 정책이 있는 인덱스에 정책을 추가해도 덮어쓰지 않아요. 요청은 200을 반환하지만 인덱스는 failed_indices에 나타나고 failures는 true예요:

{
  "updated_indices": 0,
  "failures": true,
  "failed_indices": [
    {
      "index_name": "index_1",
      "index_uuid": "t6a6I5YDQTiXY9c7cymI_w",
      "reason": "This index already has a policy, use the update policy API to update index policies"
    }
  ]
}

정책을 인덱스에 추가할 때 와일드카드 *를 사용하면 ISM 플러그인이 *를 모든 인덱스로 해석해요. 여기에는 사용자, 역할, 테넌트를 저장하는 .opendistro-security 같은 시스템 인덱스도 포함돼요. 정책의 삭제 액션이 클러스터의 모든 사용자 역할과 테넌트를 실수로 삭제할 수 있어요. _ism/add API로 인덱스를 지정할 때는 광범위한 * 와일드카드를 사용하지 말고 대신 my-logs* 같은 접두사를 추가하세요. {: .warning }


정책 업데이트

Introduced 1.0 {: .label .label-purple }

정책을 업데이트해요. seq_no 및 primary_term 매개변수를 사용하여 기존 정책을 업데이트하세요. 이 숫자가 기존 정책과 일치하지 않거나 정책이 존재하지 않으면 ISM이 오류를 발생시켜요.

현재 인덱스에 적용된 정책이 최신 정책이 아닐 수 있어요. 현재 인덱스에 적용된 정책을 보려면 인덱스 설명을 참조하세요. 최신 버전의 정책을 가져오려면 정책 가져오기를 참조하세요.

엔드포인트

PUT _plugins/_ism/policies/{policy_id}?if_seq_no={seq_no}&if_primary_term={primary_term}

요청 예시

PUT _plugins/_ism/policies/policy_1?if_seq_no=7&if_primary_term=1
{
  "policy": {
    "description": "ingesting logs",
    "default_state": "ingest",
    "states": [
      {
        "name": "ingest",
        "actions": [
          {
            "rollover": {
              "min_doc_count": 5
            }
          }
        ],
        "transitions": [
          {
            "state_name": "search"
          }
        ]
      },
      {
        "name": "search",
        "actions": [],
        "transitions": [
          {
            "state_name": "delete",
            "conditions": {
              "min_index_age": "5m"
            }
          }
        ]
      },
      {
        "name": "delete",
        "actions": [
          {
            "delete": {}
          }
        ],
        "transitions": []
      }
    ]
  }
}

{% include copy-curl.html %}

응답 예시

{
  "_id": "policy_1",
  "_version": 2,
  "_primary_term": 1,
  "_seq_no": 10,
  "policy": {
    "policy": {
      "policy_id": "policy_1",
      "description": "ingesting logs",
      "last_updated_time": 1577990934044,
      "schema_version": 1,
      "error_notification": null,
      "default_state": "ingest",
      "states": [
        {
          "name": "ingest",
          "actions": [
            {
              "retry": {
                "count": 3,
                "backoff": "exponential",
                "delay": "1m"
              },
              "rollover": {
                "min_doc_count": 5,
                "copy_alias": false
              }
            }
          ],
          "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
    }
  }
}

정책 가져오기

Introduced 1.0 {: .label .label-purple }

policy_id로 정책을 가져와요.

엔드포인트

GET _plugins/_ism/policies/{policy_id}

요청 예시

GET _plugins/_ism/policies/policy_1

{% include copy-curl.html %}

응답 예시

{
  "_id": "policy_1",
  "_version": 2,
  "_seq_no": 10,
  "_primary_term": 1,
  "policy": {
    "policy_id": "policy_1",
    "description": "ingesting logs",
    "last_updated_time": 1577990934044,
    "schema_version": 30,
    "error_notification": null,
    "default_state": "ingest",
    "states": [
      {
        "name": "ingest",
        "actions": [
          {
            "retry": {
              "count": 3,
              "backoff": "exponential",
              "delay": "1m"
            },
            "rollover": {
              "min_doc_count": 5,
              "copy_alias": false
            }
          }
        ],
        "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
  }
}

정책 목록 가져오기

Introduced 1.0 {: .label .label-purple }

정책 목록을 가져와요. 이 API는 검색 매개변수를 받아 결과를 필터링하고 페이지를 나눌 수 있어요.

엔드포인트

GET _plugins/_ism/policies

쿼리 매개변수

다음 표는 사용 가능한 쿼리 매개변수를 보여줘요. 모든 쿼리 매개변수는 선택사항이에요.

Parameter Data type Description
size Integer 반환할 정책 수예요.
from Integer 페이지네이션의 시작 위치예요.
sortField String 결과를 정렬할 필드예요. 저장된 정책 문서의 경로로 지정해요(예: policy.policy_id.keyword 또는 policy.last_updated_time). policy_id처럼 매핑되지 않은 이름은 400 오류와 함께 거부돼요.
sortOrder String 결과의 정렬 순서예요. 유효한 값은 asc(오름차순)와 desc(내림차순)이에요.
queryString String 이름이나 다른 속성으로 정책을 필터링하는 데 사용되는 쿼리 문자열이에요. Query string query를 참조하세요.

요청 예시

GET _plugins/_ism/policies

{% include copy-curl.html %}

응답 예시

각 항목에는 정책의 시퀀스 번호와 기본 텀이 포함되지만 _version은 포함되지 않아요. 간결함을 위해 각 정책의 states 배열은 다음 응답에서 생략했어요:

{
  "policies": [
    {
      "_id": "policy_1",
      "_seq_no": 10,
      "_primary_term": 1,
      "policy": {
        "policy_id": "policy_1",
        "description": "ingesting logs",
        "last_updated_time": 1577990934044,
        "schema_version": 30,
        "error_notification": null,
        "default_state": "ingest",
        "states": [],
        "ism_template": null
      }
    },
    {
      "_id": "policy_2",
      "_seq_no": 11,
      "_primary_term": 1,
      "policy": {
        "policy_id": "policy_2",
        "description": "ingesting logs",
        "last_updated_time": 1577990934042,
        "schema_version": 30,
        "error_notification": null,
        "default_state": "ingest",
        "states": [],
        "ism_template": null
      }
    }
  ],
  "total_policies": 2
}

인덱스에서 정책 제거

Introduced 1.0 {: .label .label-purple }

인덱스에서 모든 ISM 정책을 제거해요.

엔드포인트

POST _plugins/_ism/remove/{index}

요청 예시

POST _plugins/_ism/remove/index_1

{% include copy-curl.html %}

응답 예시

{
  "updated_indices": 1,
  "failures": false,
  "failed_indices": []
}

관리 인덱스 정책 업데이트

Introduced 1.0 {: .label .label-purple }

관리 인덱스 정책을 새 정책(또는 정책의 새 버전)으로 업데이트해요. 인덱스 패턴을 사용하여 여러 인덱스를 한 번에 업데이트할 수 있어요. 여러 인덱스를 업데이트할 때 특정 관리 인덱스에만 영향을 미치도록 상태 필터를 포함할 수 있어요. 변경 정책은 기존 관리 인덱스를 모두 필터링하고 지정한 상태에 있는 인덱스에만 변경을 적용해요. 또한 변경 정책이 적용된 후 관리 인덱스가 전환될 상태를 명시적으로 지정할 수 있어요.

정책 변경은 비동기 백그라운드 프로세스예요. 변경 사항은 대기열에 추가되고 백그라운드 프로세스에서 즉시 실행되지 않아요. 이 실행 지연은 현재 실행 중인 관리 인덱스가 손상된 상태가 되는 것을 보호해요. 변경하려는 정책에 약간의 구성 변경만 있는 경우 변경이 즉시 이루어져요. 예를 들어 정책이 롤오버 조건의 min_index_age 매개변수를 1000d에서 100d로 변경하면 다음 실행 시 즉시 변경돼요. 변경이 인덱스가 있는 현재 상태의 상태, 액션 또는 액션 순서를 수정하는 경우 변경은 새 상태로 전환되기 전에 현재 상태가 끝날 때 발생해요.

이 예제에서는 index_1 인덱스에 적용된 정책이 policy_1로 변경돼요. 이는 완전히 새로운 정책이거나 기존 정책의 업데이트된 버전일 수 있어요. 프로세스는 인덱스가 현재 searches 상태에 있는 경우에만 변경을 적용해요. 이 정책 변경이 이루어진 후 index_1은 delete 상태로 전환돼요.

엔드포인트

POST _plugins/_ism/change_policy/{index}

요청 예시

POST _plugins/_ism/change_policy/index_1
{
  "policy_id": "policy_1",
  "state": "delete",
  "include": [
    {
      "state": "searches"
    }
  ]
}

{% include copy-curl.html %}

응답 예시

{
  "updated_indices": 1,
  "failures": false,
  "failed_indices": []
}

변경 사항은 관리 인덱스에 대기열에 추가되고 다음 작업 실행 시 적용돼요. 따라서 updated_indices는 이미 새 정책으로 이동한 인덱스가 아니라 변경 정책이 기록된 인덱스를 계산해요.


실패한 인덱스 재시도

Introduced 1.0 {: .label .label-purple }

인덱스에 대해 실패한 액션을 재시도해요. 재시도 호출이 성공하려면 ISM이 인덱스를 관리하고 있어야 하며 인덱스가 실패 상태여야 해요. 인덱스 패턴(*)을 사용하여 여러 실패한 인덱스를 재시도할 수 있어요.

인덱스 설명을 사용하여 인덱스가 실패 상태인지 확인하세요. action 객체에 "failed": true가 포함되고 step 객체에 "step_status": "failed"가 포함되어 있어요.

선택적으로 요청 본문에 state를 지정하여 인덱스가 실패한 상태 대신 해당 상태에서 다시 시작할 수 있어요.

엔드포인트

POST _plugins/_ism/retry/{index}

요청 예시

POST _plugins/_ism/retry/index_1
{
  "state": "hot"
}

{% include copy-curl.html %}

응답 예시

{
  "updated_indices": 1,
  "failures": false,
  "failed_indices": []
}

인덱스가 실패 상태가 아니면 응답은 failed_indices에 인덱스를 보고해요:

{
  "updated_indices": 0,
  "failures": true,
  "failed_indices": [
    {
      "index_name": "index_1",
      "index_uuid": "t6a6I5YDQTiXY9c7cymI_w",
      "reason": "This index is not in failed state."
    }
  ]
}

인덱스 설명

Introduced 1.0 {: .label .label-purple }

인덱스의 현재 상태를 가져와요. 인덱스 패턴을 사용하여 여러 인덱스의 상태를 가져올 수 있어요.

엔드포인트

GET _plugins/_ism/explain/{index}

요청 예시

GET _plugins/_ism/explain/index_1

{% include copy-curl.html %}

응답 예시

{
  "index_1": {
    "index.plugins.index_state_management.policy_id": "policy_1",
    "index.opendistro.index_state_management.policy_id": "policy_1",
    "index": "index_1",
    "index_uuid": "t6a6I5YDQTiXY9c7cymI_w",
    "policy_id": "policy_1",
    "enabled": true
  },
  "total_managed_indices": 1
}

정책을 추가한 직후에는 응답의 필드가 null이고 total_managed_indices는 0이에요. ISM은 다음 스윕 시 관리 인덱스 작업을 생성하고 그때부터 응답이 채워져요. {: .note}

선택적으로 요청 경로에 show_policy 매개변수를 추가하여 현재 인덱스에 적용된 정책을 가져올 수 있어요. 이는 인덱스에 적용된 정책이 최신 정책인지 확인하는 데 유용해요. 최신 정책을 가져오려면 Get Policy API를 참조하세요.

요청 예시

GET _plugins/_ism/explain/index_1?show_policy=true

{% include copy-curl.html %}

응답 예시

{
  "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": 30,
      "error_notification": null,
      "default_state": "ingest",
      "states": [],
      "ism_template": null
    }
  },
  "total_managed_indices": 1
}

plugins.index_state_management.policy_id 설정은 ODFE 버전 1.13.0부터 더 이상 사용되지 않아요. 일관성을 위해 응답 API에서 이 필드를 유지해요.

필터링을 사용한 인덱스 설명

Introduced 2.12 {: .label .label-purple }

Explain API와 함께 POST 메서드를 사용하여 특정 기준에 따라 결과를 필터링할 수 있어요. 이를 통해 정책 ID, 현재 상태 또는 액션 유형을 기준으로 인덱스를 쿼리할 수 있어요.

엔드포인트

POST _plugins/_ism/explain/{index}

요청 본문

요청 본문은 다음 선택적 필터를 지원해요. 필터를 지정하지 않으면 해당 매개변수에 모든 값이 있는 인덱스가 결과에 포함돼요. API는 지정된 모든 필터와 일치하는 인덱스만 반환해요.

Parameter Type Description
policy_id String 지정된 정책 ID로 관리되는 인덱스만 표시하도록 결과를 필터링해요.
state String 현재 지정된 상태에 있는 인덱스만 표시하도록 결과를 필터링해요.
action_type String 현재 지정된 액션 유형을 실행 중인 인덱스만 표시하도록 결과를 필터링해요.
failed Boolean 실패한 관리 인덱스만 표시하도록 결과를 필터링해요.

요청 예시: 정책 ID로 필터링

POST _plugins/_ism/explain/log-*
{
  "filter": {
    "policy_id": "hot-warm-delete-policy"
  }
}

{% include copy-curl.html %}

요청 예시: 상태 및 액션 유형으로 필터링

POST _plugins/_ism/explain/app-*
{
  "filter": {
    "state": "warm",
    "action_type": "allocation"
  }
}

{% include copy-curl.html %}

요청 예시: 모든 기준으로 필터링

POST _plugins/_ism/explain/data-*
{
  "filter": {
    "policy_id": "data-lifecycle-policy",
    "state": "hot",
    "action_type": "rollover"
  }
}

{% include copy-curl.html %}

응답 예시

응답 {: .text-delta}
{
  "test-logs-001": {
    "index.plugins.index_state_management.policy_id": "test-lifecycle-policy",
    "index": "test-logs-001",
    "index_uuid": "LmJgKNatQZWHQu-qIHlcJw",
    "policy_id": "test-lifecycle-policy",
    "enabled": true,
    "policy": {
      "policy_id": "test-lifecycle-policy",
      "description": "Lifecycle policy for log data: hot -> warm -> cold -> delete",
      "last_updated_time": 1730308440926,
      "schema_version": 30,
      "error_notification": null,
      "default_state": "hot",
      "states": [
        {
          "name": "hot",
          "actions": [
            {
              "rollover": {
                "min_doc_count": 10000,
                "min_size": "1gb",
                "min_index_age": "1d"
              }
            }
          ],
          "transitions": [
            {
              "state_name": "warm",
              "conditions": {
                "min_index_age": "7d"
              }
            }
          ]
        },
        {
          "name": "warm",
          "actions": [
            {
              "replica_count": {
                "number_of_replicas": 0
              }
            }
          ],
          "transitions": [
            {
              "state_name": "cold",
              "conditions": {
                "min_index_age": "30d"
              }
            }
          ]
        },
        {
          "name": "cold",
          "actions": [],
          "transitions": [
            {
              "state_name": "delete",
              "conditions": {
                "min_index_age": "90d"
              }
            }
          ]
        },
        {
          "name": "delete",
          "actions": [
            {
              "delete": {}
            }
          ],
          "transitions": []
        }
      ],
      "ism_template": null
    },
    "policy_seq_no": 0,
    "policy_primary_term": 1,
    "rolled_over": false,
    "index_creation_date": 1730308447399,
    "state": {
      "name": "hot",
      "start_time": 1730308447644
    },
    "action": {
      "name": "rollover",
      "start_time": 1730308447644,
      "index": 0,
      "failed": false,
      "consumed_retries": 0,
      "last_retry_time": 0
    },
    "step": {
      "name": "attempt_rollover",
      "start_time": 1730308447644,
      "step_status": "starting"
    },
    "retry_info": {
      "failed": false,
      "consumed_retries": 0
    },
    "info": {
      "message": "Currently checking rollover conditions"
    },
    "enabled": true,
    "enabled_time": 1730308447644
  },
  "total_managed_indices": 1
}

Simulate policy

Introduced 3.7 {: .label .label-purple }

정책이 하나 이상의 인덱스에 어떻게 적용될지 변경 없이 미리 보여줘요. 각 인덱스에 대해 응답에는 현재 상태, 실행할 다음 작업, 모든 전환 조건의 평가, 인덱스가 다음으로 이동할 상태가 포함돼요. 이 엔드포인트를 사용하여 정책을 연결하기 전에 검증하거나 인덱스가 예상대로 전환되지 않는 이유를 디버깅할 수 있어요.

policy_id 또는 policy 중 정확히 하나를 제공해야 해요.

Endpoints

POST _plugins/_ism/simulate

요청 본문 필드

다음 표는 사용 가능한 요청 본문 필드를 나열해요.

Field Type Required Description
policy_id String Conditional 시뮬레이션할 저장된 ISM 정책의 ID예요. policy가 제공되지 않은 경우 필수예요.
policy Object Conditional 저장하지 않고 시뮬레이션할 인라인 정책 정의예요. policy_id가 제공되지 않은 경우 필수예요.
indices Array of strings Yes 시뮬레이션할 인덱스 이름 또는 와일드카드 패턴이에요. 와일드카드 패턴은 일치하는 구체적인 인덱스로 확장돼요. 일치하는 인덱스가 없는 패턴은 자동으로 무시돼요. 존재하지 않는 구체적인 인덱스 이름은 인덱스별 결과에 오류를 반환해요.

응답 본문 필드

다음 표는 모든 응답 본문 필드를 나열해요. 응답에는 인덱스당 하나의 항목이 있는 simulate_results 배열이 포함돼요.

Field Type Description
index_name String 인덱스의 이름이에요.
index_uuid String 인덱스의 UUID예요. 인덱스를 찾을 수 없는 경우 null이에요.
policy_id String 시뮬레이션에 사용된 정책의 ID예요. 인라인 정책의 경우 빈 문자열이에요.
is_managed Boolean 인덱스가 ISM에 의해 관리되는지 여부예요.
current_state String 인덱스가 현재 있는 상태 또는 관리되지 않는 인덱스의 경우 시작될 상태예요. error가 있는 경우 생략돼요.
current_action String 현재 상태에서 다음으로 실행될 작업이에요. error가 있는 경우 생략돼요.
transition_evaluation Array 전환별 조건 평가예요. 인덱스가 전환 단계(보류 중인 작업 없음)에 있을 때만 표시돼요. error가 있는 경우 생략돼요.
next_state String 인덱스가 전환될 상태(첫 번째 충족 조건)예요. 충족된 조건이 없으면 null이에요. error가 있는 경우 생략돼요.
error String 인덱스 수준 오류 메시지예요. 인덱스가 존재하지 않거나 다른 인덱스 수준 오류가 발생한 경우 표시돼요. 이 필드가 있는 경우 index_name, index_uuid, policy_id, is_managed를 제외한 모든 다른 필드는 생략돼요.

transition_evaluation의 각 객체에는 다음 필드가 포함돼요.

Field Type Description
state_name String 이 전환이 인덱스를 이동시킬 대상 상태예요.
condition_met Boolean 전환 조건이 충족되었는지 여부예요.
condition_type String 조건 유형(예: min_index_age, min_doc_count, min_size)이에요. 조건이 없는 전환의 경우 unconditional로 설정돼요.
current_value String 확인 중인 메트릭의 현재 값으로, 읽을 수 있는 문자열로 형식화돼요(예: "3d 4h"). 무조건 전환의 경우 생략돼요.
required_value String 조건에 필요한 임계값으로, 읽을 수 있는 문자열로 형식화돼요(예: "7d"). 무조건 전환의 경우 생략돼요.

예제 요청: 저장된 정책 시뮬레이션

다음 요청은 policy_1 정책을 index_1과 존재하지 않는 인덱스에 대해 시뮬레이션해요.

POST _plugins/_ism/simulate
{
  "policy_id": "policy_1",
  "indices": ["index_1", "nonexistent-index"]
}

{% include copy-curl.html %}

예제 응답: 저장된 정책 시뮬레이션

첫 번째 결과는 index_1이 ingest 상태에서 시작하여 다음 작업으로 rollover를 갖게 됨을 보여줘요. 두 번째 결과는 인덱스가 클러스터에 존재하지 않을 때 구체적인 인덱스 이름이 반환하는 error 필드를 보여줘요.

{
  "simulate_results": [
    {
      "index_name": "index_1",
      "index_uuid": "CNMBFMEIR12NYiOeW-pX4A",
      "policy_id": "policy_1",
      "is_managed": false,
      "current_state": "ingest",
      "current_action": "rollover",
      "next_state": null
    },
    {
      "index_name": "nonexistent-index",
      "index_uuid": null,
      "policy_id": "policy_1",
      "is_managed": false,
      "error": "Index 'nonexistent-index' not found in cluster"
    }
  ]
}

예제 요청: 인라인 정책 시뮬레이션

다음 요청은 클러스터에 저장되지 않은 정책을 시뮬레이션해요.

POST _plugins/_ism/simulate
{
  "policy": {
    "description": "hot-warm lifecycle",
    "default_state": "hot",
    "states": [
      {
        "name": "hot",
        "actions": [],
        "transitions": [
          {
            "state_name": "warm",
            "conditions": { "min_index_age": "7d" }
          }
        ]
      },
      { "name": "warm", "actions": [], "transitions": [] }
    ]
  },
  "indices": ["index_1"]
}

{% include copy-curl.html %}

예제 응답: 인라인 정책 시뮬레이션

hot 상태가 작업을 정의하지 않기 때문에 다음 작업은 전환 자체예요, 그래서 응답에 transition_evaluation 배열이 포함돼요. min_index_age 조건이 충족되지 않으므로 next_state는 null이에요. 정책이 저장되지 않았기 때문에 policy_id 필드는 빈 문자열이에요.

{
  "simulate_results": [
    {
      "index_name": "index_1",
      "index_uuid": "CNMBFMEIR12NYiOeW-pX4A",
      "policy_id": "",
      "is_managed": false,
      "current_state": "hot",
      "current_action": "transition",
      "transition_evaluation": [
        {
          "state_name": "warm",
          "condition_met": false,
          "condition_type": "min_index_age",
          "current_value": "8.5s",
          "required_value": "7d"
        }
      ],
      "next_state": null
    }
  ]
}

Delete policy

Introduced 1.0 {: .label .label-purple }

policy_id로 정책을 삭제해요.

Endpoints

DELETE _plugins/_ism/policies/{policy_id}

예제 요청

DELETE _plugins/_ism/policies/policy_1

{% include copy-curl.html %}

예제 응답

{
  "_index": ".opendistro-ism-config",
  "_id": "policy_1",
  "_version": 3,
  "result": "deleted",
  "forced_refresh": true,
  "_shards": {
    "total": 2,
    "successful": 2,
    "failed": 0
  },
  "_seq_no": 15,
  "_primary_term": 1
}

Error prevention validation

Introduced 2.4 {: .label .label-purple }

ISM은 작업을 자동으로 실행해요. 그러나 작업은 다양한 이유로 실패할 수 있어요. 오류 방지 검증을 사용하여 작업을 테스트하고 잠재적인 실패를 식별할 수 있어요.

오류 방지 검증을 활성화하려면 plugins.index_state_management.action_validation.enabled를 true로 설정하세요.

PUT _cluster/settings
{
   "persistent": {
      "plugins.index_state_management.action_validation.enabled": true
   }
}

{% include copy-curl.html %}

예제 응답

다음 응답은 설정이 업데이트되었음을 확인해요.

{
  "acknowledged" : true,
  "persistent" : {
    "plugins" : {
      "index_state_management" : {
        "action_validation" : {
          "enabled" : "true"
        }
      }
    }
  },
  "transient" : { }
}

오류 방지 검증 상태와 메시지를 검색하려면 _plugins/_ism/explain 엔드포인트에 validate_action=true를 전달하세요.

GET _plugins/_ism/explain/test-000001?validate_action=true

{% include copy-curl.html %}

예제 응답

응답에는 검증 메시지와 상태가 포함된 추가 validate 객체가 포함돼요.

{
  "test-000001" : {
    "index.plugins.index_state_management.policy_id" : "test_rollover",
    "index.opendistro.index_state_management.policy_id" : "test_rollover",
    "index" : "test-000001",
    "index_uuid" : "CgKsxFmQSIa8dWqpbSJmyA",
    "policy_id" : "test_rollover",
    "policy_seq_no" : -2,
    "policy_primary_term" : 0,
    "rolled_over" : false,
    "index_creation_date" : 1667410460649,
    "state" : {
      "name" : "rollover",
      "start_time" : 1667410766045
    },
    "action" : {
      "name" : "rollover",
      "start_time" : 1667411127803,
      "index" : 0,
      "failed" : false,
      "consumed_retries" : 0,
      "last_retry_time" : 0
    },
    "step" : {
      "name" : "attempt_rollover",
      "start_time" : 1667411127803,
      "step_status" : "starting"
    },
    "retry_info" : {
      "failed" : true,
      "consumed_retries" : 0
    },
    "info" : {
      "message" : "Previous action was not able to update IndexMetaData."
    },
    "enabled" : false,
    "validate" : {
      "validation_message" : "Missing rollover_alias index setting [index=test-000001]",
      "validation_status" : "re_validating"
    }
  },
  "total_managed_indices" : 1
}

validate_action=false를 전달하거나 validate_action 매개변수를 생략하면 응답에 검증 상태와 메시지가 포함되지 않아요.

GET _plugins/_ism/explain/test-000001?validate_action=false

{% include copy-curl.html %}

GET _plugins/_ism/explain/test-000001

{% include copy-curl.html %}

예제 응답

{
  "test-000001" : {
    "index.plugins.index_state_management.policy_id" : "test_rollover",
    "index.opendistro.index_state_management.policy_id" : "test_rollover",
    "index" : "test-000001",
    "index_uuid" : "CgKsxFmQSIa8dWqpbSJmyA",
    "policy_id" : "test_rollover",
    "policy_seq_no" : -2,
    "policy_primary_term" : 0,
    "rolled_over" : false,
    "index_creation_date" : 1667410460649,
    "state" : {
      "name" : "rollover",
      "start_time" : 1667410766045
    },
    "action" : {
      "name" : "rollover",
      "start_time" : 1667411127803,
      "index" : 0,
      "failed" : false,
      "consumed_retries" : 0,
      "last_retry_time" : 0
    },
    "step" : {
      "name" : "attempt_rollover",
      "start_time" : 1667411127803,
      "step_status" : "starting"
    },
    "retry_info" : {
      "failed" : true,
      "consumed_retries" : 0
    },
    "info" : {
      "message" : "Previous action was not able to update IndexMetaData."
    },
    "enabled" : false
  },
  "total_managed_indices" : 1
}

더 알아보기 (Learn more)