I am using mongo Atlas to use $search aggregation pipeline stage. I know that the $search aggregation pipeline stage is only available for collections hosted on MongoDB Atlas cluster and I have proper subscription so that's not the problem. I am trying to write a $search stage with autocomplete operator. When I type the word I want to show all the matching values as result.
[
{
'$search': {
'index': 'Custom_Test',
'autocomplete': {
'path': 'SomeFileName',
'query': 'Test',
'tokenOrder': 'sequential'
},
'highlight': {
'path': [
'SomeFileName'
]
}
}
}, {
'$limit': 10
}, {
'$project': {
'_id': 1,
'SomeFileName': '$SomeFileName',
'Ancestors': 1,
'highlights': {
'$meta': 'searchHighlights'
}
}
}
]
So when I am passing Test it should return all the matching SomeFileName fields. I tried to remove index as well because it will pick up default if not mentioned and tried it but no use. Any guidance is appreciated.