【发布时间】:2014-08-07 12:46:04
【问题描述】:
我的查询有问题。我使用查询来提升没有嵌套对象的文档。现在我使用nested_objects 并将查询更改为使用嵌套过滤器,但没有任何提升。 我得到了我期望的文件,但没有 _score 变化。
我是不是做错了什么??
GET index/type/_search
{
"query": {
"function_score": {
"filter": {
"bool": {
"must": [
{
"term": {
"parent.child": "test"
}
}
]
}
},
"functions": [
{
"boost_factor": "100",
"filter": {
"nested": {
"path": "parent",
"filter": {
"bool": {
"must": [
{
"term": {
"child": "test"
}
}
]
}
}
}
}
}
],
"score_mode": "sum"
}
},
"sort": "_score",
"from": 0,
"size": 320
}
编辑: 会不会是因为
嵌套过滤器
嵌套过滤器的行为很像嵌套查询,除了它 不接受 score_mode 参数。它只能用于 “过滤上下文” — 例如在过滤查询中 — 它的行为 像任何其他过滤器一样:它包含或排除,但它不得分。
虽然嵌套过滤器本身的结果没有被缓存,但 通常的缓存规则适用于嵌套过滤器内的过滤器。
http://www.elasticsearch.org/guide/en/elasticsearch/guide/current/nested-query.html
【问题讨论】:
标签: elasticsearch