快速入門:在入口網站中建立 Azure 認知搜尋服務Quickstart: Create an Azure Cognitive Search service in the portal

Azure 認知搜尋是一項可用來在自訂應用程式中插入搜尋體驗的獨立資源。Azure Cognitive Search is a standalone resource used to plug in a search experience in custom apps. 雖然 Azure 認知搜尋可與其他 Azure 服務輕易整合,但您也可以將它當作單獨元件使用、將其與網路伺服器上的應用程式整合,或與其他雲端平台上執行的軟體搭配使用。Although Azure Cognitive Search integrates easily with other Azure services, you can also use it as a standalone component, or integrate it with apps on network servers, or with software running on other cloud platforms.

在本文中,請了解如何在 Azure 入口網站中建立資源。In this article, learn how to create a resource in the Azure portal.

動畫 GIFAnimated GIF

是否偏好使用 PowerShell?Prefer PowerShell? 請使用 Azure Resource Manager 服務範本Use the Azure Resource Manager service template. 如需入門說明,請參閱使用 PowerShell 管理 Azure 認知搜尋For help with getting started, see Manage Azure Cognitive Search with PowerShell.

訂閱 (免費或付費)Subscribe (free or paid)

開啟免費的 Azure 帳戶,並使用免費信用額度來試用付費的 Azure 服務。Open a free Azure account and use free credits to try out paid Azure services. 當您用完信用額度之後,請保留帳戶,並繼續使用免費的 Azure 服務,例如網站。After credits are used up, keep the account and continue to use free Azure services, such as Websites. 除非您明確變更您的設定且同意付費,否則我們絕對不會從您的信用卡收取任何費用。Your credit card is never charged unless you explicitly change your settings and ask to be charged.

或者,請啟用 MSDN 訂閱者權益Alternatively, activate MSDN subscriber benefits. MSDN 訂用帳戶每月會提供您信用額度,讓您可以用於 Azure 付費服務。An MSDN subscription gives you credits every month you can use for paid Azure services.

  1. 登入 Azure 入口網站Sign in to the Azure portal.
  2. 按一下左上角的加號 (「+ 建立資源」)。Click the plus sign ("+ Create Resource") in the top-left corner.
  3. 使用搜尋列尋找「Azure 認知搜尋」,或透過 [Web] > [Azure 認知搜尋] 瀏覽至資源。Use the search bar to find "Azure Cognitive Search" or navigate to the resource through Web > Azure Cognitive Search.

在入口網站建立資源Create a resource in the portal

選擇訂用帳戶Choose a subscription

如果您有多個訂用帳戶,請針對您的搜尋服務選擇一個訂用帳戶。If you have more than one subscription, choose one for your search service.

設定資源群組Set a resource group

資源群組是必要的,可用於管理所有資源,包括成本。A resource group is required and is useful for managing resources all-up, including costs. 資源群組可以包含一個服務,或多個一起使用的服務。A resource group can consist of one service, or multiple services used together. 例如,如果您使用 Azure 認知搜尋來編製 Azure Cosmos DB 資料庫的索引,您可以將這兩個服務納入相同的資源群組中,以便管理。For example, if you are using Azure Cognitive Search to index an Azure Cosmos DB database, you could make both services part of the same resource group for management purposes.

如果您不想將資源結合成單一群組,或現有的資源群組中有許多資源用於不相關的解決方案中,請為您的 Azure 認知搜尋資源建立專屬的新資源群組。If you aren't combining resources into a single group, or if existing resource groups are filled with resources used in unrelated solutions, create a new resource group just for your Azure Cognitive Search resource.

建立新的資源群組Create a new resource group

經過一段時間,您可以追蹤目前和預估的成本 (如螢幕擷取畫面所示),或向下捲動以查看個別資源的費用。Over time, you can track current and projected costs all-up (as shown in the screenshot) or scroll down to view charges for individual resources. 下列螢幕擷取畫面顯示當您將多個資源結合成一個群組時,最終會看到的成本資訊類型。The following screenshot shows the kind of cost information you can eventually expect to see when you combine multiple resources into one group.

