Create/Cycle index set to specific ID?

@tmacgbay Thank you for the big push for just giving it a try.

Based on your and @gmith’s experiments I tried to just create the desired name like this:

curl -X PUT 'elast-server:9200/logs_r03m_376' -H 'Content-Type:application/json' -d '
{
	"settings":{
		"number_of_shards":"4",
		"number_of_replicas":"0"
	}
}
'

and voila, Graylog switched to the new name automatically. Cool!

-----------------------------------------------------------------

So the revised how-to is:

  • in Graylog create index set logs_r03m so elastic would have logs_r03m_0
  • in Elastic create index set logs_r03m_736 - see curl call above
  • Graylog automatically switches to the new index and starts writing to it
  • Finished! You can remove the _0 version if you want… or you can let retention policy do it.

Or, just to be on the safe side, create logs_r03m_735 and then rotate active write index.
That way logs_r03m_736 will be guaranteed to be created exactly as Graylog wants it.

-----------------------------------------------------------------

PS: It even works the other way. If I delete logs_r03m_736, graylog automatically switches to logs_r03m_0 and starts writing there (NOT RECOMMENDED!). That explain why simply rotating write index was enough for fixing Need to clear elastic search after upgrade to version 4

1 Like