How can we improve Azure Cosmos DB?

Add support for "Search text" ($text Operator)

Support for "Mongo Search Text" (https://docs.mongodb.com/manual/text-search/). Example of use:

db.stores.find( { $text: { $search: "java coffee shop" } } )

80 votes
Vote
Sign in
(thinking…)
Sign in with: oidc
Signed in as (Sign out)
You have left! (?) (thinking…)
Alexandre Ribeiro shared this idea  ·   ·  Flag idea as inappropriate…  ·  Admin →

4 comments

Sign in
(thinking…)
Sign in with: oidc
Signed in as (Sign out)
Submitting...
  • Anonymous commented  ·   ·  Flag as inappropriate

    Using azure search as a "solution" is awful, it's clunky and requires workarounds for something that is built into Mongo. Now not only do you have to pay for two services Cosmos as well as Search you now have a more brittle system due to more components. If you're claiming a compliant API this is a pretty poor solution.

  • PGR commented  ·   ·  Flag as inappropriate

    The $regex operator does not work with Full text indexes. Azure Search is not available in some regions like China so are there other options to make full text index search in CosmosDB for MongoDB

  • AdminAzure Cosmos DB Team (Product Manager, Microsoft Azure) commented  ·   ·  Flag as inappropriate

    Pretty much all of $text functionality (and more) has been implemented in Azure Search and we're happy to let you know that it now supports for MongoDB API collections (in private preview). Working with MongoDB collections is very similar to working with SQL Cosmos DB collections as described in https://docs.microsoft.com/azure/search/search-howto-index-cosmosdb

    To create a MongoDB datasource, POST an HTTP request as shown below:

    POST https://[service name].search.windows.net/datasources?api-version=2016-09-01
    Content-Type: application/json
    api-key: [Search service admin key]

    {
    "name": "mymongodbdatasource",
    "type": "documentdb",
    "credentials": {
    "connectionString": "AccountEndpoint=https://<Your Cosmos DB account name>.documents.azure.com;AccountKey=<Your Cosmos DB account key>;Database=<Your database>;ApiKind=MongoDb"
    },
    "container": { "name": "<Your collection>", "query": null },
    "dataChangeDetectionPolicy": {
    "@odata.type": "#Microsoft.Azure.Search.HighWaterMarkChangeDetectionPolicy",
    "highWaterMarkColumnName": "_ts"
    }
    }

    Note:

    1. Use `documentdb` as the data source type.
    2. Do not use a MongoDB connection string that you would use in your MongoDB application. Instead, construct the connection string as shown above. Make sure to add **ApiKind=MongoDb** to the connection string.

    Once you've created the data source, follow the steps in https://docs.microsoft.com/azure/search/search-howto-index-cosmosdb to create a search index, create an indexer, and monitor the indexer execution.

    ## Known issues and limitations

    1. Only the REST API is supported. For now, you cannot create or edit MongdoDB data sources using Azure Portal or Azure Search .NET SDK. However, you **can** monitor execution history of MongoDB indexers in the portal.

    2. Custom queries are not supported: `container.query` parameter must be set to null or omitted. If you need to use a custom query, please let us know at the emails below.

    If you encounter any issues, please contact azscustquestions@microsoft.com

  • AdminAzure Cosmos DB Team (Product Manager, Microsoft Azure) commented  ·   ·  Flag as inappropriate

    Currently, simple text search is provided through $regex operator. More comprehensive text search is coming shortly through Azure Search that will be able to index MongoDB API collections as well: https://feedback.azure.com/forums/263029-azure-search/suggestions/18861421-documentdb-indexer-should-be-able-to-index-mongodb

Feedback and Knowledge Base