How to use min_term_freq with bool query?


(mia) #1

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.


#2

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


(mia) #3

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

Thanks.


(mia) #4

bump


#5

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.


(system) #6

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