Mapping/boosting problem

Hi,

I'm new to ElasticSearch/Lucene and I have a question about boosting.

I created a mapping which defines a "_boost" field and I also have a
"boost" property for one field of my two fields.
If I understand it right with "_boost" I define a boost for the document
and with "boost" I define a boost for a field.

If I do a search the "_score" fields of the hits have always the value 1.0.

Shouldn't have the _score field different values than 1.0 (and so the
sorting of the hits) ?

Please have a look at :

Thanks,

Uli

Hi Uli,

Prefixquery and other multi-term queries (like wildcard query) don't
compute scores by default (score is always 1). Actually the score is
determined by the query time boost and the index time boost you
specified isn't used.

However the scoring can be somewhat controlled by setting a rewrite method:

Perhaps setting rewrite parameter to: 'top_terms_10' gives the scores
/ sorting you want.

Martijn

On 31 July 2012 08:50, Uli Schimpfle huschimpfle@googlemail.com wrote:

Hi,

I'm new to Elasticsearch/Lucene and I have a question about boosting.

I created a mapping which defines a "_boost" field and I also have a "boost"
property for one field of my two fields.
If I understand it right with "_boost" I define a boost for the document and
with "boost" I define a boost for a field.

If I do a search the "_score" fields of the hits have always the value 1.0.

Shouldn't have the _score field different values than 1.0 (and so the
sorting of the hits) ?

Please have a look at :

elasticsearch boost problem · GitHub

Thanks,

Uli

--
Met vriendelijke groet,

Martijn van Groningen

Hi Martijn,

Thanks for your answer about the multi-term queries. I didn't know that.

I tried to use the "rewrite": "top_terms_10" but it didn't help.

curl -XGET 'http://localhost:9200/myindex/author/_search' -d '{
"query": {
"prefix": {
"name": "Se",
"rewrite": "top_terms_10"
}
}
}'

May you have any suggestion what else I could do/try to get the boosting
for the this. Filters?, Sorting?,... I need to do some search like a prefix
query
on multiple fields.

Thanks,

Uli

Am Dienstag, 31. Juli 2012 12:31:31 UTC+2 schrieb Martijn v Groningen:

Hi Uli,

Prefixquery and other multi-term queries (like wildcard query) don't
compute scores by default (score is always 1). Actually the score is
determined by the query time boost and the index time boost you
specified isn't used.

However the scoring can be somewhat controlled by setting a rewrite
method:

Elasticsearch Platform — Find real-time answers at scale | Elastic

Perhaps setting rewrite parameter to: 'top_terms_10' gives the scores
/ sorting you want.

Martijn

On 31 July 2012 08:50, Uli Schimpfle huschimpfle@googlemail.com wrote:

Hi,

I'm new to Elasticsearch/Lucene and I have a question about boosting.

I created a mapping which defines a "_boost" field and I also have a
"boost"
property for one field of my two fields.
If I understand it right with "_boost" I define a boost for the document
and
with "boost" I define a boost for a field.

If I do a search the "_score" fields of the hits have always the value
1.0.

Shouldn't have the _score field different values than 1.0 (and so the
sorting of the hits) ?

Please have a look at :

elasticsearch boost problem · GitHub

Thanks,

Uli

--
Met vriendelijke groet,

Martijn van Groningen

Hi Uli,

The query you specified is incorrect. The query should be:
curl -XGET 'http://localhost:9200/myindex/author/_search' -d '{
"query": {
"prefix": {
"name": {
"value" : "Se",
"rewrite": "top_terms_10"
}
}
}
}'

This query does the boost into account.

Martijn

On 31 July 2012 13:21, Uli Schimpfle huschimpfle@googlemail.com wrote:

Hi Martijn,

Thanks for your answer about the multi-term queries. I didn't know that.

I tried to use the "rewrite": "top_terms_10" but it didn't help.

curl -XGET 'http://localhost:9200/myindex/author/_search' -d '{
"query": {
"prefix": {
"name": "Se",
"rewrite": "top_terms_10"
}
}
}'

May you have any suggestion what else I could do/try to get the boosting
for the this. Filters?, Sorting?,... I need to do some search like a prefix
query
on multiple fields.

