# Plugin datasource singleton

**URL:** <https://discuss.elastic.co/t/plugin-datasource-singleton/20757>\
**Category:** Elasticsearch\
**Created:** [November 14, 2014, 6:18pm UTC](https://discuss.elastic.co/t/plugin-datasource-singleton/20757 "2014-11-14T18:18:26Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Pawel\_Rog](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/pawel_rog/32/141223_2.png) [@Pawel\_Rog](https://discuss.elastic.co/u/Pawel_Rog)\
**Post date:** [November 14, 2014, 6:18pm UTC](https://discuss.elastic.co/t/plugin-datasource-singleton/20757/1 "2014-11-14T18:18:26Z")

</div>

Hi,  
I have query parser plugin. This plugin also implements transport action.  
Both: query parser and transport action should share the same data source  
object (with cache).

Unfortunately when I run a query and parser is called I see one instance of  
data source. When transport action is called I see another instance of data  
source.  
I'd like to be able to see the same data source instance because transport  
action is responsible for cache management. This cache should be used by  
query parser

Plugin has implemented method 'indexModules'

```
@Override
public Collection<Class<? extends Module>> indexModules() {
    Collection<Class<? extends Module>> modules = newArrayList();

    modules.add(CustomParserModule.class);

    return modules;
}

```

and CustomParserModule has implmeneted method conifugre

@Override  
protected void configure() {  
bind(RegisterBaseFilterParser.class).asEagerSingleton();  
bind(DataService.class).asEagerSingleton();  
}

What am I doing wrong?

--  
Paweł

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/CAF9ZkbN98LtohNAzz-vPQzENZ7W7AkBZPdYvkAeKdgr5HDUwUw%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CAF9ZkbN98LtohNAzz-vPQzENZ7W7AkBZPdYvkAeKdgr5HDUwUw%40mail.gmail.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<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, 12:49am UTC](https://discuss.elastic.co/t/plugin-datasource-singleton/20757/2 "2017-07-06T00:49:54Z")

</div>

Closed on July 6, 2017, 12:49am UTC


