script for index management in elasticsearch