在Elasticsearch集群中索引文档时出错

时间:2019-05-24 11:31:36

标签: elasticsearch

我没有在代码中使用BulkIndex请求。

下面是用于索引文档的Jest代码。

Builder builder = new Index.Builder(source).index(indexName).type(typeName)
                .id(optionalDocId == null ? UUID.randomUUID().toString() : optionalDocId);

源数据类型为Map

Caused by: java.lang.Exception: ES Error Message while writing to raw: {"root_cause":[{"type":"remote_transport_exception","reason":"[datanodes-364022667-13-482069107.azure-ebf.opsds.cp.prod-az-westus-1.prod.us.walmart.net][10.12.10.171:9300][indices:data/write/bulk[s]]"}],"type":"es_rejected_execution_exception","reason":"rejected execution of processing of [557850852][indices:data/write/bulk[s][p]]: request: BulkShardRequest [[sceventstorev1][15]] containing [index {[SCEventStore][scevents][93adca0b-7404-4405-8f72-9fa5e32a167c], source[n/a, actual length: [2.1kb], max length: 2kb]}], target allocation id: iTbBHe7vT_ihTHdJwqVRhA, primary term: 7 on EsThreadPoolExecutor[name = datanodes-364022667-13-482069107.azure-ebf.opsds.cp.prod-az-westus-1.prod.us.walmart.net/write, queue capacity = 200, org.elasticsearch.common.util.concurrent.EsThreadPoolExecutor@4d2bc57e[Running, pool size = 8, active threads = 8, queued tasks = 200, completed tasks = 148755948]]"}

给出索引索引。

{
  "sceventstore_v1": {
    "mappings": {
      "scevents": {
        "properties": {
          "eventID": {
            "type": "keyword"
          },
          "eventId": {
            "type": "keyword"
          },
          "eventName": {
            "type": "keyword"
          },
          "message": {
            "type": "text"
          },
          "producerName": {
            "type": "keyword"
          },
          "receivedTimestamp": {
            "type": "date",
            "format": "epoch_millis"
          },
          "timestamp": {
            "type": "date",
            "format": "epoch_millis"
          }
        }
      }
    }
  }
}```

1 个答案:

答案 0 :(得分:1)

错误消息部分清楚地说明了原因。

source[n/a, actual length: [2.1kb], max length: 2kb]}],表示在应用程序中配置的某个位置允许的最大长度为2kb,而您发送的最大长度超过了2.1kb。

尝试检查您的文档,看看哪个字段值超过了此限制。

可以找到更多资源https://www.elastic.co/blog/why-am-i-seeing-bulk-rejections-in-my-elasticsearch-clusterhttps://www.elastic.co/guide/en/elasticsearch/reference/current/modules-threadpool.html