Query the sum of a filtered subset of nested documents

Consider a document like this:

      title: "I love ice cream!"
      comments: [
          body: "me too!",
          reaction: 'positive',
          likes: 20
          body: "huh!",
          reaction: 'sarcastic',
          likes: 5

The comments is a field of nested type.

How can elastic answer this:
Give me all posts, where the total sum of likes on "sarcastic" comments is greater than 100.
I'm open to any other way of modelling data which helps answer such queries.

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