I know that general questions about aggregate functions have been asked
here before a number of times, but I would like to figure out how to solve
at least one specific subset of this issue. Namely, given a specific
indexed field, how do I efficiently get the min/max value of the field in
the index? Maybe I'm being naive but this sounds like it should be a super
simple task conceptually, since under the hood the index is a sorted data
structure. Of course, the ultimate idea here is to be able to do this
efficiently for the most general case, i.e. to apply range discovery to
query results, and perhaps do this for string fields as well as numeric.