# Dumb question- using the cjk analyzer

**URL:** <https://discuss.elastic.co/t/dumb-question-using-the-cjk-analyzer/5438>\
**Category:** Elasticsearch\
**Created:** [September 22, 2011, 7:06pm UTC](https://discuss.elastic.co/t/dumb-question-using-the-cjk-analyzer/5438 "2011-09-22T19:06:06Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![nathan\_moore](https://avatars.discourse-cdn.com/v4/letter/n/d78d45/32.png) [@nathan\_moore](https://discuss.elastic.co/u/nathan_moore)\
**Post date:** [September 22, 2011, 7:06pm UTC](https://discuss.elastic.co/t/dumb-question-using-the-cjk-analyzer/5438/1 "2011-09-22T19:06:06Z")

</div>

Hi everyone,

Sorry for the n00b post. I just started using ElasticSearch for a  
dynamic website search. In English, everything just works great.  
Love the json interface- was able to create an index easily, query it  
easily, and integrate it into the website easily.

It went so well, that I've been asked to use ElasticSearch for a  
Japanese text website search. Should be no problem, the documentation  
says Lucene's "cjk" analyzer is supported.

So how do I do it? Everything's in utf8, I try to execute a query:  
curl -XGET '[http://localhost:9200/MySite/search/\_search?pretty=1&q=](http://localhost:9200/MySite/search/_search?pretty=1&q=)  
\uff52\uff49\uff50'  
This fails to return any results. Naturally- I need the cjk analyzer  
to break out the Japanese characters. Cjk will do it:  
curl 'localhost:9200/MySite/\_analyze?pretty=1&analyzer=cjk' -d '  
\uff52\uff49\uff50'  
And this breaks out the tokens without a problem.

Doing what I thought was the obvious:  
curl 'localhost:9200/MySite/search/\_search?pretty=1&q=  
\uff52\uff49\uff50' -d {  
"settings":{  
"analysis":{  
"analyzer":"cjk"  
}  
}  
}'

This gives an "unable to parse" error, so obviously, I've done  
something really stupid with my syntax.

Hence my n00b question: what's wrong with my syntax? What dumb thing  
have I done? Do I need to set some default elsewhere to use the cjk  
analyzer?

Thanks in advance,

-Nathan

---

<div class="post-metadata">

**Author:** ![James\_Cook](https://avatars.discourse-cdn.com/v4/letter/j/898d66/32.png) [@James\_Cook](https://discuss.elastic.co/u/James_Cook)\
**Post date:** [September 22, 2011, 7:26pm UTC](https://discuss.elastic.co/t/dumb-question-using-the-cjk-analyzer/5438/2 "2011-09-22T19:26:17Z")

</div>

Hi Nathan,

To override the default analyzer for a particular index, you would do this:

curl -XPUT '[http://localhost:9200/myindex](http://localhost:9200/myindex)' -d '  
{  
"settings": {

"analysis" : {

```
        "analyzer" : {
            "default" : {
                "type" : "cjk"

```

}

```
        }
    }
}

```

}'

If you want to do the same across all indicies, you can add the similar configuration to the elasticsearch.yml file under the 'index' settings.

---

<div class="post-metadata">

**Author:** ![nathan\_moore](https://avatars.discourse-cdn.com/v4/letter/n/d78d45/32.png) [@nathan\_moore](https://discuss.elastic.co/u/nathan_moore)\
**Post date:** [September 22, 2011, 8:26pm UTC](https://discuss.elastic.co/t/dumb-question-using-the-cjk-analyzer/5438/3 "2011-09-22T20:26:03Z")

</div>

Thank you so much! That was fast. Worked too 🙂

-Nathan

On Sep 22, 12:26 pm, James Cook [jc...@tracermedia.com](mailto:jc...@tracermedia.com) wrote:

> Hi Nathan,
> 
> To override the default analyzer for a particular index, you would do this:
> 
> curl -XPUT '[http://localhost:9200/myindex'-d](http://localhost:9200/myindex'-d) '  
> {  
> "settings": {
> 
> "analysis" : {
> 
> ```
> "analyzer" : {
> "default" : {
> "type" : "cjk"
> 
> ```
> 
> }
> 
> ```
> }
> }
> }
> 
> ```
> 
> }'
> 
> If you want to do the same across all indicies, you can add the similar configuration to the elasticsearch.yml file under the 'index' settings.

---

<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, 3:53am UTC](https://discuss.elastic.co/t/dumb-question-using-the-cjk-analyzer/5438/4 "2017-07-06T03:53:45Z")

</div>


