# Configuring a custom plugin

**URL:** <https://discuss.elastic.co/t/configuring-a-custom-plugin/3804>\
**Category:** Elasticsearch\
**Created:** [January 18, 2011, 5:23pm UTC](https://discuss.elastic.co/t/configuring-a-custom-plugin/3804 "2011-01-18T17:23:03Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![edwarddale](https://avatars.discourse-cdn.com/v4/letter/e/f1d935/32.png) [@edwarddale](https://discuss.elastic.co/u/edwarddale)\
**Post date:** [January 18, 2011, 5:23pm UTC](https://discuss.elastic.co/t/configuring-a-custom-plugin/3804/1 "2011-01-18T17:23:03Z")

</div>

Hello,

I've developed a custom plugin that wraps the  
DictionaryCompoundWordTokenFilterFactory provided by Lucene. This  
TokenFilter requires a word list file, which is provided through the  
settings. After talking with kimchy yesterday, I made this setting  
optional so that it can be instantiated by ES without throwing an  
exception. This is done beforehand to speed up the document indexing  
process.

My problem now is that there are a number of instances of my Filter  
instantiated and only one of them has the path to the word list file  
configured. Unfortunately, when I index or analyze a document, an  
instance without the word list is used to analyze.

Does anyone know to configure a custom plugin that requires a  
parameter?

I've pushed my changes to github [1] and this is the ES configuration  
that I'm trying to use. For some reason, I can't use  
'dictionary\_decompounder' as the type for the filter, but that's a  
separate problem.

index :  
analysis :  
analyzer :  
myAnalyzer2 :  
tokenizer : standard  
filter : [dict1, standard, lowercase, stop]  
filter :  
dict1 :  
type :  
org.elasticsearch.index.analysis.DictionaryCompoundWordTokenFilterFactory  
word\_list\_path : /Users/Edward/Downloads/word.german

Thanks!  
Edward

[1] [https://github.com/scompt/elasticsearch/tree/compound](https://github.com/scompt/elasticsearch/tree/compound)

---

<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:** [January 18, 2011, 6:40pm UTC](https://discuss.elastic.co/t/configuring-a-custom-plugin/3804/2 "2011-01-18T18:40:18Z")

</div>

The filter should be created only once per index created, are you saying that it gets created several times, and some of them without the parameter passed?  
On Tuesday, January 18, 2011 at 7:23 PM, Edward Dale wrote:

> Hello,
> 
> I've developed a custom plugin that wraps the  
> DictionaryCompoundWordTokenFilterFactory provided by Lucene. This  
> TokenFilter requires a word list file, which is provided through the  
> settings. After talking with kimchy yesterday, I made this setting  
> optional so that it can be instantiated by ES without throwing an  
> exception. This is done beforehand to speed up the document indexing  
> process.
> 
> My problem now is that there are a number of instances of my Filter  
> instantiated and only one of them has the path to the word list file  
> configured. Unfortunately, when I index or analyze a document, an  
> instance without the word list is used to analyze.
> 
> Does anyone know to configure a custom plugin that requires a  
> parameter?
> 
> I've pushed my changes to github [1] and this is the ES configuration  
> that I'm trying to use. For some reason, I can't use  
> 'dictionary\_decompounder' as the type for the filter, but that's a  
> separate problem.
> 
> index :  
> analysis :  
> analyzer :  
> myAnalyzer2 :  
> tokenizer : standard  
> filter : [dict1, standard, lowercase, stop]  
> filter :  
> dict1 :  
> type :  
> org.elasticsearch.index.analysis.DictionaryCompoundWordTokenFilterFactory  
> word\_list\_path : /Users/Edward/Downloads/word.german
> 
> Thanks!  
> Edward
> 
> [1] [https://github.com/scompt/elasticsearch/tree/compound](https://github.com/scompt/elasticsearch/tree/compound)

---

<div class="post-metadata">

**Author:** ![edwarddale](https://avatars.discourse-cdn.com/v4/letter/e/f1d935/32.png) [@edwarddale](https://discuss.elastic.co/u/edwarddale)\
**Post date:** [January 19, 2011, 7:41am UTC](https://discuss.elastic.co/t/configuring-a-custom-plugin/3804/3 "2011-01-19T07:41:26Z")

</div>

The FilterFactory is being instantiated a number of times, only one of which  
picks up the word list setting. The create method is only being called once  
on one of those instances, and not the one with the configured word list.  
I've confirmed this by some low-tech debug statements in the FilterFactory  
class.

Cheers,  
Edward

kimchy wrote:

> The filter should be created only once per index created, are you saying  
> that it gets created several times, and some of them without the parameter  
> passed?  
> On Tuesday, January 18, 2011 at 7:23 PM, Edward Dale wrote:
> 
> > Hello,
> > 
> > I've developed a custom plugin that wraps the  
> > DictionaryCompoundWordTokenFilterFactory provided by Lucene. This  
> > TokenFilter requires a word list file, which is provided through the  
> > settings. After talking with kimchy yesterday, I made this setting  
> > optional so that it can be instantiated by ES without throwing an  
> > exception. This is done beforehand to speed up the document indexing  
> > process.
> > 
> > My problem now is that there are a number of instances of my Filter  
> > instantiated and only one of them has the path to the word list file  
> > configured. Unfortunately, when I index or analyze a document, an  
> > instance without the word list is used to analyze.
> > 
> > Does anyone know to configure a custom plugin that requires a  
> > parameter?
> > 
> > I've pushed my changes to github [1] and this is the ES configuration  
> > that I'm trying to use. For some reason, I can't use  
> > 'dictionary\_decompounder' as the type for the filter, but that's a  
> > separate problem.
> > 
> > index :  
> > analysis :  
> > analyzer :  
> > myAnalyzer2 :  
> > tokenizer : standard  
> > filter : [dict1, standard, lowercase, stop]  
> > filter :  
> > dict1 :  
> > type :  
> > org.elasticsearch.index.analysis.DictionaryCompoundWordTokenFilterFactory  
> > word\_list\_path : /Users/Edward/Downloads/word.german
> > 
> > Thanks!  
> > Edward
> > 
> > [1] [https://github.com/scompt/elasticsearch/tree/compound](https://github.com/scompt/elasticsearch/tree/compound)

--  
View this message in context: [http://elasticsearch-users.115913.n3.nabble.com/Configuring-a-custom-plugin-tp2281753p2285851.html](http://elasticsearch-users.115913.n3.nabble.com/Configuring-a-custom-plugin-tp2281753p2285851.html)  
Sent from the Elasticsearch Users mailing list archive at [Nabble.com](http://Nabble.com).

---

<div class="post-metadata">

**Author:** ![edwarddale](https://avatars.discourse-cdn.com/v4/letter/e/f1d935/32.png) [@edwarddale](https://discuss.elastic.co/u/edwarddale)\
**Post date:** [January 19, 2011, 2:42pm UTC](https://discuss.elastic.co/t/configuring-a-custom-plugin/3804/4 "2011-01-19T14:42:11Z")

</div>

The FilterFactory is being instantiated a number of times, only one of  
which picks up the word list setting. The create method is only being  
called once on one of those instances, and not the one with the  
configured word list. I've confirmed this by some low-tech debug  
statements in the FilterFactory class.

Cheers,  
Edward

On Jan 18, 7:40 pm, Shay Banon [shay.ba...@elasticsearch.com](mailto:shay.ba...@elasticsearch.com) wrote:

> The filter should be created only once per index created, are you saying that it gets created several times, and some of them without the parameter passed?
> 
> On Tuesday, January 18, 2011 at 7:23 PM, Edward Dale wrote:
> 
> > Hello,
> 
> > I've developed a custom plugin that wraps the  
> > DictionaryCompoundWordTokenFilterFactory provided by Lucene. This  
> > TokenFilter requires a word list file, which is provided through the  
> > settings. After talking with kimchy yesterday, I made this setting  
> > optional so that it can be instantiated by ES without throwing an  
> > exception. This is done beforehand to speed up the document indexing  
> > process.
> 
> > My problem now is that there are a number of instances of my Filter  
> > instantiated and only one of them has the path to the word list file  
> > configured. Unfortunately, when I index or analyze a document, an  
> > instance without the word list is used to analyze.
> 
> > Does anyone know to configure a custom plugin that requires a  
> > parameter?
> 
> > I've pushed my changes to github [1] and this is the ES configuration  
> > that I'm trying to use. For some reason, I can't use  
> > 'dictionary\_decompounder' as the type for the filter, but that's a  
> > separate problem.
> 
> > index :  
> > analysis :  
> > analyzer :  
> > myAnalyzer2 :  
> > tokenizer : standard  
> > filter : [dict1, standard, lowercase, stop]  
> > filter :  
> > dict1 :  
> > type :  
> > org.elasticsearch.index.analysis.DictionaryCompoundWordTokenFilterFactory  
> > word\_list\_path : /Users/Edward/Downloads/word.german
> 
> > Thanks!  
> > Edward
> 
> > [1][https://github.com/scompt/elasticsearch/tree/compound](https://github.com/scompt/elasticsearch/tree/compound)

---

<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:** [January 20, 2011, 4:26pm UTC](https://discuss.elastic.co/t/configuring-a-custom-plugin/3804/5 "2011-01-20T16:26:49Z")

</div>

Strange that its being picked up only once. I will have a look...  
On Wednesday, January 19, 2011 at 4:42 PM, Edward Dale wrote:

> The FilterFactory is being instantiated a number of times, only one of  
> which picks up the word list setting. The create method is only being  
> called once on one of those instances, and not the one with the  
> configured word list. I've confirmed this by some low-tech debug  
> statements in the FilterFactory class.
> 
> Cheers,  
> Edward
> 
> On Jan 18, 7:40 pm, Shay Banon [shay.ba...@elasticsearch.com](mailto:shay.ba...@elasticsearch.com) wrote:
> 
> > The filter should be created only once per index created, are you saying that it gets created several times, and some of them without the parameter passed?
> > 
> > On Tuesday, January 18, 2011 at 7:23 PM, Edward Dale wrote:
> > 
> > > Hello,
> > 
> > > I've developed a custom plugin that wraps the  
> > > DictionaryCompoundWordTokenFilterFactory provided by Lucene. This  
> > > TokenFilter requires a word list file, which is provided through the  
> > > settings. After talking with kimchy yesterday, I made this setting  
> > > optional so that it can be instantiated by ES without throwing an  
> > > exception. This is done beforehand to speed up the document indexing  
> > > process.
> > 
> > > My problem now is that there are a number of instances of my Filter  
> > > instantiated and only one of them has the path to the word list file  
> > > configured. Unfortunately, when I index or analyze a document, an  
> > > instance without the word list is used to analyze.
> > 
> > > Does anyone know to configure a custom plugin that requires a  
> > > parameter?
> > 
> > > I've pushed my changes to github [1] and this is the ES configuration  
> > > that I'm trying to use. For some reason, I can't use  
> > > 'dictionary\_decompounder' as the type for the filter, but that's a  
> > > separate problem.
> > 
> > > index :  
> > > analysis :  
> > > analyzer :  
> > > myAnalyzer2 :  
> > > tokenizer : standard  
> > > filter : [dict1, standard, lowercase, stop]  
> > > filter :  
> > > dict1 :  
> > > type :  
> > > org.elasticsearch.index.analysis.DictionaryCompoundWordTokenFilterFactory  
> > > word\_list\_path : /Users/Edward/Downloads/word.german
> > 
> > > Thanks!  
> > > Edward
> > 
> > > [1][https://github.com/scompt/elasticsearch/tree/compound](https://github.com/scompt/elasticsearch/tree/compound)

---

<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:** [January 21, 2011, 12:01am UTC](https://discuss.elastic.co/t/configuring-a-custom-plugin/3804/6 "2011-01-21T00:01:20Z")

</div>

I just pushed a simplification for token filters that require settings. If you look at master, check the new PhoneticTokenFilterFactory, it also requires an encoder to be set. It is annotated with @AnalysisSettingsRequired to indicate that it requires settings so ES will not pre cache it if it doesn't have them set.  
On Thursday, January 20, 2011 at 6:26 PM, Shay Banon wrote:

> Strange that its being picked up only once. I will have a look...  
> On Wednesday, January 19, 2011 at 4:42 PM, Edward Dale wrote:
> 
> > The FilterFactory is being instantiated a number of times, only one of  
> > which picks up the word list setting. The create method is only being  
> > called once on one of those instances, and not the one with the  
> > configured word list. I've confirmed this by some low-tech debug  
> > statements in the FilterFactory class.
> > 
> > Cheers,  
> > Edward
> > 
> > On Jan 18, 7:40 pm, Shay Banon [shay.ba...@elasticsearch.com](mailto:shay.ba...@elasticsearch.com) wrote:
> > 
> > > The filter should be created only once per index created, are you saying that it gets created several times, and some of them without the parameter passed?
> > > 
> > > On Tuesday, January 18, 2011 at 7:23 PM, Edward Dale wrote:
> > > 
> > > > Hello,
> > > 
> > > > I've developed a custom plugin that wraps the  
> > > > DictionaryCompoundWordTokenFilterFactory provided by Lucene. This  
> > > > TokenFilter requires a word list file, which is provided through the  
> > > > settings. After talking with kimchy yesterday, I made this setting  
> > > > optional so that it can be instantiated by ES without throwing an  
> > > > exception. This is done beforehand to speed up the document indexing  
> > > > process.
> > > 
> > > > My problem now is that there are a number of instances of my Filter  
> > > > instantiated and only one of them has the path to the word list file  
> > > > configured. Unfortunately, when I index or analyze a document, an  
> > > > instance without the word list is used to analyze.
> > > 
> > > > Does anyone know to configure a custom plugin that requires a  
> > > > parameter?
> > > 
> > > > I've pushed my changes to github [1] and this is the ES configuration  
> > > > that I'm trying to use. For some reason, I can't use  
> > > > 'dictionary\_decompounder' as the type for the filter, but that's a  
> > > > separate problem.
> > > 
> > > > index :  
> > > > analysis :  
> > > > analyzer :  
> > > > myAnalyzer2 :  
> > > > tokenizer : standard  
> > > > filter : [dict1, standard, lowercase, stop]  
> > > > filter :  
> > > > dict1 :  
> > > > type :  
> > > > org.elasticsearch.index.analysis.DictionaryCompoundWordTokenFilterFactory  
> > > > word\_list\_path : /Users/Edward/Downloads/word.german
> > > 
> > > > Thanks!  
> > > > Edward
> > > 
> > > > [1][https://github.com/scompt/elasticsearch/tree/compound](https://github.com/scompt/elasticsearch/tree/compound)

---

<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:13am UTC](https://discuss.elastic.co/t/configuring-a-custom-plugin/3804/7 "2017-07-06T04:13:24Z")

</div>


