Skip to content

Instantly share code, notes, and snippets.

@miguelff
Last active August 29, 2015 14:17
Show Gist options
  • Save miguelff/d1393bed697a61a74ba4 to your computer and use it in GitHub Desktop.
Save miguelff/d1393bed697a61a74ba4 to your computer and use it in GitHub Desktop.
{
"_index" : "development_movida_titles",
"_type" : "title",
"_id" : "366615",
"_version" : 2,
"found" : true,
"_source":{"company_id":4,"external_id":null,"name":"Test Upload","tag":[],"metadata":[{"key":4890,"value":"0"},{"key":86,"value":"MYCAT"},{"key":87,"value":"MYDET"},{"key":88,"value":"LONG DESC"},{"key":89,"value":"MYCAT"},{"key":93,"value":"BOOM"}],"asset":["366615A","366615B","366615C"],"licensor":"Bebanjo"}
}
CURL -X POST http://localhost:9200/development_movida_titles/title/366615/_explain\?pretty -d '
{
"query":{
"function_score":{
"query":{
"bool":{
"must":[
{
"match":{
"company_id":4
}
},
{
"bool": {
"should": [
{
"bool":{
"must":
[
{
"match":{
"metadata.key": 86
}
},
{
"match":{
"metadata.value": "MYCAT"
}
}
]
}
}
]
}
}
]
}
},
"functions":[
{
"boost_factor":3,
"filter":{
"term":{
"_type":"series"
}
}
},
{
"boost_factor":2,
"filter":{
"term":{
"_type":"title"
}
}
},
{
"boost_factor":1,
"filter":{
"term":{
"_type":"collection"
}
}
}
]
}
}
}'
{
"_index" : "development_movida_titles",
"_type" : "title",
"_id" : "366615",
"matched" : true,
"explanation" : {
"value" : 2.8331223,
"description" : "function score, product of:",
"details" : [ {
"value" : 1.4165611,
"description" : "sum of:",
"details" : [ {
"value" : 0.6910273,
"description" : "ConstantScore(company_id:[4 TO 4]), product of:",
"details" : [ {
"value" : 1.0,
"description" : "boost"
}, {
"value" : 0.6910273,
"description" : "queryNorm"
} ]
}, {
"value" : 0.72553384,
"description" : "sum of:",
"details" : [ {
"value" : 0.6910273,
"description" : "ConstantScore(metadata.key:[86 TO 86]), product of:",
"details" : [ {
"value" : 1.0,
"description" : "boost"
}, {
"value" : 0.6910273,
"description" : "queryNorm"
} ]
}, {
"value" : 0.03450656,
"description" : "weight(metadata.value:mycat in 0) [PerFieldSimilarity], result of:",
"details" : [ {
"value" : 0.03450656,
"description" : "score(doc=0,freq=2.0 = termFreq=2.0\n), product of:",
"details" : [ {
"value" : 0.21204367,
"description" : "queryWeight, product of:",
"details" : [ {
"value" : 0.30685282,
"description" : "idf(docFreq=1, maxDocs=1)"
}, {
"value" : 0.6910273,
"description" : "queryNorm"
} ]
}, {
"value" : 0.16273327,
"description" : "fieldWeight in 0, product of:",
"details" : [ {
"value" : 1.4142135,
"description" : "tf(freq=2.0), with freq of:",
"details" : [ {
"value" : 2.0,
"description" : "termFreq=2.0"
} ]
}, {
"value" : 0.30685282,
"description" : "idf(docFreq=1, maxDocs=1)"
}, {
"value" : 0.375,
"description" : "fieldNorm(doc=0)"
} ]
} ]
} ]
} ]
} ]
}, {
"value" : 2.0,
"description" : "Math.min of",
"details" : [ {
"value" : 2.0,
"description" : "function score, score mode [multiply]",
"details" : [ {
"value" : 2.0,
"description" : "function score, product of:",
"details" : [ {
"value" : 1.0,
"description" : "match filter: cache(_type:title)"
}, {
"value" : 2.0,
"description" : "static boost factor",
"details" : [ {
"value" : 2.0,
"description" : "boostFactor"
} ]
} ]
} ]
}, {
"value" : 3.4028235E38,
"description" : "maxBoost"
} ]
}, {
"value" : 1.0,
"description" : "queryBoost"
} ]
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment