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

Common operations

원문 보기 위키 갱신

출처: 문서

본문

일반적인 작업

테스트 절차는 워크로드의 operations 디렉터리 안에 있는 다양한 작업을 사용해요. 이 페이지는 OpenSearch Benchmark 워크로드에서 찾을 수 있는 가장 일반적인 작업들을 자세히 설명해요.

bulk

bulk operation type을 사용하면 bulk 요청을 작업으로 실행할 수 있어요.

다음 예제는 bulk-size가 5000 문서인 bulk operation type을 보여줘요.

{
  "name": "index-append",
  "operation-type": "bulk",
  "bulk-size": 5000
}

create-index

create-index 작업은 Create Index API를 실행해요. 다음 두 가지 인덱스 생성 모드를 지원해요:

  • 워크로드의 indices 섹션에 지정된 모든 인덱스 생성
  • 작업 자체 내에 정의된 특정 인덱스 하나 생성

다음 예제는 워크로드의 indices 섹션에 정의된 모든 인덱스를 생성해요. 워크로드에 정의된 모든 인덱스 설정을 사용하지만 샤드 수는 재정의해요:

{
  "name": "create-all-indices",
  "operation-type": "create-index",
  "settings": {
    "index.number_of_shards": 1
  },
  "request-params": {
    "wait_for_active_shards": "true"
  }
}

다음 예제는 작업 본문에 지정된 모든 인덱스 설정으로 새 인덱스를 생성해요:

{
  "name": "create-an-index",
  "operation-type": "create-index",
  "index": "people",
  "body": {
    "settings": {
      "index.number_of_shards": 0
    },
    "mappings": {
      "docs": {
        "properties": {
          "name": {
            "type": "text"
          }
        }
      }
    }
  }
}

delete-index

delete-index 작업은 Delete Index API를 실행해요. create-index 작업과 마찬가지로 워크로드의 indices 섹션에 있는 모든 인덱스를 삭제하거나 index 설정에 전달된 문자열을 기반으로 하나 이상의 인덱스를 삭제할 수 있어요.

다음 예제는 워크로드의 indices 섹션에 있는 모든 인덱스를 삭제해요:

{
  "name": "delete-all-indices",
  "operation-type": "delete-index"
}

다음 예제는 모든 logs_* 인덱스를 삭제해요:

{
  "name": "delete-logs",
  "operation-type": "delete-index",
  "index": "logs-*",
  "only-if-exists": false,
  "request-params": {
    "expand_wildcards": "all",
    "allow_no_indices": "true",
    "ignore_unavailable": "true"
  }
}

cluster-health

cluster-health 작업은 Cluster Health API를 실행해요. 이 API는 클러스터 상태를 확인하고 request-params에 설정된 매개변수에 따라 예상된 상태를 반환해요. 예상치 못한 클러스터 상태가 반환되면 작업은 실패를 보고해요. OpenSearch Benchmark run 명령에서 --on-error 옵션을 사용하여 상태 확인이 실패할 때 OpenSearch Benchmark가 어떻게 동작할지 제어할 수 있어요.

다음 예제는 log-* 인덱스에서 green 상태를 확인하는 cluster-health 작업을 생성해요:

{
  "name": "check-cluster-green",
  "operation-type": "cluster-health",
  "index": "logs-*",
  "request-params": {
    "wait_for_status": "green",
    "wait_for_no_relocating_shards": "true"
  },
  "retry-until-success": true
}

refresh

refresh 작업은 Refresh API를 실행해요. 이 작업은 메타데이터를 반환하지 않아요.

다음 예제는 모든 logs-* 인덱스를 새로고침해요:

{
 "name": "refresh",
 "operation-type": "refresh",
 "index": "logs-*"
}

search 작업은 Search API를 실행해요. 이 API를 사용하여 OpenSearch Benchmark 인덱스에서 쿼리를 실행할 수 있어요.

다음 예제는 search 작업 내에서 match_all 쿼리를 실행해요:

{
  "name": "default",
  "operation-type": "search",
  "body": {
    "query": {
      "match_all": {}
    }
  },
  "request-params": {
    "_source_include": "some_field",
    "analyze_wildcard": "false"
  }
}

더 알아보기 (Learn more)