question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[BUG] Azure Search Issue when trying to merge different Cosmos DB documents (with aggregation) into one index with GROUP BY operation

See original GitHub issue

Describe the bug When I trying to create an Index through Azure.Search.Documents v.11 SDK with different data sources in my case it’s just two separate Cosmos DB documents (tables). After I create the Index I am going to create a data source and indexer for the first document everything went well and it attached to the index successfully but when I am trying to create and attach the second data source to the index and in conclusion merge it to one index document it returns an error for me.

What actually I need as result? Indexer that can use Cosmos SQL query with aggregation!

image

select Sum(udf.reactionCount(r.content)), r.registri from recenzoj r
group by r.registri
function reactionCount(c){
    switch(c.reaction){
        case "Inspiring": return 1;
        case "Cool": return 1;
        case "LoveIt": return 1; 
        case "Gripping": return 1;
        case "Boring": return -1;
        case "Sad" : return -1;
        default: return 0;
    }
}

Expected behavior As a result, I want one Index which will contain two different data sources.

Actual behavior (include Exception or Stack Trace) When I am trying to create a second indexer and attach it to Index I get this error. image

Following sql which I am trying to run is here:

select Sum(udf.reactionCount(r.content)), r.registri from recenzoj r
group by r.registri

UDF which used in function:

function reactionCount(c){
    switch(c.reaction){
        case "Inspiring": return 1;
        case "Cool": return 1;
        case "LoveIt": return 1; 
        case "Gripping": return 1;
        case "Boring": return -1;
        case "Sad" : return -1;
        default: return 0;
    }
}

Environment:

  • Name and version of the Library package used: [e.g. Azure.Search.Documents 11.1.0]

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:7 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
dereklegenzoffcommented, Dec 8, 2020

@OlegLviv - I did a bit more research on this and unfortunately using GROUP By in a data source query is an unsupported scenario for Azure Cognitive Search. Cosmos DB doesn’t support continuation tokens for group bys because they can get too large. In turn, we’re not able to properly index the data when there is a group by expression.

1reaction
jsquirecommented, Sep 30, 2020

Thank you for your feedback. Tagging and routing to the team best able to assist.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Azure search service index pointing multiple document db ...
If you use product id as the key, you can simply point two indexers at the same index, and Azure Search will merge...
Read more >
Troubleshoot query issues when using Azure Cosmos DB
APPLIES TO: NoSQL. This article walks through a general recommended approach for troubleshooting queries in Azure Cosmos DB.
Read more >
Indexer errors and warnings - Azure Cognitive Search
If your data source has a field with a different data type than the field you're trying to map in your index, you...
Read more >
Azure Cosmos DB for MongoDB (4.2 server version)
Aggregation pipeline​​ Azure Cosmos DB for MongoDB supports the following aggregation commands.
Read more >
Azure Cosmos DB for MongoDB (3.6 version)
When you create Azure Cosmos DB API for MongoDB accounts, the 3.6 version of account has the endpoint in the format *.mongo.cosmos.azure.com ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found