Search code examples
elasticsearchkibana

What is _score in ES/Kibana?


I have this document in ES and I am looking at it through Kibana.

What does the _score field represent?

{
  "took": 2,
  "timed_out": false,
  "_shards": {
    "total": 11,
    "successful": 11,
    "skipped": 0,
    "failed": 0
  },
  "hits": {
    "total": 1,
    "max_score": 0.2876821,
    "hits": [
      {
        "_index": "order",
        "_type": "ACKNOWLEDGED",
        "_id": "9901234567",
        "_score": 0.2876821,
        "_source": {
          "applicationCode": "SAPS00",
          "orderId": "9901234567",
          "status": "ACKNOWLEDGED",
          "orderUpdatedDateTime": "2018-07-08T10:12:21Z",
          "totals": {
            "orderShippingTaxAmount": 3.5,
            "orderSubtotalTaxAmount": 12.55,
            "grandTotalTaxAmount": 15
          },
          "orderLines": [
            {
              "lineId": "1",
              "unitPriceTaxAmount": 5.45,
              "totalPriceTaxAmount": 10.67,
              "lineShippingTaxAmount": null
            },
            {
              "lineId": "2",
              "unitPriceTaxAmount": 2.45,
              "totalPriceTaxAmount": 8.67,
              "lineShippingTaxAmount": null
            }
          ]
        }
      }
    ]
  }
}

Solution

  • The _score in Elasticsearch is a way of determining how relevant a match is to the query. The default scoring function used by Elasticsearch is actually the default built in to Lucene which is what Elasticsearch runs under the hood. Here's an article that describes scoring fairly well.

    https://www.compose.com/articles/how-scoring-works-in-elasticsearch/

    Elasticsearch runs Lucene under the hood so by default it uses Lucene's Practical Scoring Function. This is a similarity model based on Term Frequency (tf) and Inverse Document Frequency (idf) that also uses the Vector Space Model (vsm) for multi-term queries.