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/
![](https://secure.gravatar.com/avatar/04dc793848171fe85e58606f21af9aa2?size=40&default=https%3A%2F%2Fassets.uvcdn.com%2Fpkg%2Fadmin%2Ficons%2Fuser_70-6bcf9e08938533adb9bac95c3e487cb2a6d4a32f890ca6fdc82e3072e0ea0368.png)
-
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...