Mongo $search not returning anything with pre-filtering

Hi,

I’m using mongo atlas for auto complete search, it was working correctly then I decided to add some pre-filtering and not it doesn’t return anything

Here’s my index configuration
``{
“mappings”: {
“dynamic”: false,
“fields”: {
“body”: [
{
“foldDiacritics”: true,
“maxGrams”: 15,
“minGrams”: 2,
“tokenization”: “edgeGram”,
“type”: “autocomplete”
}
],
“title”: [
{
“foldDiacritics”: true,
“maxGrams”: 15,
“minGrams”: 2,
“tokenization”: “edgeGram”,
“type”: “autocomplete”
}
]
}
}
}````

and here’s my code

`` $search: {
index: “default”,
compound: {
must: {
equals: {
path: “lng”,
value: lng,
},
},
should: [
{
autocomplete: {
query: search,
path: “title”,
},
},
{
autocomplete: {
query: search,
path: “body”,
},
},
],
},
},

Duplicate of pre-filtering in $search returns no results - I responded there.

This topic was automatically closed 5 days after the last reply. New replies are no longer allowed.