Slow Performance group in aggregation

I have 600 million records and i am trying to run group stage and its taking 30 min .
Stage 1->
$match:{
is_workflow_processing: false ,
is_error: true
}
Stage 2->
$group:{
_id: {
status: “$status”,
Risk: “$control_monitorkey”,
User: “$Masterid”,
AssetID: “$SYSTEMID”
},
cnt: { $sum: 1 }
}
stage3>

rawData: [ {
project: { Status: "_id.status",
RiskName: “_id.Risk", userId: "_id.User”,
assetId: “$_id.AssetID”,
ExceptionCount: “$cnt”,
_id: 0.0,
},
{
$sort: {
ExceptionCount: -1
}
},
{
$skip: 0
},
{
$limit: 1000
}
],
count: [ { $count: “sum” } ]

Note-> Index is created on is_workflow_processing and is_error fields
server details-> 64gb RAM,16 core CPU,4.2 mongodb version

Hi @Narendra_02631,

Great question! We have a great community forum where you can have an in-depth conversation about specific use cases and interesting problems that you get to solve using MongoDB. I would highly recommend posting your question there for a more involved discussion.

Kind Regards,
Sonali