Try this:
| stats count by src_user,src_ip,category | sort -count | streamstats count as counter by src_user,src_ip | stats sum(count) as total_count list(eval(if(counter<4,category,null()))) as values by src_user,src_ip
Explanation
| stats count by src_user,src_ip,category
-> you need the count of every category to find out the top 3
| sort -count
-> get the most frequent categorys first
| streamstats count as counter by src_user,src_ip
-> add a rank/counter for the categories by frequency
| stats sum(count) as total_count list(eval(if(counter<4,category,null()))) as values by src_user,src_ip
->only take the categories into the final result that have a rank that is smaller than 4 ( = top 3)
----- Udpate -----
You could use either the ranking based or a percentage based "base search":
| stats count by src_user,src_ip,category | sort -count | streamstats count as counter by src_user,src_ip | where counter <3
| stats count by src_user,src_ip,category | eventstats sum(count) as total_hits by src_user,src_ip | eval percentage=count/total_hits | where percentage>0.33
And the filter for categories you are interested in. If you know the interesting categories you could append:
| search category=xy OR category=yz
or maybe
| search category!=xy AND category!=yz
If you want to include/exclude the categories based on the frequency they occur you could have a seperate search that populates a lookup with the categories you want to include/exclude (this would be a kind of baseline) and then use that to filter your results. But from what you wrote I am guessing that you know the NSFW categories
... View more