Auth0 Home Blog Docs

Sort users by metadata field

users
metadata
search
list
sort

#1

Not sure if this is related to the recent issues with the users search API or not, but I used to be able to make a users query and specify a field from the user_metadata as a sort criterion (e.g. “user_metadata.first_name:1”), but now that query, even just in the API explorer, is throwing a 503 error (“Failed to perform search”). Has a change been made recently that prevents sorting by metadata fields, or should I still be able to do this?


#2

I see similar issue. Sorting users by nested attributes returns 400 error:

{
  "statusCode": 400,
  "error": "Bad Request",
  "message": "Failed to perform search. Make sure the query \"app_metadata.deleted:false AND app_metadata.admin:false\" is valid"
}

Also when I try to search for a nested attributes, eg. “app_metadata.deleted:false AND app_metadata.admin:false” without any sorting set does not return anything.


#3

Per the incident report for the issue mentioned in the OP:

  • Sorting (sort=...) is not working but we are working on a fix that should be deployed in the following days.


#4

I see similar issue. Sorting users by nested attributes returns 400 error:

{
  "statusCode": 400,
  "error": "Bad Request",
  "message": "Failed to perform search. Make sure the query \"app_metadata.deleted:false AND app_metadata.admin:false\" is valid"
}

Also when I try to search for a nested attributes, eg. “app_metadata.deleted:false AND app_metadata.admin:false” without any sorting set does not return anything.


#5

We have a same issue and same error message given when we include the ‘&sort=’ param in our search users query. The query works if the sort param is removed from the query but always fails if ‘&sort=’ is included. Also… this strangely only occurs with one of our tenants. In the other tenant the search query works fine even with the sort param included.


#6

Is there any update on that? I’ve tested it few days ago, it was still not working.


#7

Any follow up on this? Sorting by the normalized fields doesn’t work either.


#8