I have a large collection of data that I want to be able to run Autocomplete searches but limit to a specific group of entries. I am looking for best practices on how to set this up. Currently I have an Atlas Search Index on the fields I want to do Autocomplete Searches on and a regular Index on the filter criteria. Is this the most optimal performance configuration? I am still seeing searches running for multiple seconds, even though the filter criteria should only be searching a few hundred records. This leads me to think its searching the whole SearchIndex and then filtering after
For anyone that comes across this, I have gotten this to be much more performant with the following changes.
First - updated Atlas Search to have all search and filter criteria. The mongo search pipeline wont take into account Match criteria
Second - Combine all search criteria, to a single Should clause and setting the MinimumShouldMatch count to 1 for all of them. Not sure if this had a performance implication, but its cleaner in code.
Third - Utilized the QueryString “OR” clause to filter on multiple match criteria.