我想在以下查询中使用 dis_max ,而不是在两个more_like_this
查询中找到 sum 。如何修改此查询以实现该目标?
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
}
}]
}
}
}
答案 0 :(得分:1)
实现此目的的一种方法是使用should
子句通过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
}
}]
}
}