Hello I am using below query to get total count of document and its working fine
{
$searchMeta: {
index: indexName,
compound: {
should: [
{
text: {
path: path,
query: s,
fuzzy: {
maxEdits: 2,
maxExpansions: 20,
},
},
},
{
text: {
query: Soundex(s),
path: 'phoneticCode',
},
},
],
},
count: {
type: 'total',
},
},
}
But I also want to add $match filters here like
{
$match: {
CountryNo: 14,
Population:10000,
},
}
I tried doing like this but it doesn’t worked
[
{
$searchMeta: {
index: indexName,
compound: {
should: [
{
text: {
path: path,
query: s,
fuzzy: {
maxEdits: 2,
maxExpansions: 20,
},
},
},
{
text: {
query: Soundex(s),
path: 'phoneticCode',
},
},
],
},
count: {
type: 'total',
},
},
},
{
$match: {
CountryNo: 14,
Population:10000
},
},
]
Can someone please suggest me ways so that I can get the $searchMeta count that also include filters?