在資源群組層級管理成本Manage costs at the resource group level

提示

資源群組可簡化清除,因為刪除群組也會刪除其中的服務。Resource groups simplify cleanup because deleting a group also deletes the services within it. 針對使用多個服務的原型專案,將它們全部放入同一個資源群組,在專案結束之後就能更容易清除。For prototype projects utilizing multiple services, putting all of them in the same resource group makes cleanup easier after the project is over.

為服務命名Name the service

在 [執行個體詳細資料] 的 [URL] 欄位中提供服務名稱。In Instance Details, provide a service name in the URL field. 該名稱是 URL 端點的一部分,API 呼叫是根據此端點所發出:https://your-service-name.search.windows.netThe name is part of the URL endpoint against which API calls are issued: https://your-service-name.search.windows.net. 例如,如果您所需的端點是 https://myservice.search.windows.net,則應輸入 myserviceFor example, if you want the endpoint to be https://myservice.search.windows.net, you would enter myservice.

服務名稱需求:Service name requirements:

  • 此名稱在 search.windows.net 命名空間中必須是唯一名稱It must be unique within the search.windows.net namespace
  • 長度為 2 到 60 個字元2 and 60 characters in length
  • 使用小寫字母、數字或連字號 ("-")Use lowercase letters, digits, or dashes ("-")
  • 前 2 個字元或最後一個字元不可使用連字號 ("-")Avoid dashes ("-") in the first 2 characters or as the last single character
  • 不能連續使用破折號 ("--")No consecutive dashes ("--") anywhere

提示

如果您認為您將使用多個服務,建議您在服務名稱中包含區域 (或位置) 以作為為命名慣例。If you think you'll be using multiple services, we recommend including the region (or location) in the service name as a naming convention. 相同區域內的服務可以免費交換資料,因此,如果 Azure 認知搜尋位於美國西部,而您在美國西部也有其他服務,則類似 mysearchservice-westus 的名稱可讓您在決定如何結合或連結資源時,為您省去前往屬性頁面的步驟。Services within the same region can exchange data at no charge, so if Azure Cognitive Search is in West US, and you have other services also in West US, a name like mysearchservice-westus can save you a trip to the properties page when deciding how to combine or attach resources.

選擇位置Choose a location

作為 Azure 服務,Azure 認知搜尋可裝載於世界各地的資料中心。As an Azure service, Azure Cognitive Search can be hosted in datacenters around the world. 支援的區域清單可在定價頁面中找到。The list of supported regions can be found in the pricing page.

您可以為多個服務選擇相同的位置,以盡量減少或避免產生頻寬費用。You can minimize or avoid bandwidth charges by choosing the same location for multiple services. 例如,如果您要為其他 Azure 服務 (Azure 儲存體、Azure Cosmos DB、Azure SQL Database) 提供的資料編製索引,請在相同區域中建立 Azure 認知搜尋服務,以避免產生頻寬費用 (當服務位於相同區域時,輸出資料不會產生費用)。For example, if you are indexing data provided by another Azure service (Azure storage, Azure Cosmos DB, Azure SQL Database), creating your Azure Cognitive Search service in the same region avoids bandwidth charges (there are no charges for outbound data when services are in the same region).

此外,如果您使用 AI 擴充資料,請在與認知服務相同的區域中建立您的服務。Additionally, if you are using AI enrichment, create your service in the same region as Cognitive Services. 將 Azure 認知搜尋與認知服務共置於相同區域中,是 AI 擴充的需求之一Co-location of Azure Cognitive Search and Cognitive Services in the same region is a requirement for AI enrichment.

注意

