“error“: { “root_cause“: [{ “type“: “circuit_breaking_exception“, “reason“: “[parent] D【已解决】

简介: “error“: { “root_cause“: [{ “type“: “circuit_breaking_exception“, “reason“: “[parent] D【已解决】

异常

{
  "error": {
    "root_cause": [{
      "type": "circuit_breaking_exception",
      "reason": "[parent] Data too large, data for [] would be [7201130054/6.7gb], which is larger than the limit of [7103712460/6.6gb], real usage: [7201129672/6.7gb], new bytes reserved: [382/382b], usages [request=0/0b, fielddata=19998/19.5kb, in_flight_requests=21400104/20.4mb, model_inference=0/0b, accounting=10053032/9.5mb]",
      "bytes_wanted": 7201130054,
      "bytes_limit": 7103712460,
      "durability": "TRANSIENT"
    }],
    "type": "circuit_breaking_exception",
    "reason": "[parent] Data too large, data for [] would be [7201130054/6.7gb], which is larger than the limit of [7103712460/6.6gb], real usage: [7201129672/6.7gb], new bytes reserved: [382/382b], usages [request=0/0b, fielddata=19998/19.5kb, in_flight_requests=21400104/20.4mb, model_inference=0/0b, accounting=10053032/9.5mb]",
    "bytes_wanted": 7201130054,
    "bytes_limit": 7103712460,
    "durability": "TRANSIENT"
  },
  "status": 429
}

原因

相信这个原因大家都查到了,那么看文末的详细解析。

field data的缓存不够用

解决

设置 fielddata 缓存占用 JVM 内存的 40% 或更小

curl -XPUT "localhost:9200/_cluster/settings" -H 'Content-Type: application/json' -d '{
  "persistent" : {
    "indices.breaker.fielddata.limit" : "40%" 
  }
}'

返回:

{
    "acknowledged": true,
    "persistent": {
        "indices": {
            "breaker": {
                "fielddata": {
                    "limit": "40%"
                }
            }
        }
    },
    "transient": {}
}

elasticsearch fielddata理解

在es中,text类型的字段使用一种叫做fielddata的查询时内存数据结构。当字段被排序,聚合或者通过脚本访问时这种数据结构会被创建。它是通过从磁盘读取每个段的整个反向索引来构建的,然后存存储在java的堆内存中。


fileddata默认是不开启的。Fielddata可能会消耗大量的堆空间,尤其是在加载高基数文本字段时。一旦fielddata已加载到堆中,它将在该段的生命周期内保留。此外,加载fielddata是一个昂贵的过程,可能会导致用户遇到延迟命中。这就是默认情况下禁用fielddata的原因。如果尝试对文本字段进行排序,聚合或脚本访问,将看到以下异常:


“Fielddata is disabled on text fields by default. Set fielddata=true on [your_field_name] in order to load fielddata in memory by uninverting the inverted index. Note that this can however use significant memory.”


在启用fielddata之前,请考虑使用文本字段进行聚合,排序或脚本的原因。这样做通常没有意义。text字段在索引例如New York这样的词会被分词,会被拆成new,york。在此字段上面来一个terms的聚合会返回一个new的bucket和一个york的bucket,当你想只返回一个New York的bucket的时候就会出现问题。在kibana中执行如下的命令即可:

PUT my_index
{
  "mappings": {
    "_doc": {
      "properties": {
        "my_field": { 
          "type": "text",
          "fields": {
            "keyword": { 
              "type": "keyword"
            }
          }
        }
      }
    }
  }
}

然后使用my_field字段进行搜索。使用my_field.keyword字段进行聚合,排序或脚本。

可以使用PUT映射API在现有文本字段上启用fielddata,如下所示:

PUT my_index/_mapping/_doc
{
  "properties": {
    "my_field": { 
      "type":     "text",
      "fielddata": true
    }
  }
}

为my_field指定的映射应包含该字段的现有映射以及fielddata参数。


目录
相关文章
|
3月前
|
JavaScript 安全 网络安全
Node: opensslErrorStack: [ ‘error:03000086:digital envelope routines::initialization error‘ ]异常处理
Node: opensslErrorStack: [ ‘error:03000086:digital envelope routines::initialization error‘ ]异常处理
1471 0
|
3月前
|
应用服务中间件 Python 容器
ERROR [ntContainer#0-1] o.s.a.r.l.SimpleMessageListenerContainer 1917: Failed to check/redeclare aut
ERROR [ntContainer#0-1] o.s.a.r.l.SimpleMessageListenerContainer 1917: Failed to check/redeclare aut
92 0
|
12月前
|
Java Maven Android开发
成功解决FATAL ERROR in native method: JDWP on getting class status, jvmtiError=JVMTI_ERROR_WRONG_PHASE
成功解决FATAL ERROR in native method: JDWP on getting class status, jvmtiError=JVMTI_ERROR_WRONG_PHASE
|
3月前
|
Perl
报错:error Parsing error: x-invalid-end-tag
报错:error Parsing error: x-invalid-end-tag
error C2449: found ‘{‘ at file scope (missing function header?)和error C2059: syntax error : ‘}‘
error C2449: found ‘{‘ at file scope (missing function header?)和error C2059: syntax error : ‘}‘
94 0
|
前端开发 数据库
Failed to load response dataNo data found for resource with given identifier
Failed to load response dataNo data found for resource with given identifier
1244 0
Optional int parameter ‘id‘ is present but cannot be translated into a null value due to being ……
Optional int parameter ‘id‘ is present but cannot be translated into a null value due to being ……
248 0
error: static assertion failed: Signal and slot arguments are not compatible.
error: static assertion failed: Signal and slot arguments are not compatible.
error: static assertion failed: Signal and slot arguments are not compatible.