Home > database >  How to calculate gauss value?
How to calculate gauss value?

Time:02-15

I am just curious to know how this value came i applied formula but i think i am missing something can anybody tell me please.I am running single ELK stack version 7.16

POST sneaker/_search
{
  "query": {
    "function_score": {
      "functions": [
        {
          "gauss": {
            "price": {
              "origin": "300",
              "scale": "200"
            }
          }
        }
      ]
    }
  }
  , "explain": true
}

Query result

 "max_score" : 1.0,
    "hits" : [
      {
        "_shard" : "[sneaker][0]",
        "_node" : "29ds_f0VSM6_-eDNhdQPLw",
        "_index" : "sneaker",
        "_type" : "_doc",
        "_id" : "6",
        "_score" : 1.0,
        "_source" : {
          "brand" : "flite",
          "price" : 300,
          "rating" : 2,
          "release_date" : "2020-12-21"
        },
        "_explanation" : {
          "value" : 1.0,
          "description" : "function score, product of:",
          "details" : [
            {
              "value" : 1.0,
              "description" : "*:*",
              "details" : [ ]
            },
            {
              "value" : 1.0,
              "description" : "min of:",
              "details" : [
                {
                  "value" : 1.0,
                  "description" : "Function for field price:",
                  "details" : [
                    {
                      "value" : 1.0,
                      "description" : "exp(-0.5*pow(MIN[Math.max(Math.abs(300.0(=doc value) - 300.0(=origin))) - 0.0(=offset), 0)],2.0)/28853.900817779268)",
                      "details" : [ ]
                    }
                  ]
                },

I look for guassian distribution but it is different from this. I want to know how 28853.900817779268 value came

CodePudding user response:

If you look on the official documentation for the enter image description here

Using scale = 200 and decay = 0.5 (default value if unspecified), we get the following:

-200^2 / (2 * ln (0.5)) = -28853.90081

which is what you're seeing in the explanation of the query.

  • Related