0
我無法讓ElasticSearch突出顯示使用elasticsearch-mapper-attachments
索引的附件內容中的點擊數。使用ElasticSearch突出顯示附件內容中的點擊數
我在/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"
}
}
}
}
}
}
而我的查詢看起來像t他:
{
"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
,但有人評論說這又改變了......什麼是正確的配置讓突出顯示工作?
iam有同樣的問題...附件突出顯示不支持彈性搜索1.7? – 2016-06-10 11:41:38