Thanks,

Uli

Am Dienstag, 31. Juli 2012 12:31:31 UTC+2 schrieb Martijn v Groningen:

Hi Uli,

Prefixquery and other multi-term queries (like wildcard query) don't
compute scores by default (score is always 1). Actually the score is
determined by the query time boost and the index time boost you
specified isn't used.

However the scoring can be somewhat controlled by setting a rewrite
method:

Elasticsearch Platform — Find real-time answers at scale | Elastic

Perhaps setting rewrite parameter to: 'top_terms_10' gives the scores
/ sorting you want.

Martijn

On 31 July 2012 08:50, Uli Schimpfle huschimpfle@googlemail.com wrote:

Hi,

I'm new to Elasticsearch/Lucene and I have a question about boosting.

I created a mapping which defines a "_boost" field and I also have a
"boost"
property for one field of my two fields.
If I understand it right with "_boost" I define a boost for the document
and
with "boost" I define a boost for a field.

If I do a search the "_score" fields of the hits have always the value
1.0.

Shouldn't have the _score field different values than 1.0 (and so the
sorting of the hits) ?

Please have a look at :

elasticsearch boost problem · GitHub

Thanks,

Uli

--
Met vriendelijke groet,

Martijn van Groningen

--
Met vriendelijke groet,

Martijn van Groningen

Hi Martijn,

Thanks a lot!
Wouldn't have thought that the query was incorrect...

Now the result to sorted correctly. At least for document boosting.
But if I change the boosting of the field (in the mapping) the score values
are still the same.
I'm now searching in "_all" fields

curl -XGET 'http://localhost:9200/myindex/author/_search' -d '{
"query": {
"prefix": {
"_all": {
"value": "se",
"rewrite": "top_terms_10"
}
}
}
}'

Do you have an idea how to fix this? Do I have to split up the query in
multiple
ones for each field and define there a boosting?

Thanks,

Uli

Am Dienstag, 31. Juli 2012 13:59:33 UTC+2 schrieb Martijn v Groningen:

Hi Uli,

The query you specified is incorrect. The query should be:
curl -XGET 'http://localhost:9200/myindex/author/_search' -d '{
"query": {
"prefix": {
"name": {
"value" : "Se",
"rewrite": "top_terms_10"
}
}
}
}'

This query does the boost into account.

Martijn

On 31 July 2012 13:21, Uli Schimpfle huschimpfle@googlemail.com wrote:

Hi Martijn,

Thanks for your answer about the multi-term queries. I didn't know that.

I tried to use the "rewrite": "top_terms_10" but it didn't help.

curl -XGET 'http://localhost:9200/myindex/author/_search' -d '{
"query": {
"prefix": {
"name": "Se",
"rewrite": "top_terms_10"
}
}
}'

May you have any suggestion what else I could do/try to get the boosting
for the this. Filters?, Sorting?,... I need to do some search like a
prefix
query
on multiple fields.

Thanks,

Uli

Am Dienstag, 31. Juli 2012 12:31:31 UTC+2 schrieb Martijn v Groningen:

Hi Uli,

Prefixquery and other multi-term queries (like wildcard query) don't
compute scores by default (score is always 1). Actually the score is
determined by the query time boost and the index time boost you
specified isn't used.

However the scoring can be somewhat controlled by setting a rewrite
method:

Elasticsearch Platform — Find real-time answers at scale | Elastic

Perhaps setting rewrite parameter to: 'top_terms_10' gives the scores
/ sorting you want.

Martijn

On 31 July 2012 08:50, Uli Schimpfle huschimpfle@googlemail.com
wrote:

Hi,

I'm new to Elasticsearch/Lucene and I have a question about boosting.

I created a mapping which defines a "_boost" field and I also have a
"boost"
property for one field of my two fields.
If I understand it right with "_boost" I define a boost for the
document
and
with "boost" I define a boost for a field.

If I do a search the "_score" fields of the hits have always the
value
1.0.

Shouldn't have the _score field different values than 1.0 (and so the
sorting of the hits) ?

Please have a look at :

