Duplicate indexes are being created

Hello there,

I would like to ask for help with my issue.

Opensearch 1.2.0

Because we are frequently running out of shards (4000) I have decided to change

index creating a setting to monthly base.

So I change config in Logstash to

elasticsearch {

  hosts => ["https://localhost:9200"]

  ssl => true

  ssl_certificate_verification => true

  cacert => "/home/kibana/logstash/config/root-ca.pem"

  index => "%{index_replace}-%{+YYYY.MM}"    (originaly was YYYY.MM.DD.)

  document_id => "%{[@metadata][document_id]}"

  document_type => "_doc"

  template_name => "default"

  template => "/home/kibana/logstash/config/templates/default.json"

  user => Logstash

  password => "***********"




Now, however, I get duplicates being that there is a Month index 2022.04 and at the same time 2022.04.26. I can see that documents/size etc count matches the month index when I sum up each day.

Why does this happened ?