版本 es 2.3 升级到5.3
es数据中有 regcap 字段,存储的是数值型;
在对搜索结果 通过设置 regcap 字段值所在的范围进行不同的加权;
在分析explain 的时候,发现 regcap 不符合 条件范围的时候,依然设置了加权。(在通过数值条件范围进行查询的时候,是生效的,使用在加权过程中就会出现问题,2.3的时候没有问题)大家有遇见类似问题吗?这是一个bug,还是es 服务器解析的时候用了其他规则,如果是es 服务器有猫腻的话, explain 返回也应该写清楚加权原因吧。
以下是explain 部分内容:
{
"_explanation": {
"value": 63.11079,
"description": "sum of:",
"details": [
{
"value": 63.11079,
"description": "sum of:",
"details": [
{
"value": 39.01692,
"description": "sum of:",
"details": [
{
"value": 7.4304786,
"description": "weight(entname:工商银行 in 6307209) [PerFieldSimilarity], result of:",
"details": [
{
"value": 7.4304786,
"description": "score(doc=6307209,freq=1.0 = termFreq=1.0 ), product of:",
"details": [
{
"value": 8.050323,
"description": "idf, computed as log(1 + (docCount - docFreq + 0.5) / (docFreq + 0.5)) from:",
"details": [
{
"value": 10237,
"description": "docFreq",
"details": [
]
},
{
"value": 32092568,
"description": "docCount",
"details": [
]
}
]
},
{
"value": 0.92300385,
"description": "tfNorm, computed as (freq * (k1 + 1)) / (freq + k1 * (1 - b + b * fieldLength / avgFieldLength)) from:",
"details": [
{
"value": 1,
"description": "termFreq=1.0",
"details": [
]
},
{
"value": 1.2,
"description": "parameter k1",
"details": [
]
},
{
"value": 0.75,
"description": "parameter b",
"details": [
]
},
{
"value": 13.289993,
"description": "avgFieldLength",
"details": [
]
},
{
"value": 16,
"description": "fieldLength",
"details": [
]
}
]
}
]
}
]
},
{
"value": 6.6730494,
"description": "weight(entname:工商 in 6307209) [PerFieldSimilarity], result of:",
"details": [
{
"value": 6.6730494,
"description": "score(doc=6307209,freq=1.0 = termFreq=1.0 ), product of:",
"details": [
{
"value": 7.229709,
"description": "idf, computed as log(1 + (docCount - docFreq + 0.5) / (docFreq + 0.5)) from:",
"details": [
{
"value": 23258,
"description": "docFreq",
"details": [
]
},
{
"value": 32092568,
"description": "docCount",
"details": [
]
}
]
},
{
"value": 0.92300385,
"description": "tfNorm, computed as (freq * (k1 + 1)) / (freq + k1 * (1 - b + b * fieldLength / avgFieldLength)) from:",
"details": [
{
"value": 1,
"description": "termFreq=1.0",
"details": [
]
},
{
"value": 1.2,
"description": "parameter k1",
"details": [
]
},
{
"value": 0.75,
"description": "parameter b",
"details": [
]
},
{
"value": 13.289993,
"description": "avgFieldLength",
"details": [
]
},
{
"value": 16,
"description": "fieldLength",
"details": [
]
}
]
}
]
}
]
},
{
"value": 7.3460174,
"description": "weight(entname:商银 in 6307209) [PerFieldSimilarity], result of:",
"details": [
{
"value": 7.3460174,
"description": "score(doc=6307209,freq=1.0 = termFreq=1.0 ), product of:",
"details": [
{
"value": 7.9588156,
"description": "idf, computed as log(1 + (docCount - docFreq + 0.5) / (docFreq + 0.5)) from:",
"details": [
{
"value": 11218,
"description": "docFreq",
"details": [
]
},
{
"value": 32092568,
"description": "docCount",
"details": [
]
}
]
},
{
"value": 0.92300385,
"description": "tfNorm, computed as (freq * (k1 + 1)) / (freq + k1 * (1 - b + b * fieldLength / avgFieldLength)) from:",
"details": [
{
"value": 1,
"description": "termFreq=1.0",
"details": [
]
},
{
"value": 1.2,
"description": "parameter k1",
"details": [
]
},
{
"value": 0.75,
"description": "parameter b",
"details": [
]
},
{
"value": 13.289993,
"description": "avgFieldLength",
"details": [
]
},
{
"value": 16,
"description": "fieldLength",
"details": [
]
}
]
}
]
}
]
},
{
"value": 5.6552773,
"description": "weight(entname:银行 in 6307209) [PerFieldSimilarity], result of:",
"details": [
{
"value": 5.6552773,
"description": "score(doc=6307209,freq=1.0 = termFreq=1.0 ), product of:",
"details": [
{
"value": 6.127035,
"description": "idf, computed as log(1 + (docCount - docFreq + 0.5) / (docFreq + 0.5)) from:",
"details": [
{
"value": 70059,
"description": "docFreq",
"details": [
]
},
{
"value": 32092568,
"description": "docCount",
"details": [
]
}
]
},
{
"value": 0.92300385,
"description": "tfNorm, computed as (freq * (k1 + 1)) / (freq + k1 * (1 - b + b * fieldLength / avgFieldLength)) from:",
"details": [
{
"value": 1,
"description": "termFreq=1.0",
"details": [
]
},
{
"value": 1.2,
"description": "parameter k1",
"details": [
]
},
{
"value": 0.75,
"description": "parameter b",
"details": [
]
},
{
"value": 13.289993,
"description": "avgFieldLength",
"details": [
]
},
{
"value": 16,
"description": "fieldLength",
"details": [
]
}
]
}
]
}
]
},
{
"value": 6.1461744,
"description": "weight(entname:银 in 6307209) [PerFieldSimilarity], result of:",
"details": [
{
"value": 6.1461744,
"description": "score(doc=6307209,freq=2.0 = termFreq=2.0 ), product of:",
"details": [
{
"value": 4.726299,
"description": "idf, computed as log(1 + (docCount - docFreq + 0.5) / (docFreq + 0.5)) from:",
"details": [
{
"value": 284314,
"description": "docFreq",
"details": [
]
},
{
"value": 32092568,
"description": "docCount",
"details": [
]
}
]
},
{
"value": 1.3004202,
"description": "tfNorm, computed as (freq * (k1 + 1)) / (freq + k1 * (1 - b + b * fieldLength / avgFieldLength)) from:",
"details": [
{
"value": 2,
"description": "termFreq=2.0",
"details": [
]
},
{
"value": 1.2,
"description": "parameter k1",
"details": [
]
},
{
"value": 0.75,
"description": "parameter b",
"details": [
]
},
{
"value": 13.289993,
"description": "avgFieldLength",
"details": [
]
},
{
"value": 16,
"description": "fieldLength",
"details": [
]
}
]
}
]
}
]
},
{
"value": 5.7659216,
"description": "weight(entname:行 in 6307209) [PerFieldSimilarity], result of:",
"details": [
{
"value": 5.7659216,
"description": "score(doc=6307209,freq=2.0 = termFreq=2.0 ), product of:",
"details": [
{
"value": 4.4338913,
"description": "idf, computed as log(1 + (docCount - docFreq + 0.5) / (docFreq + 0.5)) from:",
"details": [
{
"value": 380881,
"description": "docFreq",
"details": [
]
},
{
"value": 32092568,
"description": "docCount",
"details": [
]
}
]
},
{
"value": 1.3004202,
"description": "tfNorm, computed as (freq * (k1 + 1)) / (freq + k1 * (1 - b + b * fieldLength / avgFieldLength)) from:",
"details": [
{
"value": 2,
"description": "termFreq=2.0",
"details": [
]
},
{
"value": 1.2,
"description": "parameter k1",
"details": [
]
},
{
"value": 0.75,
"description": "parameter b",
"details": [
]
},
{
"value": 13.289993,
"description": "avgFieldLength",
"details": [
]
},
{
"value": 16,
"description": "fieldLength",
"details": [
]
}
]
}
]
}
]
}
]
},
{
"value": 1.193869,
"description": "weight(entitytype:1 in 6307209) [PerFieldSimilarity], result of:",
"details": [
{
"value": 1.193869,
"description": "score(doc=6307209,freq=1.0 = termFreq=1.0 ), product of:",
"details": [
{
"value": 1.193869,
"description": "idf, computed as log(1 + (docCount - docFreq + 0.5) / (docFreq + 0.5)) from:",
"details": [
{
"value": 12031039,
"description": "docFreq",
"details": [
]
},
{
"value": 39700304,
"description": "docCount",
"details": [
]
}
]
},
{
"value": 1,
"description": "tfNorm, computed as (freq * (k1 + 1)) / (freq + k1) from:",
"details": [
{
"value": 1,
"description": "termFreq=1.0",
"details": [
]
},
{
"value": 1.2,
"description": "parameter k1",
"details": [
]
},
{
"value": 0,
"description": "parameter b (norms omitted for field)",
"details": [
]
}
]
}
]
}
]
},
{
"value": 1,
"description": "regcap:{51 TO 999}, product of:",
"details": [
{
"value": 1,
"description": "boost",
"details": [
]
},
{
"value": 1,
"description": "queryNorm",
"details": [
]
}
]
},
{
"value": 3,
"description": "regcap:[5000 TO 9999], product of:",
"details": [
{
"value": 3,
"description": "boost",
"details": [
]
},
{
"value": 1,
"description": "queryNorm",
"details": [
]
}
]
},
{
"value": 3,
"description": "regcap:{20000 TO 99999}, product of:",
"details": [
{
"value": 3,
"description": "boost",
"details": [
]
},
{
"value": 1,
"description": "queryNorm",
"details": [
]
}
]
},
{
"value": 4,
"description": "regcap:{500000 TO 999999}, product of:",
"details": [
{
"value": 4,
"description": "boost",
"details": [
]
},
{
"value": 1,
"description": "queryNorm",
"details": [
]
}
]
},
{
"value": 5.5,
"description": "regcap:{5000000 TO 6999999}, product of:",
"details": [
{
"value": 5.5,
"description": "boost",
"details": [
]
},
{
"value": 1,
"description": "queryNorm",
"details": [
]
}
]
},
{
"value": 6.4,
"description": "regcap:{50000000 TO 69999999}, product of:",
"details": [
{
"value": 6.4,
"description": "boost",
"details": [
]
},
{
"value": 1,
"description": "queryNorm",
"details": [
]
}
]
}
]
},
{
"value": 0,
"description": "match on required clause, product of:",
"details": [
{
"value": 0,
"description": "# clause",
"details": [
]
},
{
"value": 1,
"description": "#*:* -_type:__*, product of:",
"details": [
{
"value": 1,
"description": "boost",
"details": [
]
},
{
"value": 1,
"description": "queryNorm",
"details": [
]
}
]
}
]
}
]
}
}
es数据中有 regcap 字段,存储的是数值型;
在对搜索结果 通过设置 regcap 字段值所在的范围进行不同的加权;
在分析explain 的时候,发现 regcap 不符合 条件范围的时候,依然设置了加权。(在通过数值条件范围进行查询的时候,是生效的,使用在加权过程中就会出现问题,2.3的时候没有问题)大家有遇见类似问题吗?这是一个bug,还是es 服务器解析的时候用了其他规则,如果是es 服务器有猫腻的话, explain 返回也应该写清楚加权原因吧。
以下是explain 部分内容:
{
"_explanation": {
"value": 63.11079,
"description": "sum of:",
"details": [
{
"value": 63.11079,
"description": "sum of:",
"details": [
{
"value": 39.01692,
"description": "sum of:",
"details": [
{
"value": 7.4304786,
"description": "weight(entname:工商银行 in 6307209) [PerFieldSimilarity], result of:",
"details": [
{
"value": 7.4304786,
"description": "score(doc=6307209,freq=1.0 = termFreq=1.0 ), product of:",
"details": [
{
"value": 8.050323,
"description": "idf, computed as log(1 + (docCount - docFreq + 0.5) / (docFreq + 0.5)) from:",
"details": [
{
"value": 10237,
"description": "docFreq",
"details": [
]
},
{
"value": 32092568,
"description": "docCount",
"details": [
]
}
]
},
{
"value": 0.92300385,
"description": "tfNorm, computed as (freq * (k1 + 1)) / (freq + k1 * (1 - b + b * fieldLength / avgFieldLength)) from:",
"details": [
{
"value": 1,
"description": "termFreq=1.0",
"details": [
]
},
{
"value": 1.2,
"description": "parameter k1",
"details": [
]
},
{
"value": 0.75,
"description": "parameter b",
"details": [
]
},
{
"value": 13.289993,
"description": "avgFieldLength",
"details": [
]
},
{
"value": 16,
"description": "fieldLength",
"details": [
]
}
]
}
]
}
]
},
{
"value": 6.6730494,
"description": "weight(entname:工商 in 6307209) [PerFieldSimilarity], result of:",
"details": [
{
"value": 6.6730494,
"description": "score(doc=6307209,freq=1.0 = termFreq=1.0 ), product of:",
"details": [
{
"value": 7.229709,
"description": "idf, computed as log(1 + (docCount - docFreq + 0.5) / (docFreq + 0.5)) from:",
"details": [
{
"value": 23258,
"description": "docFreq",
"details": [
]
},
{
"value": 32092568,
"description": "docCount",
"details": [
]
}
]
},
{
"value": 0.92300385,
"description": "tfNorm, computed as (freq * (k1 + 1)) / (freq + k1 * (1 - b + b * fieldLength / avgFieldLength)) from:",
"details": [
{
"value": 1,
"description": "termFreq=1.0",
"details": [
]
},
{
"value": 1.2,
"description": "parameter k1",
"details": [
]
},
{
"value": 0.75,
"description": "parameter b",
"details": [
]
},
{
"value": 13.289993,
"description": "avgFieldLength",
"details": [
]
},
{
"value": 16,
"description": "fieldLength",
"details": [
]
}
]
}
]
}
]
},
{
"value": 7.3460174,
"description": "weight(entname:商银 in 6307209) [PerFieldSimilarity], result of:",
"details": [
{
"value": 7.3460174,
"description": "score(doc=6307209,freq=1.0 = termFreq=1.0 ), product of:",
"details": [
{
"value": 7.9588156,
"description": "idf, computed as log(1 + (docCount - docFreq + 0.5) / (docFreq + 0.5)) from:",
"details": [
{
"value": 11218,
"description": "docFreq",
"details": [
]
},
{
"value": 32092568,
"description": "docCount",
"details": [
]
}
]
},
{
"value": 0.92300385,
"description": "tfNorm, computed as (freq * (k1 + 1)) / (freq + k1 * (1 - b + b * fieldLength / avgFieldLength)) from:",
"details": [
{
"value": 1,
"description": "termFreq=1.0",
"details": [
]
},
{
"value": 1.2,
"description": "parameter k1",
"details": [
]
},
{
"value": 0.75,
"description": "parameter b",
"details": [
]
},
{
"value": 13.289993,
"description": "avgFieldLength",
"details": [
]
},
{
"value": 16,
"description": "fieldLength",
"details": [
]
}
]
}
]
}
]
},
{
"value": 5.6552773,
"description": "weight(entname:银行 in 6307209) [PerFieldSimilarity], result of:",
"details": [
{
"value": 5.6552773,
"description": "score(doc=6307209,freq=1.0 = termFreq=1.0 ), product of:",
"details": [
{
"value": 6.127035,
"description": "idf, computed as log(1 + (docCount - docFreq + 0.5) / (docFreq + 0.5)) from:",
"details": [
{
"value": 70059,
"description": "docFreq",
"details": [
]
},
{
"value": 32092568,
"description": "docCount",
"details": [
]
}
]
},
{
"value": 0.92300385,
"description": "tfNorm, computed as (freq * (k1 + 1)) / (freq + k1 * (1 - b + b * fieldLength / avgFieldLength)) from:",
"details": [
{
"value": 1,
"description": "termFreq=1.0",
"details": [
]
},
{
"value": 1.2,
"description": "parameter k1",
"details": [
]
},
{
"value": 0.75,
"description": "parameter b",
"details": [
]
},
{
"value": 13.289993,
"description": "avgFieldLength",
"details": [
]
},
{
"value": 16,
"description": "fieldLength",
"details": [
]
}
]
}
]
}
]
},
{
"value": 6.1461744,
"description": "weight(entname:银 in 6307209) [PerFieldSimilarity], result of:",
"details": [
{
"value": 6.1461744,
"description": "score(doc=6307209,freq=2.0 = termFreq=2.0 ), product of:",
"details": [
{
"value": 4.726299,
"description": "idf, computed as log(1 + (docCount - docFreq + 0.5) / (docFreq + 0.5)) from:",
"details": [
{
"value": 284314,
"description": "docFreq",
"details": [
]
},
{
"value": 32092568,
"description": "docCount",
"details": [
]
}
]
},
{
"value": 1.3004202,
"description": "tfNorm, computed as (freq * (k1 + 1)) / (freq + k1 * (1 - b + b * fieldLength / avgFieldLength)) from:",
"details": [
{
"value": 2,
"description": "termFreq=2.0",
"details": [
]
},
{
"value": 1.2,
"description": "parameter k1",
"details": [
]
},
{
"value": 0.75,
"description": "parameter b",
"details": [
]
},
{
"value": 13.289993,
"description": "avgFieldLength",
"details": [
]
},
{
"value": 16,
"description": "fieldLength",
"details": [
]
}
]
}
]
}
]
},
{
"value": 5.7659216,
"description": "weight(entname:行 in 6307209) [PerFieldSimilarity], result of:",
"details": [
{
"value": 5.7659216,
"description": "score(doc=6307209,freq=2.0 = termFreq=2.0 ), product of:",
"details": [
{
"value": 4.4338913,
"description": "idf, computed as log(1 + (docCount - docFreq + 0.5) / (docFreq + 0.5)) from:",
"details": [
{
"value": 380881,
"description": "docFreq",
"details": [
]
},
{
"value": 32092568,
"description": "docCount",
"details": [
]
}
]
},
{
"value": 1.3004202,
"description": "tfNorm, computed as (freq * (k1 + 1)) / (freq + k1 * (1 - b + b * fieldLength / avgFieldLength)) from:",
"details": [
{
"value": 2,
"description": "termFreq=2.0",
"details": [
]
},
{
"value": 1.2,
"description": "parameter k1",
"details": [
]
},
{
"value": 0.75,
"description": "parameter b",
"details": [
]
},
{
"value": 13.289993,
"description": "avgFieldLength",
"details": [
]
},
{
"value": 16,
"description": "fieldLength",
"details": [
]
}
]
}
]
}
]
}
]
},
{
"value": 1.193869,
"description": "weight(entitytype:1 in 6307209) [PerFieldSimilarity], result of:",
"details": [
{
"value": 1.193869,
"description": "score(doc=6307209,freq=1.0 = termFreq=1.0 ), product of:",
"details": [
{
"value": 1.193869,
"description": "idf, computed as log(1 + (docCount - docFreq + 0.5) / (docFreq + 0.5)) from:",
"details": [
{
"value": 12031039,
"description": "docFreq",
"details": [
]
},
{
"value": 39700304,
"description": "docCount",
"details": [
]
}
]
},
{
"value": 1,
"description": "tfNorm, computed as (freq * (k1 + 1)) / (freq + k1) from:",
"details": [
{
"value": 1,
"description": "termFreq=1.0",
"details": [
]
},
{
"value": 1.2,
"description": "parameter k1",
"details": [
]
},
{
"value": 0,
"description": "parameter b (norms omitted for field)",
"details": [
]
}
]
}
]
}
]
},
{
"value": 1,
"description": "regcap:{51 TO 999}, product of:",
"details": [
{
"value": 1,
"description": "boost",
"details": [
]
},
{
"value": 1,
"description": "queryNorm",
"details": [
]
}
]
},
{
"value": 3,
"description": "regcap:[5000 TO 9999], product of:",
"details": [
{
"value": 3,
"description": "boost",
"details": [
]
},
{
"value": 1,
"description": "queryNorm",
"details": [
]
}
]
},
{
"value": 3,
"description": "regcap:{20000 TO 99999}, product of:",
"details": [
{
"value": 3,
"description": "boost",
"details": [
]
},
{
"value": 1,
"description": "queryNorm",
"details": [
]
}
]
},
{
"value": 4,
"description": "regcap:{500000 TO 999999}, product of:",
"details": [
{
"value": 4,
"description": "boost",
"details": [
]
},
{
"value": 1,
"description": "queryNorm",
"details": [
]
}
]
},
{
"value": 5.5,
"description": "regcap:{5000000 TO 6999999}, product of:",
"details": [
{
"value": 5.5,
"description": "boost",
"details": [
]
},
{
"value": 1,
"description": "queryNorm",
"details": [
]
}
]
},
{
"value": 6.4,
"description": "regcap:{50000000 TO 69999999}, product of:",
"details": [
{
"value": 6.4,
"description": "boost",
"details": [
]
},
{
"value": 1,
"description": "queryNorm",
"details": [
]
}
]
}
]
},
{
"value": 0,
"description": "match on required clause, product of:",
"details": [
{
"value": 0,
"description": "# clause",
"details": [
]
},
{
"value": 1,
"description": "#*:* -_type:__*, product of:",
"details": [
{
"value": 1,
"description": "boost",
"details": [
]
},
{
"value": 1,
"description": "queryNorm",
"details": [
]
}
]
}
]
}
]
}
}
0 个回复