Mapping/boosting problem

Hi Uli,

The reason the score stay the same is that you change the boosting for
name but you search using the _all field.
For the _all field the following boosting applies:
"_boost": {
"name": "boostFactor",
"null_value": 1.0
},

I assume you want give documents with hits name a higher boost, right?
Perhaps this best achieved with just query
time boosting using the custom boost factor query:

And then add the two queries together like this:
{
"query":{
"bool":{
"should":[
{
"prefix":{
"_all":{
"value":"se",
"rewrite":"top_terms_10"
}
}
},
{
"custom_boost_factor":{
"prefix":{
"name":{
"value":"se",
"rewrite":"top_terms_10"
}
},
"boost_factor":20.0
}
}
],
"minimum_number_should_match":1,
"boost":1.0
}

}

}

Martijn

On 2 August 2012 16:31, Uli Schimpfle huschimpfle@googlemail.com wrote:

Hi Martijn,

I'm using my little script I posted (see the gist...)
In this script I always delete the (old) index and creates a new one (with a
new mapping).
So the mapping/index should be always up-to-date.

Uli

Am Donnerstag, 2. August 2012 15:54:44 UTC+2 schrieb Martijn v Groningen:

Hi Uli,

After you updated the mapping (setting boost to 2 for field name) did
you reindex the documents, right?
I'm not sure if you did this... Alternatively you could also use the
update api, to just update the names.

Martijn

On 1 August 2012 17:00, Uli Schimpfle huschimpfle@googlemail.com wrote:

After you've updated your mapping, do you see that your mapping has
changed?

(by executing something like this: curl -XGET
'http://localhost:9200/myindex/author/_mapping')

It showed me the correct result. One time the value 20 for the "boost"
and
one time e.g. 2

I posted another gist with the changed query and the additional mapping
query :
elasticsearch boost problem 2 · GitHub

This can possible be an expensive query to execute, because the script

is execute for each hit in your whole result set.
On the other hand this query is more flexible, since it allows you to
tweak the result ordering without a reindex.
If your result set are very large this might not be the best way to
score you result and you might have to resort to index time boosting,
which is many times faster. Obviously this depends on your data and
queries.

The index could get quite big. We have about 5 million documents (book
titiles).
And since I just started with Elasticsearch I'm more than welcome to
hear
about
any improvments I can do...

Thanks,

Uli

--
Met vriendelijke groet,

Martijn van Groningen

--
Met vriendelijke groet,

Martijn van Groningen