Ah. If you aren't using elasticsearch then you have limited searching options. The database search engine won't be able to do what you want. Sorry about that!

One option might be to keep each application's users in a separate tenant, then you can request all the users for that tenant (and by extension the application).

With elasticsearch, the query you'd run is similar to those documented here. Look for Example JSON for the query parameter to search for users with a specific role but don't limit it to a role. Here's the search docs: https://fusionauth.io/docs/v1/tech/apis/users/#search-for-users (for future folks)