Introduction to Azure Cognitive Search

Dominic Burford
3 min readFeb 28, 2020

As part of my research into technologies to support the new web application that I am helping to build, I have been looking into Azure Cognitive Search (ACS). I came across this technology by accident while reading through an issue of Code magazine[^]. In that article, the author explains how the technology can be used to perform powerful queries across your data, even leveraging fuzzy logic and AI capabilities.

Quote:

Azure Cognitive Search is the only cloud search service with built-in AI capabilities that enrich all types of information to easily identify and explore relevant content at scale.

The article then goes on to give a step-by-step guide as to how to setup and configure a simple instance of ACS. This got me thinking how I could implement this in our own applications where we regularly mine large data sets using disparate ad hoc queries. I won’t go into a detailed description of setting up or configuring ACS as there are already plenty of articles online that do this including this one[^]. In particular look at the 10-minute quickstart articles on that page.

The basic premise is to create a new instance of ACS, and as part of the configuration you connect to your data. Once you have connected to your data, you can then create Indexes. These are where the magic happens. By creating an Index onto your data, this allows you to query your data using the powerful capabilities of ACS. You can add AI capabilities if you so wish by enriching your data as part of the configuration.

For example, if your data includes images of vehicles, you can enrich your data to be able to search on the vehicle’s registration number. ACS will use its pattern recognition to locate the vehicle registrations from within the images. You can then search through the image data for vehicles that match specified vehicle registrations. This is just one simple example of how you can enrich your data and leverage the powerful AI capabilities of ACS.

You are able to write simple queries using SQL-like syntax including the following commands[^]

Hide Copy Code

search=
searchMode=
searchFields=
queryType=
$skip=
$top=

Using the power of OData expression syntax, you can then filter and order the results of your data using the following commands[^]

Hide Copy Code

$filter=
$orderby=
$select=

If you need fuzzy logic search, you can implement Lucene query syntax very easily. This gives you the ability to search for data where the user may have mis-typed a name or email address for example. If the user meant to type “Fred” as the search term, but accidentally typed “Frod” then using Lucene fuzzy logic you are able to return all such close matches (and you can also define how close a close match is too). See this article[^] for more details.

You can implement your queries using the REST API[^] or the Azure Cognitive Search .NET library[^]

However you decide to implement ACS in your application, it gives you a powerful, yet simple view onto your data allowing you to return everything from a simple SQL-like query to full blown fuzzy logic / pattern matching / AI capabilities. All from the same, consistent APIs.

I haven’t even scratched the surface of this technogy. My intention was merely to pique your interest and hopefully get other developers to explore ACS for their own applications. I’ll keep exploring this fantastic technology and hopefully write future articles on how I have used it within the applications I am developing. In the meantime, if you haven’t already done so, I can’t recommend this technology highly enough.

--

--

Dominic Burford

A father, cyclist, vegetarian, atheist, geek and multiple award winning technical author. Loves real ale, fine wine and good music. All round decent chap.