# Boostrap Elasticsearch Index Template

**URL:** <https://discuss.elastic.co/t/boostrap-elasticsearch-index-template/337377>\
**Category:** Elasticsearch\
**Tags:** ilm-index-lifecycle-management\
**Created:** [July 1, 2023, 3:15pm UTC](https://discuss.elastic.co/t/boostrap-elasticsearch-index-template/337377 "2023-07-01T15:15:49Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![mibeyki](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mibeyki/32/106771_2.png) [@mibeyki](https://discuss.elastic.co/u/mibeyki)\
**Post date:** [July 1, 2023, 3:15pm UTC](https://discuss.elastic.co/t/boostrap-elasticsearch-index-template/337377/1 "2023-07-01T15:15:49Z")

</div>

Hello,

I am trying to configure Filebeat to write data to a custom index like my-index-{now/d}-000001 (using filebeat-8.8.1 and Elastcicsearch 8.8.1).

I have followed this [guide](https://www.elastic.co/guide/en/elasticsearch/reference/8.8/getting-started-index-lifecycle-management.html#ilm-gs-create-policy); But when i try to bootstrap the index using;

```auto
PUT my-index-%7Bnow%2Fd%7D-000001
{ 
  "aliases": {
    "my-index": {}
  }
}

```

I get the error below;

```auto
{
  "error": {
    "root_cause": [
      {
        "type": "invalid_index_name_exception",
        "reason": """Invalid index name [my-index-{now/d}-000001], must not contain the following characters ['\',' ','"','<','*','?','>','|',',','/']""",
        "index_uuid": "_na_",
        "index": "my-index-{now/d}-000001"
      }
    ],
    "type": "invalid_index_name_exception",
    "reason": """Invalid index name [my-index-{now/d}-000001], must not contain the following characters ['\',' ','"','<','*','?','>','|',',','/']""",
    "index_uuid": "_na_",
    "index": "my-index-{now/d}-000001"
  },
  "status": 400
}

```

Is there something i am missing?

---

<div class="post-metadata">

**Author:** ![stephenb](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/stephenb/32/40856_2.png) [@stephenb](https://discuss.elastic.co/u/stephenb)\
**Post date:** [July 1, 2023, 3:28pm UTC](https://discuss.elastic.co/t/boostrap-elasticsearch-index-template/337377/2 "2023-07-01T15:28:17Z")

</div>

Hi @mibeyki

I think this will work for you, I can't remember right off hand the specifics but the `<>` tell it to interpret, that used to be in the docs somewhere but can't find it right now

```auto
PUT <my-index-%7Bnow%2Fd%7D-000001>
{ 
  "aliases": {
    "my-index": {}
  }
}

# Result 
{
  "acknowledged": true,
  "shards_acknowledged": true,
  "index": "my-index-2023.07.01-000001"
}

POST my-index/_rollover

{
  "acknowledged": true,
  "shards_acknowledged": true,
  "old_index": "my-index-2023.07.01-000001",
  "new_index": "my-index-2023.07.01-000002",
  "rolled_over": true,
  "dry_run": false,
  "conditions": {}
}

```

EDIT Funny I just found it [here](https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-rollover-index.html#roll-over-index-alias-with-write-index)

The more correct way...

```auto
PUT %3Cmy-index-%7Bnow%2Fd%7D-000001%3E
{
  "aliases": {
    "my-alias": {
      "is_write_index": true
    }
  }
}

```

---

<div class="post-metadata">

**Author:** ![mibeyki](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mibeyki/32/106771_2.png) [@mibeyki](https://discuss.elastic.co/u/mibeyki)\
**Post date:** [July 1, 2023, 3:35pm UTC](https://discuss.elastic.co/t/boostrap-elasticsearch-index-template/337377/3 "2023-07-01T15:35:56Z")

</div>

> [@stephenb](#):
>
> ```auto
> PUT %3Cmy-index-%7Bnow%2Fd%7D-000001%3E
> {
> "aliases": {
> "my-alias": {
> "is_write_index": true
> }
> }
> }
> 
> ```

Fantastic! 😄 thank you @stephenb. Much appreciated your quick response and solution on this!

---

<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:** [July 29, 2023, 3:35pm UTC](https://discuss.elastic.co/t/boostrap-elasticsearch-index-template/337377/4 "2023-07-29T15:35:58Z")

</div>

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