Hi All !
I found some different behaviours between ES 5 and ES 6 on query Boosting but I did not find anything in the documentation about this change. Can someone help me ?
The RESULTS are the SAME but the _score values are differents, and the orders of the array result as changed due to different _score values. ANY ideas what happened ?
The problem is this one :
Creating an index and trying to create a Boosting Query :
curl -XPUT 'elasticsearch:9200/fedetest?pretty' -H 'Content-Type: application/json' -d'
{
"mappings": {
"test": {
"properties": {
"name": {
"type": "text",
"index": "true"
},
"price": {
"type": "float"
}
}
}
}
}
'
curl -XPOST 'elasticsearch:9200/_bulk?pretty' -H 'Content-Type: application/json' -d'
{"index":{"_index":"fedetest","_type":"test","_id":1}}
{"name" : "Vital Lama", "price": "5.2"}
{"index":{"_index":"fedetest","_type":"test","_id":2}}
{"name" : "Vital Match", "price": "2.1"}
{"index":{"_index":"fedetest","_type":"test","_id":3}}
{"name" : "Mercury Vital", "price": "7.5"}
{"index":{"_index":"fedetest","_type":"test","_id":4}}
{"name" : "Fist Mercury", "price": "3.8"}
{"index":{"_index":"fedetest","_type":"test","_id":5}}
{"name" : "Zama vital 2nd", "price": "1.2"}
'
curl -XGET 'elasticsearch:9200/fedetest/_search?pretty' -H 'Content-Type: application/json' -d'
{
"query": {
"boosting" : {
"positive" : {
"term" : {
"name" : "vital"
}
},
"negative" : {
"term" : {
"name" : "mercury"
}
},
"negative_boost" : 0.2
}
}
}
'
We have 2 different results between ES 5.x and ES 6.0-beta1
ES5.x
{
"took" : 1,
"timed_out" : false,
"_shards" : {
"total" : 5,
"successful" : 5,
"failed" : 0
},
"hits" : {
"total" : 4,
"max_score" : 0.62191015,
"hits" : [
{
"_index" : "fedetest",
"_type" : "test",
"_id" : "2",
"_score" : 0.62191015,
"_source" : {
"name" : "Vital Match",
"price" : "2.1"
}
},
{
"_index" : "fedetest",
"_type" : "test",
"_id" : "1",
"_score" : 0.25811607,
"_source" : {
"name" : "Vital Lama",
"price" : "5.2"
}
},
{
"_index" : "fedetest",
"_type" : "test",
"_id" : "5",
"_score" : 0.25316024,
"_source" : {
"name" : "Lama Vital 2nd",
"price" : "3.2"
}
},
{
"_index" : "fedetest",
"_type" : "test",
"_id" : "3",
"_score" : 0.051623214,
"_source" : {
"name" : "Mercury Vital",
"price" : "7.5"
}
}
]
}
}
Elasticsearch 6.0-beta1
{
"took" : 7,
"timed_out" : false,
"_shards" : {
"total" : 5,
"successful" : 5,
"skipped" : 0,
"failed" : 0
},
"hits" : {
"total" : 4,
"max_score" : 0.6931472,
"hits" : [
{
"_index" : "fedetest",
"_type" : "test",
"_id" : "2",
"_score" : 0.6931472,
"_source" : {
"name" : "Vital Match",
"price" : "2.1"
}
},
{
"_index" : "fedetest",
"_type" : "test",
"_id" : "5",
"_score" : 0.2876821,
"_source" : {
"name" : "Lama Vital 2nd",
"price" : "3.2"
}
},
{
"_index" : "fedetest",
"_type" : "test",
"_id" : "1",
"_score" : 0.2876821,
"_source" : {
"name" : "Vital Lama",
"price" : "5.2"
}
},
{
"_index" : "fedetest",
"_type" : "test",
"_id" : "3",
"_score" : 0.2876821,
"_source" : {
"name" : "Mercury Vital",
"price" : "7.5"
}
}
]
}
}