In our previous articles related to Azure Search Service, we have learned the following.

In this article, as highlighted below, we will create an Index in the Azure Search service that we have created in our previous article mentioned above.

azure-search-create-index

What is an Index in Azure Search Service?

An index is like a persistent storage medium of the data typically called documents. It’s like a database table where you have rows (or entities).

Documents – It’s like a row of a database table.

Each Index has a Name and a set of Fields. We will learn how to create these fields in a moment.

Why should we create an Index?

As discussed in the previous article, we should let the Azure Search Service know our application specific data so that it can process and do all the analysis related to search so that we can consume the Azure Search capabilities by running Search Queries to Azure Search. So, we need to first create the Index and then load the data. This article focuses on creating the Index only.

Navigate to the Search Service that we have created as shown below.

1_searchservicedetails

As shown in the above screen capture, click on Add Index button to open the following Add Index blade where you enter the following details.

  • Index Name – Name of the Index
  • Index Fields – All the fields related to your application data.

2_addindex

Please provide a meaningful name in the Index name field and click on Fields button to open up the Fields blade as shown below.

3_defaultindexfields

Below are few of the details about the highlighted sections of the above screen capture.

  • Basic – This is the default tab that gets opened where you define the Index Schema. This is similar to creating a database table with different columns and constraints.
  • Id field – This is the default field that gets created automatically with the datatype String.
  • Key fieldBy default, the Id field is tagged as the Key This is a kind of primary key.

Azure Search Index allows us to create eight type of fields which are shown below and all of them are self-explanatory.

  • String
  • Collection (Edm.String)
  • Int32
  • Int64
  • Double
  • BooleanEdm.DateTimeOffset
  • GeographicPoint

Let’s go-ahead and create the Index schema with our application specific data requirement. As an example, we will be having Employee information.

Below is the Index Schema that I have created.

4_indexfields

Once you review your data click OK button. Once you click on OK button you will be taken back to the Add Index blade as shown below with the number of fields that you have added.

5_fieldscreated

Click OK now to create the Index. As shown below, we have successfully crated the Azure Search index.

6_createdindex

Other important Notes about Azure Search Index: You cannot edit the Index definition as of this writing. In case if you want to change the data type of a given field, you need to delete and recreate the Index.

You can have only one field with the attribute Key tagged to it.

Summary: In this article, we have learned the following.

  • What is an Azure Search Index?
  • How to create an Index
  • Different type of Fields that we can create in an Index

Hope you enjoyed reading the article. Your feedback is appreciated.