適用於 Node.js 的 Azure 搜尋服務模組Azure Search modules for Node.js

Azure 搜尋服務是一項雲端搜尋即服務解決方案,可將伺服器和基礎結構管理委託給 Microsoft,讓您利用立即可用的服務來填入搜尋資料,然後用來在您的應用程式中新增搜尋。Azure Search is a cloud search-as-a-service solution that delegates server and infrastructure management to Microsoft, leaving you with a ready-to-use service that you can populate with your data and then use to add search to your application.

深入了解 Azure 搜尋服務Learn more about Azure Search.

管理封裝Management package

安裝 npm 模組Install the npm module

安裝 Azure 搜尋服務 npm 模組Install the Azure Search npm module

npm install azure-arm-search

範例Example

此範例會在 Azure 中建立新的搜尋服務,並列出其資源群組中的資源。This example creates a new Search service in Azure, and lists the resources in its resource group.

const msRestAzure = require('ms-rest-azure');
const SearchManagement = require('azure-arm-search');

const subscriptionId = 'your-subscription-id';
const resourceGroup = 'yourResourceGroup';

msRestAzure
  .interactiveLogin()
  .then(credentials => {
    const client = new SearchManagement(credentials, subscriptionId);
    return client.services.listByResourceGroup(resourceGroup);
  })
  .then(services => console.dir(services, { depth: null, colors: true }))
  .catch(err => {
    console.log('An error ocurred');
    console.dir(err, { depth: null, colors: true });
  });

範例Samples

深入探索可在應用程式中使用的 Node.js 程式碼範例Explore more sample Node.js code you can use in your apps.