ES打分机制
1.TF-IDF 词频-逆文档频率
2.Okapi BM25
3.随机性分歧- DFR相似度
4.基于信息 - IB相似度
5.LM Dirichlet 相似度
6.LM Jelinek Mercer相似度
解释一个查询的结果集
bash
curl -XPOST 'localhost:9200/get-together/_search?pretty' -H 'Content-Type: application/json' -d '
{
"query": {
"match": {
"description": "elasticsearch"
}
},
"explain": true
}'
使用function_score来定制得分
bash
#在description字段中匹配到hadoop
#和logstash的文档,分数就乘以2或3
POST /get-together/_search
{
"query": {
"function_score": {
"query": {
"match": {
"description": "elasticsearch"
}
},
"functions": [
{
"weight": 2,
"filter": {
"term": {
"description": "hadoop"
}
}
},
{
"weight": 3,
"filter": {
"term": {
"description": "logstash"
}
}
}
]
}
}
}
合并得分
1.每个单独函数得分合并 score_mode
multiply,sum,avg,first,max,min
2.函数得分和原始得分合并 boost_mode
sum,avg,max,min,replace