Working on Typeahead

Today, I am working on typeahead with Azure Search.

I am reading,

Before you proceed, you need to make sure you have your suggester fieldset.  Per index, you can have only one suggester field.

On your page use this javascript

This code above uses the jQuery UI Autocomplete library. ( , see the API here you can go to and find CDN version to simply copy paste to the page.

Now, let’s look at HomeController.cs (or any controller that you set to be called from the javascript)  and related classes to return the suggestions.

/home/suggest?highlihts=false&fuzzy=false needs to return Jason format result.

I actually keep my Azure Search management services in different classes, where I have a method to return a list of suggestions in strings like below.

Then, I have home controller calling this method and return Json as below.

This is it, it works beautifully.




Active Directory

Active Directory (AD) is a directory service that Microsoft developed for Windows domain networks. It is included in most Windows Server operating systems as a set of processes and services. Initially, Active Directory was only in charge of centralized domain management. Starting with Windows Server 2008, however, Active Directory became an umbrella title for a broad range of directory-based identity-related services.

Active Directory is a database based system that provides authentication, directory, policy, and other services in a Windows environment

LDAP (Lightweight Directory Access Protocol) is an application protocol for querying and modifying items in directory service providers like Active Directory, which supports a form of LDAP.

Active Directory Domain Services is Microsoft’s Directory Server. It provides authentication and authorization mechanisms as well as a framework within which other related services can be deployed (AD Certificate Services, AD Federated Services, etc). It is an LDAP compliant database that contains objects. The most commonly used objects are users, computers, and groups. These objects can be organized into organizational units (OUs) by any number of logical or business needs. Group Policy Objects (GPOs) can then be linked to OUs to centralize the settings for various users or computers across an organization.

When people say “Active Directory” they typically are referring to “Active Directory Domain Services.” It is important to note that there are other Active Directory roles/products such as Certificate Services, Federation Services, Lightweight Directory Services, Rights Management Services, etc. This answer refers specifically to Active Directory Domain Services.

Azure Search, Deleting A Document

Here is how to delete a document in your Azure Search Index collection, using Azure Search SDK for .Net version 1.1.0


I shall put full run through tutorial on Azure Search .. soon soon.

What is Azure Active Directory

What is Azure Active Director? and of course they have exact same title article covering exactly I wanted to know at  So here is my short memo version.

Azure Active Directory is a service where you can manage things around credentials.  You can offer your app, API and other services based on credentials that you manage on Azure Active Directory.

For example, you have API service that is privately offering and want to manage accesses, you can do so through Azure Active Directory.

Azure Search Autoindexing DocumentDB Data


Isn’t that nice, if you can sync (index) your DocumentDB data to Azure Search in auto schedule? Yap, so that’s what we will do today.  At the end, your DocumentDB data will automatically be indexed to Azure Search, and be able to search from Azure Search like you are searching DocumentDB data.

Azure Search Index DocumentDB Data on Schedule

Original and great walk through tutorial is here at   This is my version of walking through this tutorial.

Previously I have cover a bit about Azure Search and DocumentDB so if you are not too familiar with what they are and capable of, please refer to, Mastering Azure DocumentDB Part 1 and Mastering Azure Search.

To auto index your DocumentDB to Search, you need to have two things.  1 is data source and 2 is indexer.

Continue reading “Azure Search Autoindexing DocumentDB Data”

Azure DocumentDB Limitation

The original document  is here at, but I am making note to myself here too.  These are worthy to know when you are working DocumentDB and designing the service structure.

  • You can only have up to 5 database accounts by default.
  • You can only have up to 100 database per account.
  • Number of users per account is 500,000.
  • Number of permission per database account is 2,000,000.
  • Attachment storage per database account is 2GB (I ll probably use blob storage and just have uri reference to the location so I m not so worry about this limitation now)
  •  Max request units per second per collection is 2500.
  • Number of stored procedures, triggers and UDFs per collection is 25 each.
  • Max execution time for stored procedure and trigger is 5 seconds.
  • Provisioned document storage / collection is 10GB.
  • Max collections per database account is 100. (so that’s 500 max in account)
  • Max document storage per database 1TB. = Number of collection is up to 100 and that has to be less than 1TB.
  • Max length of the ID property is 255 characters.
  • Max items per page is unlimited. There is no limit here but if I must say that’s 1TB worthy of documents to page.
  • Max request size of document and attachment is 512kb.
  • Max response size is 1MB. (how big or small is 1MB of JSON file?)
  • All request or when you talk to documentDB must be UTF-8 encode standard.
  • Max number of UDFs per query is 2.
  • Max number of JOINs per query is 5.
  • Max number of AND caluse per query is 20.
  • Max number of values per IN expression is 200.
  • Max number of points in a polygon argument in a ST_WITHIN query is 16 (don’t know what this is.. I will look into it later)
  • Max number of collection creates per minute is 5.
  • Max number of scale operations per minute is 5.

Getting Started with Azure Blob and other Storage Service

Azure Blob is a cloud storage service from Azure, and great to master if your web service needs to store binary data and text.

  • Index
    • Understanding Structure of Blob Service
    • CRUD of Container
    • CRUD of Blob

The master document of how to is here;

What is Azure Blob storage?

Azure Blob storage is a service that stores file data in the cloud. Blob storage can store any type of text or binary data, such as a document, media file, or application installer. Blob storage is sometimes referred to as object storage.

OK. Azure Blob sounds like service for almost all web services.

What is Blob Storage

It is a service for storing large amounts of unstructured data, such as text or binary data, that can be accessed from anywhere in the world via HTTP or HTTPS. You can use Blob storage to expose data publicly to the world, or to store application data privately.

Common uses of Blob storage include:Serving images or documents directly to a browser.  Storing files for distributed access.  Streaming video and audio.  Performing secure backup and disaster recovery.  Storing data for analysis by an on-premises or Azure-hosted service

Great these are all thing I want to do.  Let’s see how we can use this service. Continue reading “Getting Started with Azure Blob and other Storage Service”

Mastering Azure Search

Azure Search is a great Search-as-a-service from Azure.  It is powerful yet easy to implement from not just ASP.Net C# but from other platforms too.

The service let you index data and let you do full text search or facet, with features like search scores and suggestions.

Refer to:

The service is fully available through REST API, or by using .NET SDK.  The full control over API is great, but me – lazy guy – will go with .NET SDK to implement first.

Continue reading “Mastering Azure Search”

Working on Custom Domain Name with Azure

When you make web app on Azure, it comes with , and if it’s demo site or for internal use, that’s fine as is.  But most of the time when you want to run your own web services you want to have your own domain names, and that’s what I cover today.

Now you can buy domain name from Azure and that may be the easiest way to map custom domain to your web app.

But, I have already purchase domain elsewhere, and your company may already have domain name.  Then we will need to work with DNS record to point domain name to appropriate place within Azure. (DNS, as a function, uses data records table and map domain name to IP addresses.)

Each DNS server provide different ways to edit, create record, so I will skip that part.

DNS has several record types, but for now, we just worry about A and CNAME record types.

To set A record, you need IP address of your web app.  I somehow came across bug?? with new Azure management portal site and had to use old portal in order to get IP address, and here is how;

Use this URL:

and continue to ignore new Azure Portal links, and move to Configure > domain names, then manage domains, there you should see the IP address for you to use for your A type record.

I don’t know if it’s my environment or bug at new Azure management portal, but I ll just go with whatever works, for sake of saving my time.

After setting A name for your root domain, www for your CNAME (or whatever you desire), wait for 5-10 minutes, then you should be good to go.