# Thursday, March 14, 2019

GCast 39:

Azure Search REST API

Azure Search allows you to make your internal data searchable in the same way that search engines like Google and Bing make public information on the Internet searchable.

Thursday, March 14, 2019 8:31:00 AM (GMT Standard Time, UTC+00:00)
# Thursday, March 7, 2019

GCast 38:

Azure Search

Azure Search allows you to make your internal data searchable in the same way that search engines like Google and Bing make public information on the Internet searchable.

Thursday, March 7, 2019 9:50:00 AM (GMT Standard Time, UTC+00:00)
# Friday, March 1, 2019

Azure Search allows you to create a service making your own data searchable, in much the same way that public search engines like Google and Bing make data on the Internet searchable.

In previous articles, I showed how to create an Azure Search Service; and how to import and index data in that service.

In this article, I will show how to use a REST API exposed by the Azure Search service to return indexed results, based on search criteria.

You can do some limited searching using the Azure portal. Navigate to the Azure portal and login; then, navigate to the Azure Search service, as shown in Fig. 1.

as01-OverviewBlade
Fig. 1

Click the [Search explorer] button (Fig. 2) to display the "Search explorer" blade, as shown in Fig. 3.

as02-SearchExplorerButton
Fig. 2

as03-SearchExplorerBlade
Fig. 3

At the "Query string" field, you can enter a search term and click the [Search] button to return all the data (in JSON format) that matches the search term in any field you marked "FILTERABLE" in your index. Clicking the [Search] button issues an HTTP GET against the Search service's REST API. The results are shown in Fig. 4.

as04-SearchExplorerResults
Fig. 4

You have more flexibility calling the REST API with a POST request. This is not possible through the portal; but you can use a tool like Postman to make these requests.

The URL to which you POST can be found on the Azure service's "Overview" tab, as shown in in Fig. 5.

as05-Url
Fig. 5

The URL takes the form:

https://<servicename>.search.windows.net

where <servicename> is the name you assigned to this service.

You will also need the Query key. You can find the Query key by opening the Azure Search service's "Keys" blade (Fig. 6) and clicking "Manage query keys" to display the "Manage query keys" blade, as shown in Fig. 7.

as06-KeysBlade
Fig. 6

as07-ManageQueryKeys
Fig. 7

To test POSTing to the REST API, open Postman and open a new tab, as shown in Fig. 8.

as08-Postman
Fig. 8

At the Verb dropdown, select "POST".

At the "Request URL" field, paste in the URL. This will be the URL copied from the "Overview" tab, followed by "/indexes/<indexname>/docs/search?api-version=2017-11-11

where <indexname> is the name of the index you created in the Azure Search service.

This is shown in Fig. 9.

as09-PostmanParamsTab
Fig. 9

Select the "Headers" tab, as shown in Fig. 10.

as10-PostmanHeaderTab
Fig. 10

Enter the following 2 key/value pairs:

Key="api-key"; value=the Query key copied from the service.

Key="Content-Type"; value="application/json"

These are shown in Fig. 11.

as11-PostmanHeaderTab
Fig. 11

Select the "Body" tab to enter search parameters, as shown in Fig. 12.

as12-PostmanBodyTab
Fig. 12

The example shown
{
   "select": "*",
  "filter": "state eq 'IL'",
  "orderby": "presentationDate desc"
}

instructs the API to select all the fields' to filter the data, returning only those in which the "state" field equals "IL"; and sort the results in descending order by presentation date.

The results are shown in Fig. 13.

as13-PostmanResults
Fig. 13

In this article, you learned how to use the REST API to access an Azure Search service.

Click  the [Send] button to POST to the API.

Friday, March 1, 2019 9:27:00 AM (GMT Standard Time, UTC+00:00)
# Wednesday, February 27, 2019

Azure Search allows you to create a service making your own data searchable, in much the same way that public search engines like Google and Bing make data on the Internet searchable.

There are three steps to configuring Azure Search:

  1. Create Azure Search Service
  2. Create Index
  3. Import data

In a previous article, I showed how to create an Azure Search Service.

This article will show how to import data into Azure Search service; then index that data.

Navigate to the Azure portal and log in.

For this demo, I am indexing a Table in Azure storage containing information about my public speaking events, as shown in the Azure Data Explorer in Fig. 1.

