<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Topics tagged with user-search]]></title><description><![CDATA[A list of topics that have been tagged with user-search]]></description><link>https://fusionauth.io/community/forum/tags/user-search</link><generator>RSS for Node</generator><lastBuildDate>Sun, 04 Oct 2026 23:36:42 GMT</lastBuildDate><atom:link href="https://fusionauth.io/community/forum/tags/user-search.rss" rel="self" type="application/rss+xml"/><pubDate>Invalid Date</pubDate><ttl>60</ttl><item><title><![CDATA[How to search for users not registered to a specific application?]]></title><description><![CDATA[<p dir="auto">You can use the User Search API with a must_not clause in the Elasticsearch query to exclude users registered to a specific application. Here's an example:</p>
curl -X POST https://sandbox.fusionauth.io/api/user/search \
  -H 'Authorization: &lt;your-api-key&gt;' \
  -H 'Content-Type: application/json' \
  -d '{
  "search": {
    "accurateTotal": true,
    "numberOfResults": 100,
    "startRow": 0,
    "query": "{\"bool\":{\"must_not\":[{\"nested\":{\"path\":\"registrations\",\"query\":{\"bool\":{\"must\":[{\"match\":{\"registrations.applicationId\":\"&lt;your-application-id&gt;\"}}]}}}}]}}"
  }
}'

<p dir="auto"><strong>Key points:</strong></p>

The must_not clause excludes users matching the nested query
The nested query targets the registrations path since registrations are nested objects in the Elasticsearch mapping
Inside the nested query, the must clause matches the specific applicationId
Replace &lt;your-application-id&gt; with the UUID of your target application
This returns users who either have no registrations at all, or have registrations to other applications but not the specified one

<p dir="auto">You can paginate through results using startRow and numberOfResults if you have a large user base.</p>
<p dir="auto"><strong>Important:</strong> This approach requires the <strong>Elasticsearch search engine</strong> (not the database engine). You must use the search.query parameter with raw Elasticsearch JSON when querying against registrations, because it is defined as a <a href="https://www.elastic.co/guide/en/elasticsearch/reference/6.3/nested.html" rel="nofollow ugc">nested datatype</a> in the Elasticsearch mapping. The queryString parameter cannot be used for nested fields like registrations with expected results.</p>
<p dir="auto"><strong>Tip:</strong> You can use the <strong>Admin UI → Users → Advanced → Show Elasticsearch Query</strong> toggle to build and test queries interactively before using them in the API.</p>
Related Documentation

<a href="https://fusionauth.io/docs/apis/users/search#elasticsearch-search-engine" rel="nofollow ugc">User Search API - Elasticsearch Search Engine</a> - Main API reference for searching users with Elasticsearch
<a href="https://fusionauth.io/docs/lifecycle/manage-users/search/user-search-with-elasticsearch#searching-with-query" rel="nofollow ugc">Searching Users With Elasticsearch or OpenSearch - Searching With query</a> - Guide on using the query parameter for advanced searches
<a href="https://fusionauth.io/docs/apis/users/search#additional-query-examples" rel="nofollow ugc">User Search API - Additional Query Examples</a> - Examples of various query patterns including nested queries
<a href="https://fusionauth.io/docs/get-started/core-concepts/registrations" rel="nofollow ugc">Registrations</a> - Core concepts documentation explaining the relationship between Users, Applications, and Registrations
<a href="https://fusionauth.io/docs/lifecycle/manage-users/search/user-search-with-elasticsearch#field-mappings" rel="nofollow ugc">Field Mappings</a> - Available fields for matching in Elasticsearch searches

]]></description><link>https://fusionauth.io/community/forum/topic/3172/how-to-search-for-users-not-registered-to-a-specific-application</link><guid isPermaLink="true">https://fusionauth.io/community/forum/topic/3172/how-to-search-for-users-not-registered-to-a-specific-application</guid><dc:creator><![CDATA[FASupportBot]]></dc:creator><pubDate>Invalid Date</pubDate></item></channel></rss>