【发布时间】:2019-08-07 18:43:01
【问题描述】:
我知道在 _source 映射中标记为 excluded 的对象可以包含在搜索查询中。但是我需要在响应的突出显示部分中包含匹配的术语。
例如 我有一个像这样的映射:
{
"mappings": {
"doc": {
"_source": {
"excludes": ["some_nested_object.complex_tags_object"]
},
"properties": {
"some_nested_object": {
"type": "nested"
}
}
}
}
}
搜索查询:
GET my_index/_search {
"size": 500,
"query": {
"bool": {
"must": [{
"nested": {
"query": {
"bool": {
"must":
[{
"match_phrase_prefix": {
"some_nested_object.complex_tags_object.name": {
"query": "account"
}
}
}
]
}
},
"path": "some_nested_object"
}
}
]
}
},
"highlight": {
"pre_tags": [
""
],
"post_tags": [
""
],
"fields": {
"some_nested_object.complex_tags_object.name": {}
}
}
}
如果我不在映射中排除,而是在运行时的搜索查询中排除,那么我可以在 highlight 部分中返回匹配项,但由于对象。
那么是否可以在mapping/doc/_source 中包含标记为exclude 的字段作为highlight 的一部分?
【问题讨论】:
标签: elasticsearch lucene