I have millions of documents, each represents a point in time of individually tracked insects and their heart rate, speed, location, etc.
Is there a way to efficiently query based off of a specific bounding box of latitude longitude, and a time range, and return all the "UNIQUE/DISTINCT" values for a specific field? (i.e. insect_id)? If so, how?
I can see a query returning well over 20,000 documents, of which there may only be 10 unique/distinct insect_id. Whats the most efficient way to do this?