﻿---
title: elasticsearch-plugin
description: The elasticsearch-plugin command installs, lists, and removes Elasticsearch plugins. A plugin is only available to the node it was installed on, so run...
url: https://www.elastic.co/elastic/docs-builder/docs/4492/reference/elasticsearch/command-line-tools/elasticsearch-plugin
products:
  - Elasticsearch
applies_to:
  - Self-managed Elastic deployments: Generally available
---

# elasticsearch-plugin
The `elasticsearch-plugin` command installs, lists, and removes [Elasticsearch plugins](https://www.elastic.co/elastic/docs-builder/docs/4492/reference/elasticsearch/plugins).

## Synopsis

```shell
bin/elasticsearch-plugin
( [list]
| [install [-b, --batch] (<plugin_id>)+]
| [remove [-p, --purge] (<plugin_id>)+]
) [-h, --help] ([-s, --silent] | [-v, --verbose])
```


## Description

A plugin is only available to the node it was installed on, so run this command on every node in the cluster, then restart each node to load the plugin.
Plugins are installed into the node's `plugins` directory, whose location depends on the Elasticsearch package you installed:
- [Directory layout of `.tar.gz` archives](https://docs-v3-preview.elastic.dev/elastic/docs-builder/docs/4492/deploy-manage/deploy/self-managed/install-elasticsearch-from-archive-on-linux-macos#targz-layout)
- [Directory layout of Windows `.zip` archives](https://docs-v3-preview.elastic.dev/elastic/docs-builder/docs/4492/deploy-manage/deploy/self-managed/install-elasticsearch-with-zip-on-windows#windows-layout)
- [Directory layout of Debian package](https://docs-v3-preview.elastic.dev/elastic/docs-builder/docs/4492/deploy-manage/deploy/self-managed/install-elasticsearch-with-debian-package#deb-layout)
- [Directory layout of RPM](https://docs-v3-preview.elastic.dev/elastic/docs-builder/docs/4492/deploy-manage/deploy/self-managed/install-elasticsearch-with-rpm#rpm-layout)

Every plugin records the Elasticsearch version it was built against, and Elasticsearch checks that version both when you install the plugin and when the node starts. A node refuses to start if the check fails. Most plugins must match the running version exactly, so you have to install a new build for every upgrade, including patch releases. Text analysis plugins built against the [stable plugin API](https://www.elastic.co/elastic/docs-builder/docs/4492/extend/elasticsearch/creating-stable-plugins) only need to match the major version, so one artifact stays valid across upgrades within that major version, provided you do not downgrade a node below the version the plugin was built against.
To prevent a node from starting when a plugin you depend on is missing, use the [`plugin.mandatory`](/elastic/docs-builder/docs/4492/reference/elasticsearch/configuration-reference/node-settings#mandatory-plugins) setting.
<important>
  If Elasticsearch was installed using the deb or rpm package, then run `/usr/share/elasticsearch/bin/elasticsearch-plugin` as `root` so it can write to the appropriate files on disk. Otherwise, run `bin/elasticsearch-plugin` as the user that owns all of the Elasticsearch files.
</important>

<note>
  If you run Elasticsearch using the [official Elasticsearch Docker images](https://www.docker.elastic.co/), manage plugins with the declarative [`elasticsearch-plugins.yml` configuration file](https://docs-v3-preview.elastic.dev/elastic/docs-builder/docs/4492/deploy-manage/plugins-and-custom-configuration-files/self-managed/manage-plugins#self-managed-plugins-docker) instead. The `install` and `remove` commands are disabled when that file is present.
</note>


## Parameters

<definitions>
  <definition term="-b, --batch">
    Used with the `install` command. Skips the confirmation prompt shown for plugins that request privileges beyond those granted by default, automatically granting all requested permissions. The command detects when it is not being run from a console and enables batch mode for you; specify this parameter when that detection fails, such as when installing from an automation script.
  </definition>
  <definition term="-h, --help">
    Returns all of the command parameters.
  </definition>
  <definition term="install (<plugin_id>)+">
    Installs one or more plugins. Each `<plugin_id>` can be the name of a core plugin or a custom location, as described in [Plugin IDs](#elasticsearch-plugin-ids). Installing several plugins in one invocation is treated as a single transaction, so either all of them are installed, or none are if any one installation fails.
  </definition>
  <definition term="list">
    Lists the plugins installed on this node. To find out which plugins are installed on every node in the cluster, use the [node info API](https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-nodes-info) instead.
  </definition>
  <definition term="-p, --purge">
    Used with the `remove` command. Deletes the plugin's configuration files along with the plugin. Configuration files are preserved by default so that they survive a plugin upgrade. You can also run `remove --purge` for a plugin you have already removed, to clear configuration files it left behind.
  </definition>
  <definition term="remove (<plugin_id>)+">
    Removes one or more plugins. After removing a Java plugin, restart the node to complete the removal. You can also remove a plugin manually by deleting its directory under `plugins/`.
  </definition>
  <definition term="-s, --silent">
    Turns off all output, including the progress bar.
  </definition>
  <definition term="-v, --verbose">
    Outputs more debug information.
  </definition>
</definitions>


## Plugin IDs

The `install` command accepts the following forms of `<plugin_id>`.
<definitions>
  <definition term="Core plugin name">
    Install a core plugin by name. The command installs the version matching your Elasticsearch version and shows a progress bar while downloading.
    ```shell
    sudo bin/elasticsearch-plugin install analysis-icu
    ```
  </definition>
  <definition term="URL">
    Install a plugin from any valid URL. The plugin name is taken from its descriptor rather than the URL.
    ```shell
    sudo bin/elasticsearch-plugin install [url]
    ```
  </definition>
  <definition term="Unix file system">
    To install a plugin from your local file system at `/path/to/plugin.zip`:
    ```shell
    sudo bin/elasticsearch-plugin install file:///path/to/plugin.zip
    ```
  </definition>
  <definition term="Windows file system">
    To install a plugin from your local file system at `C:\path\to\plugin.zip`:
    ```shell
    bin\elasticsearch-plugin install file:///C:/path/to/plugin.zip
    ```
    <note>
      Any path that contains spaces must be wrapped in quotes!
    </note>
    <note>
      If you are installing a plugin from the filesystem the plugin distribution must not be contained in the `plugins` directory for the node that you are installing the plugin to or installation will fail.
    </note>
  </definition>
  <definition term="HTTP">
    To install a plugin from an HTTP URL:
    ```shell
    sudo bin/elasticsearch-plugin install <EXAMPLE_PLUGIN_HOST_URL>/plugin.zip
    ```
    The plugin script will refuse to talk to an HTTPS URL with an untrusted certificate. To use a self-signed HTTPS cert, add the CA cert to a local Java truststore and pass the location to the script as follows:
    ```shell
    sudo CLI_JAVA_OPTS="-Djavax.net.ssl.trustStore=/path/to/trustStore.jks" bin/elasticsearch-plugin install <MY_HOST_URL>/plugin.zip
    ```
  </definition>
</definitions>


## Custom config directory

If your `elasticsearch.yml` config file is in a custom location, specify the path to the config file when using the `plugin` script. You can do this as follows:
```sh
sudo ES_PATH_CONF=/path/to/conf/dir bin/elasticsearch-plugin install <plugin name>
```


## Proxy settings

To install a plugin via a proxy, you can add the proxy details to the `CLI_JAVA_OPTS` environment variable with the Java settings `http.proxyHost` and `http.proxyPort` (or `https.proxyHost` and `https.proxyPort`):
```shell
sudo CLI_JAVA_OPTS="-Dhttp.proxyHost=host_name -Dhttp.proxyPort=port_number -Dhttps.proxyHost=host_name -Dhttps.proxyPort=https_port_number" bin/elasticsearch-plugin install analysis-icu
```

Or on Windows:
```shell
set CLI_JAVA_OPTS="-Dhttp.proxyHost=host_name -Dhttp.proxyPort=port_number -Dhttps.proxyHost=host_name -Dhttps.proxyPort=https_port_number"
bin\elasticsearch-plugin install analysis-icu
```


## Exit codes

<definitions>
  <definition term="0">
    everything was OK
  </definition>
  <definition term="64">
    unknown command or incorrect option parameter
  </definition>
  <definition term="70">
    any other error
  </definition>
  <definition term="74">
    IO error
  </definition>
</definitions>


## Examples


### Install a core plugin

```shell
sudo bin/elasticsearch-plugin install analysis-icu
```


### Install multiple plugins at once

```shell
sudo bin/elasticsearch-plugin install analysis-icu analysis-kuromoji
```


### Install a plugin without the privileges prompt

```shell
sudo bin/elasticsearch-plugin install --batch [pluginname]
```


### List installed plugins

```shell
sudo bin/elasticsearch-plugin list
```


### Remove a plugin and its configuration files

```shell
sudo bin/elasticsearch-plugin remove --purge [pluginname]
```


### Remove multiple plugins at once

```shell
sudo bin/elasticsearch-plugin remove [pluginname] [pluginname] ... [pluginname]
```


### Update a plugin

Plugins cannot be updated in place. Remove the plugin and install it again:
```shell
sudo bin/elasticsearch-plugin remove [pluginname]
sudo bin/elasticsearch-plugin install [pluginname]
```