1、boolean model
类似and这种逻辑操作符,先过滤出包含指定term的doc
query "hello world" --> 过滤 --> hello / world / hello & world
bool --> must/must not/should --> 过滤 --> 包含 / 不包含 / 可能包含
doc --> 不打分数 --> 正或反 true or false --> 为了减少后续要计算的doc的数量,提升性能query: hello world
"match": {
"title": "hello world"
}
"bool": {
"should": [
{
"match": {
"title": "hello"
}
},
{
"match": {
"title": "world"
}
}
]
}
普通multivalue搜索,转换为bool搜索,boolean model
2、TF/IDF算法介绍
relevance score算法,简单来说,就是计算出,一个索引中的文本,与搜索文本,他们之间的关联匹配程度
Elasticsearch使用的是 term frequency/inverse document frequency算法,简称为TF/IDF算法
Term frequency:搜索文本中的各个词条在field文本中出现了多少次,出现次数越多,就越相关
搜索请求: hello world --> doc.content