Use pie-chart visualization for displaying most/least used records

Versions (relevant - OpenSearch/Dashboard/Server OS/Browser):
Opensearch version - 2.5.0
Server OS - CentOS 8
Browser - Chrome/Firefox

Describe the issue:
Hello everyone,
I am trying to create some pie-chart visualizations which can display the top 10 most used and top 10 least used permission from my permission index. Is there any way to achieve this?
I tried setting the “Order” to “Ascending/Descending” and the “Size” parameter to 10, but it is pretty obvious that not all records are counted before doing the sort, which leads to erronous results.
You can see in the screenshots that, for the permission “Validate the deletion of an Organization”, I initially get a count of 6 records but the correct value should be 90 (which becomes obvious when I filter ony on this permission).
Any ideas are greatly appreciated.


Relevant Logs or Screenshots:

The date range impacts the data you see. So if the date is set to Last Week, it will show you the most used and least used ones within the last week. Do you think that would explain the unexpected results?

This is pie chart I made on the Playground. If you change the date filter to Last 15 minutes or even 30, you would see that it doesn’t even return 10 results.

Hi @AMoo-Miki .
Thanks for your reply. I am not sure that the date range has any impact on my results as I have kept the same range for both tests.
However, I have seen something strange when I run the query of the pie-chart in dev-tools. You can see in the screenshot below that the value of doc_count_error_upper_bound is -1 for my example. On the Playground environment, the value is 0, so maybe this is related to the difference I am seeing in my results.