Hi, I have working pipeline. However when I add $project stage it does not work. ‘false’ instead of ‘0’ does not work neither. Moving $project stage after $skip or $limit does not work.
Does anyone know what can be the problem here?
Pipeline is set up like this:
$search : {
index : 'default',
compound: {
must: [
{
'autocomplete': {
query: _options.query,
path: 'plainText',
fuzzy: {
maxEdits: 2,
prefixLength: 3,
}
}
},
{
equals: {
path: 'searchAccessList',
value: _userID,
}
}
]
}
}
},
{
$project: {
'searchAccessLists': 0
}
},
{
$skip: _options.skip || _options.defaultSkip
},
{
$limit: Math.min((_options.limit || _options.defaultLimit), _options.maxLimit)
},
Index definition:
{
"mappings": {
"dynamic": false,
"fields": {
"plainText": {
"minGrams": 3,
"tokenization": "nGram",
"type": "autocomplete"
},
"searchAccessList": {
"type": "objectId"
},
"tags": {
"analyzer": "lucene.keyword",
"type": "string"
}
}
}
}