我在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/en/elasticsearch/reference/current/query-filter-context.html
关于java - 为什么ElasticSearch没有显示分数?,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/37944374/