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