選取您的 Cookie 偏好設定

我們使用提供自身網站和服務所需的基本 Cookie 和類似工具。我們使用效能 Cookie 收集匿名統計資料,以便了解客戶如何使用我們的網站並進行改進。基本 Cookie 無法停用,但可以按一下「自訂」或「拒絕」以拒絕效能 Cookie。

如果您同意,AWS 與經核准的第三方也會使用 Cookie 提供實用的網站功能、記住您的偏好設定,並顯示相關內容,包括相關廣告。若要接受或拒絕所有非必要 Cookie,請按一下「接受」或「拒絕」。若要進行更詳細的選擇,請按一下「自訂」。

更新儲存庫

焦點模式
更新儲存庫 - Amazon Kendra

本文為英文版的機器翻譯版本,如內容有任何歧義或不一致之處,概以英文版為準。

本文為英文版的機器翻譯版本,如內容有任何歧義或不一致之處,概以英文版為準。

您可以在建立儲存庫之後變更儲存庫的組態。您可以變更詳細資訊,例如saurus 名稱和 IAM 資訊。您也可以變更saurus 檔案 Amazon S3 路徑的位置。如果您變更儲存庫檔案的路徑, Amazon Kendra 會將現有的儲存庫取代為更新路徑中指定的儲存庫。

最多可能需要 30 分鐘才能查看更新後之saurus 檔案的效果。

注意

如果saurus 檔案中有驗證或語法錯誤,先前上傳的saurus 檔案會保留。

下列程序說明如何修改saurus 詳細資訊。

Console
修改saurus 詳細資訊
  1. 在左側導覽窗格中,於您要修改的索引下,選擇同義詞

  2. 同義詞頁面上,選取您要修改的儲存庫,然後選擇編輯

  3. 更新儲存庫頁面上,更新儲存庫詳細資訊。

  4. (選用) 選擇變更saurus 檔案路徑,然後指定新 thesaurus 檔案的 Amazon S3 路徑。您指定的檔案會取代現有的 saurus 檔案。如果您不變更路徑, 會從現有路徑 Amazon Kendra 重新載入儲存庫。

    如果您選取保留目前的儲存庫檔案, Amazon Kendra 不會重新載入儲存庫檔案。

  5. 選擇儲存以儲存組態。

您也可以從現有的儲存庫路徑重新載入儲存庫。

從現有路徑重新載入儲存庫
  1. 在左側導覽窗格中,於您要修改的索引下,選擇同義詞

  2. 同義詞頁面上,選取您要重新載入的儲存庫,然後選擇重新整理

  3. 重新載入saurus 檔案頁面上,確認您要重新整理saurus 檔案。

CLI

若要更新儲存庫,請呼叫 update-thesaurus

aws kendra update-thesaurus \ --index-id index-id \ --name "thesaurus-name" \ --description "thesaurus-description" \ --source-s3-path "Bucket=bucket-name,Key=thesaurus/synonyms.txt" \ --role-arn role-arn
Python
import boto3 from botocore.exceptions import ClientError import pprint import time kendra = boto3.client("kendra") print("Update a thesaurus") thesaurus_name = "thesaurus-name" thesaurus_description = "thesaurus-description" thesaurus_role_arn = "role-arn" thesaurus_id = "thesaurus-id" index_id = "index-id" s3_bucket_name = "bucket-name" s3_key = "thesaurus-file" source_s3_path= { 'Bucket': s3_bucket_name, 'Key': s3_key } try: kendra.update_thesaurus( Id = thesaurus_id, IndexId = index_id, Description = thesaurus_description, Name = thesaurus_name, RoleArn = thesaurus_role_arn, SourceS3Path = source_s3_path ) print("Wait for Kendra to update the thesaurus.") while True: # Get thesaurus description thesaurus_description = kendra.describe_thesaurus( Id = thesaurus_id, IndexId = index_id ) # If status is not UPDATING quit status = thesaurus_description["Status"] print("Updating thesaurus. Status: " + status) if status != "UPDATING": break time.sleep(60) except ClientError as e: print("%s" % e) print("Program ends.")
Java
package com.amazonaws.kendra; import software.amazon.awssdk.services.kendra.KendraClient; import software.amazon.awssdk.services.kendra.model.UpdateThesaurusRequest; import software.amazon.awssdk.services.kendra.model.DescribeThesaurusRequest; import software.amazon.awssdk.services.kendra.model.DescribeThesaurusResponse; import software.amazon.awssdk.services.kendra.model.S3Path; import software.amazon.awssdk.services.kendra.model.ThesaurusStatus; public class UpdateThesaurusExample { public static void main(String[] args) throws InterruptedException { KendraClient kendra = KendraClient.builder().build(); String thesaurusName = "thesaurus-name"; String thesaurusDescription = "thesaurus-description"; String thesaurusRoleArn = "role-arn"; String s3BucketName = "bucket-name"; String s3Key = "thesaurus-file"; String thesaurusId = "thesaurus-id"; String indexId = "index-id"; UpdateThesaurusRequest updateThesaurusRequest = UpdateThesaurusRequest .builder() .id(thesaurusId) .indexId(indexId) .name(thesaurusName) .description(thesaurusDescription) .roleArn(thesaurusRoleArn) .sourceS3Path(S3Path.builder() .bucket(s3BucketName) .key(s3Key) .build()) .build(); kendra.updateThesaurus(updateThesaurusRequest); System.out.println(String.format("Waiting until the thesaurus with ID %s is updated.", thesaurusId)); // a new source s3 path requires re-consumption by Kendra // and so can take as long as a Create Thesaurus operation while (true) { DescribeThesaurusRequest describeThesaurusRequest = DescribeThesaurusRequest.builder() .id(thesaurusId) .indexId(indexId) .build(); DescribeThesaurusResponse describeThesaurusResponse = kendra.describeThesaurus(describeThesaurusRequest); ThesaurusStatus status = describeThesaurusResponse.status(); if (status != ThesaurusStatus.UPDATING) { break; } TimeUnit.SECONDS.sleep(60); } System.out.println("Thesaurus update is complete."); } }
修改saurus 詳細資訊
  1. 在左側導覽窗格中,於您要修改的索引下,選擇同義詞

  2. 同義詞頁面上,選取您要修改的儲存庫,然後選擇編輯

  3. 更新儲存庫頁面上,更新儲存庫詳細資訊。

  4. (選用) 選擇變更saurus 檔案路徑,然後指定新 thesaurus 檔案的 Amazon S3 路徑。您指定的檔案會取代現有的 saurus 檔案。如果您不變更路徑, 會從現有路徑 Amazon Kendra 重新載入儲存庫。

    如果您選取保留目前的儲存庫檔案, Amazon Kendra 不會重新載入儲存庫檔案。

  5. 選擇儲存以儲存組態。

您也可以從現有的儲存庫路徑重新載入儲存庫。

從現有路徑重新載入儲存庫
  1. 在左側導覽窗格中,於您要修改的索引下,選擇同義詞

  2. 同義詞頁面上,選取您要重新載入的儲存庫,然後選擇重新整理

  3. 重新載入saurus 檔案頁面上,確認您要重新整理saurus 檔案。

隱私權網站條款Cookie 偏好設定
© 2025, Amazon Web Services, Inc.或其附屬公司。保留所有權利。