I have a parent-child relationship betweeen documents as described in the official documentation (https://www.elastic.co/guide/en/elasticsearch/guide/2.x/parent-child.html).
The child documents has a field "timestamp". I need to compute/query the difference between 2 different child's timestamp.
Example:
parent document
| |
| |
child document 1 child document 2
* timestamp1 * timestamp2
The value I want is: timestamp2 - timestamp1
Changing the child documents to nested objects in the parent is not an option.
For what a read, using scripts is not possible as child's field cannot be accessed from the parent document.
I'm using the Java API.
Any ideas?