Elastic Search - Difference betweeen timestamp of 2 child documents


(Diego Agriel) #1

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?


(system) #2

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.