Return results with match_phrase if document count is greater than 1

Good morning,

Is it possible to use match_phrase to count the occurrence of the phrase per document and only return results if the phrase count in the document in greater than 1?

{
  "query": {
    "bool": {
      "should": [
        {
          "match_phrase": {
            "logComments.content": "IF DEEMED VULNERABLE FROM COMPLETION OF THRIVE THEN REMEMBER TO FLAG INCIDENT AS VULNERABLE"
          }
        }
      ]
    }
  }
}

So in a data table for example, the result would only be shown for documents where "IF DEEMED VULNERABLE FROM COMPLETION OF THRIVE THEN REMEMBER TO FLAG INCIDENT AS VULNERABLE" appears more than once.

Hello,

Unfortunately, as far as I know, there is no paramter to set minimum frequency of the matching phrase.

One possible option could be using wildcard field and wildcard query with something like "IF DEEMED VULNERABLE FROM COMPLETION OF THRIVE THEN REMEMBER TO FLAG INCIDENT AS VULNERABLE * IF DEEMED VULNERABLE FROM COMPLETION OF THRIVE THEN REMEMBER TO FLAG INCIDENT AS VULNERABLE".

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