Introduction to Azure Search

Azure Search is new cloud service by Microsoft. I played with this service a little bit and now it is my favorite toy. In this post I give a quick overview of Azure Search and tell you what it is and what it is not. Also I provide some advice about what tools you need and how to get rid of some problems I faced when using service on CoreCLR.

Why Azure Search?

First let’s take a look at picture of Microsoft search technologies and let’s where Azure Search comes in. Below is the table of services built and provided by Microsoft. For all services I also added explanation why they don’t fit well for custom search scenarios.

TechnologyDescriptionCons
Desktop SearchPowers file search and search from mailboxes, used also by media services.Not built for web scenarios or for big number of parallel users.
BingWeb search, targeted to find web pages and files from web.Search from web index, no options for custom structured data.
SharePoint SearchPerhaps most powerful enterprise-grade search solution available, highly customizable.The best your money can buy but it is very expensive.
DocumentDBNoSQL document database built by Microsoft and provided as a services on Azure.Just a database with not much search semantics.

Azure search is the missing piece of puzzle – you can build custom search indices, customize these and search from indices from whatever application you have. For smaller loads there is also free search available on Azure.

Internals of Azure Search

Microsoft uses Elastic Search as a search engine behind Azure Search service. Elastic Search is free search solution built on top of Lucene document database. For us there is JSON-based API for search and this is how our applications communicate with search service.

Azure Search

NB! Our applications use only what Azure Search API provides. We have no direct access to search solution behind the API and actually for us it shouldn’t matter what Microsoft is actually using. Azure Search is not cloud hosted Elastic Search.

Features of Azure Search

Here are some features of Azure Search:

  • Indexers – update search index from SQL Azure or DocumentDB
  • Faceted navigation – filtering mechanism that provides self-directed drilldown navigation in search applications
  • Pagination – search results can be paged
  • Scoring profiles – feature of Microsoft Azure Search that customize the calculation of search scores, influencing how items are ranked in a search results
  • Suggesters – used for search-based auto-complete, by example
  • Tab boosting – based on existing tags elements in index can get higher ranking score in results
  • Language analyzers – analysis for fields that most frequently involve word-breaking, text normalization, and filtering out terms.

Managing search service

We can manage our search services through Azure preview portal. Screenshot below gives you some idea about what to expect.

Azure Search settings

Not all management options are available through preview portal – there are still some things you need to do through direct JSON calls to API. I hope over time all these options will find their way to management portal too.

Tools and libraries

Here are tools and libraries you can use:

  • There is search library available on Nuget. It is by Microsoft and you can use it in your applications that use full version of .NET. NB! Today this library is not supported on CoreCLR.
  • Have some REST client because there are things you can do only through API. There is RESTClient plug-in available for Firefox, by example.

RESTClient plug-in for Firefox

Solving problems

  • If your application is running on CoreCLR then you can write your own simple search client using JSON.NET by example.
  • I faced issues on Visual Studio and CoreCLR when running code asynchronously. If you run into same troubles then Task.Wait() will do the trick but don’t consider this trick as a solution. It’s still bad hack but you get control over what is going on.
  • As there are some hard limitations (you can’t change and delete existing fields in index) it’s good idea to write a piece of code that populates your indices again. You may also need this code if you just play with search service and you don’t have admin interface for your data.

Wrapping up

With Azure Search we have now simple search service that we can use for custom data. It doesn’t matter what application we are building. We can use Azure Search from all types of applications that have access to internet. Most of configuration can be done through preview portal but there are still things we have to do directly through API-s. Although there are some limitations on indices we can still use the service also for production environments. For smaller scenarios there is also free version of search service available.

Gunnar Peipman

Gunnar Peipman is ASP.NET, Azure and SharePoint fan, Estonian Microsoft user group leader, blogger, conference speaker, teacher, and tech maniac. Since 2008 he is Microsoft MVP specialized on ASP.NET.

    2 thoughts on “Introduction to Azure Search

    Leave a Reply

    Your email address will not be published. Required fields are marked *