【问题标题】:How to Do a Mapping of Array of Strings in Elasticsearch如何在 Elasticsearch 中映射字符串数组
【发布时间】:2017-09-17 17:48:39
【问题描述】:

在尝试将映射映射到索引时,我找不到任何关于如何在 elasticsearch 中构造字符串数组的示例。

我拥有的字段映射:

:tags {:type :array :store true}

我得到的错误:

{:type "mapper_parsing_exception",
 :reason "No handler for type [array] declared on field [tags]"}

【问题讨论】:

    标签: elasticsearch clojure elasticsearch-5 elasticsearch-mapping


    【解决方案1】:

    在 Elasticsearch 中,没有专用的数组类型。默认情况下,任何字段都可以包含零个或多个值,但是,数组中的所有值必须是相同的数据类型。

    因此,您不必在映射中指定任何特定的内容来存储值数组。

    欲了解更多信息,请查看: https://www.elastic.co/guide/en/elasticsearch/reference/current/array.html

    【讨论】:

    • 如果我想为数组元素指定分析器怎么办?
    • @Rajeev 您指定了一个分析器,就好像元素不在数组中一样。该分析器应用于每个项目。它们不会作为整个阵列或组进行分析。
    【解决方案2】:

    随便写

    :tags { "type" : "text" }
    

    它适用于 Elasticsearch 中的存储数组。

    【讨论】:

      猜你喜欢
      • 2021-11-15
      • 2012-01-23
      • 2020-12-12
      • 2021-06-05
      • 2014-10-31
      • 2017-07-28
      • 1970-01-01
      • 2019-01-26
      • 1970-01-01
      相关资源
      最近更新 更多