Index mapping error in rollup job

Hello all,

I’m trying to make the following rollup work:

 {
    "rollup": {
        "rollup_id": "java-cattle-summary",
        "enabled": true,
        "schedule": {
            "cron": {
                "expression": "07 14 * * *",
                "timezone": "America/Sao_Paulo"
            }
        },
        "last_updated_time": 1653410901075,
        "enabled_time": 1653410901075,
        "description": "Eventos de log Java em Rancher 1.6- Cattle.",
        "schema_version": 13,
        "source_index": "java-2*",
        "target_index": "java-cattle-history",
        "page_size": 1000,
        "delay": 0,
        "continuous": false,
        "dimensions": [
            {
                "date_histogram": {
                    "fixed_interval": "1d",
                    "source_field": "@timestamp",
                    "target_field": "@timestamp",
                    "timezone": "America/Sao_Paulo"
                }
            },
            {
                "terms": {
                    "source_field": "cattle_env",
                    "target_field": "cattle_env"
                }
            },
            {
                "terms": {
                    "source_field": "level",
                    "target_field": "level"
                }
            },
            {
                "terms": {
                    "source_field": "stack_service",
                    "target_field": "stack_service"
                }
            },
            {
                "terms": {
                    "source_field": "logger",
                    "target_field": "logger"
                }
            }
        ],
        "metrics": [
            {
                "source_field": "event_count",
                "metrics": [
                    {
                        "sum": {}
                    }
                ]
            }
        ]
    }
}

After running it, I get the following error:

