首页 > 解决方案 > 现有汇总索引的二次汇总

问题描述

我有一个从汇总作业创建的索引。其内容如下:

 "hits": {
    "total": 4,
    "max_score": 1,
    "hits": [
      {
        "_index": "my_rollup_1m_2021.08.17",
        "_type": "_doc",
        "_id": "my_rollup_1m$09-UpSrS0X2Nnx3TyDfMtg",
        "_score": 1,
        "_source": {
          "stId.terms._count": 2,
          "timestamp.date_histogram.time_zone": "UTC",
          "timestamp.date_histogram.timestamp": 1629201600000,
          "count.sum.value": 20,
          "_rollup.version": 2,
          "stId.terms.value": 1,
          "timestamp.date_histogram.interval": "1h",
          "timestamp.date_histogram._count": 2,
          "_rollup.id": "my_rollup_1m"
        }
      },
    ....
}

然后我正在尝试创建一个二级汇总作业,该作业汇总上述索引。二级汇总作业配置为:

PUT _rollup/job/my_rollup_1h
{
  "id": "my_rollup_1h",
  "index_pattern": "my_rollup_1m_2021.08.17",
  "rollup_index": "<my_rollup_1h_{now/d}>",
  "cron": "0 39 * * * ?",
  "groups": {
    "date_histogram": {
      "interval": "1h",
      "field": "timestamp.date_histogram.timestamp",
      "time_zone": "UTC"
    },
    "terms": {
      "fields": [
        "stId.terms.value"
      ]
    }
  },
  "metrics": [
    {
      "field": "count.sum.value",
      "metrics": [
        "sum"
      ]
    }
  ],
  "timeout": "20s",
  "page_size": 10000
}

从以下状态可以看出,辅助汇总作业运行良好:

"status": {
    "job_state": "started",
    "current_position": {
      "stId.terms.value.terms": 4,
      "timestamp.date_histogram.timestamp.date_histogram": 1629201600000
    },
    "upgraded_doc_id": true
  },
  "stats": {
    "pages_processed": 2,
    "documents_processed": 4,
    "rollups_indexed": 4,
    "trigger_count": 1,
    "index_time_in_ms": 1,
    "index_total": 1,
    "index_failures": 0,
    "search_time_in_ms": 5,
    "search_total": 2,
    "search_failures": 0
  }

但是当我检查第二个汇总索引时,它总是空的。此外,我在 ES 中看到了这个异常:

[2021-08-17T13:39:00,004][WARN ][o.e.x.c.i.AsyncTwoPhaseIndexer] [es-data-0] Error while attempting to bulk index documents: failure in bulk execution:
[0]: index [my_rollup_1h_2021.08.17], type [_doc], id [my_rollup_1h$2b4OsNouZ94vhB47tII2ww], message [MapperParsingException[failed to parse]; nested: ClassCastException[org.elasticsearch.index.mapper.DateFieldMapper incompatible with org.elasticsearch.index.mapper.ObjectMapper];]
[1]: index [my_rollup_1h_2021.08.17], type [_doc], id [my_rollup_1h$AU3POF2c3SwXnjzgga3d0g], message [MapperParsingException[failed to parse]; nested: ClassCastException[org.elasticsearch.index.mapper.DateFieldMapper incompatible with org.elasticsearch.index.mapper.ObjectMapper];]
[2]: index [my_rollup_1h_2021.08.17], type [_doc], id [my_rollup_1h$pQOaK-fGV4vl35xgviD4Og], message [MapperParsingException[failed to parse]; nested: ClassCastException[org.elasticsearch.index.mapper.DateFieldMapper incompatible with org.elasticsearch.index.mapper.ObjectMapper];]
[3]: index [my_rollup_1h_2021.08.17], type [_doc], id [my_rollup_1h$72Ci96Cz6XIVIoTHg3z-Rw], message [MapperParsingException[failed to parse]; nested: ClassCastException[org.elasticsearch.index.mapper.DateFieldMapper incompatible with org.elasticsearch.index.mapper.ObjectMapper];]

尝试索引数据时似乎映射异常。在这种情况下配置作业时是否还有其他事情要做?

标签: elasticsearch

解决方案


推荐阅读