新的服務目前無法在印度中部使用。Central India is currently unavailable for new services. 對於已在印度中部提供的服務,您可以無限制地相應增加,且您的服務在該區域中受到完整的支援。For services already in Central India, you can scale up with no restrictions, and your service is fully supported in that region. 此區域的限制是暫時的且僅限於新的服務。The restriction on this region is temporary and limited to new services only. 當限制不再適用時,我們將移除此注意事項。We will remove this note when the restriction no longer applies.

選擇定價層 (SKU)Choose a pricing tier (SKU)

Azure 認知搜尋目前提供多個定價層︰免費、基本或標準。Azure Cognitive Search is currently offered in multiple pricing tiers: Free, Basic, or Standard. 每一層都有自己的容量和限制Each tier has its own capacity and limits. 請參閱選擇定價層或 SKU 以取得指導方針。See Choose a pricing tier or SKU for guidance.

一般對於生產工作負載通常會選擇基本和標準服務,但大部分的客戶一開始都會使用免費服務。Basic and Standard are the most common choices for production workloads, but most customers start with the Free service. 層級之間的主要差異在於資料分割大小和速度,以及您可以建立的物件數目限制。Key differences among tiers is partition size and speed, and limits on the number of objects you can create.

請記住,服務建立之後便無法變更定價層。Remember that a pricing tier cannot be changed once the service is created. 如果您稍後需要高或較低的定價層,必須重新建立服務。If you need a higher or lower tier later, you have to re-create the service.

建立您的服務Create your service

在您提供必要的輸入之後,請繼續並建立服務。After you've provided the necessary inputs, go ahead and create the service.

檢閱及建立服務Review and create the service

您的服務會在幾分鐘內部署,而您可透過 Azure 通知進行監視。Your service is deployed within minutes, which you can monitor through Azure notifications. 請考慮將服務釘選在儀表板上,以便日後存取。Consider pinning the service to your dashboard for easy access in the future.

監視及釘選服務Monitor and pin the service

取得金鑰和 URL 端點Get a key and URL endpoint

除非您使用入口網站,否則以程式設計方式存取新服務時,您需要提供 URL 端點和授權 API 金鑰。Unless you are using the portal, programmatic access to your new service requires that you provide the URL endpoint and an authentication api-key.

  1. 在 [概觀] 頁面中,找出並複製頁面右側的 URL 端點。On the Overview page, locate and copy the URL endpoint on the right side of the page.

  2. 在 [金鑰] 頁面上,複製其中一個系統管理金鑰 (它們是相等的)。On the Keys page, copy either one of the admin keys (they are equivalent). 在您的服務上建立、更新及刪除物件時,需要系統管理員 API 金鑰。Admin api-keys are required for creating, updating, and deleting objects on your service. 相反地,查詢金鑰會提供索引內容的讀取存取權。In contrast, query keys provide read-access to index content.

    包含 URL 端點的服務概觀頁面Service overview page with URL endpoint

入口網站工作不需要端點和金鑰。An endpoint and key are not needed for portal-based tasks. 入口網站已透過管理員權限連結至您的 Azure 認知搜尋資源。The portal is already linked to your Azure Cognitive Search resource with admin rights. 如需入口網站逐步解說,請從快速入門:在入口網站中建立 Azure 認知搜尋索引For a portal walkthrough, start with Quickstart: Create an Azure Cognitive Search index in the portal.

調整您的服務Scale your service

佈建完您的服務之後,您可以調整它以符合您的需求。After your service is provisioned, you can scale it to meet your needs. 如果您為 Azure 認知搜尋服務選擇了「標準」層,您可以在兩個維度調整服務︰複本和分割區。If you chose the Standard tier for your Azure Cognitive Search service, you can scale your service in two dimensions: replicas and partitions. 如果您選擇的是「基本」層,則只能新增複本。Had you chosen the Basic tier, you can only add replicas. 如果您佈建的是免費服務,則無法進行調整。If you provisioned the free service, scale is not available.

「資料分割」允許您的服務儲存及搜尋更多文件。Partitions allow your service to store and search through more documents.