{
  "java-cattle-summary" : {
    "metadata_id" : "z2IL94ABtX2AK5k3_nWA",
    "rollup_metadata" : {
      "rollup_id" : "java-cattle-summary",
      "last_updated_time" : 1653412200064,
      "status" : "failed",
      "failure_reason" : "Could not dynamically add mapping for field [@timestamp.date_histogram]. Existing mapping for [@timestamp] must be of type object but found [date].",
      "stats" : {
        "pages_processed" : 1,
        "documents_processed" : 1811485,
        "rollups_indexed" : 0,
        "index_time_in_millis" : 0,
        "search_time_in_millis" : 1062
      }
    }
  }

Source index template is as follows:

{
  "java-2022.05.24" : {
    "mappings" : {
      "dynamic_templates" : [
        {
          "string_fields" : {
            "match" : "*",
            "match_mapping_type" : "string",
            "mapping" : {
              "doc_values" : true,
              "index" : "true",
              "type" : "keyword"
            }
          }
        }
      ],
      "properties" : {
        "@timestamp" : {
          "type" : "date"
        },
        "@version" : {
          "type" : "integer"
        },
        "agent" : {
          "properties" : {
            "ephemeral_id" : {
              "type" : "keyword"
            },
            "hostname" : {
              "type" : "keyword"
            },
            "id" : {
              "type" : "keyword"
            },
            "name" : {
              "type" : "keyword"
            },
            "type" : {
              "type" : "keyword"
            },
            "version" : {
              "type" : "keyword"
            }
          }
        },
        "application" : {
          "type" : "keyword"
        },
        "cattle_env" : {
          "type" : "keyword"
        },
        "class" : {
          "type" : "keyword"
        },
        "class_tk" : {
          "type" : "text",
          "analyzer" : "java_package_analyzer",
          "search_analyzer" : "keyword"
        },
        "clientip" : {
          "type" : "ip"
        },
        "container_name" : {
          "type" : "keyword"
        },
        "device" : {
          "type" : "keyword"
        },
        "ecs" : {
          "properties" : {
            "version" : {
              "type" : "keyword"
            }
          }
        },
        "environment" : {
          "type" : "keyword"
        },
        "event_count" : {
          "type" : "integer",
          "null_value" : 1
        },
        "exceptionclass" : {
          "type" : "keyword"
        },
        "exceptionclass_tk" : {
          "type" : "text",
          "analyzer" : "java_package_analyzer",
          "search_analyzer" : "keyword"
        },
        "exceptionpackage" : {
          "type" : "keyword"
        },
        "exceptionpackage_tk" : {
          "type" : "text",
          "analyzer" : "java_package_analyzer",
          "search_analyzer" : "keyword"
        },
        "file" : {
          "type" : "keyword"
        },
        "geoip" : {
          "properties" : {
            "agent" : {
              "properties" : {
                "build" : {
                  "properties" : {
                    "original" : {
                      "type" : "keyword",
                      "ignore_above" : 1024
                    }
                  }
                },
                "ephemeral_id" : {
                  "type" : "keyword",
                  "ignore_above" : 1024
                },
                "id" : {
                  "type" : "keyword",
                  "ignore_above" : 1024
                },
                "name" : {
                  "type" : "keyword",
                  "ignore_above" : 1024
                },
                "type" : {
                  "type" : "keyword",
                  "ignore_above" : 1024
                },
                "version" : {
                  "type" : "keyword",
                  "ignore_above" : 1024
                }
              }
            },
            "city_name" : {
              "type" : "keyword"
            },
            "container" : {
              "properties" : {
                "id" : {
                  "type" : "keyword",
                  "ignore_above" : 1024
                },
                "image" : {
                  "properties" : {
                    "name" : {
                      "type" : "keyword",
                      "ignore_above" : 1024
                    },
                    "tag" : {
                      "type" : "keyword",
                      "ignore_above" : 1024
                    }
                  }
                },
                "labels" : {
                  "type" : "object"
                },
                "name" : {
                  "type" : "keyword",
                  "ignore_above" : 1024
                },
                "runtime" : {
                  "type" : "keyword",
                  "ignore_above" : 1024
                }
              }
            },
            "continent_code" : {
              "type" : "keyword"
            },
            "country_code2" : {
              "type" : "keyword"
            },
            "country_code3" : {
              "type" : "keyword"
            },
            "country_name" : {
              "type" : "keyword"
            },
            "dma_code" : {
              "type" : "keyword"
            },
            "ip" : {
              "type" : "keyword"
            },
            "latitude" : {
              "type" : "float"
            },
            "location" : {
              "type" : "geo_point"
            },
            "longitude" : {
              "type" : "float"
            },
            "postal_code" : {
              "type" : "keyword"
            },
            "region_code" : {
              "type" : "keyword"
            },
            "region_name" : {
              "type" : "keyword"
            },
            "timezone" : {
              "type" : "keyword"
            },
            "user_agent" : {
              "properties" : {
                "device" : {
                  "properties" : {
                    "name" : {
                      "type" : "keyword",
                      "ignore_above" : 1024
                    }
                  }
                },
                "name" : {
                  "type" : "keyword",
                  "ignore_above" : 1024
                },
                "original" : {
                  "type" : "keyword",
                  "ignore_above" : 1024,
                  "fields" : {
                    "text" : {
                      "type" : "text"
                    }
                  }
                },
                "os" : {
                  "properties" : {
                    "family" : {
                      "type" : "keyword",
                      "ignore_above" : 1024
                    },
                    "full" : {
                      "type" : "keyword",
                      "ignore_above" : 1024,
                      "fields" : {
                        "text" : {
                          "type" : "text"
                        }
                      }
                    },
                    "kernel" : {
                      "type" : "keyword",
                      "ignore_above" : 1024
                    },
                    "name" : {
                      "type" : "keyword",
                      "ignore_above" : 1024,
                      "fields" : {
                        "text" : {
                          "type" : "text"
                        }
                      }
                    },
                    "platform" : {
                      "type" : "keyword",
                      "ignore_above" : 1024
                    },
                    "type" : {
                      "type" : "keyword",
                      "ignore_above" : 1024
                    },
                    "version" : {
                      "type" : "keyword",
                      "ignore_above" : 1024
                    }
                  }
                },
                "version" : {
                  "type" : "keyword",
                  "ignore_above" : 1024
                }
              }
            }
          }
        },
        "host" : {
          "properties" : {
            "name" : {
              "type" : "keyword"
            }
          }
        },
        "input" : {
          "properties" : {
            "type" : {
              "type" : "keyword"
            }
          }
        },
        "instance" : {
          "type" : "keyword"
        },
        "level" : {
          "type" : "keyword"
        },
        "line" : {
          "type" : "integer",
          "doc_values" : false
        },
        "log" : {
          "properties" : {
            "file" : {
              "properties" : {
                "path" : {
                  "type" : "keyword"
                }
              }
            },
            "flags" : {
              "type" : "keyword"
            },
            "offset" : {
              "type" : "long"
            }
          }
        },
        "logger" : {
          "type" : "keyword"
        },
        "login" : {
          "type" : "keyword"
        },
        "logmessage" : {
          "type" : "text",
          "index" : false
        },
        "logmessage_tk" : {
          "type" : "text",
          "analyzer" : "logmessage_analyzer"
        },
        "major" : {
          "type" : "keyword"
        },
        "message" : {
          "type" : "text"
        },
        "method" : {
          "type" : "keyword"
        },
        "minor" : {
          "type" : "keyword"
        },
        "name" : {
          "type" : "keyword"
        },
        "os" : {
          "type" : "keyword"
        },
        "os_full" : {
          "type" : "keyword"
        },
        "os_major" : {
          "type" : "keyword"
        },
        "os_minor" : {
          "type" : "keyword"
        },
        "os_name" : {
          "type" : "keyword"
        },
        "os_patch" : {
          "type" : "keyword"
        },
        "os_version" : {
          "type" : "keyword"
        },
        "patch" : {
          "type" : "keyword"
        },
        "path" : {
          "type" : "keyword"
        },
        "pod_ip" : {
          "type" : "ip"
        },
        "request_path" : {
          "type" : "keyword"
        },
        "request_path_tk" : {
          "type" : "text",
          "analyzer" : "request_path_analyzer",
          "search_analyzer" : "keyword"
        },
        "request_verb" : {
          "type" : "keyword"
        },
        "requestid" : {
          "type" : "keyword"
        },
        "rootcause" : {
          "type" : "keyword"
        },
        "rootcause_tk" : {
          "type" : "text",
          "analyzer" : "java_package_analyzer",
          "search_analyzer" : "keyword"
        },
        "rootcausepackage" : {
          "type" : "keyword"
        },
        "rootcausepackage_tk" : {
          "type" : "text",
          "analyzer" : "java_package_analyzer",
          "search_analyzer" : "keyword"
        },
        "rootmessage" : {
          "type" : "text",
          "index" : false
        },
        "rootmessage_tk" : {
          "type" : "text",
          "analyzer" : "logmessage_analyzer"
        },
        "sessionid" : {
          "type" : "keyword"
        },
        "stack" : {
          "type" : "keyword"
        },
        "stack_name" : {
          "type" : "keyword"
        },
        "stack_service" : {
          "type" : "keyword"
        },
        "stacktrace" : {
          "type" : "text",
          "index" : false
        },
        "stream" : {
          "type" : "keyword"
        },
        "tags" : {
          "type" : "keyword"
        },
        "thread" : {
          "type" : "keyword"
        },
        "timestamp" : {
          "type" : "date_nanos"
        },
        "type" : {
          "type" : "keyword"
        },
        "version" : {
          "type" : "keyword"
        }
      }
    }
  }
}

Does anyone have an idea about where is my mistake?

I found the issue: conflict mapping.
Target index name is java-history and index template for daily java index is applied to “java-*” indexes.

Changed the target index to “history-java” to avoid such conflict.