# \[plugin-development\] Custom transport actions and X-Pack integration

**URL:** https://discuss.elastic.co/t/plugin-development-custom-transport-actions-and-x-pack-integration/110805
**Category:** Elasticsearch
**Created:** [December 8, 2017, 9:05am UTC](https://discuss.elastic.co/t/plugin-development-custom-transport-actions-and-x-pack-integration/110805 "2017-12-08T09:05:16Z")
**Posts on this page:** 8
**Page:** 1

<div class="post-metadata">

### Author: ![dcausse](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dcausse/32/97582_2.png) [@dcausse](https://discuss.elastic.co/u/dcausse)
#### Post date: [December 8, 2017, 9:05am UTC](https://discuss.elastic.co/t/plugin-development-custom-transport-actions-and-x-pack-integration/110805/1 "2017-12-08T09:05:16Z")

</div>

Hi,

I just received a [bug report](https://github.com/o19s/elasticsearch-learning-to-rank/issues/116) concerning a plugin we wrote. The user reports that despite being the superuser it receives:

```auto
{"error":{"root_cause":[{"type":"security_exception","reason":"action [ltr:featurestore/data] is unauthorized for user [elastic]"}],"type":"security_exception","reason":"action [ltr:featurestore/data] is unauthorized for user [elastic]"},"status":403}

```

The plugin code is [https://github.com/o19s/elasticsearch-learning-to-rank/blob/master/src/main/java/com/o19s/es/ltr/action/FeatureStoreAction.java#L42](https://github.com/o19s/elasticsearch-learning-to-rank/blob/master/src/main/java/com/o19s/es/ltr/action/FeatureStoreAction.java#L42) .

Should I as a plugin developer do something particular to have a fluent integration with X-Pack when I declare custom TransportActions or is it just a special configuration with X-Pack that I should mention in the plugin documentation?

Thanks for your help.

---

<div class="post-metadata">

### Author: ![cjcenizal](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/cjcenizal/32/11216_2.png) [@cjcenizal](https://discuss.elastic.co/u/cjcenizal)
#### Post date: [December 9, 2017, 12:29am UTC](https://discuss.elastic.co/t/plugin-development-custom-transport-actions-and-x-pack-integration/110805/2 "2017-12-09T00:29:50Z")

</div>

~~Hi David, thanks for posting your question! Unfortunately, our plugin API is still in the process of being stabilized (as you may have noticed). And until then, we can't provide any official guidance on how to integrate plugins with Kibana or X-Pack because any changes we make could easily invalidate that guidance. Does this make sense?~~

EDIT: Oops, sorry! I'm on the Kibana team and I had assumed you were writing a _Kibana_ plugin, but I see you're writing an Elasticsearch one. I'll ping someone on that team to help you.

Thanks,  
CJ

---

<div class="post-metadata">

### Author: ![softwaredoug](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/softwaredoug/32/22681_2.png) [@softwaredoug](https://discuss.elastic.co/u/softwaredoug)
#### Post date: [December 15, 2017, 1:17am UTC](https://discuss.elastic.co/t/plugin-development-custom-transport-actions-and-x-pack-integration/110805/3 "2017-12-15T01:17:18Z")

</div>

Thanks for the response @cjcenizal... Was wondering if you heard anything? We've heard from a couple XPack and Elastic Cloud users about problems with the LTR plugin.

---

<div class="post-metadata">

### Author: ![spinscale](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/spinscale/32/25011_2.png) [@spinscale](https://discuss.elastic.co/u/spinscale)
#### Post date: [December 15, 2017, 8:46am UTC](https://discuss.elastic.co/t/plugin-development-custom-transport-actions-and-x-pack-integration/110805/4 "2017-12-15T08:46:05Z")

</div>

Is it possible, that the client in the corresponding transport action does execute an additional request without setting any headers?

---

<div class="post-metadata">

### Author: ![dcausse](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dcausse/32/97582_2.png) [@dcausse](https://discuss.elastic.co/u/dcausse)
#### Post date: [December 15, 2017, 9:54am UTC](https://discuss.elastic.co/t/plugin-development-custom-transport-actions-and-x-pack-integration/110805/5 "2017-12-15T09:54:02Z")

</div>

Hi @spinscale,

I'm not sure to understand your question.

The user here sends an HTTP request that targets a [REST endpoint declared](https://github.com/o19s/elasticsearch-learning-to-rank/blob/master/src/main/java/com/o19s/es/ltr/LtrQueryParserPlugin.java#L141) by the plugin.  
I tried to make the REST layer relatively thin and it should execute only one Transport action per REST request.  
Sometimes I use existing Transport action (i.e. creating an index), and it seems to work well with X-Pack.  
The problem appears to happen when the plugin uses its own [transport action](https://github.com/o19s/elasticsearch-learning-to-rank/blob/master/src/main/java/com/o19s/es/ltr/LtrQueryParserPlugin.java#L154), where in this case X-Pack seems to intercept the transport action. The custom actions are all named `ltr:something/something`.

It's unclear to me what you mean by `headers` and `additional request`. Are these `HTTP` `requests` & `headers`? Because I don't seem to find where you can set headers on transport actions.

Thanks for your help!

---

<div class="post-metadata">

### Author: ![spinscale](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/spinscale/32/25011_2.png) [@spinscale](https://discuss.elastic.co/u/spinscale)
#### Post date: [December 18, 2017, 8:25am UTC](https://discuss.elastic.co/t/plugin-development-custom-transport-actions-and-x-pack-integration/110805/6 "2017-12-18T08:25:19Z")

</div>

Hey,

what I am saying is, that if you are executing a request using a `Client` in your transport action, this request needs to know its credentials from somewhere. I think what is happening is that those credentials are not set and thus the corresponding headers need to be set.

See also [https://www.elastic.co/guide/en/x-pack/6.0/java-clients.html#transport-client](https://www.elastic.co/guide/en/x-pack/6.0/java-clients.html#transport-client)

Hope this helps!

--Alex

---

<div class="post-metadata">

### Author: ![dcausse](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dcausse/32/97582_2.png) [@dcausse](https://discuss.elastic.co/u/dcausse)
#### Post date: [December 19, 2017, 8:26am UTC](https://discuss.elastic.co/t/plugin-development-custom-transport-actions-and-x-pack-integration/110805/7 "2017-12-19T08:26:20Z")

</div>

Many thanks for the clarification!

---

<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: [January 16, 2018, 8:26am UTC](https://discuss.elastic.co/t/plugin-development-custom-transport-actions-and-x-pack-integration/110805/8 "2018-01-16T08:26:20Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
