我有一個非常複雜的搜索,其中我基本上執行大量搜索與許多實體組中的至少一個實體相匹配的文章。如何在ElasticSearch的bool查詢中獲取基礎匹配查詢的分數?
我注意到,隨着我添加更多的實體,分數急劇變化,因爲我的should
子句大小增加。
這裏是我的查詢示例2個實體:
{
"size": 50,
"track_scores": true,
"min_score": 0.05,
"sort": [
{
"timestamp": {
"order": "desc"
}
}
],
"query": {
"bool": {
"should": [
{
"bool": {
"should": [
{
"function_score": {
"functions": [
{
"boost_factor": 1000000
}
],
"query": {
"terms": {
"relatedProfiles": [
"SomethingElse/124026966662",
"SomeLocation/707765"
]
}
},
"boost_mode": "replace"
}
},
{
"bool": {
"should": [
{
"multi_match": {
"type": "phrase",
"query": "Generic Systems",
"operator": "and",
"fields": [
"content.title",
"content.description"
]
}
},
{
"multi_match": {
"type": "phrase",
"query": "Generic Systems, Inc.",
"operator": "and",
"fields": [
"content.title",
"content.description"
]
}
}
],
"minimum_should_match": "1"
}
}
],
"minimum_should_match": "1",
"_name": "0e7da739-1d18-448b-caa2-5c615a59d108"
}
},
{
"bool": {
"should": [
{
"function_score": {
"functions": [
{
"boost_factor": 1000000
}
],
"query": {
"terms": {
"relatedProfiles": [
"SomeLocation/162479",
"SomethingElse/32b95cc3-a363-47c3-2ac1-86fdb3b7d108"
]
}
},
"boost_mode": "replace"
}
},
{
"bool": {
"should": [
{
"multi_match": {
"type": "phrase",
"query": "SomeBusiness Computer Inc",
"operator": "and",
"fields": [
"content.title",
"content.description"
]
}
},
{
"multi_match": {
"type": "phrase",
"query": "SomeBusiness, Inc",
"operator": "and",
"fields": [
"content.title",
"content.description"
]
}
}
],
"minimum_should_match": "1"
}
}
],
"minimum_should_match": "1",
"_name": "00cc4b36-ce6b-4816-e61e-b7124344d108"
}
}
],
"minimum_should_match": "1"
}
},
"filter": {
"bool": {
"must": [
{
"bool": {
"should": [
{
"bool": {
"must": [
{
"term": {
"type": "News"
}
},
{
"terms": {
"language": [
"eng"
]
}
}
]
}
},
{
"terms": {
"type": [
"Social",
"Job",
"Unknown"
]
}
}
]
}
},
{
"range": {
"timestamp": {
"lt": "2015-05-13T09:25:40.605",
"gt": "2013-05-13T09:25:40.605"
}
}
}
]
}
}
}
我怎樣才能獲得潛在的比賽是得分?或者,至少是名稱查詢下面的部分的分數?
畢竟它是Dis Max查詢! –