as01-TableData
Fig. 1

Open your Azure Search Service, as shown in Fig. 2.

as02-OverviewBlade
Fig. 2

Click the [Import data] button (Fig. 3) to display the "Import data" blade, as shown in in Fig. 4.

as03-ImportDataButton
Fig. 3

as04-ImportDataBlade
Fig. 4

At the "Data Source" dropdown, select "Azure Table Storage", as shown in in Fig. 5.

as05-DataSourceTableStorage
Fig. 5

The "Connect your data" tab displays, as shown in Fig. 6.

as06-ConnectYourData
Fig. 6

At the "Name" field, enter a name for this data source.

At the "Connection string" field, click "Choose an existing connection" and select the storage account containing your data, as shown in Fig. 7.

as07-ChooseConnection
Fig. 7

At the "Table name" field, enter the name of the table containing your data.

Click the [Next] buttons at the bottom of the tab until you advance to the "Customize target index" tab, as shown in Fig. 8.

as08-CustomizeTargetIndex
Fig. 8

This tab displays all the fields in your data. Here you can select which fields can be retrieved, which can be filtered on, which can be sorted on, etc.

After making all your selections, click the [Next: Create an indexer] button at the bottom of the tab to advance to the "Create an indexer" tab, as shown in Fig. 9.

as09-CreateIndexer
Fig. 9

On this tab, you can configure how often your index will be updated from data changes. You can also decide whether to remove deleted items from your index (which will slow down indexing).

Click the [Submit] button to begin the first indexing and set the indexing schedule as configured.

A few minutes after the indexer runs, you should see the DOCUMENT COUNT and STORAGE SIZE values in the "Indexes" tab of the Search Service's "Overview" blade, as shown in Fig. 10.

as10-IndexesTab
Fig. 10

In this article, I showed how to import data into an Azure Search Service; then index that data.

In a future article, I will show how to call the search service.

Wednesday, February 27, 2019 9:21:00 AM (GMT Standard Time, UTC+00:00)
# Tuesday, February 26, 2019

Azure Search allows you to create a service making your own data searchable, in much the same way that public search engines like Google and Bing make data on the Internet searchable.

Before you can begin using Azure Search, you must perform the following actions:

  1. Create Azure Search Service
  2. Create Index
  3. Import data
  4. Index the data

This article will show how to create an Azure Search Service.

Navigate to the Azure portal and log in.

Click the [Create a Resource] button (Fig. 1) to display a list of Azure resource categories.

as01-CreateResourceButton
Fig. 1

At the Search box, enter "Azure Search" and press Enter, as shown in Fig. 2.

as02-SearchAzureSearch
Fig. 2

From the list of matching services, click on "Azure Search", as shown in Fig. 3.

as03-SelectAzureSearch
Fig. 3

A blade describing the features of Azure search displays, as shown in Fig. 4.

as03-SelectAzureSearch
Fig. 4

Click the [Create] button at the bottom of this blade.

The "New Search Service" blade displays, as shown in Fig. 5.

as04-CreateAzureSearch
Fig. 5

At the "URL" field, enter a unique name for this service. The service will expose a REST endpoint with the URL: https://xxxx.search.windows.net, where xxxx is the name you enter here.

At the "Subscription" dropdown, select the Subscription in which you want to store this service.

At the "Resource group" dropdown, select the resource group in which to store this service or click the "Create new" link to add a new resource group, as shown in Fig. 6.

as06-NewResourceGroup
Fig. 6

At the "Location" dropdown, select the region in which you want to store this service. The region should be near the users of the service or near the data you intend to index.

At the "Pricing tier" field, select an appropriate pricing tier. Clicking this field expands the "Choose your pricing tier" blade (Fig. 7), which displays the approximately monthly cost and the features of each tier.

as07-PricingTier
Fig. 7

When you have completed all the fields in the "New Search Service" blade, click the [Create] button to create the service.

When the service is created, you can navigate to it, as shown in Fig. 8.

as08-OverviewBlade
Fig. 8

This article showed how to create a new Azure Search Service. In the next article, we will create an Index for this service.

Tuesday, February 26, 2019 9:08:00 AM (GMT Standard Time, UTC+00:00)