How To Create An Index Using Import Data, Create An Indexer - Part Two

In this article, we will discuss how to create an index using import data.

In my previous article I created an Azure Search service as shown. To know how to create an Azure Search Service you can read  Part One here.

In this article, I’ll show how to add an index on search service.

We can do it in two ways,

  1. By using Add index button.
  2. OR use Import data
Here, using import data we will create an Index.

STEP 1 - Click on Import data

Open the search service as we have created in the previous article -> click on Import data 

How to create an Index using Import Data, Create an indexer

STEP 2 - Click on Data source

How to create an Index using Import Data, Create an indexer


STEP 3 - Choose Data Source

Using the below options select a data source

How to create an Index using Import Data, Create an indexer

I selected the Azure SQL Database

How to create an Index using Import Data, Create an indexer

STEP 4 - Create New Data source
  1. Name: Enter new data source name – ‘awsearch’
  2. SQL Database – Select an SQL Database, I will use the already existing database [‘awsearch’]

I created a SQL database [using adventurWorks] with name ‘awsearch’ as shown. I’ll show in another article how to create a SQL database using an Azure portal.

How to create an Index using Import Data, Create an indexer

 

For this article, I will use this existing database.

How to create an Index using Import Data, Create an indexer

STEP 5 - Test connection

 

Enter the credentials that you have used while creating the database and click on test connection.

How to create an Index using Import Data, Create an indexer

Connection is validated and we can see a table/View as shown.

How to create an Index using Import Data, Create an indexer

STEP 6 - Select Table/View

Select the table name as salesLT.customer from the dropdown list.

How to create an Index using Import Data, Create an indexer

Select the customer table and click OK.

How to create an Index using Import Data, Create an indexer

How to create an Index using Import Data, Create an indexer

STEP 7 - Cognitive Search

Cognitive search is the enterprise search that makes use of Artificial Intelligence (AI) to return results that are more relevant to the user or embedded in an application issuing the search query. To know more about cognitive skills, click on Learn More.

How to create an Index using Import Data, Create an indexer

NOTE
 
As shown above, Cognitive Search is only available in South Central US and West Europe only

STEP 8: Customize Target Index

Click on Index

The information that appears on the screen states,

  • It will provide a default index for us as shown.
  • We can delete the fields which are not required.
  • Once the index is built, deleting and changing fields will require re-indexing of documents
 How to create an Index using Import Data, Create an indexer

Index Name

Select a name for your index. Follow the guidelines for specifying index name as shown.

How to create an Index using Import Data, Create an indexer

Select Key

I Selected customerId as the key field.

As shown, the index can have only one key field and that must be a string field and retrievable.

How to create an Index using Import Data, Create an indexer 

 

Select Fields

Select fields in the index, delete the one you don’t need by right-clicking on the field and click on delete as shown.

So, I selected fields,

  • CustomerID
  • FirstName
  • LastName
  • ComapnyName
  • EmailAddress
  • Phone
  • ModifiedDate
How to create an Index using Import Data, Create an indexer 

Set Filters controls

We have five controls in an index that we can set on these fields,

  1. Retrievable
  2. Filterable
  3. Sortable
  4. Facetable
  5. Searchable
How to create an Index using Import Data, Create an indexer 

Retrievable

Select the fields for which we want documents to be retrievable as part of search results.

Searchable and retrievable

If you want the documents to be searchable and retrievable then select both and we could search based on any of the data in these fields

Filterable and sortable

As the name suggests, we could do filtration and sort on the search based on the selected fields for selected controls.

Facetable

It’s a filtering mechanism that provides a self-directed drill down in search applications. In short, we can say that the category is used to filter the results. To know more, read this MSDN doc here; in this article, the below figure clarifies what facets are.

How to create an Index using Import Data, Create an indexer 

Select the filters and Click OK

 How to create an Index using Import Data, Create an indexer

STEP 9 - Create an Indexer

 How to create an Index using Import Data, Create an indexer

Indexer Name

Enter the name for the indexer, it must alphanumeric and no uppercase, only lowercase letters, digits and dashes as shown in the validation.

How to create an Index using Import Data, Create an indexer

Schedule

It will show the schedule of your indexer, it can be,

  1. Once
  2. Hourly
  3. Daily
  4. Custom
How to create an Index using Import Data, Create an indexer 

Schedule it for hourly. We can see the high watermark column, which keeps our index up to date with database

 How to create an Index using Import Data, Create an indexer

I selected Modified date. If this has changed,since the last time we did the indexer, then update this in the index as well.

 How to create an Index using Import Data, Create an indexer
 
To track the deletions, check the Track deletions checkbox and select the soft delete column and specify the value to configure the soft delete policy,
 
 How to create an Index using Import Data, Create an indexer

For now, uncheck the track deletions and click OK.

 How to create an Index using Import Data, Create an indexer
 
 How to create an Index using Import Data, Create an indexer
 
 How to create an Index using Import Data, Create an indexer
 
 How to create an Index using Import Data, Create an indexer

Here, we can see that Indexers are now created successfully and success=1

Also, indexes contain the index name, document count and storage size.

How to create an Index using Import Data, Create an indexer 

STEP 10 - Run Indexer Manually

Now, go to the indexer,
 
 How to create an Index using Import Data, Create an indexer 

Select the name of the indexer, we see no documents have succeeded and no history for this indexer.

 How to create an Index using Import Data, Create an indexer

Click on Run and create the indexer manually and select ‘Yes’

 How to create an Index using Import Data, Create an indexer

On the extreme right notification pane, we can see the notification as

 How to create an Index using Import Data, Create an indexer
 
Index summary shows the execution history and execution details with success status,
 
How to create an Index using Import Data, Create an indexer

Now, go back again and click on Indexers, here we go,

Indexers with success details, docs succeeded as shown below. 

How to create an Index using Import Data, Create an indexer

 

Summary

In this article, we saw how to create an index using Import data, saw search filters [Retrievable, Filterable, Sortable, Facetable, Searchable] used for the fields, created indexer, and ran it manually.

Happy reading!