确定文档和查询有多么相关的过程被称为打分(scoring):将查询作为输入,使用不同的手段来确定每一篇文档的得分,将每一个因素最后通过公式综合起来,返回该文档的最终得分。这个综合考量的过程,就是我们希望相关的文档被优先返回的考量过程。在Lucene
和es
中这种相关性称为得分
文档打分的运作机制:TF-IDF
我们称之为TF-IDF
,TF
是词频(term frequency),而IDF
是逆文档频率(inverse document frequency)
1、es查相似车源:相同modelcode和citycode下的3个条件:需要:1、小于入参mile+偏移量2、晚于入参日期-偏移量3、小于入参price
![](https://images.cnblogs.com/OutliningIndicators/ContractedBlock.gif)
POST ienterprise_jiaxuan_market_price/_search
{
"from": 0,
"size": 50,
"query": {
"bool": {
"filter": [
{
"term": {
"model_code": "13835-n"
}
},
{
"term": {
"location": "南京"
}
},
{
"range": {
"mileage": {
"lte": "19"
}
}
},{
"range": {
"price": {
"lte": "18"
}
}
},
{
"range": {
"license_plate_date": {
"gte": "2017-09"
}
}
}
]
}
}
}
2、