ElasticSearch突出显示错误的字段

时间:2015-05-27 20:53:56

标签: elasticsearch

如果我在ElasticSearch中插入此数据:

PUT /a/b/1
{
   "content": "<a>Mussum<a> ipsum<a> cacilds<a>",
   "content_processed": "Mussum ipsum cacilds",
   "content.processed": "Mussum ipsum cacilds",
   "content.processed.x": "Mussum ipsum cacilds"
}

执行以下查询:

GET /a/_search
{
   "query": {
      "query_string": {
         "query": "cacilds"
      }
   },
   "highlight": {
      "pre_tags": [
         "<tag1><div class='h1'></div>",
         "<tag2>"
      ],
      "post_tags": [
         "</tag1>",
         "</tag2>"
      ],
      "fields": {
         "_all": {},
         "content": {},
         "content_processed": {},
         "content.processed": {},
         "content.processed.x": {}
      }
   }
}

我收到的亮点是:

        "highlight": {
           "content_processed": [
              "Mussum ipsum <tag1><div class='h1'></div>cacilds</tag1>"
           ],
           "content.processed": [
              "<a>Mussum<a> ipsum<a> <tag1><div class='h1'></div>cacilds</tag1><a>"
           ],
           "content": [
              "<a>Mussum<a> ipsum<a> <tag1><div class='h1'></div>cacilds</tag1><a>"
           ],
           "content.processed.x": [
              "<a>Mussum<a> ipsum<a> <tag1><div class='h1'></div>cacilds</tag1><a>"
           ]
        }

&#34;内容&#34;和&#34; content_processed&#34;价值是我所期望的。但是&#34; content.processed&#34;和&#34; content.processed.x&#34;似乎显示错误的数据。我希望他们的结果与&#34; content_processed&#34;相同。但相反,它们与&#34;内容&#34;具有相同的结果。为什么这个?我做错了吗?

1 个答案:

答案 0 :(得分:1)

目前,字段名称不应包含点。 关于支持此类字段存在一个未解决的问题:issue #9059issue #7112