# How to use user dictionary on elasticsearch / elasticsearch-analysis-kuromoji

**URL:** <https://discuss.elastic.co/t/how-to-use-user-dictionary-on-elasticsearch-elasticsearch-analysis-kuromoji/11209>\
**Category:** Elasticsearch\
**Created:** [March 19, 2013, 4:01pm UTC](https://discuss.elastic.co/t/how-to-use-user-dictionary-on-elasticsearch-elasticsearch-analysis-kuromoji/11209 "2013-03-19T16:01:48Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Mai\_2](https://avatars.discourse-cdn.com/v4/letter/m/d2c977/32.png) [@Mai\_2](https://discuss.elastic.co/u/Mai_2)\
**Post date:** [March 19, 2013, 4:01pm UTC](https://discuss.elastic.co/t/how-to-use-user-dictionary-on-elasticsearch-elasticsearch-analysis-kuromoji/11209/1 "2013-03-19T16:01:48Z")

</div>

Hi,

I've just started to use Elastic Search with elasticsearch /  
elasticsearch-analysis-kuromoji, which is Japanese tokenizer. I works well  
and now I would like to know how use user dictionary. From it's source  
code, it seems to support user dictionary.

Thank you in advance for your support.

Regards,  
Mai Nakagawa

--  
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).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<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:** [March 20, 2013, 7:16am UTC](https://discuss.elastic.co/t/how-to-use-user-dictionary-on-elasticsearch-elasticsearch-analysis-kuromoji/11209/2 "2013-03-20T07:16:48Z")

</div>

Hi Mai

I try user dictionary, elasticsearch-0.90.0 Beta1 and elasticsearch-analysis-kuromoji/1.2.0.

Register the analyzer "my\_analyzer" with kuromoji\_tokenizer using user\_dictionary.  
"userdict\_ja.txt" file put "ES\_HOME/config/userdict\_ja.txt" .(I use SOLR\_HOME/example/solr/colleciton1/config/lang/userdict\_ja.txt)

$ curl -XPUT '[http://localhost:9200/kuromoji\_sample/](http://localhost:9200/kuromoji_sample/)' -d'  
{  
"index":{  
"analysis":{  
"tokenizer" : {  
"kuromoji\_user\_dict" : {  
"type":"kuromoji\_tokenizer",  
"user\_dictionary":"userdict\_ja.txt"  
}  
},  
"analyzer" : {  
"my\_analyzer" : {  
"type" : "custom",  
"tokenizer" : "kuromoji\_user\_dict"  
}  
}

```
    }
}

```

}  
'

Analyze "朝青龍" using "my\_analyzer" with user\_dictionary. "朝青龍" include userdict\_ja.txt  
$ curl -XGET '[http://localhost:9200/kuromoji\_sample/\_analyze?analyzer=my\_analyzer&pretty](http://localhost:9200/kuromoji_sample/_analyze?analyzer=my_analyzer&pretty)' -d '朝青龍'  
{  
"tokens" : [ {  
"token" : "朝青龍",  
"start\_offset" : 0,  
"end\_offset" : 3,  
"type" : "word",  
"position" : 1  
} ]

Analyze "朝青龍" using default "kuromoji" analyzer without user\_dictionary  
$ curl -XGET '[http://localhost:9200/kuromoji\_sample/\_analyze?analyzer=kuromoji&pretty](http://localhost:9200/kuromoji_sample/_analyze?analyzer=kuromoji&pretty)' -d '朝青龍'  
{  
"tokens" : [ {  
"token" : "朝",  
"start\_offset" : 0,  
"end\_offset" : 1,  
"type" : "word",  
"position" : 1  
}, {  
"token" : "青龍",  
"start\_offset" : 1,  
"end\_offset" : 3,  
"type" : "word",  
"position" : 2  
} ]

* * *

Jun Ohtani  
[johtani@gmail.com](mailto:johtani@gmail.com)  
blog : [http://johtani.jugem.jp](http://johtani.jugem.jp)  
twitter : [http://twitter.com/johtani](http://twitter.com/johtani)

On 2013/03/20, at 1:01, Mai [nakagawa.mai@gmail.com](mailto:nakagawa.mai@gmail.com) wrote:

> Hi,
> 
> I've just started to use Elastic Search with elasticsearch / elasticsearch-analysis-kuromoji, which is Japanese tokenizer. I works well and now I would like to know how use user dictionary. From it's source code, it seems to support user dictionary.
> 
> Thank you in advance for your support.
> 
> Regards,  
> Mai Nakagawa
> 
> --  
> 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).  
> For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

--  
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).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![Mai\_2](https://avatars.discourse-cdn.com/v4/letter/m/d2c977/32.png) [@Mai\_2](https://discuss.elastic.co/u/Mai_2)\
**Post date:** [March 20, 2013, 4:19pm UTC](https://discuss.elastic.co/t/how-to-use-user-dictionary-on-elasticsearch-elasticsearch-analysis-kuromoji/11209/3 "2013-03-20T16:19:32Z")

</div>

Hi Jun san,

Thank you for your reply.

I've tried with the current latest stable version, which is  
elasticsearch-0.20.5 and elasticsearch-analysis-kuromoji/1.1.0, and it  
works as well !

Mai

On Wednesday, March 20, 2013 12:16:48 AM UTC-7, johtani wrote:

> Hi Mai
> 
> I try user dictionary, elasticsearch-0.90.0 Beta1 and  
> elasticsearch-analysis-kuromoji/1.2.0.
> 
> Register the analyzer "my\_analyzer" with kuromoji\_tokenizer using  
> user\_dictionary.  
> "userdict\_ja.txt" file put "ES\_HOME/config/userdict\_ja.txt" .(I use  
> SOLR\_HOME/example/solr/colleciton1/config/lang/userdict\_ja.txt)
> 
> $ curl -XPUT '[http://localhost:9200/kuromoji\_sample/](http://localhost:9200/kuromoji_sample/)' -d'  
> {  
> "index":{  
> "analysis":{  
> "tokenizer" : {  
> "kuromoji\_user\_dict" : {  
> "type":"kuromoji\_tokenizer",  
> "user\_dictionary":"userdict\_ja.txt"  
> }  
> },  
> "analyzer" : {  
> "my\_analyzer" : {  
> "type" : "custom",  
> "tokenizer" : "kuromoji\_user\_dict"  
> }  
> }
> 
> ```
> } 
> } 
> 
> ```
> 
> }  
> '
> 
> Analyze "朝青龍" using "my\_analyzer" with user\_dictionary. "朝青龍" include  
> userdict\_ja.txt  
> $ curl -XGET '  
> [http://localhost:9200/kuromoji\_sample/\_analyze?analyzer=my\_analyzer&pretty](http://localhost:9200/kuromoji_sample/_analyze?analyzer=my_analyzer&pretty)'  
> -d '朝青龍'  
> {  
> "tokens" : [ {  
> "token" : "朝青龍",  
> "start\_offset" : 0,  
> "end\_offset" : 3,  
> "type" : "word",  
> "position" : 1  
> } ]
> 
> Analyze "朝青龍" using default "kuromoji" analyzer without user\_dictionary  
> $ curl -XGET '  
> [http://localhost:9200/kuromoji\_sample/\_analyze?analyzer=kuromoji&pretty](http://localhost:9200/kuromoji_sample/_analyze?analyzer=kuromoji&pretty)'  
> -d '朝青龍'  
> {  
> "tokens" : [ {  
> "token" : "朝",  
> "start\_offset" : 0,  
> "end\_offset" : 1,  
> "type" : "word",  
> "position" : 1  
> }, {  
> "token" : "青龍",  
> "start\_offset" : 1,  
> "end\_offset" : 3,  
> "type" : "word",  
> "position" : 2  
> } ]
> 
> * * *
> 
> Jun Ohtani  
> [joh...@gmail.com](mailto:joh...@gmail.com) \<javascript:\>  
> blog : [http://johtani.jugem.jp](http://johtani.jugem.jp)  
> twitter : [http://twitter.com/johtani](http://twitter.com/johtani)
> 
> On 2013/03/20, at 1:01, Mai \<[nakaga...@gmail.com](mailto:nakaga...@gmail.com) \<javascript:\>\> wrote:
> 
> > Hi,
> > 
> > I've just started to use Elastic Search with elasticsearch /  
> > elasticsearch-analysis-kuromoji, which is Japanese tokenizer. I works well  
> > and now I would like to know how use user dictionary. From it's source  
> > code, it seems to support user dictionary.
> > 
> > Thank you in advance for your support.
> > 
> > Regards,  
> > Mai Nakagawa
> > 
> > --  
> > 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:\>.  
> > For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

--  
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).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<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, 2:45am UTC](https://discuss.elastic.co/t/how-to-use-user-dictionary-on-elasticsearch-elasticsearch-analysis-kuromoji/11209/4 "2017-07-06T02:45:35Z")

</div>


