ES版本:5.3.0
插件:ik
重现步骤:
如上,搜的是`中华共和`,但把`人民`也一起高亮了
插件:ik
重现步骤:
PUT test123
{
"mappings": {
"test123": {
"properties": {
"text": {
"type": "text",
"analyzer": "ik_max_word",
"search_analyzer": "ik_smart"
}
}
}
}
}
POST test123/test123
{
"text": "中华人民共和国"
}
GET test123/_search
{
"query": {
"match": {
"text": "中华共和"
}
},
"highlight": {
"fields": {
"text": {}
}
}
}
# result
{
"took": 5,
"timed_out": false,
"_shards": {
"total": 5,
"successful": 5,
"failed": 0
},
"hits": {
"total": 1,
"max_score": 0.5446649,
"hits": [
{
"_index": "test123",
"_type": "test123",
"_id": "AW8jP3nilfYoZZrT2IfC",
"_score": 0.5446649,
"_source": {
"text": "中华人民共和国"
},
"highlight": {
"text": [
"<em>中华人民共和</em>国"
]
}
}
]
}
}
如上,搜的是`中华共和`,但把`人民`也一起高亮了
2 个回复
Charele - Cisco4321
赞同来自:
{
"took" : 45,
"timed_out" : false,
"_shards" : {
"total" : 1,
"successful" : 1,
"skipped" : 0,
"failed" : 0
},
"hits" : {
"total" : {
"value" : 1,
"relation" : "eq"
},
"max_score" : 0.5753642,
"hits" : [
{
"_index" : "test123",
"_type" : "_doc",
"_id" : "-xL1Jm8BhQozQBe4JN2L",
"_score" : 0.5753642,
"_source" : {
"text" : "中华人民共和国"
},
"highlight" : {
"text" : [
"<em>中华</em>人民<em>共和</em>国"
]
}
}
]
}
}
森 - Elasticsearch,php
赞同来自: