

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

# Amazon Kendra 運作方式
<a name="how-it-works"></a>

Amazon Kendra 為您的應用程式提供搜尋和擷取增強生成 (RAG) 功能。它會直接對您的文件編製索引，或從第三方文件儲存庫編製索引，並智慧地為您的使用者提供相關資訊。您可以使用 Amazon Kendra 建立各種類型文件的可更新索引。如需 支援的文件類型清單 Amazon Kendra，請參閱[文件類型](https://docs.aws.amazon.com/kendra/latest/dg/index-document-types.html)。

Amazon Kendra 與其他 服務整合。您可以將 Amazon Kendra GenAI Enterprise Edition 索引連線至 [Amazon Q Business](https://docs.aws.amazon.com/amazonq/latest/qbusiness-ug/what-is.html)和 [Amazon Bedrock](https://docs.aws.amazon.com/bedrock/latest/userguide/what-is-bedrock.html)，以建立 RAG 聊天解決方案。或者，您可以使用 Amazon Kendra 搜尋為[Amazon Lex 聊天機器人](https://docs.aws.amazon.com/lexv2/latest/dg/faq-bot-kendra-search.html)提供支援，為使用者的問題提供有用的答案。您也可以使用 儲存[Amazon Simple Storage Service 貯](https://docs.aws.amazon.com/kendra/latest/dg/data-source-s3.html)體做為 的資料來源 Amazon Kendra ，以連接至文件並編製索引。

Amazon Kendra 具有下列元件：
+ 存放文件並使其可供搜尋的[https://docs.aws.amazon.com//kendra/latest/dg/create-index.html](https://docs.aws.amazon.com//kendra/latest/dg/create-index.html)。
+ 存放文件並 Amazon Kendra 連線的[https://docs.aws.amazon.com/kendra/latest/dg/data-source.html](https://docs.aws.amazon.com/kendra/latest/dg/data-source.html)。您可以自動同步資料來源與 Amazon Kendra 索引，讓您的索引與來源儲存庫保持最新狀態。
+ [https://docs.aws.amazon.com/kendra/latest/dg/in-adding-documents.html](https://docs.aws.amazon.com/kendra/latest/dg/in-adding-documents.html)，可直接將文件新增至索引。
+ 針對輸入查詢擷取相關段落或文字摘錄的[https://docs.aws.amazon.com/kendra/latest/APIReference/API_Retrieve.html](https://docs.aws.amazon.com/kendra/latest/APIReference/API_Retrieve.html)。
+ [https://docs.aws.amazon.com/kendra/latest/APIReference/API_Query.html](https://docs.aws.amazon.com/kendra/latest/APIReference/API_Query.html)，可搜尋指定輸入查詢的索引。

您可以透過 Amazon Kendra 主控台或 API 使用 。您可以建立、更新和刪除索引。刪除索引會刪除其所有資料來源連接器，並從中永久刪除所有文件資訊 Amazon Kendra。

**Topics**
+ [Amazon Kendra 中的索引](hiw-index.md)
+ [文件](hiw-documents.md)
+ [資料來源](hiw-data-source.md)
+ [查詢](hiw-query.md)
+ [Tags (標籤)](tagging.md)

# Amazon Kendra 中的索引
<a name="hiw-index"></a>

索引會保留文件的內容，並以可搜尋文件的方式建構。本節提供支援的索引類型和索引功能的概觀。

**Topics**
+ [Amazon Kendra 中的索引類型](hiw-index-types.md)
+ [在 Amazon Kendra 中將文件新增至索引](hiw-index-adding-docs.md)
+ [使用 Amazon Kendra 預留或通用文件欄位](index-reserved-fields-hiw.md)
+ [從 Amazon Kendra 中的索引擷取回應](index-searching.md)

# Amazon Kendra 中的索引類型
<a name="hiw-index-types"></a>

Amazon Kendra 有三種索引類型：GenAI Enterprise Edition 索引、Enterprise Edition 索引和 Developer Edition 索引。下列各節說明每個索引的功能。

**Topics**
+ [Amazon Kendra GenAI Enterprise Edition 索引](#kendra-gen-ai-index)
+ [Amazon Kendra Enterprise Edition 索引](#kendra-enterprise-index)
+ [Amazon Kendra 開發人員版本索引](#kendra-developer-index)

## Amazon Kendra GenAI Enterprise Edition 索引
<a name="kendra-gen-ai-index"></a>

Amazon Kendra GenAI Enterprise Edition 索引可為擷取 API 操作和擷取增強生成 (RAG) 使用案例提供最高的準確性。它採用最新的資訊擷取技術，例如混合搜尋 （關鍵字和向量）、語意內嵌和重新排名模型，並已跨各種資料集進行測試。與 Amazon Kendra Developer Edition 和 Amazon Kendra Enterprise Edition 索引相比，查詢 API 操作可為 Amazon Kendra GenAI Enterprise Edition 索引提供類似的準確性。

Amazon Kendra GenAI Enterprise Edition 索引可讓您跨 AWS 生成式 AI 服務移動索引資料。使用此功能，您可以無縫重複使用投資，而無需重建索引。您可以在 [Amazon Bedrock 知識庫](https://docs.aws.amazon.com/bedrock/latest/userguide/knowledge-base.html)中將其用作受管擷取器，並將其與客服人員和提示流程等 Amazon Bedrock 工具整合，以建置進階 AI 助理。您也可以將其與 搭配使用[Amazon Q Business](https://docs.aws.amazon.com/amazonq/latest/qbusiness-ug/what-is.html)，以進行全受管數位助理。

與其他兩種索引類型相比，Amazon Kendra GenAI Enterprise Edition 索引提供更小、更精細的容量單位和較低的起始價格。這可協助您更有效率地使用容量。

**注意**  
為了獲得最佳體驗和準確性，我們建議您選擇 Amazon Kendra GenAI Enterprise Edition 索引。

**Topics**
+ [支援的功能](#kendra-gen-ai-index-features)
+ [限制](#genai-index-limitations)

### 支援的功能
<a name="kendra-gen-ai-index-features"></a>

如果您針對 RAG 使用案例使用[擷取](https://docs.aws.amazon.com/kendra/latest/APIReference/API_Retrieve.html) API 操作，Amazon Kendra GenAI Enterprise Edition 索引支援下列功能：
+ **完整支援** – [可信度分數儲存貯](https://docs.aws.amazon.com/kendra/latest/APIReference/API_QueryResultItem.html#Kendra-Type-QueryResultItem-ScoreAttributes)體、[篩選](https://docs.aws.amazon.com/kendra/latest/dg/filtering.html)、[面向](https://docs.aws.amazon.com/kendra/latest/dg/filtering.html#search-facets)、[相關性調校](https://docs.aws.amazon.com/kendra/latest/dg/tuning.html)、[自訂文件擴充](https://docs.aws.amazon.com/kendra/latest/dg/custom-document-enrichment.html)、[自訂中繼資料](https://docs.aws.amazon.com/kendra/latest/dg/custom-attributes.html)，以及[調整查詢容量和文件容量](https://docs.aws.amazon.com/kendra/latest/dg/adjusting-capacity.html)。
+ **部分支援** – [資料來源連接器](https://docs.aws.amazon.com/kendra/latest/dg/data-source.html)和[使用者內容篩選](https://docs.aws.amazon.com/kendra/latest/dg/user-context-filter.html)。如需部分支援功能的詳細資訊，請參閱[限制](https://docs.aws.amazon.com/kendra/latest/dg/hiw-index-types.html#genai-index-limitations)。

如果您使用[查詢](https://docs.aws.amazon.com/kendra/latest/APIReference/API_Query.html) API 操作搜尋使用案例，Amazon Kendra GenAI Enterprise Edition 索引支援下列功能：
+ **完整支援** – [文件排名](https://docs.aws.amazon.com/kendra/latest/dg/search-service-rerank.html)、[擷取問題回答](https://docs.aws.amazon.com/kendra/latest/dg/searching-example.html)、[可信度分數儲存貯](https://docs.aws.amazon.com/kendra/latest/APIReference/API_QueryResultItem.html#Kendra-Type-QueryResultItem-ScoreAttributes)體、[篩選](https://docs.aws.amazon.com/kendra/latest/dg/filtering.html)、[面向](https://docs.aws.amazon.com/kendra/latest/dg/filtering.html#search-facets)、[排序](https://docs.aws.amazon.com/kendra/latest/dg/tuning-sorting-responses.html#sorting-responses)、[摺疊和擴展查詢結果](https://docs.aws.amazon.com/kendra/latest/dg/expand-collapse-query-results.html)、[索引瀏覽](https://docs.aws.amazon.com/kendra/latest/dg/browsing.html)、[布林查詢](https://docs.aws.amazon.com/kendra/latest/dg/searching-example.html#searching-index-query-syntax)、[完全相符](https://docs.aws.amazon.com/kendra/latest/dg/searching-example.html#searching-index-query-syntax)、[萬用字元查詢](https://docs.aws.amazon.com/kendra/latest/dg/searching-example.html#searching-index-query-syntax)、[查詢建議](https://docs.aws.amazon.com/kendra/latest/dg/query-suggestions.html)、[查詢拼字檢查程式](https://docs.aws.amazon.com/kendra/latest/dg/query-spell-check.html)、[相關性調校](https://docs.aws.amazon.com/kendra/latest/dg/tuning.html)、[增量學習](https://docs.aws.amazon.com/kendra/latest/dg/submitting-feedback.html)、[自訂文件擴充](https://docs.aws.amazon.com/kendra/latest/dg/custom-document-enrichment.html)、[自訂中繼資料](https://docs.aws.amazon.com/kendra/latest/dg/custom-attributes.html)、[調整查詢容量和文件容量](https://docs.aws.amazon.com/kendra/latest/dg/adjusting-capacity.html)，以及[搜尋體驗](https://docs.aws.amazon.com/kendra/latest/dg/deploying.html)。
+ **部分支援** – [資料來源連接器](https://docs.aws.amazon.com/kendra/latest/dg/data-source.html)和[使用者內容篩選](https://docs.aws.amazon.com/kendra/latest/dg/user-context-filter.html)。如需部分支援功能的詳細資訊，請參閱[限制](https://docs.aws.amazon.com/kendra/latest/dg/hiw-index-types.html#kendra-gen-ai-index)。

### 限制
<a name="genai-index-limitations"></a>

以下概述 Amazon Kendra GenAI Enterprise Edition 索引的已知限制：
+ Amazon Kendra GenAI Enterprise Edition 索引僅適用於美國東部 （維吉尼亞北部） 和美國西部 （奧勒岡）。
+ Amazon Kendra GenAI Enterprise Edition 索引僅支援英文內容。
+ Amazon Kendra GenAI Enterprise Edition 索引僅支援 v2.0 Amazon Kendra 資料來源連接器。
+ 在 Amazon Kendra GenAI Enterprise Edition 索引中，您只能使用[使用者屬性](https://docs.aws.amazon.com/kendra/latest/dg/user-context-filter.html#context-filter-attribute)來依使用者內容篩選搜尋結果。
+ Amazon Kendra GenAI Enterprise Edition 索引不支援權[杖型使用者存取控制](https://docs.aws.amazon.com/kendra/latest/dg/create-index-access-control.html)或[使用者 ID 和群組型使用者對文件的存取控制](https://docs.aws.amazon.com/kendra/latest/dg/user-context-filter.html#context-filter-user-incl-datasources)。
+ Amazon Kendra GenAI Enterprise Edition 索引已停用 [CreateAccessControlConfiguration](https://docs.aws.amazon.com/kendra/latest/APIReference/API_CreateAccessControlConfiguration.html) API 操作。
+ 如果您使用 Amazon Kendra GenAI Enterprise Edition 索引搭配 Amazon Q Business，請注意下列有關控制最終使用者存取文件的事項：

  Amazon Q Business 使用使用者電子郵件 ID 來判斷最終使用者對 索引中文件的存取權。當您將 Amazon Kendra 索引連線至 時 Amazon Q Business， 會將使用者識別電子郵件 ID Amazon Q Business 重鋪至 Amazon Kendra，以啟用最終使用者的文件篩選。如果連接到 Amazon Kendra 索引的資料來源未使用電子郵件 ID 型文件篩選，或電子郵件 ID 不存在，則 只會從公有文件 Amazon Q Business 產生回應。

## Amazon Kendra Enterprise Edition 索引
<a name="kendra-enterprise-index"></a>

Amazon Kendra Enterprise Edition 索引提供語意搜尋功能，並提供適用於生產工作負載的高可用性服務。

**Topics**
+ [支援的功能](#kendra-ent-index-features)
+ [限制](#ent-index-limitations)

### 支援的功能
<a name="kendra-ent-index-features"></a>

如果您使用 RAG 使用案例的[擷取](https://docs.aws.amazon.com/kendra/latest/APIReference/API_Retrieve.html) API 操作，Amazon Kendra Enterprise Edition 索引支援下列功能：使用[進階查詢語法](https://docs.aws.amazon.com/kendra/latest/dg/searching-example.html#searching-index-query-syntax)進行查詢、查詢[的建議拼字修正](https://docs.aws.amazon.com/kendra/latest/dg/query-spell-check.html)、[面向](https://docs.aws.amazon.com/kendra/latest/dg/filtering.html#search-facets)、自動完成搜尋查詢的[查詢建議](https://docs.aws.amazon.com/kendra/latest/dg/query-suggestions.html)，以及[增量學習](https://docs.aws.amazon.com/kendra/latest/dg/submitting-feedback.html)。

如果您使用[查詢](https://docs.aws.amazon.com/kendra/latest/APIReference/API_Query.html) API 操作搜尋使用案例，Amazon Kendra Enterprise Edition 索引支援所有功能。

### 限制
<a name="ent-index-limitations"></a>

以下概述 Amazon Kendra Enterprise Edition 索引的已知限制：
+ 如果您搭配 使用 Amazon Kendra Enterprise Edition 索引 Amazon Q Business，請注意下列有關控制最終使用者存取文件的事項：

  Amazon Q Business 使用使用者電子郵件 ID 來判斷最終使用者對 索引中文件的存取權。當您將 Amazon Kendra 索引連線至 時 Amazon Q Business， 會將使用者識別電子郵件 ID Amazon Q Business 重鋪至 Amazon Kendra，以啟用最終使用者的文件篩選。如果連接到 Amazon Kendra 索引的資料來源未使用電子郵件 ID 型文件篩選，或電子郵件 ID 不存在，則 只會從公有文件 Amazon Q Business 產生回應。

## Amazon Kendra 開發人員版本索引
<a name="kendra-developer-index"></a>

Amazon Kendra Developer Edition 索引也提供語意搜尋功能，供您測試使用案例。不過，我們不建議將其用於生產使用案例。

**Topics**
+ [支援的功能](#kendra-dev-index-features)
+ [限制](#dev-index-limitations)

### 支援的功能
<a name="kendra-dev-index-features"></a>

如果您使用 RAG 使用案例的[擷取](https://docs.aws.amazon.com/kendra/latest/APIReference/API_Retrieve.html) API 操作：使用[進階查詢語法](https://docs.aws.amazon.com/kendra/latest/dg/searching-example.html#searching-index-query-syntax)查詢、查詢[的建議拼字修正](https://docs.aws.amazon.com/kendra/latest/dg/query-spell-check.html)、[面向](https://docs.aws.amazon.com/kendra/latest/dg/filtering.html#search-facets)、自動完成搜尋查詢的[查詢建議](https://docs.aws.amazon.com/kendra/latest/dg/query-suggestions.html)，以及[增量學習](https://docs.aws.amazon.com/kendra/latest/dg/submitting-feedback.html)，Amazon Kendra 開發人員版本索引支援下列功能。

如果您使用[查詢](https://docs.aws.amazon.com/kendra/latest/APIReference/API_Query.html) API 操作搜尋使用案例，Amazon Kendra 開發人員版本索引支援所有功能。

### 限制
<a name="dev-index-limitations"></a>

以下概述 Amazon Kendra 開發人員版本索引的已知限制：
+ 如果您搭配 使用 Amazon Kendra Developer Edition 索引 Amazon Q Business，請注意下列有關控制最終使用者存取文件的事項：

  Amazon Q Business 使用使用者電子郵件 ID 來判斷最終使用者對 索引中文件的存取權。當您將 Amazon Kendra 索引連線至 時 Amazon Q Business， 會將使用者識別電子郵件 ID Amazon Q Business 重鋪至 Amazon Kendra，以啟用最終使用者的文件篩選。如果連接到 Amazon Kendra 索引的資料來源未使用電子郵件 ID 型文件篩選，或電子郵件 ID 不存在，則 只會從公有文件 Amazon Q Business 產生回應。

# 在 Amazon Kendra 中將文件新增至索引
<a name="hiw-index-adding-docs"></a>

將文件新增至索引的方式取決於存放文件的方式。
+ 如果您將文件存放在某種儲存庫中，例如 Amazon S3 儲存貯體或 Microsoft SharePoint 網站，您可以使用[資料來源連接器](https://docs.aws.amazon.com/kendra/latest/dg/data-source.html)從儲存庫為文件編製索引。
+ 如果您未將文件存放在儲存庫中，您可以使用 [BatchPutDocument](https://docs.aws.amazon.com/kendra/latest/APIReference/API_BatchPutDocument.html) API 操作來直接索引文件。
+ 對於必須存放在 Amazon Kendra (Amazon S3) 儲存貯體中的常見問答集問題和答案，您可以從儲存貯體上傳它們。

您可以使用 Amazon Kendra 主控台、 AWS CLI或 AWS SDK 建立索引。如需可編製索引的文件類型資訊，請參閱[文件類型](https://docs.aws.amazon.com/kendra/latest/dg/index-document-types.html)。

# 使用 Amazon Kendra 預留或通用文件欄位
<a name="index-reserved-fields-hiw"></a>

使用 [UpdateIndex](https://docs.aws.amazon.com/kendra/latest/APIReference/API_UpdateIndex.html) API 操作，您可以建立預留或常用欄位。若要這樣做，您可以使用 `DocumentMetadataConfigurationUpdates`，並指定要映射至同等文件屬性/欄位名稱的 Amazon Kendra 預留索引欄位名稱。您也可以建立自訂欄位。

如果您使用資料來源連接器，大多數包含將資料來源文件欄位映射至 Amazon Kendra 索引欄位的欄位映射。如果您使用 主控台，您可以透過選取資料來源、選取編輯動作，然後繼續在欄位映射區段旁設定資料來源來更新欄位。

您可以設定 `Search` 物件，將欄位設定為可顯示、可面向、可搜尋和可排序。您可以設定 `Relevance` 物件來設定欄位的排名順序、提升持續時間或時段，以套用至映射至特定欄位值的提升、新鮮度、重要性值和重要性值。

如果您使用 主控台，您可以透過選取導覽功能表中的面向選項來設定欄位的搜尋設定。若要設定相關性調校，請選取導覽選單中搜尋索引的選項，輸入查詢，然後使用側邊面板選項調校搜尋相關性。您無法在建立欄位之後變更欄位類型。

Amazon Kendra 具有下列預留或常用文件欄位，您可以使用：
+ `_authors` – 負責文件內容的一或多個作者清單。
+ `_category` – 在特定群組中放置文件的類別。
+ `_created_at` – 文件建立的日期和時間，以 ISO 8601 格式表示。例如，2012-03-25T12 日下午 12：30 （加上 10 秒），2012 年 3 月 25 日中歐時間的 ISO 8601 日期時間格式為 2012 年 3 月 25 日。
+ `_data_source_id` – 包含文件的資料來源的識別碼。
+ `_document_body` – 文件的內容。
+ `_document_id` – 文件的唯一識別碼。
+ `_document_title` – 文件的標題。
+ `_excerpt_page_number` – PDF 檔案中文件摘錄出現的頁碼。如果您的索引是在 2020 年 9 月 8 日之前建立的，您必須先重新索引文件，才能使用此屬性。
+ `_faq_id` – 如果這是問答類型文件 (FAQ)，則為常見問答集的唯一識別符。
+ `_file_type` – 文件的檔案類型，例如 pdf 或 doc。
+ `_last_updated_at` – 文件上次更新的日期和時間，以 ISO 8601 格式表示。例如，2012-03-25T12 日下午 12：30 （加上 10 秒），2012 年 3 月 25 日中歐時間的 ISO 8601 日期時間格式為 2012 年 3 月 25 日。
+ `_source_uri` – 文件可用的 URI，例如公司網站上的文件 URI。
+ `_version` – 文件特定版本的識別碼。
+ `_view_count` – 文件的檢視次數。
+ `_language_code` （字串） – 適用於文件的語言程式碼。如果您未指定語言，則預設為英文。如需支援語言的詳細資訊，包括其代碼，請參閱[新增英文以外語言的文件](https://docs.aws.amazon.com/kendra/latest/dg/in-adding-languages.html)。

您可以使用 `DocumentMetadataConfigurationUpdates` 搭配 `UpdateIndex` API 操作建立自訂欄位，就像建立預留或常用欄位一樣。您必須為自訂欄位設定適當的資料類型。

如果您使用 主控台，您可以透過選取資料來源、選取編輯動作，然後在欄位映射區段旁繼續設定資料來源，來更新欄位。有些資料來源不支援新增欄位或自訂欄位。您無法在建立欄位之後變更欄位類型。

以下是您可以為自訂欄位設定的類型：
+ Date
+ Number
+ String
+ 字串清單

如果您使用 [BatchPutDocument](https://docs.aws.amazon.com/kendra/latest/APIReference/API_BatchPutDocument.html) API 操作將文件新增至索引， 會`Attributes`列出文件的欄位/屬性，並使用 `DocumentAttribute` 物件建立欄位。

對於從 Amazon S3 資料來源編製索引的文件，您可以使用包含欄位資訊的 [JSON 中繼資料檔案](https://docs.aws.amazon.com/kendra/latest/dg/s3-metadata.html)建立欄位。

如果您使用支援的資料庫做為資料來源，您可以使用欄位[映射選項來設定欄位](https://docs.aws.amazon.com/kendra/latest/dg/data-source-database.html#data-source-procedure-database)。

# 從 Amazon Kendra 中的索引擷取回應
<a name="index-searching"></a>

建立索引後，您可以開始搜尋文件。

若要搜尋 Amazon Kendra 索引，您可以使用[擷取](https://docs.aws.amazon.com/kendra/latest/APIReference/API_Retrieve.html) API 操作或[查詢](https://docs.aws.amazon.com/kendra/latest/APIReference/API_Query.html) API 操作。

擷取 API 操作非常適合擷取增強產生 (RAG) 使用案例。對於指定的查詢，它會傳回最多 200 個字符單字的語意相關段落排名清單。您可以將它們傳送到大型語言模型 (LLM)，以使用 RAG 產生答案。如需詳細資訊，請參閱[搜尋索引](https://docs.aws.amazon.com/kendra/latest/dg/searching.html)。

查詢 API 操作最適合文件搜尋使用案例。對於指定的查詢，它會傳回與查詢相關的 100 個字詞摘錄的排名文件清單。這對於使用者瀏覽排名文件清單的傳統文件搜尋使用案例非常有用。

若要查看每個索引類型的擷取和查詢 API 操作支援哪些功能，請參閱[索引類型](https://docs.aws.amazon.com/kendra/latest/dg/hiw-index-types.html)。

# 文件
<a name="hiw-documents"></a>

本節說明 如何為其支援的許多文件格式和文件的不同欄位/屬性編製 Amazon Kendra 索引。

**Topics**
+ [文件類型或格式](#index-document-types)
+ [文件屬性或欄位](#hiw-document-attributes)

## 文件類型或格式
<a name="index-document-types"></a>

Amazon Kendra 支援熱門的文件類型或格式，例如 PDF、HTML、Word、PowerPoint 等。索引可以包含多種文件格式。

Amazon Kendra 會擷取文件內的內容，以便搜尋文件。文件的剖析方式是最佳化對擷取的文字和文件中任何表格式內容 (HTML 資料表） 的搜尋。這表示將文件建構為用於搜尋的欄位或屬性。文件中繼資料，例如上次修改的日期，對於搜尋非常有用。

文件可以組織成資料列和資料欄。例如，每個文件都是一列，而標題和內文內容等每個文件欄位/屬性都是一欄。例如，如果您使用資料庫做為資料來源，則應將資料結構化或組織成資料列和資料欄。

您可以透過下列方式將文件新增至索引：
+ [BatchPutDocument](https://docs.aws.amazon.com/kendra/latest/dg/in-adding-documents.html) API
+ [資料來源連接器](https://docs.aws.amazon.com/kendra/latest/dg/data-sources.html)

如果您想要新增常見問答集檔案，您可以使用 [CreateFaq](https://docs.aws.amazon.com/kendra/latest/dg/in-creating-faq.html) API 來新增存放在 Amazon S3 儲存貯體中的檔案。您可以選擇基本 CSV 格式、在標頭中包含自訂欄位/屬性的 CSV 格式，以及包含自訂欄位的 JSON 格式。預設格式為基本 CSV。

以下提供每個支援文件格式的資訊，以及在編製文件索引時 Amazon Kendra 如何處理每個格式。


| 文件格式 | 視為 | 文件的處理方式 | 原始結構 | 
| --- | --- | --- | --- | 
| 可攜文件格式 (PDF) | HTML | 轉換為 HTML，然後擷取內容。 | 非結構化 | 
| HyperText 標記語言 (HTML) | HTML | 篩選掉 HTML 標籤以擷取內容。內容必須在主要HTML開始和結束標籤之間 (<HTML>content</HTML>)。 | 半結構化 | 
| 可擴展標記語言 (XML) | XML | 篩選掉 XML 標籤以擷取內容。 | 半結構化 | 
| 可擴展樣式表語言轉換 (XSLT) | XSLT | 標籤會經過篩選以擷取內容。 | 半結構化 | 
| MarkDown (MD) | 純文字 | 內容是以包含的 MarkDown 語法擷取。 | 半結構化 | 
| 逗號分隔符號值 (CSV) | CSV | 從每個儲存格擷取的內容，將單一檔案視為單一文件結果。 | 為常見問答集檔案結構化，否則為半結構化 | 
| Microsoft Excel (XLS 和 XLSX) | XLS 和 XLSX | 從每個儲存格擷取的內容，將單一檔案視為單一文件結果。 | 半結構化 | 
| JavaScript 物件標記法 (JSON) | 純文字 | 內容是以包含的 JSON 語法擷取。 | 半結構化 | 
| RTF 格式 | RTF | RTF 語法會篩選出以擷取內容。 | 半結構化 | 
| Microsoft PowerPoint (PPT) | PPT、PPTX | 只有文字內容會從 PowerPoint 投影片擷取以進行搜尋。不會擷取影像和其他內容。 | 非結構化 | 
| Microsoft Word | DOC、DOCX | 只有文字內容會從 Word 頁面擷取以進行搜尋。不會擷取影像和其他內容。 | 非結構化 | 
| 純文字 (TXT) | TXT | 將擷取文字文件中的所有文字。 | 非結構化 | 

## 文件屬性或欄位
<a name="hiw-document-attributes"></a>

文件具有與其相關聯的屬性或欄位。文件的欄位是文件的屬性或文件結構中包含的內容。例如，每個文件可能包含標題、內文文字和作者。您也可以為特定文件新增自訂欄位。例如，如果您的索引搜尋稅務文件，您可以為 W-2、1099 等稅務文件類型指定自訂欄位。

在查詢中使用文件欄位之前，必須先將其映射至索引欄位。例如，標題欄位可以映射到欄位 `_document_title`。如需詳細資訊，請參閱[映射欄位](https://docs.aws.amazon.com/kendra/latest/dg/field-mapping.html)。若要新增欄位，您必須建立索引欄位以映射欄位。您可以使用 主控台或使用 [UpdateIndex](https://docs.aws.amazon.com/kendra/latest/APIReference/API_UpdateIndex.html) API 建立索引欄位。

您可以使用文件欄位來篩選回應並建立面向搜尋結果。例如，您可以篩選回應，只傳回特定版本的文件，也可以篩選搜尋，只傳回符合搜尋詞彙的 1099 類型的稅務文件。如需詳細資訊，請參閱[篩選和面向搜尋](https://docs.aws.amazon.com/kendra/latest/dg/filtering.html)。

您也可以使用文件欄位來手動調整查詢回應。例如，您可以選擇增加標題欄位的重要性，以在決定回應中傳回哪些文件時，增加 Amazon Kendra 指派給欄位的權重。如需詳細資訊，請參閱[調整搜尋相關性](https://docs.aws.amazon.com/kendra/latest/dg/tuning.html)。

如果您要將文件直接新增至索引，請將[文件](https://docs.aws.amazon.com/kendra/latest/APIReference/API_Document.html)輸入參數中的欄位指定至 [BatchPutDocument](https://docs.aws.amazon.com/kendra/latest/APIReference/API_BatchPutDocument.html) API。您可以在 [DocumentAttribute](https://docs.aws.amazon.com/kendra/latest/APIReference/API_DocumentAttribute.html) 物件陣列中指定自訂欄位值。如果您使用的是資料來源，您用來新增文件欄位的方法取決於資料來源。如需詳細資訊，請參閱[映射資料來源欄位](https://docs.aws.amazon.com/kendra/latest/dg/field-mapping.html)。

### 使用 Amazon Kendra 預留或通用文件欄位
<a name="index-reserved-fields"></a>

使用 [UpdateIndex API](https://docs.aws.amazon.com/kendra/latest/APIReference/API_UpdateIndex.html)，您可以使用 建立預留或通用欄位，`DocumentMetadataConfigurationUpdates` Amazon Kendra 並指定預留索引欄位名稱以映射至同等文件屬性/欄位名稱。您也可以建立自訂欄位。如果您使用資料來源連接器，大多數包含將資料來源文件欄位映射至 Amazon Kendra 索引欄位的欄位映射。如果您使用 主控台，您可以透過選取資料來源、選取編輯動作，然後繼續在欄位映射區段旁設定資料來源來更新欄位。

您可以設定 `Search` 物件，將欄位設定為可顯示、可面向、可搜尋和可排序。您可以設定 `Relevance` 物件來設定欄位的排名順序、提升持續時間或時段，以套用至映射至特定欄位值的提升、新鮮度、重要性值和重要性值。如果您使用 主控台，您可以在導覽功能表中選取面向選項來設定欄位的搜尋設定。若要設定相關性調校，請選取導覽選單中搜尋索引的選項，輸入查詢，然後使用側邊面板選項調校搜尋相關性。建立欄位後，就無法變更欄位類型。

Amazon Kendra 具有下列預留或常用文件欄位，您可以使用：
+ `_authors`- 負責文件內容的一或多個作者清單。
+ `_category`- 在特定群組中放置文件的類別。
+ `_created_at`- 建立文件的 ISO 8601 格式日期和時間。例如，2012-03-25T12:30:10\$101:00 是以 ISO 8601 日期時間格式表示的歐洲中部時間 2012 年 3 月 25 日中午 12:30 (加上 10 秒)。
+ `_data_source_id`- 包含文件之資料來源的識別符。
+ `_document_body`- 文件的內容。
+ `_document_id`- 文件的唯一識別符。
+ `_document_title`- 文件的標題。
+ `_excerpt_page_number`- PDF 檔案中文件摘錄出現的頁碼。如果您的索引是在 2020 年 9 月 8 日之前建立的，您必須先重新索引文件，才能使用此屬性。
+ `_faq_id`—如果這是問答類型文件 (FAQ)，則為常見問答集的唯一識別符。
+ `_file_type`— 文件的檔案類型，例如 pdf 或 doc。
+ `_last_updated_at`- 上次更新文件的 ISO 8601 格式日期和時間。例如，2012-03-25T12:30:10\$101:00 是以 ISO 8601 日期時間格式表示的歐洲中部時間 2012 年 3 月 25 日中午 12:30 (加上 10 秒)。
+ `_source_uri`- 文件可用的 URI。例如，公司網站上的文件 URI。
+ `_version`- 文件特定版本的識別符。
+ `_view_count`— 文件已檢視的次數。
+ `_language_code` （字串） — 適用於文件的語言程式碼。如果您未指定語言，則預設為英文。如需支援語言的詳細資訊，包括其代碼，請參閱[新增英文以外語言的文件](https://docs.aws.amazon.com/kendra/latest/dg/in-adding-languages.html)。

對於自訂欄位，您可以使用 `DocumentMetadataConfigurationUpdates`搭配 `UpdateIndex` API 來建立這些欄位，就像您在建立預留或通用欄位時一樣。您必須為自訂欄位設定適當的資料類型。如果您使用 主控台，您可以透過選取資料來源、選取編輯動作，然後繼續在欄位映射區段旁設定資料來源來更新欄位。有些資料來源不支援新增欄位或自訂欄位。建立欄位後，就無法變更欄位類型。

以下是您可以為自訂欄位設定的類型：
+ Date
+ Number
+ String
+ 字串清單

如果您使用 [BatchPutDocument](https://docs.aws.amazon.com/kendra/latest/APIReference/API_BatchPutDocument.html) API 將文件新增至索引， 會`Attributes`列出文件的欄位/屬性，並使用 `DocumentAttribute` 物件建立欄位。

對於從 Amazon S3 資料來源編製索引的文件，您可以使用包含欄位資訊的 [JSON 中繼資料檔案](https://docs.aws.amazon.com/kendra/latest/dg/s3-metadata.html)建立欄位。

如果您使用支援的資料庫做為資料來源，您可以使用欄位[映射選項來設定欄位](https://docs.aws.amazon.com/kendra/latest/dg/data-source-database.html#data-source-procedure-database)。

# 資料來源
<a name="hiw-data-source"></a>

資料來源是資料儲存庫或位置， Amazon Kendra 可連線至您的文件或內容並編製索引。例如，您可以設定 Amazon Kendra 連線到 Microsoft SharePoint 來編目和索引在此來源中存放的文件。您也可以提供 URLs Amazon Kendra 讓 進行網路爬取，為網頁編製索引。您可以自動同步資料來源與 Amazon Kendra 索引，以便在資料來源中新增、更新或刪除的文件也會在索引中新增、更新或刪除。

支援的資料來源包括：
+ [Adobe Experience Manager](https://docs.aws.amazon.com/kendra/latest/dg/data-source-aem.html)
+ [Alfresco](https://docs.aws.amazon.com/kendra/latest/dg/data-source-alfresco.html)
+ [Aurora (MySQL)](https://docs.aws.amazon.com/kendra/latest/dg/data-source-aurora-mysql.html)
+ [Aurora (PostgreSQL)](https://docs.aws.amazon.com/kendra/latest/dg/data-source-aurora-postgresql.html)
+ [Amazon FSx (Windows)](https://docs.aws.amazon.com/kendra/latest/dg/data-source-fsx.html)
+ [Amazon FSx (NetApp ONTAP)](https://docs.aws.amazon.com/kendra/latest/dg/data-source-fsx-ontap.html) 
+  [資料庫資料來源](https://docs.aws.amazon.com/kendra/latest/dg/data-source-database.html)
+ [Amazon RDS (Microsoft SQL Server)](https://docs.aws.amazon.com/kendra/latest/dg/data-source-rds-ms-sql-server.html)
+ [Amazon RDS (MySQL)](https://docs.aws.amazon.com/kendra/latest/dg/data-source-rds-mysql.html)
+ [Amazon RDS ( Oracle)](https://docs.aws.amazon.com/kendra/latest/dg/data-source-rds-oracle.html)
+ [Amazon RDS (PostgreSQL)](https://docs.aws.amazon.com/kendra/latest/dg/data-source-rds-postgresql.html)
+ [Amazon S3 儲存貯體](https://docs.aws.amazon.com/kendra/latest/dg/data-source-s3.html)
+ [Amazon Kendra Web 爬蟲程式](https://docs.aws.amazon.com/kendra/latest/dg/data-source-web-crawler.html)
+ [Box (立方體)](https://docs.aws.amazon.com/kendra/latest/dg/data-source-box.html)
+ [Confluence](https://docs.aws.amazon.com/kendra/latest/dg/data-source-confluence.html)
+ [自訂資料來源](https://docs.aws.amazon.com/kendra/latest/dg/data-source-custom.html)
+ [Dropbox](https://docs.aws.amazon.com/kendra/latest/dg/data-source-dropbox.html)
+ [Drupal](https://docs.aws.amazon.com/kendra/latest/dg/data-source-drupal.html)
+ [GitHub](https://docs.aws.amazon.com/kendra/latest/dg/data-source-github.html)
+ [Gmail](https://docs.aws.amazon.com/kendra/latest/dg/data-source-gmail.html)
+ [Google 工作區硬碟](https://docs.aws.amazon.com/kendra/latest/dg/data-source-google-drive.html)
+ [IBM DB2](https://docs.aws.amazon.com/kendra/latest/dg/data-source-ibm-db2.html)
+ [Jira](https://docs.aws.amazon.com/kendra/latest/dg/data-source-jira.html)
+ [Microsoft Exchange](https://docs.aws.amazon.com/kendra/latest/dg/data-source-exchange.html)
+ [Microsoft OneDrive](https://docs.aws.amazon.com/kendra/latest/dg/data-source-onedrive.html)
+ [Microsoft SharePoint](https://docs.aws.amazon.com/kendra/latest/dg/data-source-sharepoint.html)
+ [Microsoft Teams](https://docs.aws.amazon.com/kendra/latest/dg/data-source-teams.html)
+ [Microsoft SQL Server](https://docs.aws.amazon.com/kendra/latest/dg/data-source-ms-sql-server.html)
+ [Microsoft Yammer](https://docs.aws.amazon.com/kendra/latest/dg/data-source-yammer.html)
+ [MySQL](https://docs.aws.amazon.com/kendra/latest/dg/data-source-mysql.html)
+ [Oracle 資料庫](https://docs.aws.amazon.com/kendra/latest/dg/data-source-oracle-database.html)
+ [PostgreSQL](https://docs.aws.amazon.com/kendra/latest/dg/data-source-postgresql.html)
+ [Quip](https://docs.aws.amazon.com/kendra/latest/dg/data-source-quip.html)
+ [Salesforce](https://docs.aws.amazon.com/kendra/latest/dg/data-source-salesforce.html)
+ [ServiceNow](https://docs.aws.amazon.com/kendra/latest/dg/data-source-servicenow.html)
+ [Slack](https://docs.aws.amazon.com/kendra/latest/dg/data-source-slack.html)
+ [Zendesk](https://docs.aws.amazon.com/kendra/latest/dg/data-source-zendesk.html)

如需 支援的文件類型或格式清單， Amazon Kendra 請參閱[文件類型](https://docs.aws.amazon.com/kendra/latest/dg/index-document-types.html)。您必須先建立索引，才能建立資料來源連接器，以從資料來源建立文件的索引。

**注意**  
若要建立文件索引，您不需要使用資料來源。您可以使用批次上傳，將文件直接新增至索引。如需詳細資訊，請參閱將[文件直接新增至索引](https://docs.aws.amazon.com/kendra/latest/dg/in-adding-documents.html)。

 如需使用 Amazon Kendra 主控台、 AWS CLI 或 SDKs逐步解說，請參閱[入門](https://docs.aws.amazon.com/kendra/latest/dg/getting-started.html)。

# 查詢
<a name="hiw-query"></a>

若要取得答案，使用者會查詢索引。使用者可以在查詢中使用自然語言。回應包含資訊，例如標題、文字摘錄，以及索引中提供最佳答案的文件位置。

Amazon Kendra 會使用您提供有關文件的所有資訊，而不只是文件的內容，來判斷文件是否與查詢相關。例如，如果您的索引包含文件上次更新時間的相關資訊，您可以指示 Amazon Kendra 指派與最近更新之文件更高的相關性。

查詢也可以包含如何篩選回應的條件，讓 僅 Amazon Kendra 傳回符合篩選條件的文件。例如，如果您建立了名為 *department* 的索引欄位，您可以篩選回應，以便僅傳回部門欄位設定為 *legal* 的文件。如需詳細資訊，請參閱[篩選搜尋](https://docs.aws.amazon.com/kendra/latest/dg/filtering.html)。

您可以調校索引中個別欄位的相關性，藉此影響查詢的結果。調校會變更欄位對結果的重要性。例如，如果您提高具有*新*類別的文件的重要性，則具有此類別的文件更有可能包含在回應中。如需詳細資訊，請參閱[調整搜尋相關性](https://docs.aws.amazon.com/kendra/latest/dg/tuning.html)。

如需使用查詢的詳細資訊，請參閱[搜尋索引](https://docs.aws.amazon.com/kendra/latest/dg/searching.html)。

# Tags (標籤)
<a name="tagging"></a>

透過指派標籤來管理您的索引、資料來源和FAQs。您可以使用標籤，以各種方式對 Amazon Kendra 資源進行分類。例如，依用途、擁有者或應用程式或任何組合。每個標籤皆包含由您定義的*索引鍵*和*值*。

標籤可協助您：
+ 識別和組織您的 AWS 資源。許多 AWS 服務支援標記，因此您可以將相同的標籤指派給不同 服務中的資源，以指出資源相關。例如，您可以標記索引，以及使用具有相同標籤之索引的 Amazon Lex 機器人。
+ 配置成本。您可以在 AWS 帳單與成本管理 儀表板上啟用標籤。 AWS 使用標籤來分類您的成本，並為您提供每月成本分配報告。如需詳細資訊，請參閱《*關於 AWS 帳單*[和成本管理》中的成本分配和標記](https://docs.aws.amazon.com/awsaccountbilling/latest/aboutv2/cost-alloc-tags.html)。
+ 控制對資源的存取。您可以在控制資源存取 Amazon Kendra 的 (IAM) 政策中使用 AWS Identity and Access Management 標籤。您可以將這些政策連接至 IAM 角色或使用者，以啟用標籤型存取控制。如需詳細資訊，請參閱[以標籤為基礎的授權](https://docs.aws.amazon.com/kendra/latest/dg/security_iam_service-with-iam.html#security_iam_service-with-iam-tags)。

您可以使用 AWS 管理主控台、 AWS Command Line Interface (AWS CLI) 或 Amazon Kendra API 來建立和管理標籤。

## 標記資源
<a name="tagging-resources"></a>

如果您使用的是 Amazon Kendra 主控台，您可以在建立或稍後新增資源時標記資源。您也可以使用 主控台來更新或移除標籤。

如果您使用的是 AWS Command Line Interface (AWS CLI) 或 Amazon Kendra API，請使用下列操作來管理 資源的標籤：
+ [CreateDataSource](https://docs.aws.amazon.com/kendra/latest/APIReference/API_CreateDataSource.html) - 在您建立資料來源時套用標籤。
+ [CreateFaq](https://docs.aws.amazon.com/kendra/latest/APIReference/API_CreateFaq.html) - 在您建立常見問答集時套用標籤。
+ [CreateIndex](https://docs.aws.amazon.com/kendra/latest/APIReference/API_CreateIndex.html) - 在建立索引時套用標籤。
+ [ListTagsForResource](https://docs.aws.amazon.com/kendra/latest/APIReference/API_ListTagsForResource.html) - 檢視與資源相關聯的標籤。
+ [TagResource](https://docs.aws.amazon.com/kendra/latest/APIReference/API_TagResource.html) - 新增和修改資源的標籤。
+ [UntagResource](https://docs.aws.amazon.com/kendra/latest/APIReference/API_UntagResource.html) - 從資源移除標籤。

## 標籤限制
<a name="tag-restrictions"></a>

下列限制適用於 Amazon Kendra 資源上的標籤：
+ 標籤數量上限 — 50
+ 金鑰長度上限 - 128 個字元
+ 最大值長度—256 個字元
+ 索引鍵和值的有效字元—a–z、A–Z、空格和下列字元：\$1 . ： / = \$1 - 和 @
+ 鍵和值會區分大小寫
+ 請不要使用 `aws:` 做為鍵的字首；它已保留供 AWS 使用