【问题标题】:How to increase size of string in elastic search如何在弹性搜索中增加字符串的大小
【发布时间】:2014-07-24 06:28:24
【问题描述】:

我正在寻找如何在弹性搜索中增加字符串的长度。 这篇 UTF8 encoding is longer than the max length 32766 的帖子说,为了做到这一点,我需要执行以下操作之一:

1) change the type to binary
2) to continue to use string but set the index type to "no"

我该怎么做?

【问题讨论】:

    标签: elasticsearch


    【解决方案1】:

    您需要更改字段的映射,然后重新索引数据 - 将数据索引到字段后,您无法更改字段的映射。

    如果您不熟悉 Elasticsearch 或 Put 映射 API 中的映射概念,我会从这里开始阅读:

    http://www.elasticsearch.org/guide/en/elasticsearch/guide/current/mapping-intro.html

    这里:

    http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/indices-put-mapping.html

    假设你想创建一个二进制字段,你会做这样的事情:

    $ curl -XPUT 'http://localhost:9200/yourindex/yourtype/_mapping' -d '
    {
        "yourtype" : {
            "properties" : {
                "yourbigstring" : {"type" : "binary", "store" : true }
            }
        }
    }
    '
    

    如果您想将其保留为字符串但不进行分析:

    $ curl -XPUT 'http://localhost:9200/yourindex/yourtype/_mapping' -d '
    {
        "yourtype" : {
            "properties" : {
                "yourbigstring" : {"type" : "string", "store" : true, "index" : "not_analyzed"}
            }
        }
    }
    '
    

    【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-02-26
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多