Complex nested aggregation query based on time

Hello there,

I am trying to write a rather complex aggregation

Let's say my json documents contains the following fields: timestamp,
username, subject

The search should return documents where:

  • two identical "subject" fields,
  • by the same username,
  • within an interval of X minutes.

Using nested aggregation I can group by username, and count the identical
subjects (terms).
However I can't find a way to also specify a time interval within the
query. (the identical subjects should be within an interval of X minutes)

All pointers are welcome.


You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to
To view this discussion on the web visit
For more options, visit