How the score is calculated in elasticsearch?


(Li Jessen) #1

When I tries,
GET /logstash-2019.02.17/doc/_search
{
"query":{
"match":{
"response": "200"
}
}
}
The index logstash-2019.02.17 does have a field of "response" of type "text",
"response" : {
"type" : "text",
"norms" : false,
"fields" : {
"keyword" : {
"type" : "keyword",
"ignore_above" : 256
}
}
}
But the result shows _"score" : 0.061875403, why is it so low?


(David Pilato) #2

You can use explain: true in your query to get how the score is computed.

If you don't care about the score, I'd recommend using a constant_score Query: https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-constant-score-query.html

GET /logstash-2019.02.17/_search_search
{
    "query": {
        "constant_score" : {
            "filter" : {
                "term" : { "response" : "200"}
            }
        }
    }
}

(system) closed #3

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.