Struggling to get basic roleups working

Trying to use rollups. Here is my role up definition:

{
  "config": {
    "id": "connections_rollup_test_1",
    "index_pattern": "connections_c1_*",
    "rollup_index": "connections_rollup_test_1",
    "cron": "0 * * * * ?",
    "groups": {
      "date_histogram": {
        "fixed_interval": "5m",
        "field": "created_at",
        "delay": "30s",
        "time_zone": "UTC"
      },
      "terms": {
        "fields": [
          "device_key"
        ]
      }
    },
    "metrics": [
      {
        "field": "bandwidth",
        "metrics": [
          "sum"
        ]
      }
    ],
    "timeout": "20s",
    "page_size": 1000
  },
  "status": {
    "job_state": "indexing",
    "current_position": {
      "created_at.date_histogram": 1574817600000,
      "device_key.terms": "123b0300-dc3d-4c6b-a174-b7f9228644e1"
    },
    "upgraded_doc_id": true
  },
  "stats": {
    "pages_processed": 257,
    "documents_processed": 13203322,
    "rollups_indexed": 257000,
    "trigger_count": 1,
    "index_time_in_ms": 422335,
    "index_total": 257,
    "index_failures": 0,
    "search_time_in_ms": 75850,
    "search_total": 257,
    "search_failures": 0
  }
}

In the logs I see the following:

2019-12-16T01:31:57,154][DEBUG][o.e.a.b.TransportShardBulkAction] [es-1] [connections_rollup_test_1][0] failed to execute bulk item (index) index {[connections_rollup_test_1][_doc][connections_rollup_test_1$6l734zrgjXQcgc0UlENsEw], source[{"bandwidth.sum.value":108.0,"created_at.date_histogram.time_zone":"UTC","created_at.date_histogram.timestamp":1574719800000,"created_at.date_histogram._count":2,"_rollup.version":2,"created_at.date_histogram.interval":"5m","device_key.terms._count":2,"device_key.terms.value":"09858ffe-fc30-448a-a87c-9418854b7787","_rollup.id":"connections_rollup_test_1"}]}

org.elasticsearch.index.mapper.MapperParsingException: Could not dynamically add mapping for field [bandwidth.sum.value]. Existing mapping for [bandwidth] must be of type object but found [long].

I don't understand how I am supposed to turn bandwidth which is a numeric metric that I am summing over into an object? Or why that mapping is having a conflict in the first place. Bandwidth is a long in the underlying index mapping. Any help would be greatly appreciated. Thanks!

Do you have a template with index pattern matching the rollup index "connections_rollup_test_"? if you do, does it define mapping for the "bandwidth" field? I think that could cause your conflict.

If so, try with an index name that won't match the template.

That was it! I had a template that matched the pattern of the rollup name. Thanks so much for the suggestion. Was completely stumped as to what it was.