如何为两个more_like_this查询添加sum子句? [英] How do I include a sum clause for two more_like_this queries?
本文介绍了如何为两个more_like_this查询添加sum子句?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
而不是在以下查询中使用 dis_max ,我想查找两个 more_like_this
查询的总和。如何修改此查询才能实现?
Instead of using dis_max in the following query, I want to find the sum of two more_like_this
queries. How can I modify this query to achieve that?
POST /ucberkley/docs/_search
{
"fields": [
"Category"
],
"size": 1500,
"query": {
"dis_max": {
"queries": [{
"more_like_this": {
"fields": [
"PRIMARY_CONTENT_EN"
],
"ids": [
173161
],
"min_term_freq": 1,
"max_query_terms": 2,
"boost": 2
}
}, {
"more_like_this": {
"fields": [
"PRIMARY_CONTENT_EN"
],
"ids": [
175277
],
"min_term_freq": 1,
"max_query_terms": 2,
"boost": -1
}
}]
}
}
}
推荐答案
通过<一个href =https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-bool-query.html =nofollow> bool 查询使用应该
子句
示例:
"query": {
"bool": {
"disable_coord" : "true",
"should": [{
"more_like_this": {
"fields": [
"PRIMARY_CONTENT_EN"
],
"ids": [
173161
],
"min_term_freq": 1,
"max_query_terms": 2,
"boost": 1
}
}, {
"more_like_this": {
"fields": [
"PRIMARY_CONTENT_EN"
],
"ids": [
175277
],
"min_term_freq": 1,
"max_query_terms": 2,
"boost": -1
}
}]
}
}
这篇关于如何为两个more_like_this查询添加sum子句?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文