elasticsearch boost problem · GitHub

Thanks,

Uli

--
Met vriendelijke groet,

Martijn van Groningen

--
Met vriendelijke groet,

Martijn van Groningen

You only changed the _boosting field in the mapping? Did you reindex?

The boost value you set in boostFactor applies for the whole doc as
far as I know.
So doesn't matter what field you query (_all, name etc) as long as
there is a hit, the
boost should be applied.

Martijn

On 31 July 2012 14:09, Uli Schimpfle huschimpfle@googlemail.com wrote:

Hi Martijn,

Thanks a lot!
Wouldn't have thought that the query was incorrect...

Now the result to sorted correctly. At least for document boosting.
But if I change the boosting of the field (in the mapping) the score values
are still the same.
I'm now searching in "_all" fields

curl -XGET 'http://localhost:9200/myindex/author/_search' -d '{
"query": {
"prefix": {
"_all": {
"value": "se",
"rewrite": "top_terms_10"
}
}
}
}'

Do you have an idea how to fix this? Do I have to split up the query in
multiple
ones for each field and define there a boosting?

Thanks,

Uli

Am Dienstag, 31. Juli 2012 13:59:33 UTC+2 schrieb Martijn v Groningen:

Hi Uli,

The query you specified is incorrect. The query should be:
curl -XGET 'http://localhost:9200/myindex/author/_search' -d '{
"query": {
"prefix": {
"name": {
"value" : "Se",
"rewrite": "top_terms_10"
}
}
}
}'

This query does the boost into account.

Martijn

On 31 July 2012 13:21, Uli Schimpfle huschimpfle@googlemail.com wrote:

Hi Martijn,

Thanks for your answer about the multi-term queries. I didn't know that.

I tried to use the "rewrite": "top_terms_10" but it didn't help.

curl -XGET 'http://localhost:9200/myindex/author/_search' -d '{
"query": {
"prefix": {
"name": "Se",
"rewrite": "top_terms_10"
}
}
}'

May you have any suggestion what else I could do/try to get the boosting
for the this. Filters?, Sorting?,... I need to do some search like a
prefix
query
on multiple fields.

Thanks,

Uli

Am Dienstag, 31. Juli 2012 12:31:31 UTC+2 schrieb Martijn v Groningen:

Hi Uli,

Prefixquery and other multi-term queries (like wildcard query) don't
compute scores by default (score is always 1). Actually the score is
determined by the query time boost and the index time boost you
specified isn't used.

However the scoring can be somewhat controlled by setting a rewrite
method:

Elasticsearch Platform — Find real-time answers at scale | Elastic

Perhaps setting rewrite parameter to: 'top_terms_10' gives the scores
/ sorting you want.

Martijn

On 31 July 2012 08:50, Uli Schimpfle huschimpfle@googlemail.com
wrote:

Hi,

I'm new to Elasticsearch/Lucene and I have a question about boosting.

I created a mapping which defines a "_boost" field and I also have a
"boost"
property for one field of my two fields.
If I understand it right with "_boost" I define a boost for the
document
and
with "boost" I define a boost for a field.

If I do a search the "_score" fields of the hits have always the
value
1.0.

Shouldn't have the _score field different values than 1.0 (and so the
sorting of the hits) ?

Please have a look at :

elasticsearch boost problem · GitHub

Thanks,

Uli

--
Met vriendelijke groet,

Martijn van Groningen

--
Met vriendelijke groet,

Martijn van Groningen

--
Met vriendelijke groet,

Martijn van Groningen

In my little test script at the beginning I delete the index, create a new
one,
write the mapping, write the documents.

First try (with a field boost factor of 20) :

curl -XPUT 'http://localhost:9200/myindex/author/_mapping' -d '{
"author": {
"_boost": {
"name": "boostFactor",
"null_value": 1.0
},
"properties": {
"id": {
"type": "long"
},
"boostFactor": {
"type": "float",
"null_value": 1.0
},
"name": {
"type": "string",
"index": "not_analyzed",
"boost": 20.0
},
"countryOfBirth": {
"type": "string"
}
}
}
}'

