From inside a plugin, I need to get a grip of what's the absolute path of elasticsearch.yml.
motivation: I need my plugin's settings file to sit side-by-side in the config dir beside elasticsearch.yml
I can understand what's the path of the ES_HOME like this:
System.getProperty("es.path.home");
But this doesn't tell you much about the config directory is going to be. And that's because there is a command line option, namely -Epath.conf=/x/y/z that can move the config directory anywhere else and the plugin will know nothing about it.
Currently there is no Java API to get the "argv" command line arguments array of the current process (except for the JVM options).
So: How to get the value of -Epath.conf from a plugin?
You didn't mention which version of elasticsearch you are writing this plugin for. Assuming that this is something recent (5.x or above) you can get this information from Environment, which is passed as one of the parameters to the createComponents calls.
Apache, Apache Lucene, Apache Hadoop, Hadoop, HDFS and the yellow elephant
logo are trademarks of the
Apache Software Foundation
in the United States and/or other countries.