How can i Index collection from cosmos Db using Azure Cognitive search

Sofia 20 Reputation points
2024-05-30T23:39:32.64+00:00

How can I index a specific collection from a Cosmos DB data source using Azure Cognitive search?

I have setup resource from Azure AI Search and CosmosDB instance contains two collections when I create an index in Azure AI Search connected to the cosmodDB ,it successfully indexes and returns data from first collection, but when i create another index to second collection it returns null. not sure what is missing in my configuration.

Azure Cosmos DB
Azure Cosmos DB
An Azure NoSQL database service for app development.
1,680 questions
0 comments No comments
{count} votes

Accepted answer
  1. GeethaThatipatri-MSFT 29,477 Reputation points Microsoft Employee
    2024-05-30T23:58:38.45+00:00

    @Sofia Welcome to Microsoft Q&A thanks for posting your question.

    I found a similar ask on SO forum which might be useful for you

    https://stackoverflow.com/questions/78511738/how-to-index-a-specific-collection-in-a-cosmos-datasource-with-azure-ai-search

    Regards

    Geetha

    0 comments No comments

1 additional answer

Sort by: Most helpful
  1. Q&A Assist
    2024-05-30T23:39:32.6766667+00:00
    AI generated content. This question contains an answer created with AI from Q&A Assist. Learn more

    To index a specific collection from a Cosmos DB data source using Azure Cognitive Search, you need to create a data source, index, and indexer. Here are the steps:

    1. Create a data source: In the Azure Cognitive Search portal, create a new data source and select "Azure Cosmos DB" as the source type. Provide the connection string for your Cosmos DB account and select the database and collection you want to index.
    2. Create an index: Create a new index in the Azure Cognitive Search portal and define the schema to match the structure of your Cosmos DB collection. Make sure to map the fields you want to search on.
    3. Create an indexer: Create a new indexer in the Azure Cognitive Search portal and specify the data source and index you created in the previous steps. The indexer will automatically extract data from your Cosmos DB collection and populate the search index.

    If you're having trouble indexing a second collection, make sure you have created a separate data source, index, and indexer for that collection. Also, check that the connection string and permissions are correct for the second collection.


    References:

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.