我的mapping如下
PUT hotel
{
"mappings": {
"properties": {
"id": {
"type": "keyword"
},
"name": {
"type": "text",
"copy_to": "all"
},
"address": {
"type": "keyword",
"index": false
},
"price": {
"type": "integer"
},
"score": {
"type": "integer"
},
"brand": {
"type": "keyword",
"copy_to": "all"
},
"city": {
"type": "keyword"
},
"starName": {
"type": "keyword"
},
"business": {
"type": "keyword",
"copy_to": "all"
},
"location": {
"type": "geo_point"
},
"pic": {
"type": "keyword",
"index": false
},
"all": {
"type": "text",
"analyzer": "ik_max_word"
}
}
}
}
插入一条文档
POST /hotel/_doc
{
"id": 339952837,
"name": "如家酒店(北京良乡西路店)",
"address": "良乡西路7号",
"price": 159,
"score": 46,
"brand": "如家",
"city": "北京",
"starName": "二钻",
"business": "房山风景区",
"location": "39.73167, 116.132482",
"pic": "https://m.tuniucdn.com/fb3/s1/2n9c/3Dpgf5RTTzrxpeN5y3RLnRVtxMEA_w200_h200_c1_t0.jpg"
}
我的高亮查询如下
GET /hotel/_search
{
"query": {
"match": {
"all": "如家"
}
},
"highlight": {
"fields": {
"name": {
"require_field_match": "false"
},
"brand": {
"require_field_match": "false"
}
}
}
}
得到这样的结果:
name、brand、business属性都copy_to到all属性中了,"require_field_match": "false"(也不必须匹配字段了)。
问题:brand能高亮,name不能高亮是什么原因?