Hello! I am trying to ingest records from MongoDB through a Enterprise Search Mongo-Connector. I would like to use an advanced rule to only pull in those where a specific field (expiresAt
) is greater than or equal to the current date. The Elastic docs state that the mongodb connector supports aggregation pipelines in the advanced rules, however I am getting errors when trying to set this up.
For example:
{
"aggregate": {
"pipeline": [
{
"$addFields": {
"current_date": { "$toDate": "$$NOW" }
}
},
{
"$match": {
"expiresAt": {
"$gte": "$current_date"
}
}
}
]
}
}
Throws the following error:
[40324:Location40324]: Unrecognized pipeline stage name: '$add_fields' (on server-shard-00-01.o4mny.mongodb.net:27017, modern retry, attempt 1)
Where is it even getting "add_fields" from? Is this not possible?