Users Lucene search for not blocked users

Problem statement

Going by the documentation about the user search using the Lucene syntax, I should be able to use “blocked:false” and get the non-blocked users. But it returns nothing. It works for “blocked:true”, which returns the blocked users.


I can’t search for non-blocked users in the same way as searching for blocked users.


The issue is that the “blocked” attribute may not be present on users. This attribute will be only in the Raw JSON if it has been set at some point in the user’s history. In the absence of this attribute, Auth0 considers the user not blocked.

To work around this, you could search using the following Lucene query to get all users that are not blocked:

NOT blocked:true

With this, only blocked users are filtered out, but it is not reliant on finding an exact match for “blocked:false” present within the user’s JSON.