0

My goal is to rename an index named foo, so it falls into an index pattern named bar, which includes indices named bar*. I do not want to reindex the whole index so its rather large, for it would take up massive amounts of resources.

I see Elasticsearch rename index , as a possible solution, but if I add an alias called "bar-0001" to the index named "foo", would "foo" fall into the the "bar*" index pattern?

Or could I add the index named foo to the index pattern bar?

For reference, the index is about 5GB with ~2.5 million docs.

Thanks

ColeGulledge
  • 393
  • 1
  • 2
  • 12

1 Answers1

0

I believe alias resolve your problem.

Example

Create three indices: bar_01, bar_02, foo_01

PUT bar_01

PUT bar_02

PUT foo_01

Add alias bar_alais to indice foo_01

POST _aliases
{
  "actions": [
    {
      "add": {
        "index": "foo_01",
        "alias": "bar_alias"
      }
    }
  ]
}

Get all indice start with bar

GET bar*

Return indices bar_01, 02 and foo_01

{
  "bar_01": {
    "aliases": {},
  ...
    }
  },
  "bar_02": {
    "aliases": {},
  ...
    }
  },
  "foo_01": {
    "aliases": {
      "bar_alias": {}
    },
....
  }
}
rabbitbr
  • 2,991
  • 2
  • 4
  • 17
  • Yeah, that's what I thought as well, and you are correct, when I run GET bar*, I see foo, but when I go to the discover tab, and look for my index "foo" with bar_alias in the index pattern bar* it is not found.. really strange. – ColeGulledge Jan 07 '23 at 01:51
  • oo perhaps I need to refresh the index pattern! – ColeGulledge Jan 07 '23 at 01:52
  • You can put alias in all índices bar and create a pattern with alias. – rabbitbr Jan 07 '23 at 02:11
  • ehhh , there are hundreds of people utilizing this pattern, that have visualizations / saved queries attached to the original patterns unique id.. so I really can't create a new index pattern.. – ColeGulledge Jan 07 '23 at 02:16