Field boosting at query time

Hello,

sorry if this question is already explained in the docs but i tried to go
through all the boosting and custom scoring documentation and didn't find
what i was looking for.

I'm trying to write a query that will give preference to certain fields
when doing a match query on "_all". so for example to be able to score
higher when the query matches the title and author fields than it would
when it matches on a subject field. I've seen various ways to boost scores
based on field values as well as how to add a boost to the field mappings
on index time, but what if I want to do the field boost on query time
instead?

here's a query i'm running. what would be the best way for example to add
a 2.0 boost to the title field?

http://pastebin.com/XBwat3zy

-Mike

--
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/CALdNedLu0q3c-vyeqbyDN_vaR%3DoBTA45Bk5vd6Fj2X8f0BbcAA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Hi,
If I'm not wrong you cannot boost fields in _all field on query time.
Querying the _all field should take in account the index-time boost, but
for query-time boost you will need the field names you are searching in.
You can set boost for a field at query time using "^":
"title^5.0"

You can probably do query on ["title^5.0", "_all"] and don't set the boost
in the mapping (index time)
This way the matches in _all will have base boost of 1.0, but if there is
match on "title" field you should get additional boost of 5.0

Regs
Tihomir

08 август 2014, петък, 16:15:55 UTC+3, Mike Topper написа:

Hello,

sorry if this question is already explained in the docs but i tried to go
through all the boosting and custom scoring documentation and didn't find
what i was looking for.

I'm trying to write a query that will give preference to certain fields
when doing a match query on "_all". so for example to be able to score
higher when the query matches the title and author fields than it would
when it matches on a subject field. I've seen various ways to boost scores
based on field values as well as how to add a boost to the field mappings
on index time, but what if I want to do the field boost on query time
instead?

here's a query i'm running. what would be the best way for example to add
a 2.0 boost to the title field?

GET /catalog_data/book/_search?routing=1{ "fields": [], "query": { - Pastebin.com

-Mike

--
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/2cd02a13-f4af-48b2-bd69-cf4d233c18ab%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.