# How to call variables?

**URL:** <https://discuss.elastic.co/t/how-to-call-variables/312809>\
**Category:** Elasticsearch\
**Created:** [August 24, 2022, 12:22pm UTC](https://discuss.elastic.co/t/how-to-call-variables/312809 "2022-08-24T12:22:39Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![ToonKnight](https://avatars.discourse-cdn.com/v4/letter/t/3e96dc/32.png) [@ToonKnight](https://discuss.elastic.co/u/ToonKnight)\
**Post date:** [August 24, 2022, 12:22pm UTC](https://discuss.elastic.co/t/how-to-call-variables/312809/1 "2022-08-24T12:22:39Z")

</div>

Hey all,

I made a script that would create a jew index, as soon as the currently running one reaches a space limit.

I can't share the script but basically, I have two variables at the start that is could newindex and runningindex, the script works fine but as soon I try to give the new index an alias then I have issues

I wanted to put variables that I made in the command below so that I can then POST automatically  
but it won't see my variables.

can someone please let me know how I can call my variables in the command.

```auto
<curl -X POST http://localhost:9200/_aliases -H 'Content-Type: application/json' -d'

{
  "actions": [
    {
      "add": {
        "index": "$newindex",
        "alias": "events"
      }
    },
    {
      "remove": {
        "index": "$runningindex",
        "alias": "events-active"
      }
    },
    {
      "add": {
        "index": "$newindex",
        "alias": "events-active"
      }
    }
  ]
}
>

```

The error

```auto
</{"acknowledged":true,"shards_acknowledged":true,"index":"events-2022-08-24"}{"error":{"root_cause":[{"type":"index_not_found_exception","reason":"no such index [$newindex]","resource.type":"index_or_alias","resource.id":"$newindex","index_uuid":"_na_","index":"$newindex"}],"type":"index_not_found_exception","reason":"no such index [$newindex]","resource.type":"index_or_alias","resource.id":"$newindex","index_uuid":"_na_","index":"$newindex"},"status":404}DONE
>

```

---

<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 21, 2022, 12:23pm UTC](https://discuss.elastic.co/t/how-to-call-variables/312809/2 "2022-09-21T12:23:06Z")

</div>

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