Better TopN Errors
Description
I've run into this a few times, the errors we get from TopN are basically non-existent and it's very confusing.
For example, the correct query might be:
TopN(gender)
{"results":[[{"id":2,"count":300823},{"id":0,"count":300516},{"id":1,"count":298867}]]}
If you were to pass field=, you get:
TopN(field=gender)
{"results":[[]]}
...not helpful—that should result in a descriptive error message that reminds you of the syntax for TopN.
A TopN for a non-existent is a bit better:
curl localhost:10101/index/i-students_ts/query -d'TopN(gnder)'
{"error":"executing: field not found"}
though it would be nice if it said field 'gnder' not found.
What if there's no cache on the field, or if the cache size is 0, or if it's a BSI field?
# BSI
TopN(age)
{"results":[[]]}
# CacheType None
TopN(gender)
{"results":[[]]}
Those are both pretty unhelpful! It might be considered breaking... but I feel like an error would be more helpful here. If you're doing that query, you're probably expecting some result, and if it's impossible to ever get a result, that seems like an error.
Success criteria (What criteria will consider this ticket closeable?)
Seems like this case didn't get fixed, or has regressed:
TopN(field=gender)
{"results":[[]]}
To recap, that needs to be an error saying "HEY JUST DO TopN(gender)"