问题
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"
}
}
}
回答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"
}
}
}
}
}
来源:https://stackoverflow.com/questions/28296320/elasticsearch-filter-via-number-of-mentions