为了方便,在项目中配置了搜索模板,用的5.4版本
如果在搜索的时候增加高亮就会报错,如下
# 增加模版
POST _search/template/full_text_normal
{
"query": {
"bool": {
"must": [
{
"match": {
"full_text": "{{full_text}}"
}
}
]
}
},
"highlight": {
"require_field_match": false,
"fields": {
"full_text": {},
"title": {},
"content": {}
}
}
}
但是在使用过程中,这个高亮不起作用,如果在搜索的时候增加高亮就会报错,如下
POST script_es/_search/template
{
"id":"full_text_normal",
"params":{
"full_text":"kaishi好开始 好"
},
"highlight": {
"require_field_match": false,
"fields": {
"full_text": {},
"title": {},
"content": {}
}
}
}
错误信息如下{
"error": {
"root_cause": [
{
"type": "illegal_argument_exception",
"reason": "[search_template] unknown field [highlight], parser not found"
}
],
"type": "illegal_argument_exception",
"reason": "[search_template] unknown field [highlight], parser not found"
},
"status": 400
}
1 个回复
rochy - rochy_he
赞同来自: