我有一个包含以下数据的弹性搜索索引:
“A-Team”(例如)
我的索引设置是:
"index": {
"number_of_shards": "1",
"provided_name": "tyh.tochniyot",
"creation_date": "1481039136127",
"analysis": {
"analyzer": {
"whitespace_analyzer": {
"type": "whitespace"
},
"ngram_analyzer": {
"type": "custom",
"tokenizer": "ngram_tokenizer"
}
},
"tokenizer": {
"ngram_tokenizer": {
"type": "ngram",
"min_gram": "3",
"max_gram": "7"
}
}
},
当我搜索:
_search
{
"from": 0,
"size": 20,
"track_scores": true,
"highlight": {
"fields": {
"*": {
"fragment_size": 100,
"number_of_fragments": 10,
"require_field_match": false
}
}
},
"query": {
"match": {
"_all": {
"query": "Tea"
}
}
}
我希望得到突出显示的结果:
"highlight": {
"field": [
"The A-<em>Tea</em>m"
]
}
但我根本没有得到任何亮点。
我使用空格进行搜索并使用 ngram 进行索引的原因是我不想在搜索阶段破坏我正在搜索的单词,就像如果我正在搜索“Team”它会找到我“Tea”、“eam”、团队”
谢谢