Saturday, February 25, 2017

Azure Search #3 - Azure Search Index


When you want to have Azure Search integrated with your application data first thing you have to do is creating a Azure Search index under your search service. One Search service can contain multiple indexes.

An index is a persistent store of documents and other constructs used by an Azure Search service.

A document is a single unit searchable data in your index.

Index is like a table in SQL database. But there are some differences. When creating a index a given data field has set of attributes and a field type. Lets first look at what are the possible data types we can store in Azure search index.


Type Description

Text that can optionally be tokenized for full-text search


A list of strings that can optionally be tokenized for full-text search


Contains true/false values


32-bit integer values


64-bit integer values


Double-precision numeric data


Date time values represented in the OData V4 format


A point representing a geographic location on the globe

for more details about search index datatypes visit here

Next you have to define the attributes, which is used to describe the fields to the azure search service. following are the attributes included in a given data field. if value is not defined it is default set to false.


Attribute Description

A string that provides the unique ID of each document, used for document look up. Every index must have one key. Only one field can be the key, and its type must be set to Edm.String.

Retrievable Specifies whether a field can be returned in a search result
Filterable Allows the field to be used in filter queries
Sortable Allows a query to sort search results using this field
Facetable Allows a field to be used in a faceted navigation structure for user self-directed filtering. Typically fields containing repetitive values that you can use to group multiple documents together (for example, multiple documents that fall under a single brand or service category) work best as facets
Searchable Marks the field as full-text searchable


for an example if you mark some data fields are “Searchable” true when you send a full text search request to the search service, search service will search that text in every field that you have marked “Searchable” and will send the search results for you.

So you can see how easy it is , If we had to make a search service we will have to write a query which will check match in every column which needs to search. but here what you need to do is just mark the field as “Searchable” and search service will do the rest for you.

There are 3 ways to create a Search service Index.

  1. Azure Portal
  2. .Net
  3. Rest API

I will describe then one by one with samples in next blog posts. Until then

Happy Coding !!

1 comment :