「複本」允許服務來處理更高的搜尋查詢負載。Replicas allow your service to handle a higher load of search queries.

新增資源會增加每月的帳單。Adding resources increases your monthly bill. 定價計算機可協助您了解新增資源對帳單的影響。The pricing calculator can help you understand the billing ramifications of adding resources. 請記住,您可以根據負載來調整資源。Remember that you can adjust resources based on load. 例如,您可增加資源來建立完整的初始索引,並於稍後將資源減少到較適合累加式編製索引的層級。For example, you might increase resources to create a full initial index, and then reduce resources later to a level more appropriate for incremental indexing.

  1. 在 Azure 入口網站中移至您的搜尋服務頁面。Go to your search service page in the Azure portal.
  2. 在左導覽窗格中,選取 [設定] > [調整] 。In the left-navigation pane, select Settings > Scale.
  3. 您可以使用滑桿來新增任何一種類型的資源。Use the slidebar to add resources of either type.

新增容量Add capacity

注意

每個分割區的儲存體和速度均以更高的層次增加。Per-partition storage and speed increases at higher tiers. 如需詳細資訊,請參閱容量和限制For more information, see capacity and limits.

新增第二個服務的時機When to add a second service

大部分的客戶都是使用在提供正確資源平衡的層次上佈建的單一服務。Most customers use just one service provisioned at a tier providing the right balance of resources. 單一服務可以裝載多個索引 (數量受限於所選層的最大限制),且每個索引都互相隔離。One service can host multiple indexes, subject to the maximum limits of the tier you select, with each index isolated from another. 在 Azure 認知搜尋中,要求只能導向至單一索引,以盡可能降低意外或刻意從相同服務的其他索引中擷取資料的機會。In Azure Cognitive Search, requests can only be directed to one index, minimizing the chance of accidental or intentional data retrieval from other indexes in the same service.

雖然大部分的客戶只使用單一服務,但如果操作需求包含下列項目,則可能需要服務備援:Although most customers use just one service, service redundancy might be necessary if operational requirements include the following:

  • 災害復原 (資料中心中斷)。Disaster recovery (data center outage). Azure 認知搜尋不提供中斷時的即時容錯移轉功能。Azure Cognitive Search does not provide instant failover in the event of an outage. 如需建議和指導方針,請參閱服務管理For recommendations and guidance, see Service administration.
  • 您的多租用戶模型調查判斷額外服務為最佳化設計。Your investigation of multi-tenancy modeling has determined that additional services is the optimal design. 如需詳細資訊,請參閱針對多租用戶設計For more information, see Design for multi-tenancy.
  • 針對全球部署的應用程式,您可能在多個區域都需要 Azure 認知搜尋執行個體,以降低應用程式國際流量的延遲。For globally deployed applications, you might require an instance of Azure Cognitive Search in multiple regions to minimize latency of your application’s international traffic.

注意

在 Azure 認知搜尋中,您無法區隔索引和查詢作業,因此您永遠不會針對區隔的工作負載建立多個服務。In Azure Cognitive Search, you cannot segregate indexing and querying operations; thus, you would never create multiple services for segregated workloads. 一律是在建立索引的服務上查詢該索引 (您無法在某個服務中建立索引,並將它複製到另一個服務)。An index is always queried on the service in which it was created (you cannot create an index in one service and copy it to another).

不需要第二個服務即可獲得高可用性。A second service is not required for high availability. 當您在同一個服務中使用 2 個或更多的複本,查詢就會達到高可用性。High availability for queries is achieved when you use 2 or more replicas in the same service. 複本更新是循序的,這表示當服務更新推出時,至少會有一個複本是可運作的。如需執行時間的詳細資訊,請參閱服務等級協定Replica updates are sequential, which means at least one is operational when a service update is rolled out. For more information about uptime, see Service Level Agreements.

後續步驟Next steps

佈建服務之後,您可以繼續在入口網站中建立第一個索引。After provisioning a service, you can continue in the portal to create your first index.