Problem Statement
We search for users with the following query:
app_metadata.identities.email: "[test2@gmail.com](mailto:test2@gmail.com)" AND app_metadata.identities.connection: "facebook"
The user returned from the search has the following app_metadata:
{
"identities": [
{
"connection": "facebook",
"email": "[test1@gmail.com](mailto:test1@gmail.com)"
},
{
"connection": "twitter",
"email": "[test2@gmail.com](mailto:test2@gmail.com)"
}
]
}
We don’t expect this result returned since the matching attribute values are each in different objects.
Solution
This is a known limitation of user search. When you have an AND condition for two attributes of an object belonging to an array, the search will not enforce the AND condition per object but instead across all objects of that array.
We suggest you use the same query and further filter the results in your code by iterating through each object and checking whether both attribute values match.