Timeout exception when querying for users

Hi,
Im trying to retrieve all the users whose user_id starts with a predefined prefix. I am always receiving HTTP 503, query exceeded timeout exception. I made sure we are requesting for a single page of results, which is way less than the prescribed limit of 1000.
I also looked into creating an export users job but it doesn’t allow filtering based on user_id prefix.
Can anyone suggest me how to fix this issue?
Following is the Request/Response for reference:

Request: https://auth0_endpoint/api/v2/users?per_page=10&page=0&q=user_id:samlp|saml-* AND updated_at:[2019-05-21T18:29:04.286Z TO 2019-06-21T20:29:04.286Z]&search_engine=v3

Response:
{
“statusCode”: 503,
“error”: “Service Unavailable”,
“message”: “The query exceeded the timeout. Please try refining your search criteria. See https://auth0.com/docs/best-practices/search-best-practices
}

This would abort the query to save resources, and for example throw a Timeout exception.

is there a way to retrieve the list of users Im looking for?

Hello @smajeti and @jonathanjohnston725! I am currently checking with one of our senior team members to see If I can find out an answer for you. I will reply back with what I find, thanks!

1 Like

@smajeti after checking with one of our senior team members they recommend reducing the time being searched for. Please let me know if this helps you proceed forward, otherwise we can take a deeper look at other possibilities. Thank you.

@James.Morrison
I changed my query from
q=user_id:samlp|saml-* AND updated_at:[2019-05-21T18:29:04.286Z TO 2019-06-21T20:29:04.286Z] to q=updated_at:[2019-05-21T18:29:04.286Z TO 2019-06-21T20:29:04.286Z] AND user_id:samlp|saml-*
and it works fine.

Looks like the sorted key was based on timestamp and service manually filters the results based on the id prefix before returning the results.

Thank you so much for your help. Looks like Im currently unblocked.

1 Like

I’m happy to hear it all came together, have a fantastic day!

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.