Allow indexing of synthetic fields
In order to work around some of the inherent limitations of the Atlas Search capabilities, it would be very useful if we could define and index arbitrary synthetic fields using any normal MongoDB functions & operators. All other Atlas Search capabilities (query, sort, etc.) should support these synthetic fields the same as any other.
This could possibly be implemented with a new field type and a custom analyzer that supports an aggregate pipeline on the input document and returning the field as its output. This is just an idea, there may be better ways to do it.
{
"mappings": {
"dynamic": false,
"fields": {
"foobar": {
"type": "synthetic",
"analyzer": "my-aggregate-analyzer"
}
}
},
"analyzers": [
{
"name": "my-aggregate-analyzer",
"aggregate": [
{ <stage> },
...
]
}
]
}
-
David commented
While this feature would be valuable for me, I've had a better idea that would solve it and all kinds of other scenarios as well: