Inputs.kafka_consumer can't set topic name as tag using topic_tag = ""

I’m using inputs.kafka_consumer to read data from two topics and would like to use the kafka topic name as a tag to differentiate the data in my single elasticsearch index. I’ve tried this, but I don’t see the tag in my index:

  ## Kafka brokers.
  brokers = [{{ sa_kafka_brokers }}]
  ## Topics to consume.
  topics = [{{ kafka_topics_ucv }}]
  ## When set this tag will be added to all metrics with the topic as the value.
  topic_tag = ""

Replying to myself as I got an answer via GitHub:

It seems you need to put a string inside the “” to name the tag, not the value. I misunderstood the documentation and thought that if you put something inside the “” it would add a static tag.

So when I set topic_tag = “topic_name” I got:

"tag": {
      "agent_host": "my_agent_hostname",
      "host": "my_host",
      "source": "my_source",
      "topic_name": "metrics-topic-name"