explain查看怎么计算得分的,format将json格式结果转为yaml展示
POST tlsmz/_search?format=yaml
{
"explain": true,
"query": {
"bool": {
"must": [
{
"term": {
"fz.keyword": {
"value": "南昌西"
}
}
},
{
"bool": {
"should": [
{
"match": {
"dz": "长沙"
}
}
]
}
}
]
}
}
}
通过/index/_explain/id 可以看到我们的文档是否被匹配,为什么匹配/不匹配。详细的原因
GET tlsmz/_explain/A53AC90D8F3941B8E055000000000001
{
"query": {
"bool": {
"must": [
{
"term": {
"fz.keyword": {
"value": "南昌西"
}
}
},
{
"bool": {
"should": [
{
"match": {
"dz": "长沙"
}
}
]
}
}
]
}
}
}
{
"_index" : "tlsmz",
"_type" : "_doc",
"_id" : "A53AC90D8F3941B8E055000000000001",
"matched" : false,
"explanation" : {
"value" : 0.0,
"description" : "Failure to meet condition(s) of required/prohibited clause(s)",
"details" : [
{
"value" : 0.0,
"description" : "no match on required clause (fz.keyword:南昌西)",
"details" : [
{
"value" : 0.0,
"description" : "no matching term",
"details" : [ ]
}
]
},
{
"value" : 0.0,
"description" : "no match on required clause (dz:长沙)",
"details" : [
{
"value" : 0.0,
"description" : "no matching term",
"details" : [ ]
}
]
}
]
}
}