# Elasticsearch date-index-name-processor when set to week, always create w52

**URL:** <https://discuss.elastic.co/t/elasticsearch-date-index-name-processor-when-set-to-week-always-create-w52/312255>\
**Category:** Elasticsearch\
**Tags:** ingest-pipeline\
**Created:** [August 17, 2022, 8:19am UTC](https://discuss.elastic.co/t/elasticsearch-date-index-name-processor-when-set-to-week-always-create-w52/312255 "2022-08-17T08:19:03Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ioxxy](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ioxxy/32/109760_2.png) [@Ioxxy](https://discuss.elastic.co/u/Ioxxy)\
**Post date:** [August 17, 2022, 8:19am UTC](https://discuss.elastic.co/t/elasticsearch-date-index-name-processor-when-set-to-week-always-create-w52/312255/1 "2022-08-17T08:19:03Z")

</div>

Hello there,

I'm using Elasticsearch v7.16.2.  
I'm working for a client, and it's impossible for them to change the elastic output to change the index name. My goal is to change the daily format to a weekly one.

To do so, I'm using the ingest pipeline date-index-name processor.  
The problem is, when I simulate / test the pipeline I got what I want, but when I apply it, the week is always week number 52.  
Do you have an explaination for this ?

The test :

```auto
POST _ingest/pipeline/_simulate
{
  "pipeline" :
  {
    "description": "test",
    "processors" : [
  {
      "date_index_name": {
        "field": "@timestamp",
        "date_rounding": "M",
        "index_name_prefix": "index-cagnottage-",
        "index_name_format": "yyyy-MM",
        "if": "ctx.process == 'SECURITY'"
      }
    },
    {
      "date_index_name": {
        "field": "@timestamp",
        "date_rounding": "w",
        "index_name_prefix": "kubernetes_cluster-",
        "index_name_format": "yyyy-ww"
      }
    }
]
  },
  "docs": [
    {
      "_source": {
        "@timestamp": "2022-08-17T07:25:57.530Z"
      }
    }
  ]
}

```

Test result :

```auto
{
  "docs" : [
    {
      "doc" : {
        "_index" : "<kubernetes_cluster-{2022-33||/w{yyyy-ww|UTC}}>",
        "_type" : "_doc",
        "_id" : "_id",
        "_source" : {
          "@timestamp" : "2022-08-17T07:25:57.530Z"
        },
        "_ingest" : {
          "timestamp" : "2022-08-17T08:08:17.311457476Z"
        }
      }
    }
  ]
}

```

Reality result (done with the same @timestamp as the test) :

```auto
kubernetes_cluster-2021-52

```

Note : The first date\_index\_name to root few documents out of the main index is working fine.

Note 2 : When date rounding is set to w, I get year 2021,  
when I set date rouding to m, I get year 2022, complete non sense to me...

Thank you for your help.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [September 14, 2022, 8:19am UTC](https://discuss.elastic.co/t/elasticsearch-date-index-name-processor-when-set-to-week-always-create-w52/312255/2 "2022-09-14T08:19:09Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
