Prevent multiply by zero when using Gauss Decay function

Hello,

I'm using a Gauss Decay function to decrease relevance of old documents in my index (origin is current time). Is there a way to prevent a Gauss function to return 0 for very old documents in this case?

I am using a function score query with score mode multiply. For very old documents in my index their relevance is always 0 because of multiplication with 0 from the Gauss Decay function with the current time as the origin. Is there a way to prevent this?

Thanks for your time, I appreciate any feedback :slight_smile:

Hi @mortenxd,

Can you check if the parameter boost_mode works for you?

POST posts/doc/1
{
  "date": "1800-12-08T00:00:00"
}

POST posts/doc/2
{
  "date": "2017-12-08T00:00:00"
}

GET posts/_search
{
  "query": {
    "function_score": {
      "boost_mode": "avg",
      "score_mode": "multiply", 
      "gauss": {
        "date": {
          "origin": "2017-12-08T00:00:00",
          "scale": "10d",
          "decay": 0.5
        }
      }
    }
  }
}

Cheers,
LG

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