Count error in canvas

The values ​​aggregation from visualize and canvas are different.
The time was set equally.
Why is it so different?

metric(visualize)

canvas

Hello,
Using the TinyMath unique function in Canvas after retrieving the datasource will give you the number of unique values in the 1000(?) documents you get back from esdocs For canvas the equivalent of the Unique Count will be the COUNT_DISTINCT SQL command .

Can you explain in more detail?

my sql: SELECT DISTINCT COUNT(field_name) FROM "index_name"
image