Asynchronous Batch Ingestion API
출처: 문서
본문
비동기 배치 수집 API
3.0부터 사용 중단 {: .label .label-red }
이 기능은 사용이 중단되었어요. 비슷한 기능을 위해서는 OpenSearch Data Prepper를 사용하세요. 이 기능이 다시 도입되길 원한다면 ML Commons 저장소에서 이슈를 생성하세요. {: .warning}
비동기 배치 수집 API를 사용하여 원격 파일 서버(예: Amazon Simple Storage Service(Amazon S3) 또는 OpenAI)의 파일에서 OpenSearch 클러스터로 데이터를 수집할 수 있어요. 자세한 구성 단계는 비동기 배치 수집을 참조하세요.
엔드포인트
POST /_plugins/_ml/_batch_ingestion
요청 본문 필드
다음 표는 사용 가능한 요청 필드를 보여줘요.
필드 | 데이터 타입 | 필수/선택 | 설명
:--- | :--- | :---
index_name| String | Required | 인덱스 이름.
field_map | Object | Required | 소스 파일의 필드를 수집을 위해 OpenSearch 인덱스의 특정 필드에 매핑.
ingest_fields | Array | Optional | 추가 매핑 없이 OpenSearch 인덱스로 직접 수집해야 하는 소스 파일의 필드를 나열.
credential | Object | Required | Amazon S3 또는 OpenAI와 같은 외부 데이터 소스에 접근하기 위한 인증 정보 포함.
data_source | Object | Required | 데이터가 수집되는 외부 파일의 유형과 위치 지정.
data_source.type | String | Required | 외부 데이터 소스의 유형 지정. 유효한 값은 s3 및 openAI.
data_source.source | Array | Required | 데이터가 수집되는 하나 이상의 파일 위치 지정. s3의 경우 Amazon S3 버킷의 파일 경로 지정(예: ["s3://offlinebatch/output/sagemaker_batch.json.out"]). openAI의 경우 입력 또는 출력 파일의 파일 ID 지정(예: ["file-<your output file id>", "file-<your input file id>", "file-<your other file>"]).
예제 요청: 단일 파일 수집
POST /_plugins/_ml/_batch_ingestion
{
"index_name": "my-nlp-index",
"field_map": {
"chapter": "$.content[0]",
"title": "$.content[1]",
"chapter_embedding": "$.SageMakerOutput[0]",
"title_embedding": "$.SageMakerOutput[1]",
"_id": "$.id"
},
"ingest_fields": ["$.id"],
"credential": {
"region": "us-east-1",
"access_key": "<your access key>",
"secret_key": "<your secret key>",
"session_token": "<your session token>"
},
"data_source": {
"type": "s3",
"source": ["s3://offlinebatch/output/sagemaker_batch.json.out"]
}
}
{% include copy-curl.html %}
예제 요청: 여러 파일 수집
POST /_plugins/_ml/_batch_ingestion
{
"index_name": "my-nlp-index-openai",
"field_map": {
"question": "source[1].$.body.input[0]",
"answer": "source[1].$.body.input[1]",
"question_embedding":"source[0].$.response.body.data[0].embedding",
"answer_embedding":"source[0].$.response.body.data[1].embedding",
"_id": ["source[0].$.custom_id", "source[1].$.custom_id"]
},
"ingest_fields": ["source[2].$.custom_field1", "source[2].$.custom_field2"],
"credential": {
"openAI_key": "<you openAI key>"
},
"data_source": {
"type": "openAI",
"source": ["file-<your output file id>", "file-<your input file id>", "file-<your other file>"]
}
}
{% include copy-curl.html %}
예제 응답
{
"task_id": "cbsPlpEBMHcagzGbOQOx",
"task_type": "BATCH_INGEST",
"status": "CREATED"
}