【发布时间】:2015-06-29 22:54:41
【问题描述】:
我正在尝试了解 elasticsearch (1.6) 中使用 shingle 分析器索引的文档的 fieldnorm 计算 - 它似乎不包括 shingled 术语。如果是这样,是否可以将计算配置为包括叠瓦项?具体来说,这是我使用的分析器:
{
"index" : {
"analysis" : {
"filter" : {
"shingle_filter" : {
"type" : "shingle",
"max_shingle_size" : 3
}
},
"analyzer" : {
"my_analyzer" : {
"type" : "custom",
"tokenizer" : "standard",
"filter" : ["word_delimiter", "lowercase", "shingle_filter"]
}
}
}
}
}
这是使用的映射:
{
"docs": {
"properties": {
"text" : {"type": "string", "analyzer" : "my_analyzer"}
}
}
}
我发布了一些文件:
{"text" : "the"}
{"text" : "the quick"}
{"text" : "the quick brown"}
{"text" : "the quick brown fox jumps"}
...
将以下查询与解释 API 一起使用时,
{
"query": {
"match": {
"text" : "the"
}
}
}
我得到以下字段规范(为简洁起见,省略了其他细节):
"_source": {
"text": "the quick"
},
"_explanation": {
"value": 0.625,
"description": "fieldNorm(doc=0)"
}
"_source": {
"text": "the quick brown fox jumps over the"
},
"_explanation": {
"value": 0.375,
"description": "fieldNorm(doc=0)"
}
这些值似乎表明 ES 看到 2 个术语用于第一个文档(“the quick”)和 7 个术语用于第二个文档(“the quick brown fox jumps over the”),不包括带状疱疹。是否可以将 ES 配置为也使用 shingled 术语(即分析器返回的所有术语)计算字段规范?
【问题讨论】:
标签: elasticsearch