# How to use my customer lucene analyzer(tokenizer)?

**URL:** https://discuss.elastic.co/t/how-to-use-my-customer-lucene-analyzer-tokenizer/19086
**Category:** Elasticsearch
**Created:** [August 5, 2014, 6:58am UTC](https://discuss.elastic.co/t/how-to-use-my-customer-lucene-analyzer-tokenizer/19086 "2014-08-05T06:58:16Z")
**Posts on this page:** 7
**Page:** 1

<div class="post-metadata">

### Author: ![fancyerii](https://avatars.discourse-cdn.com/v4/letter/f/ee7513/32.png) [@fancyerii](https://discuss.elastic.co/u/fancyerii)
#### Post date: [August 5, 2014, 6:58am UTC](https://discuss.elastic.co/t/how-to-use-my-customer-lucene-analyzer-tokenizer/19086/1 "2014-08-05T06:58:16Z")

</div>

I want to use my own Chinese analyzer and I can write lucene analyzer class  
myself. How can I integrate it to elasticsearch?  
I googled and  
found [http://www.elasticsearch.org/guide/en/elasticsearch/guide/current/custom-analyzers.html](http://www.elasticsearch.org/guide/en/elasticsearch/guide/current/custom-analyzers.html).  
But it only combine existing tokenizers and filters. I can use tokenizer  
writing in java by myself.

--  
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/c3fe52cd-8cb5-4c53-b0fe-87183deb45bf%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/c3fe52cd-8cb5-4c53-b0fe-87183deb45bf%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

### Author: ![Tihomir\_Lichev1](https://avatars.discourse-cdn.com/v4/letter/t/f08c70/32.png) [@Tihomir\_Lichev1](https://discuss.elastic.co/u/Tihomir_Lichev1)
#### Post date: [August 5, 2014, 7:30am UTC](https://discuss.elastic.co/t/how-to-use-my-customer-lucene-analyzer-tokenizer/19086/2 "2014-08-05T07:30:49Z")

</div>

I think you should write your own plugin with your analyzer implementation,  
so you can register your analyzer into the ES and use it later on.  
You could have a look and see how it done maybe in this  
plugin: [GitHub - elastic/elasticsearch-analysis-kuromoji: Japanese (kuromoji) Analysis Plugin](https://github.com/elasticsearch/elasticsearch-analysis-kuromoji)

05 август 2014, вторник, 09:58:16 UTC+3, [fanc...@gmail.com](mailto:fanc...@gmail.com) написа:

> I want to use my own Chinese analyzer and I can write lucene analyzer  
> class myself. How can I integrate it to elasticsearch?  
> I googled and found  
> [Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/guide/en/elasticsearch/guide/current/custom-analyzers.html).  
> But it only combine existing tokenizers and filters. I can use tokenizer  
> writing in java by myself.

--  
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/fe02dc31-991c-49f9-9820-63ba96a37d33%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/fe02dc31-991c-49f9-9820-63ba96a37d33%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

### Author: ![johtani](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/johtani/32/44956_2.png) [@johtani](https://discuss.elastic.co/u/johtani)
#### Post date: [August 5, 2014, 7:34am UTC](https://discuss.elastic.co/t/how-to-use-my-customer-lucene-analyzer-tokenizer/19086/3 "2014-08-05T07:34:25Z")

</div>

Hi,

I think this plugin will be helpful for you.

> **[GitHub - elastic/elasticsearch-analysis-kuromoji: Japanese (kuromoji)...](https://github.com/elastic/elasticsearch-analysis-kuromoji)**
>
> Japanese (kuromoji) Analysis Plugin. Contribute to elastic/elasticsearch-analysis-kuromoji development by creating an account on GitHub.

2014/08/05 15:58 [fancyerii@gmail.com](mailto:fancyerii@gmail.com):

> I want to use my own Chinese analyzer and I can write lucene analyzer  
> class myself. How can I integrate it to elasticsearch?  
> I googled and found  
> [Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/guide/en/elasticsearch/guide/current/custom-analyzers.html).  
> But it only combine existing tokenizers and filters. I can use tokenizer  
> writing in java by myself.
> 
> --  
> 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/c3fe52cd-8cb5-4c53-b0fe-87183deb45bf%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/c3fe52cd-8cb5-4c53-b0fe-87183deb45bf%40googlegroups.com)  
> [https://groups.google.com/d/msgid/elasticsearch/c3fe52cd-8cb5-4c53-b0fe-87183deb45bf%40googlegroups.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/c3fe52cd-8cb5-4c53-b0fe-87183deb45bf%40googlegroups.com?utm_medium=email&utm_source=footer)  
> .  
> For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

--  
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/CAPW8A5xqnsWa76TJuSAWwxPyrUA8F9cJ6tyTs2ZJxXFpb4vEMg%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CAPW8A5xqnsWa76TJuSAWwxPyrUA8F9cJ6tyTs2ZJxXFpb4vEMg%40mail.gmail.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

### Author: ![art](https://avatars.discourse-cdn.com/v4/letter/a/8797f3/32.png) [@art](https://discuss.elastic.co/u/art)
#### Post date: [August 22, 2014, 12:18am UTC](https://discuss.elastic.co/t/how-to-use-my-customer-lucene-analyzer-tokenizer/19086/4 "2014-08-22T00:18:30Z")

</div>

I have the same question about using an analyzer I have written as a  
plug-in for Elasticsearch 1.3.

> <https://github.com/elastic/elasticsearch-analysis-kuromoji/blob/es-1.3/README.md>

demonstrates only how to use the tokenizers in combination with the  
built-in CustomAnalyzer. They do not show how to use the kuromoji analyzer  
itself.

When I try to specify my analyzer for a field, I get errors like this:

MapperParsingException[Analyzer [special\_analyzer] not found for field  
[foo]];

Can you show an example of how to specify the kuromoji analyzer for a  
field? I should then be able to adapt it for use with my plugin analyzer.

Thanks in advance,  
Art

On Tuesday, August 5, 2014 12:34:42 AM UTC-7, Jun Ohtani wrote:

> Hi,
> 
> I think this plugin will be helpful for you.
> 
> [GitHub - elastic/elasticsearch-analysis-kuromoji: Japanese (kuromoji) Analysis Plugin](https://github.com/elasticsearch/elasticsearch-analysis-kuromoji)  
> 2014/08/05 15:58 \<[fanc...@gmail.com](mailto:fanc...@gmail.com) \<javascript:\>\>:
> 
> > I want to use my own Chinese analyzer and I can write lucene analyzer  
> > class myself. How can I integrate it to elasticsearch?  
> > I googled and found  
> > [Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/guide/en/elasticsearch/guide/current/custom-analyzers.html).  
> > But it only combine existing tokenizers and filters. I can use tokenizer  
> > writing in java by myself.
> > 
> > --  
> > 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 [elasticsearc...@googlegroups.com](mailto:elasticsearc...@googlegroups.com) \<javascript:\>.  
> > To view this discussion on the web visit  
> > [https://groups.google.com/d/msgid/elasticsearch/c3fe52cd-8cb5-4c53-b0fe-87183deb45bf%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/c3fe52cd-8cb5-4c53-b0fe-87183deb45bf%40googlegroups.com)  
> > [https://groups.google.com/d/msgid/elasticsearch/c3fe52cd-8cb5-4c53-b0fe-87183deb45bf%40googlegroups.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/c3fe52cd-8cb5-4c53-b0fe-87183deb45bf%40googlegroups.com?utm_medium=email&utm_source=footer)  
> > .  
> > For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

--  
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/da795847-3ea2-4afb-9a7b-aefdd6f111a0%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/da795847-3ea2-4afb-9a7b-aefdd6f111a0%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

### Author: ![johtani](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/johtani/32/44956_2.png) [@johtani](https://discuss.elastic.co/u/johtani)
#### Post date: [August 22, 2014, 6:23am UTC](https://discuss.elastic.co/t/how-to-use-my-customer-lucene-analyzer-tokenizer/19086/5 "2014-08-22T06:23:24Z")

</div>

Hi Art,

I wrote an example specifying the kuromoji analyzer("kuromoji") and custom  
analyzer("my\_analyzer") for a field.

curl -XPUT "[http://localhost:9200/kuromoji-sample](http://localhost:9200/kuromoji-sample)" -d'  
{  
"settings": {  
"index": {  
"analysis": {  
"analyzer": {  
"my\_analyzer": {  
"tokenizer": "kuromoji\_tokenizer",  
"filter": [  
"kuromoji\_baseform"  
]  
}  
}  
}  
}  
},  
"mappings": {  
"sample": {  
"properties": {  
"title": {  
"type": "string",  
"analyzer": "my\_analyzer"  
},  
"body" : {  
"type": "string",  
"analyzer": "kuromoji"  
}  
}  
}  
}  
}'

I hope that it will be helpful for you.

2014-08-22 9:18 GMT+09:00 [art@safeshepherd.com](mailto:art@safeshepherd.com):

> I have the same question about using an analyzer I have written as a  
> plug-in for Elasticsearch 1.3.
> 
> [elasticsearch-analysis-kuromoji/README.md at es-1.3 · elastic/elasticsearch-analysis-kuromoji · GitHub](https://github.com/elasticsearch/elasticsearch-analysis-kuromoji/blob/es-1.3/README.md)  
> demonstrates only how to use the tokenizers in combination with the  
> built-in CustomAnalyzer. They do not show how to use the kuromoji analyzer  
> itself.
> 
> When I try to specify my analyzer for a field, I get errors like this:
> 
> MapperParsingException[Analyzer [special\_analyzer] not found for field  
> [foo]];
> 
> Can you show an example of how to specify the kuromoji analyzer for a  
> field? I should then be able to adapt it for use with my plugin analyzer.
> 
> Thanks in advance,  
> Art
> 
> On Tuesday, August 5, 2014 12:34:42 AM UTC-7, Jun Ohtani wrote:
> 
> > Hi,
> > 
> > I think this plugin will be helpful for you.
> > 
> > [GitHub - elastic/elasticsearch-analysis-kuromoji: Japanese (kuromoji) Analysis Plugin](https://github.com/elasticsearch/elasticsearch-analysis-kuromoji)  
> > 2014/08/05 15:58 [fanc...@gmail.com](mailto:fanc...@gmail.com):
> > 
> > > I want to use my own Chinese analyzer and I can write lucene analyzer  
> > > class myself. How can I integrate it to elasticsearch?  
> > > I googled and found [Elastic — The Search AI Company | Elastic](http://www.elasticsearch.org/guide/en/)  
> > > elasticsearch/guide/current/custom-analyzers.html. But it only combine  
> > > existing tokenizers and filters. I can use tokenizer writing in java by  
> > > myself.
> > > 
> > > --  
> > > 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 [elasticsearc...@googlegroups.com](mailto:elasticsearc...@googlegroups.com).
> > > 
> > > To view this discussion on the web visit [https://groups.google.com/d/](https://groups.google.com/d/)  
> > > msgid/elasticsearch/c3fe52cd-8cb5-4c53-b0fe-87183deb45bf%  
> > > [40googlegroups.com](http://40googlegroups.com)  
> > > [https://groups.google.com/d/msgid/elasticsearch/c3fe52cd-8cb5-4c53-b0fe-87183deb45bf%40googlegroups.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/c3fe52cd-8cb5-4c53-b0fe-87183deb45bf%40googlegroups.com?utm_medium=email&utm_source=footer)  
> > > .  
> > > For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).
> > 
> > --  
> > 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/da795847-3ea2-4afb-9a7b-aefdd6f111a0%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/da795847-3ea2-4afb-9a7b-aefdd6f111a0%40googlegroups.com)  
> > [https://groups.google.com/d/msgid/elasticsearch/da795847-3ea2-4afb-9a7b-aefdd6f111a0%40googlegroups.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/da795847-3ea2-4afb-9a7b-aefdd6f111a0%40googlegroups.com?utm_medium=email&utm_source=footer)  
> > .
> 
> For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

## --

Jun Ohtani  
blog : [http://blog.johtani.info](http://blog.johtani.info)

--  
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/CAPW8A5x9xr\_4OoHeBjCO%2BYYJHN3-O5pSk2fB7-v0rETKPMRHkg%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CAPW8A5x9xr_4OoHeBjCO%2BYYJHN3-O5pSk2fB7-v0rETKPMRHkg%40mail.gmail.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

### Author: ![art](https://avatars.discourse-cdn.com/v4/letter/a/8797f3/32.png) [@art](https://discuss.elastic.co/u/art)
#### Post date: [August 26, 2014, 5:08pm UTC](https://discuss.elastic.co/t/how-to-use-my-customer-lucene-analyzer-tokenizer/19086/6 "2014-08-26T17:08:43Z")

</div>

Thanks Jun, that was helpful. It helped me to realize I had not fully  
connected my analyzer plugin.

On Thursday, August 21, 2014 11:23:47 PM UTC-7, Jun Ohtani wrote:

> Hi Art,
> 
> I wrote an example specifying the kuromoji analyzer("kuromoji") and custom  
> analyzer("my\_analyzer") for a field.
> 
> curl -XPUT "[http://localhost:9200/kuromoji-sample](http://localhost:9200/kuromoji-sample)" -d'  
> {  
> "settings": {  
> "index": {  
> "analysis": {  
> "analyzer": {  
> "my\_analyzer": {  
> "tokenizer": "kuromoji\_tokenizer",  
> "filter": [  
> "kuromoji\_baseform"  
> ]  
> }  
> }  
> }  
> }  
> },  
> "mappings": {  
> "sample": {  
> "properties": {  
> "title": {  
> "type": "string",  
> "analyzer": "my\_analyzer"  
> },  
> "body" : {  
> "type": "string",  
> "analyzer": "kuromoji"  
> }  
> }  
> }  
> }  
> }'
> 
> I hope that it will be helpful for you.
> 
> 2014-08-22 9:18 GMT+09:00 \<[a...@safeshepherd.com](mailto:a...@safeshepherd.com) \<javascript:\>\>:
> 
> > I have the same question about using an analyzer I have written as a  
> > plug-in for Elasticsearch 1.3.
> > 
> > [https://github.com/elasticsearch/elasticsearch-analysis-kuromoji/blob/es-1.3/README.md](https://github.com/elasticsearch/elasticsearch-analysis-kuromoji/blob/es-1.3/README.md)  
> > demonstrates only how to use the tokenizers in combination with the  
> > built-in CustomAnalyzer. They do not show how to use the kuromoji analyzer  
> > itself.
> > 
> > When I try to specify my analyzer for a field, I get errors like this:
> > 
> > MapperParsingException[Analyzer [special\_analyzer] not found for field  
> > [foo]];
> > 
> > Can you show an example of how to specify the kuromoji analyzer for a  
> > field? I should then be able to adapt it for use with my plugin analyzer.
> > 
> > Thanks in advance,  
> > Art
> > 
> > On Tuesday, August 5, 2014 12:34:42 AM UTC-7, Jun Ohtani wrote:
> > 
> > > Hi,
> > > 
> > > I think this plugin will be helpful for you.
> > > 
> > > [GitHub - elastic/elasticsearch-analysis-kuromoji: Japanese (kuromoji) Analysis Plugin](https://github.com/elasticsearch/elasticsearch-analysis-kuromoji)  
> > > 2014/08/05 15:58 [fanc...@gmail.com](mailto:fanc...@gmail.com):
> > > 
> > > > I want to use my own Chinese analyzer and I can write lucene analyzer  
> > > > class myself. How can I integrate it to elasticsearch?  
> > > > I googled and found [Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/guide/en/)  
> > > > elasticsearch/guide/current/custom-analyzers.html. But it only combine  
> > > > existing tokenizers and filters. I can use tokenizer writing in java by  
> > > > myself.
> > > > 
> > > > --  
> > > > 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 [elasticsearc...@googlegroups.com](mailto:elasticsearc...@googlegroups.com).
> > > > 
> > > > To view this discussion on the web visit [https://groups.google.com/d/](https://groups.google.com/d/)  
> > > > msgid/elasticsearch/c3fe52cd-8cb5-4c53-b0fe-87183deb45bf%  
> > > > [40googlegroups.com](http://40googlegroups.com)  
> > > > [https://groups.google.com/d/msgid/elasticsearch/c3fe52cd-8cb5-4c53-b0fe-87183deb45bf%40googlegroups.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/c3fe52cd-8cb5-4c53-b0fe-87183deb45bf%40googlegroups.com?utm_medium=email&utm_source=footer)  
> > > > .  
> > > > For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).
> > > 
> > > --  
> > > 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 [elasticsearc...@googlegroups.com](mailto:elasticsearc...@googlegroups.com) \<javascript:\>.  
> > > To view this discussion on the web visit  
> > > [https://groups.google.com/d/msgid/elasticsearch/da795847-3ea2-4afb-9a7b-aefdd6f111a0%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/da795847-3ea2-4afb-9a7b-aefdd6f111a0%40googlegroups.com)  
> > > [https://groups.google.com/d/msgid/elasticsearch/da795847-3ea2-4afb-9a7b-aefdd6f111a0%40googlegroups.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/da795847-3ea2-4afb-9a7b-aefdd6f111a0%40googlegroups.com?utm_medium=email&utm_source=footer)  
> > > .
> > 
> > For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).
> 
> ## --
> 
> Jun Ohtani  
> blog : [http://blog.johtani.info](http://blog.johtani.info)

--  
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/a792d08d-534f-4619-bfcb-0f01262b6c51%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/a792d08d-534f-4619-bfcb-0f01262b6c51%40googlegroups.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, 1:06am UTC](https://discuss.elastic.co/t/how-to-use-my-customer-lucene-analyzer-tokenizer/19086/7 "2017-07-06T01:06:18Z")

</div>


