弹性搜索过滤器通过提及的数量 [英] Elasticsearch filter via number of mentions
本文介绍了弹性搜索过滤器通过提及的数量的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在尝试撰写一个查询,这将返回给我关于某些关键字的文章,但是我希望文章只显示给定的关键字是否在我使用以下查询的文章中提到了5次但是没有结果
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"
}
}
}
推荐答案
我不相信是您列出的任何min_term_freq选项。
但是,您可以使用过滤器中的脚本实现相同的功能 -
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"
}
}
}
}
}
这篇关于弹性搜索过滤器通过提及的数量的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文