我在Ubuntu 16.04上使用ElasticSearch 2.3.1。
映射为:
{
"settings": {
"analysis": {
"filter": {
"2gramsto3_filter": {
"type": "ngram",
"min_gram": 2,
"max_gram": 3
}
},
"analyzer": {
"2gramsto3": {
"type": "custom",
"tokenizer": "standard",
"filter": [
"lowercase",
"2gramsto3_filter"
]
}
}
}
},
"mappings": {
"agents": {
"properties": {
"presentation": {
"type": "string",
"analyzer": "2gramsto3"
},
"cv": {
"type": "string",
"analyzer": "2gramsto3"
}
}
}
}
查询是:
{
"size": 20,
"from": 0,
"query": {
"bool": {
"filter": [
{
"bool": {
"must": [
[
{
"match": {
"cv": "folletto"
}
},
{
"match": {
"cv": " psicologia"
}
},
{
"match": {
"cv": " tenacia"
}
}
]
]
}
}
]
}
}
}
结果发现14567个文档,但比分总是 "_score": 0
我阅读了具有分数的过滤器,那么,为什么在这种情况下不呢?
谢谢!
分数不是针对过滤器计算的。如果您需要分数,则需要使用常规查询。
只需考虑以下文档中指出的含义即可。参考文档:https : //www.elastic.co/guide/zh-CN/elasticsearch/reference/current/query-filter-context.html
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句