Search code examples
performanceazure-cosmosdbazure-cognitive-search

Using Azure Search with DocumentDB


If DocumentDB can do its own indexing and Azure Search can also do indexing, then why would I want to use them together? Any use cases?

Also, using DocumentDB is already expensive and if I use Azure Search with it, how does this affect my DocumentDB performance and cost?


Solution

  • DocumentDB shines as a general purpose document database, while Azure Search shines as a full text search (FTS) engine.

    For example, Azure Search provides:

    • Linguistically-aware indexing and search that takes into account word forms (e.g., singular vs. plural, verb tenses, and many other kinds of grammatical inflections) in ~60 languages.
    • High quality lemmatization and tokenization. For example, word-breaking Chinese text is hard because white space is optional
    • Synonyms
    • Proximity search, similar pronunciation search (soundex / metaphone), wildcard and regex search using Lucene query syntax
    • Customizable ranking, so that you can boost newer documents, for example
    • Suggestions
    • ... dozens of other text processing and natural language-related features

    If all you need are simple numerical filters or exact string comparisons, just use DocumentDB.

    If you need natural language search for some of your content, use Azure Search together with DocumentDB. Connecting them is easy with DocumentDB indexer.

    In terms of cost implications, using Azure Search with DocumentDB doesn't change the cost of DocumentDB. If you use the DocumentDB indexer, it will consume a certain amount of Read Units - how much depends on your data and the query you use, as well as your indexing schedule.