Boosting fields


(Ben McCann) #1

I want to query on numerous fields and have some fields be weighted much
more heavily than other fields. Only one field needs to match to return a
result, but if multiple match I'd like the scores to combine to a higher
score. Another thing that would be nice would be to potentially use one
field to contribute to scoring, but not retrieval.

It looks like I might be able to use either a bool should query or a
function_score query? Any tips on what the best query is to use for the
case above and what the tradeoffs might be?

Thanks,
Ben

--
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.
For more options, visit https://groups.google.com/groups/opt_out.


(Jörg Prante) #2

Did you read
http://jontai.me/blog/2013/01/advanced-scoring-in-elasticsearch/ ?

With function score query, you are on the right track (it supersedes custom
filters score query used in the blog post)

Jörg

--
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.
For more options, visit https://groups.google.com/groups/opt_out.


(Ben McCann-2) #3

Thanks for the pointer Jörg. That's a great article. I have a question
after reading it.

When I look at the docs for
function_scorehttp://www.elasticsearch.org/guide/en/elasticsearch/reference/current/query-dsl-function-score-query.htmlit
shows the following:

"function_score": {
"(query|filter)": {},
"boost": "boost for the whole query",
"FUNCTION": {},
"boost_mode":"(mult|replace|...)"
}

What's the difference between using query and filter? Is it that a query is
essential an "or" operation and a filter is an "and" operation?

Thanks,
Ben

On Sat, Oct 5, 2013 at 12:07 PM, joergprante@gmail.com <
joergprante@gmail.com> wrote:

Did you read
http://jontai.me/blog/2013/01/advanced-scoring-in-elasticsearch/ ?

With function score query, you are on the right track (it supersedes
custom filters score query used in the blog post)

Jörg

--
You received this message because you are subscribed to a topic in the
Google Groups "elasticsearch" group.
To unsubscribe from this topic, visit
https://groups.google.com/d/topic/elasticsearch/CLDSVrdE-Qk/unsubscribe.
To unsubscribe from this group and all its topics, send an email to
elasticsearch+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

--
about.me/benmccann

--
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.
For more options, visit https://groups.google.com/groups/opt_out.


(Jörg Prante) #4

Usually you use "query" to compute new scores for the hits in the query.

With "filter" you compute new scores for the hits that are in the filter.

This inherits from "custom score query" and "custom filters score query".

Jörg

--
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.
For more options, visit https://groups.google.com/groups/opt_out.


(system) #5