# Elasticsearch plugin list behavior

**URL:** <https://discuss.elastic.co/t/elasticsearch-plugin-list-behavior/55651>\
**Category:** Elasticsearch\
**Created:** [July 15, 2016, 6:41pm UTC](https://discuss.elastic.co/t/elasticsearch-plugin-list-behavior/55651 "2016-07-15T18:41:10Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![yodog](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/yodog/32/4822_2.png) [@yodog](https://discuss.elastic.co/u/yodog)\
**Post date:** [July 15, 2016, 6:41pm UTC](https://discuss.elastic.co/t/elasticsearch-plugin-list-behavior/55651/1 "2016-07-15T18:41:10Z")

</div>

I created a [puppet defined type](https://docs.puppet.com/puppet/latest/reference/lang_defined_types.html) to handle logstash plugins install/removal automatically.

```
define logstash::plugin (
    $command = install,
    $logoutput = true,
) {
    exec {
        "$name":
            command => "/opt/logstash/bin/plugin $command $name",
            logoutput => $logoutput,
            path => ["/bin", "/sbin", "/usr/bin", "/usr/sbin"],
            unless => "/opt/logstash/bin/plugin list $name",
        ;
    }
}

```

before attempting anything, it checks if the plugin is already installed by issuing the list command  
`/opt/logstash/bin/plugin list $name`

i would like to do the same with elasticsearch plugins, but issuing a similar command  
`/usr/share/elasticsearch/bin/plugin list $name`  
always return all installed plugins

is there any way to get it to accept a plugin name as argument and return only that given name, like logstash plugin above?

---

<div class="post-metadata">

**Author:** ![magnusbaeck](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/magnusbaeck/32/44943_2.png) [@magnusbaeck](https://discuss.elastic.co/u/magnusbaeck)\
**Post date:** [July 22, 2016, 3:36pm UTC](https://discuss.elastic.co/t/elasticsearch-plugin-list-behavior/55651/2 "2016-07-22T15:36:22Z")

</div>

Are you able to filter the plugin command through grep? If so something like `/usr/share/elasticsearch/bin/plugin list | grep -q "- $name$"` should work.

---

<div class="post-metadata">

**Author:** ![yodog](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/yodog/32/4822_2.png) [@yodog](https://discuss.elastic.co/u/yodog)\
**Post date:** [August 4, 2016, 12:26pm UTC](https://discuss.elastic.co/t/elasticsearch-plugin-list-behavior/55651/3 "2016-08-04T12:26:20Z")

</div>

yes, this is what i'm doing right now.

i was just trying to avoid pipe ( `|` ) and short-circuit (`&& ||` ) because the `bin/plugin` exit codes are not consistent.

for example, `bin/plugin remove` always exits with status `0`, even if the plugin name passed as argument does not exists.

this makes it really hard to be scripted.

the way i see, it should exit with status `1` if a plugin was not removed.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [July 5, 2017, 10:30pm UTC](https://discuss.elastic.co/t/elasticsearch-plugin-list-behavior/55651/4 "2017-07-05T22:30:05Z")

</div>


