Support for nested datatype search
It appears that Atlas Search does not yet support nested documents in arrays like MongoDB
https://docs.mongodb.com/v4.2/reference/operator/query/elemMatch/
-
Pratik commented
Yes, Much needed. We are stuck on the point as we need to search where a single nested document from an array matches all the conditions. like it is supported with elemMatch in Mongo Search.
-
Yurii commented
If you have array of objects - it's impossible to allows arrays of objects to be indexed in a way that they can be queried independently of each other. Using 'document' type can return fields that are flattened into multi-value fields, and the association between fields in subobjects is lost. Details can be found in a link above.
-
Justin commented
It does for strings. For example if you had the mapping:
```
{
"analyzer": "lucene.standard",
"searchAnalyzer": "lucene.standard",
"mappings": {
"dynamic": false,
"fields": {
"values": {
"fields": {
"stringValue": {
"type": "string"
}
},
"type": "document"
}
}
}
}
```And a document in your db:
```
{
values: [
{ textValue: "here is some example text" }
}
}
```And the query:
```
db.answers.aggregate([
{
$searchBeta: {
near: {
query: "example",
path: "values.textValue"
}
}
}
])
```Then it will work...