61

I have installed elasticsearch with brew install elasticsearch. My plugins seem to reside in /usr/local/Cellar/elasticsearch/0.19.8/plugins. With cat $( which plugin ) I see a ES_HOME variable that contains the correct path.

Is there a way to ask elastic for ES_HOME or the plugins directory?


EDIT

What I am looking for is the directory used by the plugin executable to install the plugins when I do plugin -install something. I want to use that path in a script to fire up elastic search.

Kostas
  • 8,356
  • 11
  • 47
  • 63
  • Being an old question, be mindful that instillation using Elasticsearch plugin has been deprecated since ES 5. In other words, all new/X-Pack features come bundled from version 5.0 onward. – CubeBot88 Mar 29 '19 at 09:01

4 Answers4

114

To find your elasticsearch home directory & install plugin(s) follow these steps below.

Locate your home directory ( Look for Settings -> Path -> Home for value )

$ curl "localhost:9200/_nodes/settings?pretty=true"

Goto Location (Example settings.path.home value: /usr/local/Cellar/elasticsearch/1.5.0)

$ cd /usr/local/Cellar/elasticsearch/1.5.0

Install Plugin (Example plugin: mobz/elasticsearch-head)

$ bin/plugin -install mobz/elasticsearch-head
Tyler Rafferty
  • 3,391
  • 4
  • 28
  • 37
  • 1
    This is an oooold question. Thanks for the complete answer though. – Kostas Apr 08 '15 at 07:35
  • 4
    just to leave it here, this helps for me using the APT method installing [elastic search via repository](https://www.elastic.co/guide/en/elasticsearch/reference/2.x/setup-repositories.html) `sudo /usr/share/elasticsearch/bin/plugin install mobz/elasticsearch-head` – DavidKahnt Mar 03 '16 at 21:35
  • `curl: (7) Failed to connect to localhost port 9200: Connection refused` – Green Mar 06 '18 at 09:30
  • https://stackoverflow.com/questions/31677563/connection-refused-error-on-elastic-search – Tyler Rafferty Mar 06 '18 at 16:37
33

I used this command:

$ curl "localhost:9200/_nodes?pretty=true&settings=true"

Check next setting: nodes - settings - path - plugins and use it as your plugins directory.

juaniiton1
  • 739
  • 1
  • 5
  • 11
19

I had the same problem as you and I was able to locate the ES_HOME directory by following @imotiv's suggestion.

Simply call PATH_TO_SERVER:9200/_cluster/nodes?settings=true&pretty=true

Therein you'll see the path.home entry. That is your ES working directory.

Once you locate your ElasticSearch home folder, in my case /usr/share/elasticsearch, cd down to that location.

Once there, you could simply run bin/plugin -install elasticsearch/elasticsearch-analysis-phonetic/1.3.0 and it will automatically do the rest for you.

Hope this helps.

swatkat7
  • 301
  • 2
  • 4
7

Not totally sure what you are trying to achieve, but hopefully this will help. There are a couple of way to find the plugins directory for elasticsearch. You can set plugins: TRACE in the logging.yml file, it will cause elasticsearch to log the full path of plugins that it's loading. You can also execute

$ curl "localhost:9200/_cluster/nodes?settings=true&pretty=true"

to check the current settings. Elasticsearch is using location specified in the path.plugins settings to load plugins. If path.plugins is not set, it will use plugins directory in the directory specified by the path.home setting.

imotov
  • 28,277
  • 3
  • 90
  • 82
  • I am sorry but upon reading my question again it seems I missed a critical point: I am looking for the directory that the **plugin** executable is using by default to install the plugins when I do `plugin -install something`. I want to use that path in a script to fire up elastic search. – Kostas Aug 16 '12 at 06:34
  • 1
    This is non-trivial. If you want to do it in a clean way, you will need to load several config files and check several environment settings. I think the simplest way would be to write a small java app that would load settings and then get pluginsFile from `org.elasticsearch.env.Environment`. Basically it would be the first 2 lines of the main method of `org.elasticsearch.plugins.PluginManager` except instead of checking that path exists, it would return it to the caller. – imotov Aug 16 '12 at 14:46