小编khi*_*ras的帖子

ElasticSearch:inner_hits和hightlight_query

简短版本:是否有可能获得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)

正如你所看到的,还有领域doctextsentences领域.这个想法是将文档文本分成句子以允许基于句子的搜索.

让这成为一个示例文档:

{
  "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)

elasticsearch elasticsearch-2.0

5
推荐指数
1
解决办法
2030
查看次数

标签 统计

elasticsearch ×1

elasticsearch-2.0 ×1