# JSON - Analyzer configuration

**URL:** <https://discuss.elastic.co/t/json-analyzer-configuration/7790>\
**Category:** Elasticsearch\
**Created:** [May 21, 2012, 5:28pm UTC](https://discuss.elastic.co/t/json-analyzer-configuration/7790 "2012-05-21T17:28:22Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Diego\_Sosa](https://avatars.discourse-cdn.com/v4/letter/d/47e85d/32.png) [@Diego\_Sosa](https://discuss.elastic.co/u/Diego_Sosa)\
**Post date:** [May 21, 2012, 5:28pm UTC](https://discuss.elastic.co/t/json-analyzer-configuration/7790/1 "2012-05-21T17:28:22Z")

</div>

Hello everyone,

I am trying to create the mapping for my first object. It has two  
properties for now: an id and a name. The ID is not searchable but the  
name is and I would like to use the snowball analyzer configured with  
spanish language. How should I set that in json?

{  
"possible\_client": {  
"properties" : {  
"id" : {  
"type" : "long",  
"store" : "yes",  
"index" : "not\_analyzed"  
},  
"name" : {  
"type" : "string",  
"store" : "yes",  
"index" : "analyzed",  
"analyzer" : "spanish" \<--- How to set and configure different  
analyzers here?  
}  
}  
}  
}

Thanks in advance.

---

<div class="post-metadata">

**Author:** ![Nick\_Dunn](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/nick_dunn/32/2315_2.png) [@Nick\_Dunn](https://discuss.elastic.co/u/Nick_Dunn)\
**Post date:** [May 21, 2012, 6:55pm UTC](https://discuss.elastic.co/t/json-analyzer-configuration/7790/2 "2012-05-21T18:55:19Z")

</div>

Agustin,

My understanding is that you can configure custom analysers with a  
configuration file, which you either place on your server in the  
elasticsearch directory (which it reads when you restart the instance), or  
pass your configuration when you create the index via the API. I use the  
second method. Here's an example JSON file I use to configure an index:

> <https://github.com/nickdunn/elasticsearch/blob/master/templates/index.json>

It creates two custom analysers named "symphony\_fulltext" and  
"symphony\_autocomplete", which use an array of filters. Note that the  
"symphony\_fulltext" analyser uses two custom filters named  
"custom\_synonyms" and "custom\_stop", which are defined underneath.

I sent this JSON document when creating the index for the first time, but  
you can use the update API to send changes to the index after creation  
(just be sure to use the open/close API first, else it won't work).

So it sounds to me like you want to create your own custom analyser, call  
it "spanish" and configure your tokenisers and filters there.

N.

On Monday, May 21, 2012 6:28:22 PM UTC+1, Agustin Lopez wrote:

> Hello everyone,
> 
> I am trying to create the mapping for my first object. It has two  
> properties for now: an id and a name. The ID is not searchable but the  
> name is and I would like to use the snowball analyzer configured with  
> spanish language. How should I set that in json?
> 
> {  
> "possible\_client": {  
> "properties" : {  
> "id" : {  
> "type" : "long",  
> "store" : "yes",  
> "index" : "not\_analyzed"  
> },  
> "name" : {  
> "type" : "string",  
> "store" : "yes",  
> "index" : "analyzed",  
> "analyzer" : "spanish" \<--- How to set  
> and configure different  
> analyzers here?  
> }  
> }  
> }  
> }
> 
> Thanks in advance.

---

<div class="post-metadata">

**Author:** ![Agustin\_Lopez](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/agustin_lopez/32/2888_2.png) [@Agustin\_Lopez](https://discuss.elastic.co/u/Agustin_Lopez)\
**Post date:** [May 21, 2012, 10:06pm UTC](https://discuss.elastic.co/t/json-analyzer-configuration/7790/3 "2012-05-21T22:06:50Z")

</div>

Nick,

Thank you for your reply. Do you know where can I find some documentation about placing custom analyzers with a configuration file you place on the server?  
Does this impact every index? On the other hand, I understand what you did. I was trying to do the same thing but from inside the mapping. I guess that needs to be done on the index level.

I'll give it a try as you said, but if you know where I can find information about the configuration file that would be ideal.

Thanks.

On May 21, 2012, at 3:55 PM, Nick Dunn wrote:

> Agustin,
> 
> My understanding is that you can configure custom analysers with a configuration file, which you either place on your server in the elasticsearch directory (which it reads when you restart the instance), or pass your configuration when you create the index via the API. I use the second method. Here's an example JSON file I use to configure an index:
> 
> [https://github.com/nickdunn/elasticsearch/blob/master/templates/index.json](https://github.com/nickdunn/elasticsearch/blob/master/templates/index.json)
> 
> It creates two custom analysers named "symphony\_fulltext" and "symphony\_autocomplete", which use an array of filters. Note that the "symphony\_fulltext" analyser uses two custom filters named "custom\_synonyms" and "custom\_stop", which are defined underneath.
> 
> I sent this JSON document when creating the index for the first time, but you can use the update API to send changes to the index after creation (just be sure to use the open/close API first, else it won't work).
> 
> So it sounds to me like you want to create your own custom analyser, call it "spanish" and configure your tokenisers and filters there.
> 
> N.
> 
> On Monday, May 21, 2012 6:28:22 PM UTC+1, Agustin Lopez wrote:  
> Hello everyone,
> 
> I am trying to create the mapping for my first object. It has two  
> properties for now: an id and a name. The ID is not searchable but the  
> name is and I would like to use the snowball analyzer configured with  
> spanish language. How should I set that in json?
> 
> {  
> "possible\_client": {  
> "properties" : {  
> "id" : {  
> "type" : "long",  
> "store" : "yes",  
> "index" : "not\_analyzed"  
> },  
> "name" : {  
> "type" : "string",  
> "store" : "yes",  
> "index" : "analyzed",  
> "analyzer" : "spanish" \<--- How to set and configure different  
> analyzers here?  
> }  
> }  
> }  
> }
> 
> Thanks in advance.

---

<div class="post-metadata">

**Author:** ![Ivan](https://avatars.discourse-cdn.com/v4/letter/i/df788c/32.png) [@Ivan](https://discuss.elastic.co/u/Ivan)\
**Post date:** [May 22, 2012, 4:57pm UTC](https://discuss.elastic.co/t/json-analyzer-configuration/7790/4 "2012-05-22T16:57:43Z")

</div>

Agustin,

If you want to define a custom analyzer at the global ES level, you  
would need to simply add it to your config file. The default config is  
in YAML (elasticsearch.yml), but it can be converted to JSON.

The documentation has an example with custom analyzers/tokenizers/filters:

> **[Elasticsearch Platform — Find real-time answers at scale](https://www.elastic.co)**
>
> Power insights and outcomes with the Elasticsearch Platform and AI. See into your data and find answers that matter with enterprise solutions designed to help you build, observe, and protect. Try Elasticsearch free today.

The configuration code you see needs to be part of elasticsearch.yml.  
Every index in the system can you whatever is defined in the  
configuration file.

--  
Ivan

On Mon, May 21, 2012 at 3:06 PM, Agustin Lopez  
[agustin.lopez@arancione-consulting.com](mailto:agustin.lopez@arancione-consulting.com) wrote:

> Nick,
> 
> Thank you for your reply. Do you know where can I find some documentation  
> about placing custom analyzers with a configuration file you place on the  
> server?  
> Does this impact every index? On the other hand, I understand what you did.  
> I was trying to do the same thing but from inside the mapping. I guess that  
> needs to be done on the index level.
> 
> I'll give it a try as you said, but if you know where I can find information  
> about the configuration file that would be ideal.
> 
> Thanks.
> 
> On May 21, 2012, at 3:55 PM, Nick Dunn wrote:
> 
> Agustin,
> 
> My understanding is that you can configure custom analysers with a  
> configuration file, which you either place on your server in the  
> elasticsearch directory (which it reads when you restart the instance), or  
> pass your configuration when you create the index via the API. I use the  
> second method. Here's an example JSON file I use to configure an index:
> 
> [https://github.com/nickdunn/elasticsearch/blob/master/templates/index.json](https://github.com/nickdunn/elasticsearch/blob/master/templates/index.json)
> 
> It creates two custom analysers named "symphony\_fulltext" and  
> "symphony\_autocomplete", which use an array of filters. Note that the  
> "symphony\_fulltext" analyser uses two custom filters named "custom\_synonyms"  
> and "custom\_stop", which are defined underneath.
> 
> I sent this JSON document when creating the index for the first time, but  
> you can use the update API to send changes to the index after creation (just  
> be sure to use the open/close API first, else it won't work).
> 
> So it sounds to me like you want to create your own custom analyser, call it  
> "spanish" and configure your tokenisers and filters there.
> 
> N.
> 
> On Monday, May 21, 2012 6:28:22 PM UTC+1, Agustin Lopez wrote:
> 
> > Hello everyone,
> > 
> > I am trying to create the mapping for my first object. It has two  
> > properties for now: an id and a name. The ID is not searchable but the  
> > name is and I would like to use the snowball analyzer configured with  
> > spanish language. How should I set that in json?
> > 
> > {  
> > "possible\_client": {  
> > "properties" : {  
> > "id" : {  
> > "type" : "long",  
> > "store" : "yes",  
> > "index" : "not\_analyzed"  
> > },  
> > "name" : {  
> > "type" : "string",  
> > "store" : "yes",  
> > "index" : "analyzed",  
> > "analyzer" : "spanish" \<--- How to set  
> > and configure different  
> > analyzers here?  
> > }  
> > }  
> > }  
> > }
> > 
> > Thanks in advance.

---

<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 25, 2012, 8:27pm UTC](https://discuss.elastic.co/t/json-analyzer-configuration/7790/5 "2012-05-25T20:27:51Z")

</div>

Note that you can also define the analyzers in the create index request.

On Tue, May 22, 2012 at 6:57 PM, Ivan Brusic [ivan@brusic.com](mailto:ivan@brusic.com) wrote:

> Agustin,
> 
> If you want to define a custom analyzer at the global ES level, you  
> would need to simply add it to your config file. The default config is  
> in YAML (elasticsearch.yml), but it can be converted to JSON.
> 
> The documentation has an example with custom analyzers/tokenizers/filters:
> 
> [Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/guide/reference/index-modules/analysis/custom-analyzer.html)
> 
> The configuration code you see needs to be part of elasticsearch.yml.  
> Every index in the system can you whatever is defined in the  
> configuration file.
> 
> --  
> Ivan
> 
> On Mon, May 21, 2012 at 3:06 PM, Agustin Lopez  
> [agustin.lopez@arancione-consulting.com](mailto:agustin.lopez@arancione-consulting.com) wrote:
> 
> > Nick,
> > 
> > Thank you for your reply. Do you know where can I find some documentation  
> > about placing custom analyzers with a configuration file you place on the  
> > server?  
> > Does this impact every index? On the other hand, I understand what you  
> > did.  
> > I was trying to do the same thing but from inside the mapping. I guess  
> > that  
> > needs to be done on the index level.
> > 
> > I'll give it a try as you said, but if you know where I can find  
> > information  
> > about the configuration file that would be ideal.
> > 
> > Thanks.
> > 
> > On May 21, 2012, at 3:55 PM, Nick Dunn wrote:
> > 
> > Agustin,
> > 
> > My understanding is that you can configure custom analysers with a  
> > configuration file, which you either place on your server in the  
> > elasticsearch directory (which it reads when you restart the instance),  
> > or  
> > pass your configuration when you create the index via the API. I use the  
> > second method. Here's an example JSON file I use to configure an index:
> 
> [https://github.com/nickdunn/elasticsearch/blob/master/templates/index.json](https://github.com/nickdunn/elasticsearch/blob/master/templates/index.json)
> 
> > It creates two custom analysers named "symphony\_fulltext" and  
> > "symphony\_autocomplete", which use an array of filters. Note that the  
> > "symphony\_fulltext" analyser uses two custom filters named  
> > "custom\_synonyms"  
> > and "custom\_stop", which are defined underneath.
> > 
> > I sent this JSON document when creating the index for the first time, but  
> > you can use the update API to send changes to the index after creation  
> > (just  
> > be sure to use the open/close API first, else it won't work).
> > 
> > So it sounds to me like you want to create your own custom analyser,  
> > call it  
> > "spanish" and configure your tokenisers and filters there.
> > 
> > N.
> > 
> > On Monday, May 21, 2012 6:28:22 PM UTC+1, Agustin Lopez wrote:
> > 
> > > Hello everyone,
> > > 
> > > I am trying to create the mapping for my first object. It has two  
> > > properties for now: an id and a name. The ID is not searchable but the  
> > > name is and I would like to use the snowball analyzer configured with  
> > > spanish language. How should I set that in json?
> > > 
> > > {  
> > > "possible\_client": {  
> > > "properties" : {  
> > > "id" : {  
> > > "type" : "long",  
> > > "store" : "yes",  
> > > "index" : "not\_analyzed"  
> > > },  
> > > "name" : {  
> > > "type" : "string",  
> > > "store" : "yes",  
> > > "index" : "analyzed",  
> > > "analyzer" : "spanish" \<--- How to set  
> > > and configure different  
> > > analyzers here?  
> > > }  
> > > }  
> > > }  
> > > }
> > > 
> > > Thanks in advance.

---

<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:27am UTC](https://discuss.elastic.co/t/json-analyzer-configuration/7790/6 "2017-07-06T03:27:02Z")

</div>


