Hi,
Currently, I am deleting docs using DSL queries that are older than 10 days. I am having a 1P shard on a single node with No replicas or nodes for this env.
DSL query-
POST index_name/_delete_by_query
{
 "query": {
   "range": {
     "@timestamp": {
       "lte": "now-10d"
      }
    }
  }
}
As per my understanding of ILM policy, an index is getting deleted instead of docs in an index, and a new index is created.
As I am putting ILM policy in newly created index, I need to confirm below configurations to work.
Logs are getting ingested from logstash.I guess the output filter config needs to be changed as below.
output {
      elasticsearch {
       host => <>
        ilm_rollover_alias => "index_name"
        ilm_pattern => "000001"
        ilm_policy => "new_policy"
        }
    }
Setting ILM policy
Step1-
PUT _ilm/policy/new_policy
{
    "policy": {
        "phases": {
            "hot": {
                "min_age": "0ms",
                "actions": {
                    "rollover": {
                        "max_size": "40gb"
                    },
                    "set_priority": {
                        "priority": 100
                    }
                }
            },
              "delete": {
                "min_age": "10d",
                "actions": {
                    "delete": {}
                }
            }
       
        }
     }
}
}
2 nd step creating template-
PUT _template/new_index_template
{
  "index_patterns": [
    "index_name-*"
  ],
    "settings": {
      "number_of_shards": 1,
      "number_of_replicas": 0
      "index.lifecycle.name": "new_policy",
      "index.lifecycle.rollover_alias": "new_index"
    },
    "mappings": {<....>
   }
}
3 rd step-
PUT index-name-000001
{
  "aliases": {
    "new_index": {
      "is_write_index": true
    }
  }
}
            
Manage existing indices | Elasticsearch Guide [7.15] | Elastic
Data rollover in Elasticsearch