adding some command line options for starting es as well as some refactoring of the es resource for reuse