【问题标题】:Why does ElasticSearch is not showing the score?为什么 ElasticSearch 不显示分数?
【发布时间】:2016-06-21 20:38:41
【问题描述】:

我在 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 个文档,但是分数是 always "_score": 0

我读过过滤器有分数,那么,为什么不在这种情况下呢?

谢谢!

【问题讨论】:

    标签: java elasticsearch elasticsearch-mapping


    【解决方案1】:

    不为过滤器计算分数。如果需要分数,则需要使用普通查询。

    请考虑以下文档中指出的含义。 参考文档:https://www.elastic.co/guide/en/elasticsearch/reference/current/query-filter-context.html

    【讨论】:

      猜你喜欢
      • 2014-10-30
      • 2022-09-21
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-09-20
      相关资源
      最近更新 更多