How to search by response time

Hi,

I will like to search an index that has fields that contain a requestTime and responseTime field. The search will typically find the difference in time (responseTime - requestTime) in each document, order and group the result by another field.

Is this possible? What is the right query to do this?

Regards.