You can use the admin ui to build the query string.
Definitely test it out with the search first, and then use the bulk delete api.
Here's a shell script that searches for all users except one:
curl -vvv -XGET -H "Authorization: $API_KEY" 'http://localhost:9011/api/user/search/?queryString=NOT%20email:test%40example.com'Note that I had to escape the space and the @ sign, but here's the elasticsearch query without the escaping: NOT email:test@example.com.
Also, if you are using the database search engine, the syntax will be entirely different, as this example relies on the Elasticsearch syntax.