Query nested array having n matching elements

Is this possible?
I am indexing web site user activity focusing on user comments across multiple web sites and databases.
I am "fairly" new to ES and am addressing quite a large problem.
So basic question...
Along with user name data and email in each document, comments on various topics are in a nested array as objects with basic fields like comment_topic and comment_text (text fields).
eg.
{
"name": "user name",
"id": "123",
"email":"abc@eample.com,"
"comments": [
{
"comment_topic": "topic 1",
"comment_text": "whatever"
},
{
"comment_topic": "topic 2",
"comment_text": "whatever"
},
{
"comment_topic": "topic 1",
"comment_text": "further more ...."
},
]
}

Is it possible to query documents where, say , 10 or more comments array elements in a document match a given topic? Looking for users really active on a topic.

This brings up a basic question of matching on a term frequency minimum value. I am not familiar with how to to this. I have seen some related but dated solutions, not sure if they are still viable or best practice...
ie.

{
  "query": {
    "filtered": {
      "filter": {
        "script": {
          "script": "_index['name'][term_to_lookup].tf() > occurrences",
          "params": {
            "term_to_lookup": "copyright",
            "occurrences": 1
          }
        }
      }
    }
  }
}

Any thoughts would be greatly appreciated.
Cheers,
Frank

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