選取您的 Cookie 偏好設定

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

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

更新索引典 - Amazon Kendra

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

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

更新索引典

您可以在建立索引典之後變更其組態。您可以變更索引典名稱和 IAM 資訊等詳細資料。您也可以變更索引典檔案 Amazon S3 路徑的位置。如果您變更索引典檔案的路徑, Amazon Kendra 會以更新路徑中指定的索引典取代現有的索引典。

您最多可能需要 30 分鐘才能看到更新的索引典檔案的效果。

注意

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

下列程序顯示如何修改索引典詳細資料。

Console
若要修改索引典詳細資料
  1. 在左側導覽窗格的索引下,選擇 [同義字]。

  2. 在「同義字」頁面上,選取您要修改的同義字辭典,然後選擇「編輯」。

  3. 在 [更新索引典] 頁面上,更新索引典詳細資料。

  4. (選擇性) 選擇 [變更索引典檔案路徑],然後指定新索引典檔案的 Amazon S3 路徑。您現有的索引典檔案會由您指定的檔案取代。如果您不變更路徑,請從現有路徑 Amazon Kendra 重新載入同義字辭典。

    如果您選取「保留目前的索引典檔案」,則 Amazon Kendra 不會重新載入同義字辭典檔案。

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

您也可以從現有的索引典路徑重新載入索引典。

從既有路徑重新載入同義字辭典
  1. 在左側導覽窗格的索引下,選擇 [同義字]。

  2. 在「同義字」頁面上,選取您要重新載入的同義字辭典,然後選擇「重新整理」。

  3. 在 [重新載入索引典檔案] 頁面上,確認您要重新整理索引典檔案。

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."); } }
若要修改索引典詳細資料
  1. 在左側導覽窗格的索引下,選擇 [同義字]。

  2. 在「同義字」頁面上,選取您要修改的同義字辭典,然後選擇「編輯」。

  3. 在 [更新索引典] 頁面上,更新索引典詳細資料。

  4. (選擇性) 選擇 [變更索引典檔案路徑],然後指定新索引典檔案的 Amazon S3 路徑。您現有的索引典檔案會由您指定的檔案取代。如果您不變更路徑,請從現有路徑 Amazon Kendra 重新載入同義字辭典。

    如果您選取「保留目前的索引典檔案」,則 Amazon Kendra 不會重新載入同義字辭典檔案。

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

您也可以從現有的索引典路徑重新載入索引典。

從既有路徑重新載入同義字辭典
  1. 在左側導覽窗格的索引下,選擇 [同義字]。

  2. 在「同義字」頁面上,選取您要重新載入的同義字辭典,然後選擇「重新整理」。

  3. 在 [重新載入索引典檔案] 頁面上,確認您要重新整理索引典檔案。

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