# Adding analyzers

**URL:** <https://discuss.elastic.co/t/adding-analyzers/4359>\
**Category:** Elasticsearch\
**Created:** [May 7, 2011, 1:37am UTC](https://discuss.elastic.co/t/adding-analyzers/4359 "2011-05-07T01:37:47Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Paul\_Loy](https://avatars.discourse-cdn.com/v4/letter/p/ad7895/32.png) [@Paul\_Loy](https://discuss.elastic.co/u/Paul_Loy)\
**Post date:** [May 7, 2011, 1:37am UTC](https://discuss.elastic.co/t/adding-analyzers/4359/1 "2011-05-07T01:37:47Z")

</div>

Using these index settings:

{  
"analysis":{  
"analyzer":{  
"title":{  
"type":"standard"  
},  
"en\_title":{  
"type":"org.apache.lucene.analysis.en.EnglishAnalyzer"  
},  
"cjk\_title":{  
"type":"org.apache.lucene.analysis.cjk.CJKAnalyzer"  
}  
}  
}  
}

Causes this:

1. Could not find a suitable constructor in  
org.apache.lucene.analysis.cjk.CJKAnalyzer. Classes must have either one  
(and only one) constructor annotated with @Inject or a zero-argument  
constructor that is not private.  
at org.apache.lucene.analysis.cjk.CJKAnalyzer.class(CJKAnalyzer.java:46)  
at  
org.elasticsearch.index.analysis.AnalyzerProviderFactory.create(AnalyzerProviderFactory.java:1)  
at  
org.elasticsearch.common.inject.assistedinject.FactoryProvider2.initialize(FactoryProvider2.java:161)  
at  
org.elasticsearch.index.analysis.AnalysisModule.configure(AnalysisModule.java:299)

2. Could not find a suitable constructor in  
org.apache.lucene.analysis.en.EnglishAnalyzer. Classes must have either one  
(and only one) constructor annotated with @Inject or a zero-argument  
constructor that is not private.  
at  
org.apache.lucene.analysis.en.EnglishAnalyzer.class(EnglishAnalyzer.java:48)  
at  
org.elasticsearch.index.analysis.AnalyzerProviderFactory.create(AnalyzerProviderFactory.java:1)  
at  
org.elasticsearch.common.inject.assistedinject.FactoryProvider2.initialize(FactoryProvider2.java:161)  
at  
org.elasticsearch.index.analysis.AnalysisModule.configure(AnalysisModule.java:299)

I suppose I could just wrap the analyzers myself to make them work, but  
thought I'd see what your suggestion may be.

Thanks.

## Paul.

* * *

Paul Loy  
[paul@keteracel.com](mailto:paul@keteracel.com)  
[http://uk.linkedin.com/in/paulloy](http://uk.linkedin.com/in/paulloy)

---

<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:** [May 7, 2011, 7:16am UTC](https://discuss.elastic.co/t/adding-analyzers/4359/2 "2011-05-07T07:16:25Z")

</div>

For custom analyzers, then you need to wrap it youself with an elasticsearch analyzer factory that creates them. But, those specific analyzers are already exposed in elasticsearch (the english on in 0.16.1, though its just a porter stemmer if memory serves).  
On Saturday, May 7, 2011 at 4:37 AM, Paul Loy wrote:

> Using these index settings:
> 
> {  
> "analysis":{  
> "analyzer":{  
> "title":{  
> "type":"standard"  
> },  
> "en\_title":{  
> "type":"org.apache.lucene.analysis.en.EnglishAnalyzer"  
> },  
> "cjk\_title":{  
> "type":"org.apache.lucene.analysis.cjk.CJKAnalyzer"  
> }  
> }  
> }  
> }
> 
> Causes this:
> 
> 1. Could not find a suitable constructor in org.apache.lucene.analysis.cjk.CJKAnalyzer. Classes must have either one (and only one) constructor annotated with @Inject or a zero-argument constructor that is not private.  
> at org.apache.lucene.analysis.cjk.CJKAnalyzer.class(CJKAnalyzer.java:46)  
> at org.elasticsearch.index.analysis.AnalyzerProviderFactory.create(AnalyzerProviderFactory.java:1)  
> at org.elasticsearch.common.inject.assistedinject.FactoryProvider2.initialize(FactoryProvider2.java:161)  
> at org.elasticsearch.index.analysis.AnalysisModule.configure(AnalysisModule.java:299)
> 
> 2. Could not find a suitable constructor in org.apache.lucene.analysis.en.EnglishAnalyzer. Classes must have either one (and only one) constructor annotated with @Inject or a zero-argument constructor that is not private.  
> at org.apache.lucene.analysis.en.EnglishAnalyzer.class(EnglishAnalyzer.java:48)  
> at org.elasticsearch.index.analysis.AnalyzerProviderFactory.create(AnalyzerProviderFactory.java:1)  
> at org.elasticsearch.common.inject.assistedinject.FactoryProvider2.initialize(FactoryProvider2.java:161)  
> at org.elasticsearch.index.analysis.AnalysisModule.configure(AnalysisModule.java:299)
> 
> I suppose I could just wrap the analyzers myself to make them work, but thought I'd see what your suggestion may be.
> 
> Thanks.
> 
> ## Paul.
> 
> * * *
> 
> Paul Loy  
> [paul@keteracel.com](mailto:paul@keteracel.com)  
> [http://uk.linkedin.com/in/paulloy](http://uk.linkedin.com/in/paulloy)

---

<div class="post-metadata">

**Author:** ![Paul\_Loy](https://avatars.discourse-cdn.com/v4/letter/p/ad7895/32.png) [@Paul\_Loy](https://discuss.elastic.co/u/Paul_Loy)\
**Post date:** [May 7, 2011, 10:40pm UTC](https://discuss.elastic.co/t/adding-analyzers/4359/3 "2011-05-07T22:40:57Z")

</div>

I think you're correct about the PorterStemmer, however the SnowBallAnalyzer  
is deprecated so don't know what option I have.

On Sat, May 7, 2011 at 8:16 AM, Shay Banon [shay.banon@elasticsearch.com](mailto:shay.banon@elasticsearch.com)wrote:

> For custom analyzers, then you need to wrap it youself with an  
> elasticsearch analyzer factory that creates them. But, those specific  
> analyzers are already exposed in elasticsearch (the english on in 0.16.1,  
> though its just a porter stemmer if memory serves).
> 
> On Saturday, May 7, 2011 at 4:37 AM, Paul Loy wrote:
> 
> Using these index settings:
> 
> {  
> "analysis":{  
> "analyzer":{  
> "title":{  
> "type":"standard"  
> },  
> "en\_title":{  
> "type":"org.apache.lucene.analysis.en.EnglishAnalyzer"  
> },  
> "cjk\_title":{  
> "type":"org.apache.lucene.analysis.cjk.CJKAnalyzer"  
> }  
> }  
> }  
> }
> 
> Causes this:
> 
> 1. Could not find a suitable constructor in  
> org.apache.lucene.analysis.cjk.CJKAnalyzer. Classes must have either one  
> (and only one) constructor annotated with @Inject or a zero-argument  
> constructor that is not private.  
> at org.apache.lucene.analysis.cjk.CJKAnalyzer.class(CJKAnalyzer.java:46)  
> at  
> org.elasticsearch.index.analysis.AnalyzerProviderFactory.create(AnalyzerProviderFactory.java:1)  
> at  
> org.elasticsearch.common.inject.assistedinject.FactoryProvider2.initialize(FactoryProvider2.java:161)  
> at  
> org.elasticsearch.index.analysis.AnalysisModule.configure(AnalysisModule.java:299)
> 
> 2. Could not find a suitable constructor in  
> org.apache.lucene.analysis.en.EnglishAnalyzer. Classes must have either one  
> (and only one) constructor annotated with @Inject or a zero-argument  
> constructor that is not private.  
> at  
> org.apache.lucene.analysis.en.EnglishAnalyzer.class(EnglishAnalyzer.java:48)  
> at  
> org.elasticsearch.index.analysis.AnalyzerProviderFactory.create(AnalyzerProviderFactory.java:1)  
> at  
> org.elasticsearch.common.inject.assistedinject.FactoryProvider2.initialize(FactoryProvider2.java:161)  
> at  
> org.elasticsearch.index.analysis.AnalysisModule.configure(AnalysisModule.java:299)
> 
> I suppose I could just wrap the analyzers myself to make them work, but  
> thought I'd see what your suggestion may be.
> 
> Thanks.
> 
> ## Paul.
> 
> * * *
> 
> Paul Loy  
> [paul@keteracel.com](mailto:paul@keteracel.com)  
> [Paul Loy - Amihan Entertainment | LinkedIn](http://uk.linkedin.com/in/paulloy)

## --

Paul Loy  
[paul@keteracel.com](mailto:paul@keteracel.com)  
[http://uk.linkedin.com/in/paulloy](http://uk.linkedin.com/in/paulloy)

---

<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:** [May 8, 2011, 5:58am UTC](https://discuss.elastic.co/t/adding-analyzers/4359/4 "2011-05-08T05:58:58Z")

</div>

Its deprecated for the specific language analysis analyzers. In 0.16, you have `cjk` (for the CJKAnalyzer), and in upcoming 0.16.1 you also have `english` for the `EnglishAnalyzer`. `cjk` and `english` are similar to `standard`, you can just start using them in your mappings.  
On Sunday, May 8, 2011 at 1:40 AM, Paul Loy wrote:

> I think you're correct about the PorterStemmer, however the SnowBallAnalyzer is deprecated so don't know what option I have.
> 
> On Sat, May 7, 2011 at 8:16 AM, Shay Banon [shay.banon@elasticsearch.com](mailto:shay.banon@elasticsearch.com) wrote:
> 
> > For custom analyzers, then you need to wrap it youself with an elasticsearch analyzer factory that creates them. But, those specific analyzers are already exposed in elasticsearch (the english on in 0.16.1, though its just a porter stemmer if memory serves).  
> > On Saturday, May 7, 2011 at 4:37 AM, Paul Loy wrote:
> > 
> > > Using these index settings:
> > > 
> > > {  
> > > "analysis":{  
> > > "analyzer":{  
> > > "title":{  
> > > "type":"standard"  
> > > },  
> > > "en\_title":{  
> > > "type":"org.apache.lucene.analysis.en.EnglishAnalyzer"  
> > > },  
> > > "cjk\_title":{  
> > > "type":"org.apache.lucene.analysis.cjk.CJKAnalyzer"  
> > > }  
> > > }  
> > > }  
> > > }
> > > 
> > > Causes this:
> > > 
> > > 1. Could not find a suitable constructor in org.apache.lucene.analysis.cjk.CJKAnalyzer. Classes must have either one (and only one) constructor annotated with @Inject or a zero-argument constructor that is not private.  
> > > at org.apache.lucene.analysis.cjk.CJKAnalyzer.class(CJKAnalyzer.java:46)  
> > > at org.elasticsearch.index.analysis.AnalyzerProviderFactory.create(AnalyzerProviderFactory.java:1)  
> > > at org.elasticsearch.common.inject.assistedinject.FactoryProvider2.initialize(FactoryProvider2.java:161)  
> > > at org.elasticsearch.index.analysis.AnalysisModule.configure(AnalysisModule.java:299)
> > > 
> > > 2. Could not find a suitable constructor in org.apache.lucene.analysis.en.EnglishAnalyzer. Classes must have either one (and only one) constructor annotated with @Inject or a zero-argument constructor that is not private.  
> > > at org.apache.lucene.analysis.en.EnglishAnalyzer.class(EnglishAnalyzer.java:48)  
> > > at org.elasticsearch.index.analysis.AnalyzerProviderFactory.create(AnalyzerProviderFactory.java:1)  
> > > at org.elasticsearch.common.inject.assistedinject.FactoryProvider2.initialize(FactoryProvider2.java:161)  
> > > at org.elasticsearch.index.analysis.AnalysisModule.configure(AnalysisModule.java:299)
> > > 
> > > I suppose I could just wrap the analyzers myself to make them work, but thought I'd see what your suggestion may be.
> > > 
> > > Thanks.
> > > 
> > > ## Paul.
> > > 
> > > * * *
> > > 
> > > Paul Loy  
> > > [paul@keteracel.com](mailto:paul@keteracel.com)  
> > > [http://uk.linkedin.com/in/paulloy](http://uk.linkedin.com/in/paulloy)
> 
> ## --
> 
> Paul Loy  
> [paul@keteracel.com](mailto:paul@keteracel.com)  
> [http://uk.linkedin.com/in/paulloy](http://uk.linkedin.com/in/paulloy)

---

<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:06am UTC](https://discuss.elastic.co/t/adding-analyzers/4359/5 "2017-07-06T04:06:43Z")

</div>


