Thanks for the reply.
Now, trying out the Overall Average as a sibling aggregation rather than the parent aggregation Moving Average it starts showing some better results.
Mind you, things are not 100% accurate since I still have something like 8-9% error over a week of samples.
To make an example, filtering over the last 7 days, in the Discover I can see there are 2954 total hits and 1339 successful hits. So 45.32% of success.
Same results are given in the Visual Builder if I create a new series and Sum the total occurrences and the successful occurrences.
Though, in a Visual Builder series using the Filter Ratio it still shows 52.62%.
I tried changing the sampling as you suggested but it really varies a little (let's say it goes from 51% to 53%).
I really cannot get what the problem might be. Also because I'm grouping by another field, and a certain category of documents which should be 100% successful (since over that period of time show 2944 hits and 2944 successes) is something like 99.954%. It cannot depends on the sampling since EVERY document is a SUCCESS.
Unfortunately it seems I cannot use the mathematical computation approach (at least the way they used it in that thread) because I can't count only the occurrences that have a specific value for a field, can I?
In the discussion you linked, tsullivan does:
Sum -> number_of_tokens
Sum -> number_of_tokens_matched
And then use a Bucket Script.
What I'd need is something like:
Count -> my_field:SUCCESS
Count -> everything
But I cannot find a way to assign a variable to a filtered field. Is there any?