Filebeat redis module not working

Hi, I am using redis module from filebeat to monitor a redis docker container. (using docker image docker.elastic.co/beats/filebeat:7.13.1)

# enable redis module
filebeat.modules:
  - module: redis
# redis container
filebeat.autodiscover:
  providers:
    - type: docker
      templates:
        - condition:
            contains:
              docker.container.name: redis
          config:
            - module: redis
              log:
                enabled: true
              slowlog:
                enabled: true
                var.hosts: ["redis:6379"]

I can see from the logs that module is trying to access the localhost (127.0.0.1:6379). I am using docker swarm and attaching to the overlay network. The name of the container redis (named redis) should be resolved by the docker. I am not sure why it is trying to access localhost when I told it to connect to "redis:6379"

...
beats_filebeat.1.obeqtflii3cs@prod-app01    | 2021-07-17T00:25:31.018Z	ERROR	harvester/registry.go:98	Error running input: error receiving slowlog data: dial tcp 127.0.0.1:6379: connect: connection refused
....
beats_filebeat.1.obeqtflii3cs@prod-app01    | 2021-07-17T00:25:31.133Z	INFO	log/input.go:157	Configured paths: [/var/log/redis/redis-server.log*]
beats_filebeat.1.obeqtflii3cs@prod-app01    | 2021-07-17T00:25:31.133Z	WARN	[cfgwarn]	redis/input.go:52	EXPERIMENTAL: Redis slowlog input is enabled.
beats_filebeat.1.obeqtflii3cs@prod-app01    | 2021-07-17T00:25:31.135Z	INFO	log/input.go:157	Configured paths: [/var/log/redis/redis-server.log*]
beats_filebeat.1.obeqtflii3cs@prod-app01    | 2021-07-17T00:25:31.135Z	WARN	[cfgwarn]	redis/input.go:52	EXPERIMENTAL: Redis slowlog input is enabled.
...
beats_filebeat.1.obeqtflii3cs@prod-app01    | 2021-07-17T00:25:41.020Z	ERROR	harvester/registry.go:98	Error running input: error receiving slowlog data: dial tcp 127.0.0.1:6379: connect: connection refused
beats_filebeat.1.obeqtflii3cs@prod-app01    | 2021-07-17T00:25:51.021Z	ERROR	harvester/registry.go:98	Error running input: error receiving slowlog data: dial tcp 127.0.0.1:6379: connect: connection refused
beats_filebeat.1.obeqtflii3cs@prod-app01    | 2021-07-17T00:26:01.022Z	ERROR	harvester/registry.go:98	Error running input: error receiving slowlog data: dial tcp 127.0.0.1:6379: connect: connection refused

Is this something, I am doing wrong or it is a bug in the filebeat redis module ?