Cant't change index name in metricbeat

Hello,

I want to change the index name for the metricbeat.

For that I try to change index name in Outputs of metricbeat.yml and metricbeat.reference.yml file as shown below :

setup.template.name: "test-"
setup.template.pattern: "test-*"

output.elasticsearch:
  # Array of hosts to connect to.
  hosts: ["localhost:9200"]
  index: "test-"

But the index keeps the default name.

Is there a problem in my configuration ?

7.x is setup.ilm.enabled: auto, so setup.ilm.rollover_alias probably needs to be set. You'll have to run metricbeat setup again and restart metricbeat.