Elasticsearch-6.x规范错误不起作用

时间:2018-04-24 07:33:51

标签: elasticsearch

这就是我所做的:

首先: curl -X PUT "localhost:9200/log_20180419"

第二

curl -X PUT "localhost:9200/log_20180419/_mapping/_doc" -H 'Content-Type: application/json' -d'
    {
      "properties": {    
        "title": {
          "type": "text",
          "norms": false
        }
      }
    }
    '

第三

    #I insert data with python client : elastisearch-py
    from elastisearch import Elastisearch
    es_conn = Elastisearch()
    content_tmp = "acxzcasiuchxzuicbhasuicgzyugas%s"
    for i in range(10000):
        result = content_tmp % i
        es_conn.index(index="log_20180419", body = {"title":result}, doc_type="_doc")

第四 我查询它

curl -X GET "localhost:9200/cdn_log_20180419/_search?pretty" -H 'Content-Type: application/json' -d'
{
    "query": { 
        "match":{



  "title":"dasuioczxuivcaduciqanbcaiushcauinhauincsaincdjkxzcbyquiwbjkfcznkajsbcjkzxhcuiasbcjkzxchjdsfasckjbjak9999"
        }
    }
}
'

结果

{
  "took" : 1,
  "timed_out" : false,
  "_shards" : {
    "total" : 5,
    "successful" : 5,
    "skipped" : 0,
    "failed" : 0
  },
  "hits" : {
    "total" : 1,
    "max_score" : 7.2293553,
    "hits" : [
      {
        "_index" : "cdn_log_20180419",
        "_type" : "_doc",
        "_id" : "oDR99mIBBZEcRu0i7LlO",
        "_score" : 7.2293553,
        "_source" : {
          "title" : "dasuioczxuivcaduciqanbcaiushcauinhauincsaincdjkxzcbyquiwbjkfcznkajsbcjkzxhcuiasbcjkzxchjdsfasckjbjak9999"
        }
      }
    ]
  }
}

你可以看到,结果中仍然有_score文件,我搞糊涂了吗? Doc在这里https://www.elastic.co/guide/en/elasticsearch/reference/current/norms.html

1 个答案:

答案 0 :(得分:0)

规范只是得分的一部分。该范数涵盖了字段长度范数和索引时间提升(如果您正在使用它),但术语频率和逆文档频率(TF / IDF)与其无关。

如果您不需要/想要对您的查询进行评分,请查看boolean filtersconstant score