Hello,
If I understand correctly what you want to do is to use a bar chart for more than 20 agents in descending order of number of alerts related to authentication problems.
What you could do would be:
IMPORTANT: the DQL queries are transformed to individual conditions for each of the ORs. This added to the size of the aggregation of the agents can seriously impact the performance.
Here is an image where you can see a configuration like the one described above:

In addition, I leave you the documentation of OpenSearch here: https://opensearch.org/docs/latest/dashboards/visualize/viz-index/
Hope it helps.