Here's a situation that's similar to my real question:
Let's say I'm recording the temperatures of all major cities in the world once per day. So, each document has the following fields:
timestamp
city_name
temp
The type of query that I'm interested in is of the following form:
Get all cities C and timestamps T such that the temperature jumped more than a certain amount compared to the week before.
More precisely:
temp(C, T) > temp(C, T-one week)*lambda
My understanding is that Elastic looks only within the documents but I don't mind being wrong if there's a built-in method for handling such queries. Obviously, my goal is to avoid writing a big wrapper around Elastic when I create my API.
Thank you!