【问题标题】:Failing to store keyword text field length above 32766未能存储超过 32766 的关键字文本字段长度
【发布时间】:2018-03-19 05:45:41
【问题描述】:

我一直在尝试将字段存储为类型关键字以支持区分大小写的文本搜索,

但是当我尝试存储长度超过 32766 个字符的文本时,它无法存储它,出现以下异常

    Elasticsearch exception [type=illegal_argument_exception, reason=Document contains at least one immense term in field="case_message_message.lowcase" (whose UTF8 encoding is longer than the max length 32766), all of which were skipped.  Please correct the analyzer to not produce such terms.  The prefix of the first immense term is: '[-32, -80, -84, -32, -79, -122, -32, -80, -126, -32, -80, -105, -32, -80, -77, -32, -79, -126, -32, -80, -80, -32, -79, -127, 58, 32, -32, -80, -107, -32]...', original message: bytes can be at most 32766 in length; got 37632]

有什么办法可以把这段文字存储在32766以上,

弹性搜索版本 6.1.2

非常感谢任何帮助。

更新 1:

这是我使用自定义规范器和规范器的索引的映射

{
   "org-16-database": {
      "mappings": {
         "org-16-table": {
            "properties": {
               "My field": {
                  "type": "text",
                  "fields": {
                     "keyword": {
                        "type": "keyword"
                     },
                     "lowcase": {
                        "type": "keyword",
                        "normalizer": "my_normalizer"
                     }
                  },
                  "fielddata": true
               }
            }
         }
      }
   }
}

设置

    {
       "org-16-database": {
          "settings": {
             "index": {
                "number_of_shards": "5",
                "provided_name": "org-16-database",
                "creation_date": "1521198435444",
                "analysis": {
                   "normalizer": {
                      "my_normalizer": {
                         "filter": [
                            "lowercase"
                         ],
                         "type": "custom"
                      }
                   }
                },
                "number_of_replicas": "1",
                "uuid": "lN-7iYloQWy7oaD3uMIYGQ",
                "version": {
                   "created": "6010299"
                }
             }
          }
       }
    }

【问题讨论】:

  • 你试过keyword这个类型
  • 是的,我将类型作为关键字来存储文本字段@Vijayakumar
  • 我已经粘贴了下面的链接。你能试试吗。 @Raviteja Gannoju
  • 您能否发布您的索引设置。这将有助于缩小问题范围。
  • 我已经更新了我的问题以及我的映射@Vijayakumar

标签: java elasticsearch keyword maxlength


【解决方案1】:

正如documentation 中所写,当您创建新的关键字字段时,默认启用参数ignore_above。此选项对于防止 Lucene 的术语字节长度限制为 32766 也很有用。您可以通过修改映射来增加此限制,而无需重新索引。允许的最大值是 10922

【讨论】:

  • 当您说You could increase this limit modifying your mapping, without reindex. 时,您的意思是我们可以更改ignore_above 值吗?
  • @RavitejaGannoju 是的,完全正确
【解决方案2】:

【讨论】:

  • 我不想标记字段,但我必须增加字段的大小
  • 如果我使用tokenize,startswith 和endswith 将不起作用。
猜你喜欢
  • 1970-01-01
  • 2011-07-26
  • 2012-12-19
  • 1970-01-01
  • 2017-08-12
  • 1970-01-01
  • 1970-01-01
  • 2014-02-18
  • 1970-01-01
相关资源
最近更新 更多