Boosting for a number near X


(Guy Bowden) #1

Hi,

I have documents (accommodations) stored with a numeric attribute - "number
of beds"

I'd like to be able to boost by a certain amount if that number is close to
a search query.

e.g. prefer documents with a number of beds close to what is being searched
for.

This will be added to the rest of the search criteria - is there a way to
do this? I can filter by a number within a range, but would like the
results returned to take some ordering from the closeness of the number
searched for.

Thanks
Guy

--
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.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/e4e54a0c-16af-4c55-a01e-f074d066fc01%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


(Hannes Korte) #2

Hi Guy,

sounds like you are looking for the function score query:

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

And there maybe especially for the decay functions:

"Decay functions score a document with a function that decays depending
on the distance of a numeric field value of the document from a user
given origin. This is similar to a range query, but with smooth edges
instead of boxes."

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

Have a look at all the beautiful example plots Britta created.. :slight_smile:

Best regards,
Hannes

On 15.04.2014 15:18, Guy Bowden wrote:

Hi,

I have documents (accommodations) stored with a numeric attribute - "number
of beds"

I'd like to be able to boost by a certain amount if that number is close to
a search query.

e.g. prefer documents with a number of beds close to what is being searched
for.

This will be added to the rest of the search criteria - is there a way to
do this? I can filter by a number within a range, but would like the
results returned to take some ordering from the closeness of the number
searched for.

Thanks
Guy

--
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.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/534D37E5.8060609%40hkorte.com.
For more options, visit https://groups.google.com/d/optout.


(system) #3