Aggregation with Fuzzy search runs too slow

Hi Everyone,

I’m running an Aggregation pipeline on an Index, containing Fuzzy search. The index contains 2.5 million documents. Interestingly the query takes few seconds when executed directly on the Atlas’s Aggregation editor but takes more than a minute if I run the same Pipeline from my C# client.
The Pipeline is exactly the same, I’ve now ran out of ideas for where to look for a possible issue.
Although I can see that the performance is improved if I change the prefixLenght or the maxEdits for the Fuzzy parameters, but the question remains the same that why a long running search from my client takes only few seconds on the Atlas’s search editor.

Haris Munawar

Can you share your code? Chances are you’re consuming all results in your C# code, but from the Atlas UI it is implicitly doing a $limit of 10 or so documents.

I’ve explicitly setting the limit to 50 records and I can confirm that no more than 50 records are returned.
The performance improves if I set the fuzzy.maxEdits to 1 instead of 0. But again, the same query with maxEdits equal to 0, works way more quick on the Atlast’s Aggregation editor.

I’ll try if I get the same behavior using Compass.

Could you share the searching code? How are you limiting it to 50 records? With $limit within the pipeline?