我正在发送这样的查询:(使用查询{全部})
{
"query": {
"custom_filters_score": {
"query": {
"match_all": {}
},
"filters": [
{
"filter": {
"range": {
"last_contact_at": {
"gte": "2013-06-21T12:02:25Z"
}
}
},
"boost": 1
},
{
"filter": {
"range": {
"available_at": {
"gte": "2013-06-28"
}
}
},
"boost": 2
},
{
"filter": {
"term": {
"company_type": "intern"
}
},
"boost": 10
},
{
"filter": {
"range": {
"friends_count": {
"from": 1
}
}
},
"boost": 3
},
{
"filter": {
"term": {
"blacklisted": true
}
},
"boost": -100
},
{
"filter": {
"term": {
"focuses": "ruby php"
}
},
"boost": 5
},
{
"filter": {
"term": {
"tags": "ruby php"
}
},
"boost": 4
}
],
"score_mode": "total"
}
}
}
我得到以下响应 max_score: 16 这是我的提升点的总和。
回复
{
"took": 3,
"timed_out": false,
"_shards": {
"total": 5,
"successful": 5,
"failed": 0
},
"hits": {
"total": 10,
"max_score": 16,
...
当我发送相同的 custom_filters_score 但查询 { string term }
{
"query": {
"custom_filters_score": {
"query": {
"query_string": {
"query": "ruby php"
}
},
"filters": [
{
"filter": {
"range": {
"last_contact_at": {
"gte": "2013-06-21T12:03:46Z"
}
}
},
"boost": 1
},
{
"filter": {
"range": {
"available_at": {
"gte": "2013-06-28"
}
}
},
"boost": 2
},
{
"filter": {
"term": {
"company_type": "intern"
}
},
"boost": 10
},
{
"filter": {
"range": {
"friends_count": {
"from": 1
}
}
},
"boost": 3
},
{
"filter": {
"term": {
"blacklisted": true
}
},
"boost": -100
},
{
"filter": {
"term": {
"focuses": "ruby php"
}
},
"boost": 5
},
{
"filter": {
"term": {
"tags": "ruby php"
}
},
"boost": 4
}
],
"score_mode": "total"
}
}
}
我得到 max_score 的以下响应:8.990471
回复
{
"took": 4,
"timed_out": false,
"_shards": {
"total": 5,
"successful": 5,
"failed": 0
},
"hits": {
"total": 6,
"max_score": 8.990471,
...
如何达到max_score
我的提升点的总和,并且只显示包含 term 的结果?
搜索服务:https : //gist.github.com/8f13ce2be820d9ef1959