Getting Started With Azure Search As Service - Part Two

This article is a continuation of a  previous article,  at this link.
If you are interested in watching video on same topics, please find it here
In this article, we will learn about Azure search concepts and terminologies like Index, Schema, Indexer, and data sources and will apply this concept by loading sample data in Azure search index and using  search explorer to pass our search query and get data.  

Index and Schema

Index in Azure search is equivalent to database table. You will create Index for a particular category of data which has its own schema (columns and column type). Data is then stored in Index as row, similar to any database table. For e.g, if you wanted to store Hotels listing data, you would create one Index with Hotel and create fields/columns like HotelId, Hotel Name, Description, Category, tags, Address, Rating, Rooms. Here address and rooms can be another complex type which has its own fields. We will talk about this schema later when we will load sample data.
Based on the pricing tier you select, you get a number of Indexes that can be created. Sample pricing tier is below.
Azure Search
You can create Index and its schema from Azure portal or progamatically using RESTP API/.NET SDK. 
Let us see how to create Index from Portal (in this article, we are automating this Index creation process from .NET SDK based on source data in XML).
Once you have Azure service created, you can see 'Add Index' as below.
Azure Search
We will get the below screen, provide Index name, primary key and add fields as per your requirement.
Azure Search 
Dropdown in above screenshot tells us about different supported data type, you can refer this link to more details.
If you notice, there are columns like filterable, sortable, facetable and searchable. Let us briefly see what this options means. The below explanation is taken  from Offical Microsoft docs.
Retrievable means that it shows up in search results list. You can mark individual fields as off limits for search results by clearing this checkbox, for example for fields used only in filter expressions.
Filterable, Sortable, and Facetable determine whether fields are used in a filter, sort, or faceted navigation structure.
Searchable means that a field is included in full text search. Strings are searchable. Numeric fields and Boolean fields are often marked as not searchable.

Data sources and indexers

An indexer is a crawler that loads data in Index from external Azure data source with field to field mapping. Basically, it is kind of scheduler job which pulls data from data sources and puts in Index. Data sources are bascially stored data connections which will be used by Indexer. As of now, only Azure data sources are supported like, 
  • Azure SQL
  • Azure Cosmos DB
  • Azure Blob Storage
  • Azure Table Storage
  • SQL Server on Azure VM.
For your data which does not reside in any of the above, we have to programmatically push data to Index.
For creating Indexers, we have the  below 3 options. 
  • Portal > Import Data Wizard (later in this article)
  • Service REST API (refer from this link)
  • .NET SDK (in my next article)
Now let us see how to load sample data in Azure search. 
Go to, and select your provisioned Azure search service. On Overview blade, find option 'Import data'.
Azure Search 
Select datasource as samples,
Azure Search 
 Select hotels-sample, click on next
Azure Search
We will get an option to select congnitive search, skip this and go to Customize Target Index. 
On the below screen, you can customize target Index schema. Please note that based on sample datasource it created a default index for us. 
Azure Search
For the sake of simplicity, we will keep this as it as and move to next screen 'Create a Indexer'.
As this is sample data, we cannot create a schedule but if it would have been as datasource we could setup a schedule. Based on our schedule it would run jobs and pull data from the respective data source.
Azure Search
Click on Submit button. It will validate our configuration we selected and then create Index, Indexer and datasource. 
Now we have create Index and sample data is imported in our Index. Let us now see how to use search explorer to see what data is loaded.
On the top navigation next to Import data, we will see option 'Search explorer', click on it.
It will give us below screen. Click on search without any change. It will load all the 50 documents as part of sample data.
Azure Search 
Search explorer is using REST API, we can use oData filter expression to filter data like in the example.
$filter=HotelId eq '22'
Azure Search
If you try to filter with some field which is not marked as filterable, we will get below error.
$filter=HotelName eq 'Regal Orb Resort'
"Invalid expression: 'HotelName' is not a filterable field. Only filterable fields can be used in filter expressions.\r\nParameter name: $filter"
You can learn more about query parameter at this offical microsoft link.


In this article, we have learned about,
  • Index and schema
  • Indexer and data sources
  • Loading sample data in Azure Search Index.
  • Using search explorer.
Please refer to this next article, if you want to learn how to automate operations like creating index, loading data from custom data source (xml file), and querying data by passing diffrent search parameters and options using .NET SDK.