컬렉션 생성(CLI) - Amazon OpenSearch Service

기계 번역으로 제공되는 번역입니다. 제공된 번역과 원본 영어의 내용이 상충하는 경우에는 영어 버전이 우선합니다.

컬렉션 생성(CLI)

이 섹션의 절차에 따라를 사용하여 OpenSearch Serverless 컬렉션을 생성합니다 AWS CLI.

시작하기 전 준비 사항

를 사용하여 컬렉션을 생성하기 전에 다음 절차에 AWS CLI따라 컬렉션에 필요한 정책을 생성합니다.

참고

다음 각 절차에서 컬렉션의 이름을 지정할 때 이름은 다음 기준을 충족해야 합니다.

  • 계정 및에 고유합니다. AWS 리전

  • 소문자 a~z, 숫자 0~9 및 하이픈(-)만 포함할 것

  • 3~32자 사이일 것

컬렉션에 필요한 정책을 생성하려면
  1. 를 열고 다음 명령을 AWS CLI 실행하여 컬렉션의 의도한 이름과 일치하는 리소스 패턴으로 암호화 정책을 생성합니다.

    aws opensearchserverless create-security-policy \ --name policy name \ --type encryption --policy "{\"Rules\":[{\"ResourceType\":\"collection\",\"Resource\":[\"collection\/collection name\"]}],\"AWSOwnedKey\":true}"

    예를 들어 컬렉션 로그 애플리케이션의 이름을 지정하려는 경우 다음과 같은 암호화 정책을 생성할 수 있습니다.

    aws opensearchserverless create-security-policy \ --name logs-policy \ --type encryption --policy "{\"Rules\":[{\"ResourceType\":\"collection\",\"Resource\":[\"collection\/logs-application\"]}],\"AWSOwnedKey\":true}"

    정책을 추가 컬렉션에 사용하려는 경우 collection/logs* 또는 collection/*과 같이 규칙을 더 광범위하게 만들 수 있습니다.

  2. 다음 명령을 실행하여 네트워크 정책을 사용하여 컬렉션에 대한 네트워크 설정을 구성합니다. 컬렉션을 생성한 후에 네트워크 정책을 생성해도 되지만, 네트워크 정책은 컬렉션보다 먼저 생성하는 것이 좋습니다.

    aws opensearchserverless create-security-policy \ --name policy name \ --type network --policy "[{\"Description\":\"description\",\"Rules\":[{\"ResourceType\":\"dashboard\",\"Resource\":[\"collection\/collection name\"]},{\"ResourceType\":\"collection\",\"Resource\":[\"collection\/collection name\"]}],\"AllowFromPublic\":true}]"

    이전 로그 애플리케이션 예시를 사용하여 다음과 같은 네트워크 정책을 생성할 수 있습니다.

    aws opensearchserverless create-security-policy \ --name logs-policy \ --type network --policy "[{\"Description\":\"Public access for logs collection\",\"Rules\":[{\"ResourceType\":\"dashboard\",\"Resource\":[\"collection\/logs-application\"]},{\"ResourceType\":\"collection\",\"Resource\":[\"collection\/logs-application\"]}],\"AllowFromPublic\":true}]"

컬렉션 생성

다음 절차에서는 CreateCollection API 작업을 사용하여 SEARCH 또는 유형의 컬렉션을 생성합니다TIMESERIES. 요청에 컬렉션 유형을 지정하지 않으면 기본값은 TIMESERIES입니다. 이러한 유형에 대한 자세한 내용은 섹션을 참조하세요컬렉션 유형 선택. 벡터 검색 컬렉션을 만들려면 벡터 검색 컬렉션 작업(을)를 참조하세요.

컬렉션이 로 암호화된 경우 AWS 소유 키kmsKeyArn는 ARNauto이 아니라 입니다.

중요

컬렉션을 생성한 후에는 데이터 액세스 정책과 일치하지 않는 한 컬렉션에 액세스할 수 없습니다. 자세한 내용은 Amazon OpenSearch Serverless를 위한 데이터 액세스 제어 단원을 참조하십시오.

컬렉션 생성
  1. 에 설명된 필수 정책을 생성했는지 확인합니다시작하기 전 준비 사항.

  2. 다음 명령을 실행합니다. 에 SEARCH 또는를 type 지정합니다TIMESERIES.

    aws opensearchserverless create-collection --name "collection name" --type collection type --description "description"

자동 의미 체계 보강 인덱스를 사용하여 컬렉션 생성

다음 절차에 따라 자동 의미 체계 보강을 위해 구성된 인덱스를 사용하여 새 OpenSearch Serverless 컬렉션을 생성합니다. 이 절차에서는 OpenSearch Serverless CreateIndex API 작업을 사용합니다.

인덱스가 자동 의미 체계 보강을 위해 구성된 새 컬렉션을 생성하려면

다음 명령을 실행하여 컬렉션과 인덱스를 생성합니다.

aws opensearchserverless create-index \ --region Region ID \ --id collection name --index-name index name \ --index-schema \ 'mapping in json'

다음은 그 예입니다.

aws opensearchserverless create-index \ --region us-east-1 \ --id conversation_history --index-name conversation_history_index \ --index-schema \ '{ "mappings": { "properties": { "age": { "type": "integer" }, "name": { "type": "keyword" }, "user_description": { "type": "text" }, "conversation_history": { "type": "text", "semantic_enrichment": { "status": "ENABLED", // Specifies the sparse tokenizer for processing multi-lingual text "language_option": "MULTI-LINGUAL", // If embedding_field is provided, the semantic embedding field will be set to the given name rather than original field name + "_embedding" "embedding_field": "conversation_history_user_defined" } }, "book_title": { "type": "text", "semantic_enrichment": { // No embedding_field is provided, so the semantic embedding field is set to "book_title_embedding" "status": "ENABLED", "language_option": "ENGLISH" } }, "abstract": { "type": "text", "semantic_enrichment": { // If no language_option is provided, it will be set to English. // No embedding_field is provided, so the semantic embedding field is set to "abstract_embedding" "status": "ENABLED" } } } } }'