Closed xiaohoutongxue closed 3 years ago
mapping: { "article" : { "mappings" : { "properties" : { "_class" : { "type" : "text", "fields" : { "keyword" : { "type" : "keyword", "ignore_above" : 256 } } }, "content" : { "type" : "text", "fields" : { "pinyin" : { "type" : "text", "analyzer" : "pinyin" } }, "analyzer" : "ik_max_word" }, "createTime" : { "type" : "long" }, "title" : { "type" : "text", "fields" : { "pinyin" : { "type" : "text", "analyzer" : "pinyin" } }, "analyzer" : "ik_max_word" } } } } }
搜索 GET /article/_search { "query":{ "multi_match": { "query": "shenshang", "fields": ["content.pinyin"] } }, "highlight": { "pre_tags" : [""], "post_tags" : [""], "fields": { "content.pinyin": {} } } }
结果: "highlight" : { "content.pinyin" : [ "迪斯科浪费空间四点零分了是对方身上的" ] }
怎么让这个pre_tags 打在 对应拼音的汉字上呢
mapping: { "article" : { "mappings" : { "properties" : { "_class" : { "type" : "text", "fields" : { "keyword" : { "type" : "keyword", "ignore_above" : 256 } } }, "content" : { "type" : "text", "fields" : { "pinyin" : { "type" : "text", "analyzer" : "pinyin" } }, "analyzer" : "ik_max_word" }, "createTime" : { "type" : "long" }, "title" : { "type" : "text", "fields" : { "pinyin" : { "type" : "text", "analyzer" : "pinyin" } }, "analyzer" : "ik_max_word" } } } } }
搜索 GET /article/_search { "query":{ "multi_match": { "query": "shenshang", "fields": ["content.pinyin"] } }, "highlight": { "pre_tags" : [""],
"post_tags" : [" "],
"fields": {
"content.pinyin": {}
}
}
}
结果: "highlight" : { "content.pinyin" : [ " 迪斯科浪费空间四点零分了是对方身上的"
]
}
怎么让这个pre_tags 打在 对应拼音的汉字上呢