Auth0 Home Blog Docs

Search user by (connection and email) with Lucene query



Hello, I want to retrieve a user who has a connection as “{Db-Name}” and email = “{email}” from Auth0. The below is Lucene query for it in c#.

var luceneString = $"(email:"{email}" And identities.connection: “{connection}”)";

Now, I calling management API endpoint GetAllUsers in below manners.

1). var lstUser = await _managementApiClient.Users.GetAllAsync(null, null, null, null, connection, null, null, luceneString, “v3”);
2). var primaryAccount = (await _managementApiClient.Users.GetAllAsync(q: $“email:{email} And identities.connection: {connection}”)).FirstOrDefault();

The only difference is that in a 2nd way I am passing Lucene string directly to API endpoint. Now, in both the cases, I am getting the list of users who have a connection as specified above. But the actual result should be in combination of “Connection” + “Email”.

@jmangelo, @prashantT :- Can you guys please tell me what’s wrong in this implementation. Need your help as soon as possible.


@jmangelo, @prashantT :- I got the issue. As per Lucene query syntax “and” should be “AND”