How to use min_term_freq with bool query?

I have this query:

{
   "bool":{
      "must":[
         {
            "multi_match":{
               "query":"foo",
               "fields":[
                  "title",
                  "body"
               ]
            }
         }
      ]
   }
}

and I want to exclude results that have the term mentioned 1 times.

I have already tried more like this api without any luck. I have also looked to term vector but it also did not work.

For the exclusion you could use the must_not clause :
https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-bool-query.html

1 Like

What exactly should I exclude? Can you give me example please?

Thanks.

bump

I think I misunderstood what you want to achieve here :
But if you want to exclude ONLY the terms mentioned once?
There's one approach where you could add the term_vectors data (term_frequency), into your documents during the indexing process, then query on the term_frequency for the specific term.

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