Logo Zephyrnet

Tăng cường tìm kiếm doanh nghiệp với Amazon Kendra

Ngày:

Amazon Kendra is an easy-to-use enterprise search service that allows you to add search capabilities to your applications so end-users can easily find information stored in different data sources within your company. This could include invoices, business documents, technical manuals, sales reports, corporate glossaries, internal websites, and more. You can harvest this information from storage solutions like Dịch vụ lưu trữ đơn giản của Amazon (Amazon S3) and OneDrive; applications such as SalesForce, SharePoint and Service Now; or relational databases like Dịch vụ cơ sở dữ liệu quan hệ của Amazon (Amazon RDS)

When you type a question, the service uses machine learning (ML) algorithms to understand the context and return the most relevant results, whether that’s a precise answer or an entire document. Most importantly, you don’t need to have any ML experience to do this—Amazon Kendra also provides you with the code that you need to easily integrate with your new or existing applications.

This post shows you how to create your internal enterprise search by using the capabilities of Amazon Kendra. This enables you to build a solution to create and query your own search index. For this post, you use Amazon.com help documents in HTML format as the data source, but Amazon Kendra also supports MS Office (.doc, .ppt), PDF, and text formats.

Tổng quan về giải pháp

This post provides the steps to help you create an enterprise search engine on AWS using Amazon Kendra. You can provision a new Amazon Kendra index in under an hour without much technical depth or ML experience.

The post also demonstrates how to configure Amazon Kendra for a customized experience by adding FAQs, deploying Amazon Kendra in custom applications, and synchronizing data sources. This post addresses and answers these questions in the subsequent sections.

Điều kiện tiên quyết

Đối với hướng dẫn này, bạn nên có các điều kiện tiên quyết sau:

Creating and configuring your document repository

Trước khi có thể tạo chỉ mục trong Amazon Kendra, bạn cần tải tài liệu vào nhóm S3. Phần này chứa các hướng dẫn để tạo nhóm S3, lấy tệp và tải chúng vào nhóm. Sau khi hoàn thành tất cả các bước trong phần này, bạn đã có một nguồn dữ liệu mà Amazon Kendra có thể sử dụng.

  1. trên Bảng điều khiển quản lý AWS, Trong Khu vực danh sách, chọn Đông Mỹ (N. Virginia) or any Region of your choice that Amazon Kendra có sẵn trong.
  2. Chọn DỊCH VỤ.
  3. Theo Kho, chọn S3.
  4. Trên bảng điều khiển Amazon S3, chọn Tạo xô.
  5. Theo Cấu hình chung, cung cấp những thông tin dưới đây:
    • Tên nhóm: kendrapost-{your account id}.
    • Khu vực: Choose the same Region that you use to deploy your Amazon Kendra index (this post uses US East (N. Virginia) us-east-1).
  6. Theo Bucket settings for Block Public Access, hãy để mọi thứ với các giá trị mặc định.
  7. Theo Cài đặt nâng cao, hãy để mọi thứ với các giá trị mặc định.
  8. Chọn Tạo xô.
  9. Tải về amazon_help_docs.zip và giải nén các tệp.
  10. Trên bảng điều khiển Amazon S3, chọn nhóm mà bạn vừa tạo và chọn Tải lên.
  11. Upload the unzipped files.

Inside your bucket, you should now see two folders: amazon_help_docs (with 3,100 objects) and faqs (with one object).

The following screenshot shows the contents of amazon_help_docs.

The following screenshot shows the contents of faqs.

Tạo chỉ mục

An chỉ số is the Amazon Kendra component that provides search results for documents and frequently asked questions. After completing all the steps in this section, you have an index ready to consume documents from different data sources. For more information about indexes, see Chỉ số.

To create your first Amazon Kendra index, complete the following steps:

  1. Trên bảng điều khiển, chọn DỊCH VỤ.
  2. Theo Machine Learning, chọn Amazon Kendra.
  3. On the Amazon Kendra main page, choose Tạo chỉ mục.
  4. Trong tạp chí Index details phần, cho Tên chỉ mục, đi vào kendra-blog-index.
  5. Trong Mô tả, đi vào My first Kendra index.
  6. Trong Vai trò IAM, chọn Tạo một vai trò mới.
  7. Trong Tên vai trò, đi vào -index-role (your role name has the prefix AmazonKendra-YourRegion-).
  8. Trong Encryption, don’t select Use an AWS KMW managed encryption key.

(Your data is encrypted with an Amazon Kendra-owned key by default.)

  1. Chọn Sau.

For more information about the IAM roles Amazon Kendra creates, see Điều kiện tiên quyết.

Amazon Kendra offers two editions. Kendra Enterprise Edition provides a high-availability service for production workloads. Kendra Developer Edition is suited for building a proof-of-concept and experimentation. For this post, you use the Developer edition.

  1. Trong tạp chí Các phiên bản cấp phép phần, chọn Phiên bản dành cho nhà phát triển.
  2. Chọn Tạo.

For more information on the free tier, document size limits, and total storage for each Amazon Kendra edition, see Amazon Kendra pricing.

