【问题标题】:Elasticsearch _mapping API is not telling me which fields are not analyzedElasticsearch _mapping API 没有告诉我哪些字段没有被分析
【发布时间】:2020-07-17 00:56:18
【问题描述】:

我试图阻止 elasticsearch 分析我文档中的某些字段。 我发布了这个映射:

{
  "properties" : {
     "f1" : {
        "index" : "not_analyzed",
        "include_in_all" : false,
        "type" : "string"
     },
     "f2" : {
        "index" : "not_analyzed",
        "include_in_all" : false,
        "type" : "string"
     },
     "f3" : {
        "index" : "not_analyzed",
        "include_in_all" : false,
        "type" : "string"
     }
  }
} 

然后我 ping 映射端点,它没有告诉我这些字段是否 是否分析:

{
  "myindex" : {
    "mappings" : {
      "mytype" : {
        "properties" : {
          "f1" : {
            "type" : "keyword",
            "include_in_all" : false
          },
          "f2" : {
            "type" : "keyword",
            "include_in_all" : false
          },
          "f3" : {
            "type" : "keyword",
            "include_in_all" : false
          }
        }
      }
    }
  }
}

在我看到的示例中,查询 _mapping API 似乎可以判断哪些字段被分析或不被分析。

【问题讨论】:

  • 在 ES 5 中,keyword 类型等同于以前的 ES 版本中的 not_analyzed string

标签: elasticsearch


【解决方案1】:

在 elasticsearch 5.0 及更高版本中,有一种分离已分析内容和未分析内容的新方法:

但是,总结一下:

  • 关键字未分析
  • 文本被分析

具有 3 个值的索引属性:“no”、“analyzed”、“not-analyzed”现在简化为“yes”和“no”

【讨论】:

    猜你喜欢
    • 2012-09-21
    • 2016-08-13
    • 2011-07-27
    • 1970-01-01
    • 1970-01-01
    • 2023-03-26
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多