I am getting Atlas search error “Failed to run this query. Reason: “compound” unrecognized field “sort””. I have compound query with must operator and after that I am sorting.
[{
“$search”: {
“compound”: {
“must”: [{
“text”: {
“query”: “John”,
“path”: “emp.contract.empFirstName”
}
}, {
“text”: {
“query”: “2023”,
“path”: “emp.contract.strYear”
}
}, {
“text”: {
“query”: “DFW”,
“path”: “location”
}
}
],
"sort": {
"emp.contract.empLastName": -1
}
},
"index": "default"
}
}
]