How to Index and Search Data with Azure Search

azure search

INTRODUCTION TO AZURE SEARCH: -

Azure Search is a search-as-a-service model through which we can develop and implement great search experience in ​​​mobile applications as well as into web without managing infrastructure.

Search is a hard and niche area. From an infrastructure ​point of view, it needs to have high availability, durability, scale, and operations. From a functionality standpoint, it needs to have ranking, language support, and geospatial capabilities.

Azure Search can fulfill all these user experience features , along with giving you monitoring and reporting, simple scoring, and tools for prototyping and inspection.

FEATURE DESCRIPTIONS:

Azure Search comes with all the core features which other search technolgies have like Free-form text search, Relevance, Geo-search, Filters and facets, User experience feature(Autocomplete, Search suggestions, Synonyms, Hit highlighting, Sorting , Paging ), but it adds with some features which Azure Search provides out of the box.

AI Enrichment :

  • Cognitive Search
  • Knowledge Store

Platform Level :

  • Monitoring and diagnostics
  • Server-side encryption
  • Infrastructure

Azure Search Workfow:​

We can avail azure search service on Azure Portal.

we have to create azure search service and have to specify a name which is the part of URL against which REST API calls are being called. We have to give the resource group which is the collection of the azure services and the resources (SQL database) together.

Format for the URL: https://your-service-name.search.windows.net

Enter your service name in the URL field. For example, if you want the endpoint to be https://codebator.search.windows.net, you would enter codebator.

We have to now choose which tier we want, Free or Paid tier. For Free tier we have been given 50MB storage space as well as we can create 3indexes per service. For Paid tiers all the services are same except the no of Replicas and Partitions which are scalable as per the need.

GET the Admin API keys i.e primary admin key and the Secondary admin key which are used to create, update and delete objects on your service.

Scale your services by just using the portal.These are some of the advance features of Azure Search. In the Free tier you have been provided with one replica as well as one partition, but in future if you want to scale the storage or we can say infrastructure then we have to follow the following procedure.

CREATE INDEX​ :

We can create the index either by using the portal or by using the .NET or REST APIs. Index is the means through which the data is being organized and being searched in Azure Search. Index contains the Schema and the search options.​

Typical Schema

  • Fields definition: name, type, key.

Search Specific

  • Fields attributes – searchable, facetable, etc.
  • Analysis
  • Suggesters for auto-complete
  • Scoring profile for ranking tuning.​

CREATE INDEX​ :

You can create the schema using azure portal or using the REST API.

Once we create the index, then we are ready to load the data. We can either use the PUSH or PULL mechanism​

PULL : In the pull mechanism we can retrieve the data from the external source with the help of indexers. Indexers helps in the process of data ingestion such as one could connect, read or serialize data.Indexers are available for Azure Cosmos DB, Azure SQL Database, Azure Blob Storage, and SQL Server hosted in an Azure VM. In the Portal there is import data module through which we can load our data. It automatically connects to the data source too which we have pointed out, moreover it generates an index based on the meta data of the external data source. ​

Now once we click on the import data wizard then we are ready to connect with the external datasource. We have to specify the data source to which we are pointing

The target index will be automatically created once we connect to the data, it scrawls the data and based on the pattern it create the index, then we can specify the name of our indexer hence the data will be imported into the azure search, when we run the indexer we see the execution history about how many records are succeeded and how many failed.

PUSH : Using the indexing API we can push the data into the Azure Search index. Any data composed of json documents can be pushed to an azure search index meant the each document is mapped to the fields we have described in the schema. We do not have to take care where our data is, we can post it from anywhere. While pushing the data through REST API we have to take care of the @search.action which we have to include while pushing the data so that the necessary action can be take.

There are may search actions like Upload Merge mergeOrUpload delete​

SEARCH​ :

Now once the data has been pushed we can retrieve it with the help of indexing API. We can implement the queries using the REST API or .NET library. In the REST API, Search Operation is issued by the GET and POST request and the parameters are given as a query for the selected matching documents.

Few of the GET APIs are :

  • RESULTS : https://codebator.search.windows.net/indexes/catalog/docs?api-version=2017-11-11
  • FOR INDEX : https://codebator.search.windows.net/indexes?api-version=2017-11-11
  • FOR SEARCH :​ https://codebator.search.windows.net/indexes/catalog/docs?api-version=2017-11-11&search=prod1830015

CONCLUSION :

Azure Search workflow have been explained so that new people working on it can get some knowledge how to start. This search is very easy as from the infrastructure point of view we do not have to take care about anything hence if one follow the above steps, can easily start working on azure search with no greater difficulty.​​ Formore detail kindly visit Microsoft Azure