This is an issue that has burned me many times. I write a query and see that it returns reasonable results and put it into code. Later I notice that the results aren't quite that reasonable after all. After a bit of digging I find that the results have been truncated to the first 10 items at some point and the rest of the query has continued from that. Is there a warning mode that would tell me that this has happened? It's really frustrating to try to stick "size: 0" everywhere especially since some aggregations treat 0 to actually mean 0.
Unfortunately we do this on purpose since
size:0 doesn't scale well to high-cardinality fields. If you know that your fields have a low cardinality, then the only way is to set size:0 explicitly. A safer option, if you expect the cardianlity to be less than N, would be to request N+1 terms (size:N+1) and fail if N+1 terms are actually returned.