I have an requirement like this.
I want to caluclate the distance between objects based on some parameters. Distance formula will be supplied as script.
So i thought to use scripted metric aggregation. Inside the script i want to use another aggregation like min and max values on some fields. I want to do all this in single query.
Is this possible?