I can run the following queries from Atlas search UI, and it’s working fine:
[
{
$search: {
index: “videosearch”,
compound: {
should: [{
equals: {
path: “language_id”,
value: 1,
}
},
{
equals: {
path: “status”,
value: 1,
}
},
{
text: {
path: "title",
query: "sambhal",
}
}
],
"minimumShouldMatch": 3
}
}
}
]
But I am getting the Error while running the same query in GoLang,
“compound.should” only one of [autocomplete, compound, embeddedDocument, equals, exists, geoShape, geoWithin, in, knnBeta, moreLikeThis, near, phrase, queryString, range, regex, search, span, term, text, wildcard] may be present
Below is my golang code:
“compound”: bson.M{
“should”: bson.D{
{Key: “equals”, Value: bson.M{
“path”: “language_id”,
“value”: language_id,
}},
{Key: “equals”, Value: bson.M{
“path”: “status”,
“value”: 1,
}},
{Key: “text”, Value: bson.M{
“path”: “title”,
“query”: query,
}},
},
“minimumShouldMatch”: 3,
}
Please help with the solution.