The result is :
..."_score":0.076713204,"_source":{"id":2,"boostFactor":0.61,"name":"Sergio
Herold","countryOfBirth":"Peru"}}
..."_score":0.033562027,"_source":{"id":1,"boostFactor":0.22,"name":"Sewald
Kruse","countryOfBirth":"Deutschland"}}
..."_score":0.009589151,"_source":{"id":4,"boostFactor":0.07,"name":"Gudrun
Weil","countryOfBirth":"Serbien"}}
..."_score":0.0041952534,"_source":{"id":3,"boostFactor":0.03,"name":"Sebastion
Wund","countryOfBirth":"Deutschland"}}

Please have a look at the 3rd line. The query value was found in the
"countryOfBirth" field.

Now with a boosting value of 1 :

curl -XPUT 'http://localhost:9200/myindex/author/_mapping' -d '{
"author": {
"_boost": {
"name": "boostFactor",
"null_value": 1.0
},
"properties": {
"id": {
"type": "long"
},
"boostFactor": {
"type": "float",
"null_value": 1.0
},
"name": {
"type": "string",
"index": "not_analyzed",
"boost": 1.0
},
"countryOfBirth": {
"type": "string"
}
}
}
}'

The result is :
..."_score":0.076713204,"_source":{"id":2,"boostFactor":0.61,"name":"Sergio
Herold","countryOfBirth":"Peru"}}
..."_score":0.033562027,"_source":{"id":1,"boostFactor":0.22,"name":"Sewald
Kruse","countryOfBirth":"Deutschland"}}
..."_score":0.009589151,"_source":{"id":4,"boostFactor":0.07,"name":"Gudrun
Weil","countryOfBirth":"Serbien"}}
..."_score":0.0041952534,"_source":{"id":3,"boostFactor":0.03,"name":"Sebastion
Wund","countryOfBirth":"Deutschland"}}

As you can see the _score values are the same. Shouldn't there be a
difference between the row 3 and the rows 1,2,4 ?

If I change the field "boostFactor" of the documents I get different _sorce
values. But not if I change the boosting
in the mapping for the field "name"...

Any suggestions?

Thanks,

Uli

Hi Uli,

I'd expect a difference to. I tried to reproduce the issue you're
experience. However on my machine here it seems to work
as expected.

I first run your script as in specified in the gist and I get the
following result:
[{"_index":"myindex","_type":"author","_id":"2","_score":3.6822338,
"_source" : {
"id": 2,
"boostFactor": 0.61,
"name": "Sergio Herold",
"countryOfBirth": "Peru"
}},{"_index":"myindex","_type":"author","_id":"1","_score":1.2274113,
"_source" : {
"id": 1,
"boostFactor": 0.22,
"name": "Sewald Kruse",
"countryOfBirth": "Deutschland"
}},{"_index":"myindex","_type":"author","_id":"3","_score":0.15342641,
"_source" : {
"id": 3,
"boostFactor": 0.03,
"name": "Sebastion Wund",
"countryOfBirth": "Deutschland"
}}]

I then change the mapping in the script and re-execute it with the
following result:
[{"_index":"myindex","_type":"author","_id":"2","_score":0.15342641,
"_source" : {
"id": 2,
"boostFactor": 0.61,
"name": "Sergio Herold",
"countryOfBirth": "Peru"
}},{"_index":"myindex","_type":"author","_id":"1","_score":0.067124054,
"_source" : {
"id": 1,
"boostFactor": 0.22,
"name": "Sewald Kruse",
"countryOfBirth": "Deutschland"
}},{"_index":"myindex","_type":"author","_id":"3","_score":0.008390507,
"_source" : {
"id": 3,
"boostFactor": 0.03,
"name": "Sebastion Wund",
"countryOfBirth": "Deutschland"
}}]

As you can the _score values are different.

Martijn

On 31 July 2012 14:47, Uli Schimpfle huschimpfle@googlemail.com wrote:

In my little test script at the beginning I delete the index, create a new
one,
write the mapping, write the documents.

First try (with a field boost factor of 20) :

curl -XPUT 'http://localhost:9200/myindex/author/_mapping' -d '{
"author": {
"_boost": {
"name": "boostFactor",
"null_value": 1.0
},
"properties": {
"id": {
"type": "long"
},
"boostFactor": {
"type": "float",
"null_value": 1.0
},
"name": {
"type": "string",
"index": "not_analyzed",
"boost": 20.0
},
"countryOfBirth": {
"type": "string"
}
}
}
}'

The result is :
..."_score":0.076713204,"_source":{"id":2,"boostFactor":0.61,"name":"Sergio
Herold","countryOfBirth":"Peru"}}
..."_score":0.033562027,"_source":{"id":1,"boostFactor":0.22,"name":"Sewald
Kruse","countryOfBirth":"Deutschland"}}
..."_score":0.009589151,"_source":{"id":4,"boostFactor":0.07,"name":"Gudrun
Weil","countryOfBirth":"Serbien"}}
..."_score":0.0041952534,"_source":{"id":3,"boostFactor":0.03,"name":"Sebastion
Wund","countryOfBirth":"Deutschland"}}

Please have a look at the 3rd line. The query value was found in the
"countryOfBirth" field.

Now with a boosting value of 1 :

curl -XPUT 'http://localhost:9200/myindex/author/_mapping' -d '{
"author": {
"_boost": {
"name": "boostFactor",
"null_value": 1.0
},
"properties": {
"id": {
"type": "long"
},
"boostFactor": {
"type": "float",
"null_value": 1.0
},
"name": {
"type": "string",
"index": "not_analyzed",
"boost": 1.0
},
"countryOfBirth": {
"type": "string"
}
}
}
}'

The result is :
..."_score":0.076713204,"_source":{"id":2,"boostFactor":0.61,"name":"Sergio
Herold","countryOfBirth":"Peru"}}
..."_score":0.033562027,"_source":{"id":1,"boostFactor":0.22,"name":"Sewald
Kruse","countryOfBirth":"Deutschland"}}
..."_score":0.009589151,"_source":{"id":4,"boostFactor":0.07,"name":"Gudrun
Weil","countryOfBirth":"Serbien"}}
..."_score":0.0041952534,"_source":{"id":3,"boostFactor":0.03,"name":"Sebastion
Wund","countryOfBirth":"Deutschland"}}

As you can see the _score values are the same. Shouldn't there be a
difference between the row 3 and the rows 1,2,4 ?

If I change the field "boostFactor" of the documents I get different _sorce
values. But not if I change the boosting
in the mapping for the field "name"...

Any suggestions?

Thanks,

Uli

--
Met vriendelijke groet,

Martijn van Groningen

Hi Martijn,

Thanks again for you answer.
And you're right. The _score values are different. It's my fault, I was
(already) doing a different search.

curl -XGET 'http://localhost:9200/myindex/author/_search' -d '{
"query": {
"prefix": {
"_all": {
"value": "se",
"rewrite": "top_terms_10"
}
}
}

I change the field name to "_all" (and the search string is now lowercase).
Doing a search with "_all" the scores don't change if I change the "boost"
field of the "name" field in the mapping.

For now I'm doing some query like this :

curl -XGET 'http://localhost:9200/myindex/author/_search' -d '{
"query": {
"custom_score": {
"query": {
"query_string": {
"query": "name:(su*)^20 su*"
}
},
"script": "_score * doc['boostFactor'].value"
}
}
}'

This is probably not the fastet one...

Any suggestions for improvements ?

Thanks,

Uli

I change the field name to "_all" (and the search string is now lowercase).
Doing a search with "_all" the scores don't change if I change the "boost"
field of the "name" field in the mapping.
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')

curl -XGET 'http://localhost:9200/myindex/author/_search' -d '{
"query": {
"custom_score": {
"query": {
"query_string": {
"query": "name:(su*)^20 su*"
}
},
"script": "_score * doc['boostFactor'].value"
}
}
}'

This is probably not the fastet one...

Any suggestions for improvements ?
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.

Martijn

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 :

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

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

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

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

Hi Martijn,

Can you please tell me how to do the same in a query string query without any fields specified. Using rewrite as a parameter here doesn't seem to work for me.

Can you provide me with an example?