Hello @gaobinlong , Thank you so much for the suggestion. I tried specifying index parameter as my-index-name-%{yyyy.MM.dd.HH} in data prepper and it’s showing while trying to create index in OpenSearch but I need to create the index manually specifying the timestamp field explicitly as below:
PUT my-index-name-2023.09.06.06
{
"mappings": {
"properties": {
"log_time": {
"type": "date",
"format": "[dd/MMM/yyyy:HH:mm:ss.SSS]"
},
"bytes": {
"type": "integer"
}
}
}
}
My index policy is like below:
{
"policy_id": "index_rotation_everhour",
"description": "Hot/Warm/Delete example",
"last_updated_time": 1693976276550,
"schema_version": 18,
"error_notification": {
"channel": {
"id": "SVGfG4oBbMQGkbGGjItQ"
},
"message_template": {
"source": "Index {{ctx.index}} failed",
"lang": "mustache"
}
},
"default_state": "hot",
"states": [
{
"name": "hot",
"actions": [
{
"retry": {
"count": 3,
"backoff": "exponential",
"delay": "1m"
},
"rollover": {
"min_index_age": "2h",
"min_primary_shard_size": "5gb"
}
}
],
"transitions": [
{
"state_name": "warm",
"conditions": {
"min_rollover_age": "1h"
}
}
]
},
{
"name": "warm",
"actions": [
{
"retry": {
"count": 3,
"backoff": "exponential",
"delay": "1m"
},
"replica_count": {
"number_of_replicas": 0
}
}
],
"transitions": [
{
"state_name": "delete",
"conditions": {
"min_rollover_age": "3h"
}
}
]
},
{
"name": "delete",
"actions": [
{
"retry": {
"count": 3,
"backoff": "exponential",
"delay": "1m"
},
"notification": {
"channel": {
"id": "SVGfG4oBbMQGkbGGjItQ"
},
"message_template": {
"source": "Index: {{ctx.index}} Deleted",
"lang": "mustache"
}
}
}
],
"transitions": []
}
],
"ism_template": [
{
"index_patterns": [
"my-index-name-*"
],
"priority": 100,
"last_updated_time": 1693934657602
}
]
}
For the first time, I created index my-index-name-2023.09.06.06 manually and I was expecting the next index my-index-name-2023.09.06.07 will be created automatically because of index policy but it’s not happening. While trying to create manually it shows my-index-name-2023.09.06.07 was available in index pattern but it does not have timestamp (log_time in my case) and it looks like it’s been already created without timestamp as it’s not asking me to select timestamp but if it was already created it should be available on the discover menu but it’s not there. I will be very grateful if you have any suggestion on this.
Thanks for your help.