The index creation process can take up to 30 minutes. When the creation process is complete, you see a message at the top of the page that you successfully created your index.

Adding a data source

A nguồn dữ liệu là một vị trí lưu trữ các tài liệu để lập chỉ mục. Bạn có thể tự động đồng bộ hóa các nguồn dữ liệu với chỉ mục Amazon Kendra để đảm bảo rằng các tìm kiếm phản ánh chính xác các tài liệu mới, cập nhật hoặc đã xóa trong kho nguồn.

After completing all the steps in this section, you have a data source linked to Amazon Kendra. For more information, see Thêm tài liệu từ nguồn dữ liệu.

Before continuing, make sure that the index creation is complete and the index shows as Active.

  1. trên kendra-blog-index trang, chọn Thêm nguồn dữ liệu.

Amazon Kendra supports six types of data sources: Amazon S3, SharePoint Online, ServiceNow, OneDrive, Salesforce online, and Amazon RDS. For this post, you use Amazon S3.

  1. Theo Amazon S3, chọn Thêm trình kết nối.

Để biết thêm thông tin về các nguồn dữ liệu khác nhau mà Amazon Kendra hỗ trợ, hãy xem Thêm tài liệu từ nguồn dữ liệu.

  1. Trong tạp chí Xác định các thuộc tính phần, cho Tên nguồn dữ liệu, đi vào amazon_help_docs.
  2. Trong Mô tả, đi vào AWS services documentation.
  3. Chọn Sau.
  4. Trong tạp chí Định cấu hình cài đặt phần, cho Nhập vị trí nguồn dữ liệu, nhập nhóm S3 mà bạn đã tạo: kendrapost-{your account id}.
  5. Rời bỏ Vị trí thư mục tiền tố tệp siêu dữ liệu

Theo mặc định, các tệp siêu dữ liệu được lưu trữ trong cùng một thư mục với tài liệu. Nếu bạn muốn đặt các tệp này trong một thư mục khác, bạn có thể thêm tiền tố. Để biết thêm thông tin, hãy xem S3 document metadata.

  1. Trong Chọn khóa giải mã, bỏ chọn nó.
  2. Trong Tên vai trò, đi vào source-role (tên vai trò của bạn có tiền tố là AmazonKendra-).
  3. Trong Cấu hình bổ sung, bạn có thể thêm một mẫu để bao gồm hoặc loại trừ một số thư mục hoặc tệp nhất định. Đối với bài đăng này, hãy giữ các giá trị mặc định.
  4. Trong tần số, chọn Chạy theo yêu cầu.

This step defines the frequency with which the data source is synchronized with the Amazon Kendra index. For this walkthrough, you do this manually (one time only).

  1. Chọn Sau.
  2. trên Xem lại và tạo trang, chọn Tạo.
  3. After you create the data source, choose Đồng bộ hóa ngay bây giờ để đồng bộ hóa các tài liệu với chỉ mục Amazon Kendra.

Thời gian của quá trình này phụ thuộc vào số lượng tài liệu mà bạn lập chỉ mục. Đối với trường hợp sử dụng này, có thể mất 15 phút, sau đó bạn sẽ thấy thông báo đồng bộ hóa thành công.

Trong tạp chí Đồng bộ hóa lịch sử chạy , bạn có thể thấy rằng 3,099 tài liệu đã được đồng bộ hóa.

Exploring the search index using the search console

The goal of this section is to let you explore possible search queries via the built-in Amazon Kendra console.

To search the index you created above, complete the following steps:

  1. Theo Chỉ số, chọn kendra-blog-index.
  2. Chọn Bảng điều khiển tìm kiếm.

Kendra can answer three types of questions: factoid, descriptive, and keyword. For more information, see Câu hỏi thường gặp về Amazon Kendra. You can ask some questions using the Amazon.com help documents that you uploaded earlier.

Trong trường tìm kiếm, hãy nhập What is Amazon music unlimited?

With a factoid question (who, what, when, where), Amazon Kendra can answer and also offer a link to the source document.

As a keyword search, enter shipping rates to Canada. The following screenshot shows the answer Amazon Kendra gives.

Thêm câu hỏi thường gặp

You can also upload a list of FAQs to provide direct answers to common questions your end-users ask. To do this, you need to load a .csv file with the information related to the questions. This section contains instructions to create and configure that file and load it into Amazon Kendra.

  1. Trên bảng điều khiển Amazon Kendra, hãy điều hướng đến tệp index.
  2. Theo Quản lý dữ liệu, chọn Câu Hỏi Thường Gặp.
  3. Chọn Thêm Câu hỏi thường gặp.
  4. Trong tạp chí Define FAQ project phần, cho Tên câu hỏi thường gặp, đi vào kendra-post-faq.
  5. Trong Mô tả, đi vào My first FAQ list.

Amazon Kendra accepts .csv files formatted with each row beginning with a question followed by its answer. For example, see the following table.

câu hỏi Trả lời URL (optional)
What is the height of the Space Needle?  605 chân  https://www.spaceneedle.com/
How tall is the Space Needle?  605 chân  https://www.spaceneedle.com/
What is the height of the CN Tower? 1815 chân https://www.cntower.ca/
How tall is the CN Tower? 1815 chân https://www.cntower.ca/

