Here are updates we just received:
Currently, we do not index null
, empty array ([]
), and empty objects ({}
) fields in metadata (user_metadata
or app_metadata
). These fields are currently treated as if they don’t exist by the search backend, so to retrieve the user mentioned in your question, the customer could emit such a query:
q:NOT _exists_:app_metadata.key1
Note that in addition to returning users with key1: []
, this would also return users who do not have key1
in their app_metadata
.
Moreover, the existence queries can be very slow and may timeout depending on the size of the user base of the customer. For that reason, we don’t recommend using them in our https://auth0.com/docs/manage-users/user-search/user-search-best-practices .
For the scenario you described, a better way would be to search for another attribute in metadata. For example, set a key1_empty: true
flag in your metadata object to identify users having key1: []
. This would allow us to retrieve the user much more efficiently from the user search endpoint.
Our Documentation team added below in this doc to reflect this limitation.
Metadata fields that contain an empty array, empty object, or
null value are not indexed and cannot be searched for.
I have created a feature request ticket for handling this concern in the future.
Any other queries regarding this topic I can assist?