0

I am trying to write a query which will return me articles about certain keywords but I want the articles to only show if the the given keyword is mentions 5 times in the articles I am using following query But no result

  {
   "query":{

      "multi_match":{
         "query":"Apple",
         "operator":"AND",
         "fields":[
            "Text"
         ]

      }
      ,"min_term_freq" : 5
   },
   "sort":{
      "Date":{
         "order":"desc"
      }
   }
}
Ironman
  • 173
  • 1
  • 3
  • 10

1 Answers1

1

I dont believe there is any min_term_freq option as you have listed. But then you can use scripting in filter to achieve the same -

{
  "query": {
    "filtered": {
      "filter": {
        "script": {
          "script": "_index['Text']['apple'].tf() > 5"
        }
      }
    }
  }
}
Vineeth Mohan
  • 18,633
  • 8
  • 63
  • 77