简短版本:是否有可能获得highlight_query为突出显示inner_hits结果而提供的功能?
长版:请考虑以下映射:
{
"settings": {
"number_of_replicas": 0,
"number_of_shards": 1
},
"mappings": {
"docs": {
"properties": {
"doctext": {
"type": "string",
"store": "yes"
},
"sentences": {
"type": "nested",
"properties": {
"text": {
"type": "string",
"store": "yes"
}
}
}
}
}
}
}
Run Code Online (Sandbox Code Playgroud)
正如你所看到的,还有领域doctext和sentences领域.这个想法是将文档文本分成句子以允许基于句子的搜索.
让这成为一个示例文档:
{
"doctext": "I will do a presentation. I talk about lions and show images of zebras. I hope it will be fun.",
"sentences": [
{
"text": "I will …Run Code Online (Sandbox Code Playgroud)