# Decay Function question

I've begun using the decay function in order to promote more recent results
in our index. In particular I'm using what's documented here:

http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/query-dsl-function-score-query.html

Here's the date example they use (let's assume gaussian slope):

``````"DECAY_FUNCTION": {
"FIELD_NAME": {
"origin": "2013-09-17",
"scale": "10d",
"offset": "5d",
"decay" : 0.5
}
}
``````

So in trying to visualize this decay, is it safe to make the following
assumptions in terms of associating these input values to a graph:

• origin is the start (x-value) of the slope, in this case the date
9/17/2013
• for all points up to offset, the slope is flat, so there's no negative
scoring for the 5 days after 9/17/2013
• the "end" of the slope is scale
• at the data point 'scale', the slope will have a y-value (on the graph)
of decay (0.5)

The last point I am not so sure about. Furthermore, I'm unclear as to what
happens for articles outside of scale, so past 10 days. My test show that
they actually get a 'zero' multiplier for their score, so basically their
scores all end up being zero. I was under the impression that they would
get a score multiplier of 0.5. Any help would be appreciated.

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.

Hi Mario,

I added an image which hopefully explains a little better how decay
functions work here:

• origin is the start (x-value) of the slope, in this case the date 9/17/2013

yes

• for all points up to offset, the slope is flat, so there's no negative scoring for the 5 days after 9/17/2013

The decay function never returns a negative value. It will always be
between 0 and 1. For each value within +- offset from the defined
origin the decay function will just return 1.

• the "end" of the slope is scale

No, decay function will decrease further. The scale parameter just
steers how quickly the function approaches 0.

• at the data point 'scale', the slope will have a y-value (on the
graph) of decay (0.5)

yes.

My test show that they actually get a 'zero' multiplier for their score, so basically their scores all end up being zero. I was under the impression that they would get a score multiplier of 0.5.

No, the score will decrease further until it reaches 0. If you need
to have documents outside the "scale" range to have a value of 0.5 you
need to define a separate function which then adjusts the score for
these documents as needed.

On Thu, Nov 6, 2014 at 8:07 PM, Marlo Epres mepres@gmail.com wrote:

I've begun using the decay function in order to promote more recent results
in our index. In particular I'm using what's documented here:

http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/query-dsl-function-score-query.html

Here's the date example they use (let's assume gaussian slope):

``````"DECAY_FUNCTION": {
"FIELD_NAME": {
"origin": "2013-09-17",
"scale": "10d",
"offset": "5d",
"decay" : 0.5
}
}
``````

So in trying to visualize this decay, is it safe to make the following
assumptions in terms of associating these input values to a graph:

• origin is the start (x-value) of the slope, in this case the date
9/17/2013
• for all points up to offset, the slope is flat, so there's no negative
scoring for the 5 days after 9/17/2013
• the "end" of the slope is scale
• at the data point 'scale', the slope will have a y-value (on the graph) of
decay (0.5)

The last point I am not so sure about. Furthermore, I'm unclear as to what
happens for articles outside of scale, so past 10 days. My test show that
they actually get a 'zero' multiplier for their score, so basically their
scores all end up being zero. I was under the impression that they would get
a score multiplier of 0.5. Any help would be appreciated.

--
You received this message because you are subscribed to the Google Groups
"elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an