This is how the .CSV file included for this use case looks like:

"How do I sign up for the Amazon Prime free Trial?"," To sign up for the Amazon Prime free trial, your account must have a current, valid credit card. Payment options such as an Amazon.com Corporate Line of Credit, checking accounts, pre-paid credit cards, or gift cards cannot be used. "," https://www.amazon.com/gp/help/customer/display.html/ref=hp_left_v4_sib?ie=UTF8&nodeId=201910190”

  1. Theo FAQ settings, Cho S3, đi vào s3://kendrapost-{your account id}/faqs/kendrapost.csv.
  2. Trong Vai trò IAM, chọn Tạo một vai trò mới.
  3. Trong Tên vai trò, đi vào faqs-role (tên vai trò của bạn có tiền tố là AmazonKendra-).
  4. Chọn Thêm.
  5. Wait until you see the status show as Active.

You can now see how the FAQ works on the search console.

  1. Theo Chỉ số, choose your index.
  2. Theo Quản lý dữ liệu, chọn Bảng điều khiển tìm kiếm.
  3. Trong trường tìm kiếm, hãy nhập How do I sign up for the Amazon Prime free Trial?
  4. The following screenshot shows that Amazon Kendra added the FAQ that you uploaded previously to the results list, and provides an answer and a link to the related documentation.

Using Amazon Kendra in your own applications

You can add the following components from the search console in your application:

  • Main search page The main page that contains all the components. This is where you integrate your application with the Amazon Kendra API.
  • Thanh tìm kiếm The component where you enter a search term and that calls the search function.
  • Kết quả The component that displays the results from Amazon Kendra. It has three components: suggested answers, FAQ results, and recommended documents.
  • Sự đánh số trang The component that paginates the response from Amazon Kendra.

Amazon Kendra provides source code that you can deploy in your website. This is offered free of charge under a modified MIT license so you can use it as is or change it for your own needs.

This section contains instructions to deploy Amazon Kendra search to your website. You use a Node.js demo application that runs locally in your machine. This use case is based on a MacOS environment.

To run this demo, you need the following components:

  1. Tải về amazon_aws-kendra-sample-app-master.zip và giải nén tập tin.
  2. Open a terminal window and go to the aws-kendra-sample-app-master thư mục:
    cd /{folder path}/aws-kendra-sample-app-master

  3. Tạo một bản sao của .env.development.local.example nộp hồ sơ như .env.development.local:
    cp .env.development.local.example .env.development.local

  4. Chỉnh sửa .env.development.local file and add the following connection parameters:
    • REACT_APP_INDEX – Your Amazon Kendra index ID (you can find this number on the Index home page)
    • REACT_APP_AWS_ACCESS_KEY_ID – Your account access key
    • REACT_APP_AWS_SECRET_ACCESS_KEY – Your account secret access key
    • REACT_APP_AWS_SESSION_TOKEN – Leave it blank for this use case
    • REACT_APP_AWS_DEFAULT_REGION – The Region that you used to deploy the Kendra index (for example, us-east-1)
  5. Lưu các thay đổi.
  6. Install the Node.js dependencies:
    npm install

  7. Launch the local development server:
  8. View the demo app at http://localhost:3000/. You should see the following screenshot.
  9. Enter the same question you used to test the FAQs: How do I sign up for the Amazon Prime free Trial?

The following screenshot shows that the result is the same as the one you got from the Amazon Kendra console, even though the demo webpage is running locally in your machine.

Dọn dẹp

To avoid incurring future charges and to clean out unused roles and policies, delete the resources you created: the Amazon Kendra index, S3 bucket, and corresponding IAM roles.

  1. To delete the Amazon Kendra index, under Chỉ số, chọn kendra-blog-index.
  2. Trong tạp chí index settings section, from the Hoạt động menu thả xuống, chọn Xóa bỏ.
  3. Để xác nhận việc xóa, hãy nhập Delete in the field and choose Xóa bỏ.

Chờ cho đến khi bạn nhận được thông báo xác nhận; quá trình này có thể mất đến 15 phút.

Để biết hướng dẫn về cách xóa bộ chứa S3 của bạn, hãy xem How do I delete an S3 Bucket?

Kết luận

In this post, you learned how to use Amazon Kendra to deploy an enterprise search service. You can use Amazon Kendra to improve the search experience in your company, powered by ML. You can enable rapid look for your documents using natural language, without any previous ML/AI experience. For more information about Amazon Kendra, see AWS re: Invent 2019 - Bài phát biểu với Andy Jassy trên Youtube, Câu hỏi thường gặp về Amazon KendraAmazon Kendra là gì?


Lưu ý

Leonardo Gómez is a Big Data Specialist Solutions Architect at AWS. Based in Toronto, Canada, He works with customers across Canada to design and build big data architectures.

Source: https://aws.amazon.com/blogs/machine-learning/enhancing-enterprise-search-with-amazon-kendra/

tại chỗ_img

Tin tức mới nhất

tại chỗ_img