【发布时间】:2015-02-05 13:33:26
【问题描述】:
我无法让 ElasticSearch 突出显示使用 elasticsearch-mapper-attachments 索引的附件内容中的命中。
我在/stuff/file 的数据如下所示:
{
"id": "string"
"name": "string"
"attachment": "...base 64 encoded file"
}
我的映射器配置放到/stuff/file/_mapper 看起来像这样:
{
"file" : {
"properties" : {
"attachment" : {
"type" : "attachment",
"path" : "full",
"fields": {
"name": { "store": true },
"title": { "store": true },
"content": { "store": true },
"attachment": {
"type": "string",
"term_vector": "with_positions_offsets",
"store": true
}
}
}
}
}
}
当我在 /stuff/_mapper/file 查询它时,我得到了返回:
{
"stuff":{
"mappings":{
"file":{
"properties":{
"attachment":{
"type":"attachment",
"path":"full",
"fields":{
"attachment":{
"type":"string"
},
"author":{
"type":"string"
},
"title":{
"type":"string"
},
"name":{
"type":"string"
},
"date":{
"type":"date",
"format":"dateOptionalTime"
},
"keywords":{
"type":"string"
},
"content_type":{
"type":"string"
},
"content_length":{
"type":"integer"
},
"language":{
"type":"string"
}
}
},
"id":{
"type":"string"
},
"name":{
"type":"string"
}
}
}
}
}
}
我的查询如下所示:
{
"size": 30,
"query": {
"multi_match": {
"query": "{{.Query}}",
"operator": "and",
"fields": ["id", "name^4", "attachment"],
"fuzziness": "AUTO",
"minimum_should_match": "80%"
}
},
"highlight" : {
"fields" : {
"attachment": { }
}
}
}
当我搜索附件中的术语时,它会返回正确的结果,但没有突出显示。几年前有一个类似的问题,在一些地方将 attachment 替换为 file,但有一些 cmets 再次改变了......让突出显示工作的正确配置是什么?
【问题讨论】:
-
我有同样的问题...弹性搜索 1.7 不支持附件突出显示?
标签: elasticsearch attachment highlight