# Question about creating custom rivers

**URL:** <https://discuss.elastic.co/t/question-about-creating-custom-rivers/3958>\
**Category:** Elasticsearch\
**Created:** [February 21, 2011, 11:10pm UTC](https://discuss.elastic.co/t/question-about-creating-custom-rivers/3958 "2011-02-21T23:10:56Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![IvanBrusic](https://avatars.discourse-cdn.com/v4/letter/i/ecae2f/32.png) [@IvanBrusic](https://discuss.elastic.co/u/IvanBrusic)\
**Post date:** [February 21, 2011, 11:10pm UTC](https://discuss.elastic.co/t/question-about-creating-custom-rivers/3958/1 "2011-02-21T23:10:56Z")

</div>

I found the concept of rivers interesting, so I decided to implement  
my own out of curiosity. The goal is to index JSON documents returned  
from an HTML 5 WebSocket. My issue is very likely a naming issue, I  
am formatting my code around the existing river plugins.

Please forgive me, but the code is in Scala. It still should be very  
readable (if not more so 🙂 ) [https://gist.github.com/837883](https://gist.github.com/837883)

My es-plugin.properties  
plugin=plugin.SimpleWebsocketRiverPlugin

class SimpleWebsocketRiverPlugin @Inject() extends AbstractPlugin {  
def name() = {  
"river-simplewebsocket";  
}

```
def description() = {
    "River Simple Websocket Plugin";
}

```

}

class SimpleWebsocketRiverModule extends AbstractModule {  
override def configure() = {

bind(classOf[River]).to(classOf[SimpleWebsocketRiver]).asEagerSingleton()  
}  
}

The actual River declaration is:  
class SimpleWebsocketRiver @Inject()(riverName: RiverName,  
riverSettings: RiverSettings, client: Client) extends  
AbstractRiverComponent(riverName, riverSettings) with River

I am able to bundle the code as a zip file and install as a plugin:  
./bin/plugin url file:/// install simplewebsocket

ElasticSearch starts off fine:  
...  
[2011-02-21 18:03:04,210][INFO][plugins] [Gideon,  
Gregory] loaded [river-simplewebsocket]  
...

Attempting to create a new river results in an error:

curl -XPUT localhost:9200/\_river/test\_river/\_meta -d '  
{  
"type" : "simplewebsocket"  
}  
'  
ERROR:  
[2011-02-21 18:05:51,509][WARN][river] [Gideon,  
Gregory] failed to create river [simplewebsocket][test\_river]  
org.elasticsearch.common.settings.NoClassSettingsException: Failed to  
load class with value [simplewebsocket]

I am assuming that I simply did not name something correctly. What am  
I missing?

Thanks in advance,  
Ivan

---

<div class="post-metadata">

**Author:** ![IvanBrusic](https://avatars.discourse-cdn.com/v4/letter/i/ecae2f/32.png) [@IvanBrusic](https://discuss.elastic.co/u/IvanBrusic)\
**Post date:** [February 22, 2011, 4:04am UTC](https://discuss.elastic.co/t/question-about-creating-custom-rivers/3958/2 "2011-02-22T04:04:04Z")

</div>

Found my own answer by digging through the source code. For those  
that are interested, you must either declare the entire classname in  
the "type" field of the \_meta or your module must belong to the  
org.elasticsearch.river package.

Works like a charm.

---

<div class="post-metadata">

**Author:** ![kimchy](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/kimchy/32/44952_2.png) [@kimchy](https://discuss.elastic.co/u/kimchy)\
**Post date:** [February 22, 2011, 8:14pm UTC](https://discuss.elastic.co/t/question-about-creating-custom-rivers/3958/3 "2011-02-22T20:14:19Z")

</div>

Heya, gerat your found it!. Using the class name as the river is not that nice..., pushed an improvement to that: [Allow to register custom rivers under a custom type name (And not full class names) · Issue #712 · elastic/elasticsearch · GitHub](https://github.com/elasticsearch/elasticsearch/issues/712).  
On Tuesday, February 22, 2011 at 6:04 AM, Ivan Brusic wrote:

> Found my own answer by digging through the source code. For those  
> that are interested, you must either declare the entire classname in  
> the "type" field of the \_meta or your module must belong to the  
> org.elasticsearch.river package.
> 
> Works like a charm.

---

<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 6, 2017, 4:11am UTC](https://discuss.elastic.co/t/question-about-creating-custom-rivers/3958/4 "2017-07-06T04:11:41Z")

</div>


