【问题标题】:fields in mapping are not included in the search results returned by ElasticSearchmapping 中的字段不包含在 ElasticSearch 返回的搜索结果中
【发布时间】:2016-11-29 22:24:18
【问题描述】:

我在 ES 中做了如下映射:

curl -XPOST http://localhost:9200/developer/document/_mapping -d '
{
      "document" : {
        "properties" : {
          "content" : {
            "type" : "string",
            "analyzer": "ik_max_word",
            "search_analyzer": "ik_max_word",
            "copy_to":"single_word_content"
          },
          "ID" : {
            "type" : "string"
          },
          "title" : {
            "type" : "string",
            "analyzer": "ik_max_word",
            "search_analyzer": "ik_max_word",
            "copy_to":"single_word_content"
          },
          "single_word_content":{
            "type": "string",
            "analyzer":"standard",
           }
        }
    }
}'

然后我在 ES 中插入一个 without single_word_content 字段的文档。 当我从 ES 搜索时,搜索结果中没有返回 single_word_content 字段,并且突出显示也不适用于 single_word_content 字段

【问题讨论】:

    标签: elasticsearch


    【解决方案1】:

    有一个关于此的重要说明 ES 文档。

    原始 _source 字段不会被修改以显示复制的值。

    您可以查看documentation。本说明适用于 5.0。因此,您可以明确指出您的复制字段以返回您的搜索结果。

    【讨论】:

      猜你喜欢
      • 2023-03-10
      • 2012-08-13
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-09-28
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多