How to call variables?

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.

<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

</{"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
>

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