I had the following documents indexed
PUT ecommercesite/product/2
{
"product_name": "Men Water Resistant Jacket",
"description": "Provides comfort during biking and hiking",
}
when I tried to get the scoring for this document for a query
POST ecommercesite/product/2/_explain
{
"query":{
"bool" : {
"should": [
{
"match": {
"product_name": "Performance Fleece"
}
},
{
"bool": {
"must": [
{
"match": {
"product_name": "Water resistant"
}
},
{
"range": {
"unit_price": {
"lte": 100
}
}
}
]
}
}
]
}
}
}
The scoring looks like this ,
{
"_index" : "ecommercesite",
"_type" : "product",
"_id" : "2",
"matched" : true,
"explanation" : {
"value" : 1.5753641,
"description" : "sum of:",
"details" : [
{
"value" : 1.5753641,
"description" : "sum of:",
"details" : [
{
"value" : 0.5753642,
"description" : "sum of:",
"details" : [
{
"value" : 0.2876821,
"description" : "weight(product_name:water in 0) [PerFieldSimilarity], result of:",
"details" : [
{
"value" : 0.2876821,
"description" : "score(doc=0,freq=1.0 = termFreq=1.0\n), product of:",
"details" : [
{
"value" : 0.2876821,
"description" : "idf, computed as log(1 + (docCount - docFreq + 0.5) / (docFreq + 0.5)) from:",
"details" : [
{
"value" : 1.0,
"description" : "docFreq",
"details" : [ ]
},
{
"value" : 1.0,
"description" : "docCount",
"details" : [ ]
}
]
},
{
"value" : 1.0,
"description" : "tfNorm, computed as (freq * (k1 + 1)) / (freq + k1 * (1 - b + b * fieldLength / avgFieldLength)) from:",
"details" : [
{
"value" : 1.0,
"description" : "termFreq=1.0",
"details" : [ ]
},
{
"value" : 1.2,
"description" : "parameter k1",
"details" : [ ]
},
{
"value" : 0.75,
"description" : "parameter b",
"details" : [ ]
},
{
"value" : 4.0,
"description" : "avgFieldLength",
"details" : [ ]
},
{
"value" : 4.0,
"description" : "fieldLength",
"details" : [ ]
}
]
}
]
}
]
},
{
"value" : 0.2876821,
"description" : "weight(product_name:resistant in 0) [PerFieldSimilarity], result of:",
"details" : [
{
"value" : 0.2876821,
"description" : "score(doc=0,freq=1.0 = termFreq=1.0\n), product of:",
"details" : [
{
"value" : 0.2876821,
"description" : "idf, computed as log(1 + (docCount - docFreq + 0.5) / (docFreq + 0.5)) from:",
"details" : [
{
"value" : 1.0,
"description" : "docFreq",
"details" : [ ]
},
{
"value" : 1.0,
"description" : "docCount",
"details" : [ ]
}
]
},
{
"value" : 1.0,
"description" : "tfNorm, computed as (freq * (k1 + 1)) / (freq + k1 * (1 - b + b * fieldLength / avgFieldLength)) from:",
"details" : [
{
"value" : 1.0,
"description" : "termFreq=1.0",
"details" : [ ]
},
{
"value" : 1.2,
"description" : "parameter k1",
"details" : [ ]
},
{
"value" : 0.75,
"description" : "parameter b",
"details" : [ ]
},
{
"value" : 4.0,
"description" : "avgFieldLength",
"details" : [ ]
},
{
"value" : 4.0,
"description" : "fieldLength",
"details" : [ ]
}
]
}
]
}
]
}
]
},
{
"value" : 1.0,
"description" : "unit_price:[-2139095041 TO 1120403456]",
"details" : [ ]
}
]
}
]
}
}
what I really didnt understand was, if we look at "sum of " block - it is only considering the query ""product_name": "Water resistant"" as you see there in the output - Why is it so, where does it calculate the scoring for ""product_name": "Performance Fleece"
I am on 6.8.8