# Overriding built-in analyzer and set it as default

**URL:** <https://discuss.elastic.co/t/overriding-built-in-analyzer-and-set-it-as-default/19338>\
**Category:** Elasticsearch\
**Created:** [August 19, 2014, 12:21pm UTC](https://discuss.elastic.co/t/overriding-built-in-analyzer-and-set-it-as-default/19338 "2014-08-19T12:21:23Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![phoenix](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/phoenix/32/1319_2.png) [@phoenix](https://discuss.elastic.co/u/phoenix)\
**Post date:** [August 19, 2014, 12:21pm UTC](https://discuss.elastic.co/t/overriding-built-in-analyzer-and-set-it-as-default/19338/1 "2014-08-19T12:21:23Z")

</div>

Hi everyone,

I'm trying to override the french analyser in my index. What i want is that  
this custom 'french' analyzer becomes the default analyzer for all searches  
and indexing, if none is given explicitly.

The settings i give are like this :

{  
"index":{  
"cluster.name":"test-cluster",  
"client.transport.sniff":true,  
"analysis":{  
"filter":{  
"french\_elision":{  
"type":"elision",  
"articles":[  
"l",  
"m",  
"t",  
"qu",  
"n",  
"s",  
"j",  
"d",  
"c",  
"jusqu",  
"quoiqu",  
"lorsqu",  
"puisqu"  
]  
},  
"french\_stop":{  
"type":"stop",  
"stopwords":"_french_",  
"ignore\_case":true  
},  
"snowball":{  
"type":"snowball",  
"language":"french"  
}  
},  
"analyzer":{  
"french":{  
"tokenizer":"standard",  
"filter":[  
"french\_elision",  
"lowercase",  
"french\_stop",  
"snowball"  
]  
},  
"lower\_analyzer":{  
"type":"custom",  
"tokenizer":"keyword",  
"filter":"lowercase"  
},  
"token\_analyzer":{  
"type":"custom",  
"tokenizer":"whitespace"  
},  
"default":{  
"type":"french"  
}  
}  
}  
}  
}  
The problem is that my analyzer seems to work correctly, but it is not used  
as a default.  
A test with inquisitor plugin gives me this :

Index: test-indexAnalyzed Textdefaultaime 1cheval 3frenchaim 1cheval 3  
lower\_analyzerj'aime les chevaux 1token\_analyzerj'aime 1les 2chevaux 3  
As you can see, the french override analyzer gives me a perfect result, but  
the default one gives me wrong result. The verb is not stemmed to 'aim' and  
stays 'time' (which is not correct). Only the 'chevaux' word is stemmed to  
'cheval' (which is correct).

Do you know what i'm doing wrong ? Or how i could do to tell ElasticSearch  
to choose my custom french analyzer as its default analyzer instead of  
digging out the built-in french analyzer ?

Note : I tried giving it directly a name instead of a type, but with no  
luck, like this : "default": "french"

Thanks for all your help in advance !

--  
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/980c2240-15ec-4ba2-ad46-a57e17300070%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/980c2240-15ec-4ba2-ad46-a57e17300070%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![vineeth\_mohan\_2](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/vineeth_mohan_2/32/747_2.png) [@vineeth\_mohan\_2](https://discuss.elastic.co/u/vineeth_mohan_2)\
**Post date:** [August 19, 2014, 12:55pm UTC](https://discuss.elastic.co/t/overriding-built-in-analyzer-and-set-it-as-default/19338/2 "2014-08-19T12:55:55Z")

</div>

Hello Frederic ,

I believe you can use the default configuration settings for this -

> **[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.

Thanks  
Vineeth

On Tue, Aug 19, 2014 at 5:51 PM, Frederic Esnault \<  
[esnault.frederic@gmail.com](mailto:esnault.frederic@gmail.com)\> wrote:

> Hi everyone,
> 
> I'm trying to override the french analyser in my index. What i want is  
> that this custom 'french' analyzer becomes the default analyzer for all  
> searches and indexing, if none is given explicitly.
> 
> The settings i give are like this :
> 
> {  
> "index":{  
> "cluster.name":"test-cluster",  
> "client.transport.sniff":true,  
> "analysis":{  
> "filter":{  
> "french\_elision":{  
> "type":"elision",  
> "articles":[  
> "l",  
> "m",  
> "t",  
> "qu",  
> "n",  
> "s",  
> "j",  
> "d",  
> "c",  
> "jusqu",  
> "quoiqu",  
> "lorsqu",  
> "puisqu"  
> ]  
> },  
> "french\_stop":{  
> "type":"stop",  
> "stopwords":"_french_",  
> "ignore\_case":true  
> },  
> "snowball":{  
> "type":"snowball",  
> "language":"french"  
> }  
> },  
> "analyzer":{  
> "french":{  
> "tokenizer":"standard",  
> "filter":[  
> "french\_elision",  
> "lowercase",  
> "french\_stop",  
> "snowball"  
> ]  
> },  
> "lower\_analyzer":{  
> "type":"custom",  
> "tokenizer":"keyword",  
> "filter":"lowercase"  
> },  
> "token\_analyzer":{  
> "type":"custom",  
> "tokenizer":"whitespace"  
> },  
> "default":{  
> "type":"french"  
> }  
> }  
> }  
> }  
> }  
> The problem is that my analyzer seems to work correctly, but it is not  
> used as a default.  
> A test with inquisitor plugin gives me this :
> 
> Index: test-indexAnalyzed Textdefaultaime 1cheval 3frenchaim 1cheval 3  
> lower\_analyzerj'aime les chevaux 1token\_analyzerj'aime 1les 2chevaux 3  
> As you can see, the french override analyzer gives me a perfect result,  
> but the default one gives me wrong result. The verb is not stemmed to 'aim'  
> and stays 'time' (which is not correct). Only the 'chevaux' word is stemmed  
> to 'cheval' (which is correct).
> 
> Do you know what i'm doing wrong ? Or how i could do to tell Elasticsearch  
> to choose my custom french analyzer as its default analyzer instead of  
> digging out the built-in french analyzer ?
> 
> Note : I tried giving it directly a name instead of a type, but with no  
> luck, like this : "default": "french"
> 
> Thanks for all your help in advance !
> 
> --  
> 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/980c2240-15ec-4ba2-ad46-a57e17300070%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/980c2240-15ec-4ba2-ad46-a57e17300070%40googlegroups.com)  
> [https://groups.google.com/d/msgid/elasticsearch/980c2240-15ec-4ba2-ad46-a57e17300070%40googlegroups.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/980c2240-15ec-4ba2-ad46-a57e17300070%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/CAGdPd5%3D86V%2BJ9ynikWMSj1NK0WU67GaT\_o9T76BsVGVHtU1\_%2Bg%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CAGdPd5%3D86V%2BJ9ynikWMSj1NK0WU67GaT_o9T76BsVGVHtU1_%2Bg%40mail.gmail.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![phoenix](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/phoenix/32/1319_2.png) [@phoenix](https://discuss.elastic.co/u/phoenix)\
**Post date:** [August 19, 2014, 2:28pm UTC](https://discuss.elastic.co/t/overriding-built-in-analyzer-and-set-it-as-default/19338/3 "2014-08-19T14:28:55Z")

</div>

Hi Vineeth and thanks for your answer.

If i understood correctly, what you suggest is to add a _default_ section  
in all mappings, right ?  
First, I would prefer to set it once and for all in the global settings.  
I'd be surprised there is no way to reference a custom analyzer in the  
global default analyzer definition, but maybe...  
Second, your link relates to default mapping, not settings.  
Finally, could you give me an example of default analyzer using your  
solution, just to test ? Documentation is too thin.

Le mardi 19 août 2014 14:56:10 UTC+2, vineeth mohan a écrit :

> Hello Frederic ,
> 
> I believe you can use the default configuration settings for this -
> 
> [Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/index-modules-mapper.html#_default_mapping)
> 
> Thanks  
> Vineeth
> 
> On Tue, Aug 19, 2014 at 5:51 PM, Frederic Esnault \<[esnault....@gmail.com](mailto:esnault....@gmail.com)  
> \<javascript:\>\> wrote:
> 
> > Hi everyone,
> > 
> > I'm trying to override the french analyser in my index. What i want is  
> > that this custom 'french' analyzer becomes the default analyzer for all  
> > searches and indexing, if none is given explicitly.
> > 
> > The settings i give are like this :
> > 
> > {  
> > "index":{  
> > "cluster.name":"test-cluster",  
> > "client.transport.sniff":true,  
> > "analysis":{  
> > "filter":{  
> > "french\_elision":{  
> > "type":"elision",  
> > "articles":[  
> > "l",  
> > "m",  
> > "t",  
> > "qu",  
> > "n",  
> > "s",  
> > "j",  
> > "d",  
> > "c",  
> > "jusqu",  
> > "quoiqu",  
> > "lorsqu",  
> > "puisqu"  
> > ]  
> > },  
> > "french\_stop":{  
> > "type":"stop",  
> > "stopwords":"_french_",  
> > "ignore\_case":true  
> > },  
> > "snowball":{  
> > "type":"snowball",  
> > "language":"french"  
> > }  
> > },  
> > "analyzer":{  
> > "french":{  
> > "tokenizer":"standard",  
> > "filter":[  
> > "french\_elision",  
> > "lowercase",  
> > "french\_stop",  
> > "snowball"  
> > ]  
> > },  
> > "lower\_analyzer":{  
> > "type":"custom",  
> > "tokenizer":"keyword",  
> > "filter":"lowercase"  
> > },  
> > "token\_analyzer":{  
> > "type":"custom",  
> > "tokenizer":"whitespace"  
> > },  
> > "default":{  
> > "type":"french"  
> > }  
> > }  
> > }  
> > }  
> > }  
> > The problem is that my analyzer seems to work correctly, but it is not  
> > used as a default.  
> > A test with inquisitor plugin gives me this :
> > 
> > Index: test-index Analyzed Text default aime 1cheval 3 french aim 1  
> > cheval 3 lower\_analyzer j'aime les chevaux 1 token\_analyzer j'aime 1les 2  
> > chevaux 3  
> > As you can see, the french override analyzer gives me a perfect result,  
> > but the default one gives me wrong result. The verb is not stemmed to 'aim'  
> > and stays 'time' (which is not correct). Only the 'chevaux' word is stemmed  
> > to 'cheval' (which is correct).
> > 
> > Do you know what i'm doing wrong ? Or how i could do to tell  
> > Elasticsearch to choose my custom french analyzer as its default analyzer  
> > instead of digging out the built-in french analyzer ?
> > 
> > Note : I tried giving it directly a name instead of a type, but with no  
> > luck, like this : "default": "french"
> > 
> > Thanks for all your help in advance !
> > 
> > --  
> > 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/980c2240-15ec-4ba2-ad46-a57e17300070%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/980c2240-15ec-4ba2-ad46-a57e17300070%40googlegroups.com)  
> > [https://groups.google.com/d/msgid/elasticsearch/980c2240-15ec-4ba2-ad46-a57e17300070%40googlegroups.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/980c2240-15ec-4ba2-ad46-a57e17300070%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/1b619d79-8bc7-4832-8835-7854837d6421%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/1b619d79-8bc7-4832-8835-7854837d6421%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![jprante](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jprante/32/44941_2.png) [@jprante](https://discuss.elastic.co/u/jprante)\
**Post date:** [August 19, 2014, 3:11pm UTC](https://discuss.elastic.co/t/overriding-built-in-analyzer-and-set-it-as-default/19338/4 "2014-08-19T15:11:09Z")

</div>

This sequence

"default":{  
"type":"french"  
}

will not work, you do not have an analyzer of type "french".

Just rename the analyzer with name "french" to the name "default" and it  
will be used as default.

Jörg

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

---

<div class="post-metadata">

**Author:** ![phoenix](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/phoenix/32/1319_2.png) [@phoenix](https://discuss.elastic.co/u/phoenix)\
**Post date:** [August 19, 2014, 3:24pm UTC](https://discuss.elastic.co/t/overriding-built-in-analyzer-and-set-it-as-default/19338/5 "2014-08-19T15:24:15Z")

</div>

Hi Jörg and thanks for your answer.

I agree with, defining my custom analyzer directly would solve the problem,  
but i have another constraint, which makes this impossible.  
I want to be able to select an analyzer at runtime (when creating the  
index), depending on the user locale.

I had a locale adapter i made myself which converted the locale to an  
analyzer name, but i had problem with the french analyzer, which led me to  
the current problem.

So i want to be able to :

1. override the french analyzer because the built-in french analyzer does  
not satisfy me;
2. set the default analyzer to my custom french analyzer
3. for people using another language, still be able to get a default  
analyzer to english snowball for example.

So i'd like to be able to do something like that :

{...{ "analyzer": "french" { "type":snowball", "language": "French" }, ...,  
"default" : ""}

The program generated value would be a simple translation of my user's  
locale : fr \> french, en \> english, and so on...  
The challenge here is that if "default" is set to "french", it should  
reference the custom "french" analyzer.

Le mardi 19 août 2014 17:11:21 UTC+2, Jörg Prante a écrit :

> This sequence
> 
> "default":{  
> "type":"french"  
> }
> 
> will not work, you do not have an analyzer of type "french".
> 
> Just rename the analyzer with name "french" to the name "default" and it  
> will be used as default.
> 
> Jörg

--  
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/a33dec5c-b98b-4cee-a200-022d138e8ea3%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/a33dec5c-b98b-4cee-a200-022d138e8ea3%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![vineeth\_mohan\_2](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/vineeth_mohan_2/32/747_2.png) [@vineeth\_mohan\_2](https://discuss.elastic.co/u/vineeth_mohan_2)\
**Post date:** [August 20, 2014, 2:24am UTC](https://discuss.elastic.co/t/overriding-built-in-analyzer-and-set-it-as-default/19338/6 "2014-08-20T02:24:30Z")

</div>

Hello Frederic ,

This was what i had in mind -

> **[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.

Place the default mapping under config and index creation will take default  
values from there.

Thanks  
Vineeth

On Tue, Aug 19, 2014 at 7:58 PM, Frederic Esnault \<  
[esnault.frederic@gmail.com](mailto:esnault.frederic@gmail.com)\> wrote:

> Hi Vineeth and thanks for your answer.
> 
> If i understood correctly, what you suggest is to add a _default_ section  
> in all mappings, right ?  
> First, I would prefer to set it once and for all in the global settings.  
> I'd be surprised there is no way to reference a custom analyzer in the  
> global default analyzer definition, but maybe...  
> Second, your link relates to default mapping, not settings.  
> Finally, could you give me an example of default analyzer using your  
> solution, just to test ? Documentation is too thin.
> 
> Le mardi 19 août 2014 14:56:10 UTC+2, vineeth mohan a écrit :
> 
> > Hello Frederic ,
> > 
> > I believe you can use the default configuration settings for this -  
> > [Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/guide/en/elasticsearch/)  
> > reference/current/index-modules-mapper.html#\_default\_mapping
> > 
> > Thanks  
> > Vineeth
> > 
> > On Tue, Aug 19, 2014 at 5:51 PM, Frederic Esnault [esnault....@gmail.com](mailto:esnault....@gmail.com)  
> > wrote:
> > 
> > > Hi everyone,
> > > 
> > > I'm trying to override the french analyser in my index. What i want is  
> > > that this custom 'french' analyzer becomes the default analyzer for all  
> > > searches and indexing, if none is given explicitly.
> > > 
> > > The settings i give are like this :
> > > 
> > > {  
> > > "index":{  
> > > "cluster.name":"test-cluster",  
> > > "client.transport.sniff":true,  
> > > "analysis":{  
> > > "filter":{  
> > > "french\_elision":{  
> > > "type":"elision",  
> > > "articles":[  
> > > "l",  
> > > "m",  
> > > "t",  
> > > "qu",  
> > > "n",  
> > > "s",  
> > > "j",  
> > > "d",  
> > > "c",  
> > > "jusqu",  
> > > "quoiqu",  
> > > "lorsqu",  
> > > "puisqu"  
> > > ]  
> > > },  
> > > "french\_stop":{  
> > > "type":"stop",  
> > > "stopwords":"_french_",  
> > > "ignore\_case":true  
> > > },  
> > > "snowball":{  
> > > "type":"snowball",  
> > > "language":"french"  
> > > }  
> > > },  
> > > "analyzer":{  
> > > "french":{  
> > > "tokenizer":"standard",  
> > > "filter":[  
> > > "french\_elision",  
> > > "lowercase",  
> > > "french\_stop",  
> > > "snowball"  
> > > ]  
> > > },  
> > > "lower\_analyzer":{  
> > > "type":"custom",  
> > > "tokenizer":"keyword",  
> > > "filter":"lowercase"  
> > > },  
> > > "token\_analyzer":{  
> > > "type":"custom",  
> > > "tokenizer":"whitespace"  
> > > },  
> > > "default":{  
> > > "type":"french"  
> > > }  
> > > }  
> > > }  
> > > }  
> > > }  
> > > The problem is that my analyzer seems to work correctly, but it is not  
> > > used as a default.  
> > > A test with inquisitor plugin gives me this :
> > > 
> > > Index: test-index Analyzed Text default aime 1cheval 3 french aim 1  
> > > cheval 3 lower\_analyzer j'aime les chevaux 1 token\_analyzer j'aime 1les  
> > > 2chevaux 3  
> > > As you can see, the french override analyzer gives me a perfect result,  
> > > but the default one gives me wrong result. The verb is not stemmed to 'aim'  
> > > and stays 'time' (which is not correct). Only the 'chevaux' word is stemmed  
> > > to 'cheval' (which is correct).
> > > 
> > > Do you know what i'm doing wrong ? Or how i could do to tell  
> > > Elasticsearch to choose my custom french analyzer as its default analyzer  
> > > instead of digging out the built-in french analyzer ?
> > > 
> > > Note : I tried giving it directly a name instead of a type, but with no  
> > > luck, like this : "default": "french"
> > > 
> > > Thanks for all your help in advance !
> > > 
> > > --  
> > > 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/980c2240-15ec-4ba2-ad46-a57e17300070%  
> > > [40googlegroups.com](http://40googlegroups.com)  
> > > [https://groups.google.com/d/msgid/elasticsearch/980c2240-15ec-4ba2-ad46-a57e17300070%40googlegroups.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/980c2240-15ec-4ba2-ad46-a57e17300070%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/1b619d79-8bc7-4832-8835-7854837d6421%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/1b619d79-8bc7-4832-8835-7854837d6421%40googlegroups.com)  
> > [https://groups.google.com/d/msgid/elasticsearch/1b619d79-8bc7-4832-8835-7854837d6421%40googlegroups.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/1b619d79-8bc7-4832-8835-7854837d6421%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/CAGdPd5nieftiTPGaKZjzkmSKR9XTmB8v%2Bfts6C%2BK5-6CWuLzUA%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CAGdPd5nieftiTPGaKZjzkmSKR9XTmB8v%2Bfts6C%2BK5-6CWuLzUA%40mail.gmail.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![phoenix](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/phoenix/32/1319_2.png) [@phoenix](https://discuss.elastic.co/u/phoenix)\
**Post date:** [August 20, 2014, 11:24am UTC](https://discuss.elastic.co/t/overriding-built-in-analyzer-and-set-it-as-default/19338/7 "2014-08-20T11:24:07Z")

</div>

Sorry but i can't make it work.

I tried this :

{  
"record":{  
"\_all":{  
"enabled":false  
},  
"index\_analyzer":"my\_french",  
"search\_analyzer":"my\_french",  
"properties":{  
"\_uuid":{  
"type":"string",  
"store":"yes",  
"index":"not\_analyzed"  
},  
"a":{  
"type":"multi\_field",  
"fields":{  
"a":{  
"type":"string",  
"store":"yes",  
"index":"analyzed"  
},  
"raw":{  
"type":"string",  
"store":"no",  
"index":"not\_analyzed"  
},  
"tokens":{  
"type":"string",  
"store":"no",  
"index":"analyzed",  
"analyzer":"token\_analyzer"  
},  
"lower":{  
"type":"string",  
"store":"no",  
"index":"analyzed",  
"analyzer":"lower\_analyzer"  
}  
}  
},  
...

But my analyzer is not taken into consideration while searching (but it is  
while indexing).

The mapping i get from the created index just states : "analyzer":  
"my\_french" (it must have concatenated the search\_ and index\_ analyzers),  
but still not working for search.  
I have to specify the analyzer in my query. :

{  
"query": {  
"match": {  
"a": {  
"query": "aimera"  
"analyzer": "my\_french"  
}  
}  
}  
}

Like this it works, but it's not the behaviour i want.

Le mercredi 20 août 2014 04:24:40 UTC+2, vineeth mohan a écrit :

> Hello Frederic ,
> 
> This was what i had in mind -  
> [Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/mapping-conf-mappings.html)
> 
> Place the default mapping under config and index creation will take  
> default values from there.
> 
> Thanks  
> Vineeth
> 
> On Tue, Aug 19, 2014 at 7:58 PM, Frederic Esnault \<[esnault....@gmail.com](mailto:esnault....@gmail.com)  
> \<javascript:\>\> wrote:
> 
> Hi Vineeth and thanks for your answer.
> 
> If i understood correctly, what you suggest is to add a _default_ section  
> in all mappings, right ?  
> First, I would prefer to set it once and for all in the global settings.  
> I'd be surprised there is no way to reference a custom analyzer in the  
> global default analyzer definition, but maybe...  
> Second, your link relates to default mapping, not settings.  
> Finally, could you give me an example of default analyzer using your  
> solution, just to test ? Documentation is too thin.
> 
> Le mardi 19 août 2014 14:56:10 UTC+2, vineeth mohan a écrit :
> 
> Hello Frederic ,
> 
> I believe you can use the default configuration settings for this -  
> [Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/guide/en/elasticsearch/)  
> reference/current/index-modules-mapper.html#\_default\_mapping
> 
> Thanks  
> Vineeth
> 
> On Tue, Aug 19, 2014 at 5:51 PM, Frederic Esnault [esnault....@gmail.com](mailto:esnault....@gmail.com)  
> wrote:
> 
> Hi everyone,
> 
> I'm trying to override the french analyser in my index. What i want is  
> that this custom 'french' analyzer becomes the default analyzer for all  
> searches and indexing, if none is given explicitly.
> 
> The settings i give are like this :
> 
> {  
> "index":{  
> "cluster.name":"test-cluster",  
> "client.transport.sniff":true,  
> "analysis":{  
> "filter":{  
> "french\_elision":{  
> "type":"elision",  
> "articles":[  
> "l",  
> "m",  
> "t",  
> "qu",  
> "n",  
> "s",  
> "j",  
> "d",  
> "c",  
> "jusqu",  
> "quoiqu",  
> "lorsqu",  
> "puisqu"  
> ]  
> },  
> "french\_stop":{  
> "type":"stop",  
> "stopwords":"_french_"\<span  
> style="color:rgb(102,102,102);font-family:'Ubu
> 
> ...

--  
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/ce7fa514-1265-470c-8f91-64db35351433%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/ce7fa514-1265-470c-8f91-64db35351433%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![jprante](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jprante/32/44941_2.png) [@jprante](https://discuss.elastic.co/u/jprante)\
**Post date:** [August 20, 2014, 7:05pm UTC](https://discuss.elastic.co/t/overriding-built-in-analyzer-and-set-it-as-default/19338/8 "2014-08-20T19:05:41Z")

</div>

If you want to set up a small number of known analyzers but keep the same  
field to search on, the method ES provides is simple: use different  
mappings within an index.

For combining analyzers for multilanguage search in a single index/mapping,  
look at the combo analyzer:

> **[GitHub - yakaz/elasticsearch-analysis-combo: Elasticsearch Combo Analyzer](https://github.com/yakaz/elasticsearch-analysis-combo)**
>
> Elasticsearch Combo Analyzer. Contribute to yakaz/elasticsearch-analysis-combo development by creating an account on GitHub.

I use this analyzer token chaining method for german/english/french words  
in a single field with success, together with keyword repeat token filter,  
ICU normalizer, ICU folding, and unique filter, having no need to "switch"  
analyzers.

Jörg

On Tue, Aug 19, 2014 at 5:24 PM, Frederic Esnault \<  
[esnault.frederic@gmail.com](mailto:esnault.frederic@gmail.com)\> wrote:

> Hi Jörg and thanks for your answer.
> 
> I agree with, defining my custom analyzer directly would solve the  
> problem, but i have another constraint, which makes this impossible.  
> I want to be able to select an analyzer at runtime (when creating the  
> index), depending on the user locale.
> 
> I had a locale adapter i made myself which converted the locale to an  
> analyzer name, but i had problem with the french analyzer, which led me to  
> the current problem.
> 
> So i want to be able to :
> 
> 1. override the french analyzer because the built-in french analyzer does  
> not satisfy me;
> 2. set the default analyzer to my custom french analyzer
> 3. for people using another language, still be able to get a default  
> analyzer to english snowball for example.
> 
> So i'd like to be able to do something like that :
> 
> {...{ "analyzer": "french" { "type":snowball", "language": "French" },  
> ..., "default" : ""}
> 
> The program generated value would be a simple translation of my user's  
> locale : fr \> french, en \> english, and so on...  
> The challenge here is that if "default" is set to "french", it should  
> reference the custom "french" analyzer.
> 
> Le mardi 19 août 2014 17:11:21 UTC+2, Jörg Prante a écrit :
> 
> > This sequence
> > 
> > "default":{  
> > "type":"french"  
> > }
> > 
> > will not work, you do not have an analyzer of type "french".
> > 
> > Just rename the analyzer with name "french" to the name "default" and it  
> > will be used as default.
> > 
> > Jörg
> > 
> > --  
> > 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/a33dec5c-b98b-4cee-a200-022d138e8ea3%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/a33dec5c-b98b-4cee-a200-022d138e8ea3%40googlegroups.com)  
> > [https://groups.google.com/d/msgid/elasticsearch/a33dec5c-b98b-4cee-a200-022d138e8ea3%40googlegroups.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/a33dec5c-b98b-4cee-a200-022d138e8ea3%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/CAKdsXoHUZqXEAqEXC2QC75FzFfpDZaZsDLObZZP7999W\_-ct1Q%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CAKdsXoHUZqXEAqEXC2QC75FzFfpDZaZsDLObZZP7999W_-ct1Q%40mail.gmail.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![phoenix](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/phoenix/32/1319_2.png) [@phoenix](https://discuss.elastic.co/u/phoenix)\
**Post date:** [August 23, 2014, 11:29am UTC](https://discuss.elastic.co/t/overriding-built-in-analyzer-and-set-it-as-default/19338/9 "2014-08-23T11:29:35Z")

</div>

Thanks a lot for the combo analyzer tip. I'll give it a try soon.  
Right now i found a solution to my problem by setting my\_analyzer for all  
text fields.  
I'll see what the combo can do for me, but seems like a good solution.  
Thx !

But i still think that would be nice to be allowed to just reference an  
analyzer in the index settings default analyzer field, like 'default':  
'my-analyser'.

Le mercredi 20 août 2014 21:05:48 UTC+2, Jörg Prante a écrit :

> If you want to set up a small number of known analyzers but keep the same  
> field to search on, the method ES provides is simple: use different  
> mappings within an index.
> 
> For combining analyzers for multilanguage search in a single  
> index/mapping, look at the combo analyzer:
> 
> [GitHub - yakaz/elasticsearch-analysis-combo: Elasticsearch Combo Analyzer](https://github.com/yakaz/elasticsearch-analysis-combo)
> 
> I use this analyzer token chaining method for german/english/french words  
> in a single field with success, together with keyword repeat token filter,  
> ICU normalizer, ICU folding, and unique filter, having no need to "switch"  
> analyzers.
> 
> Jörg
> 
> On Tue, Aug 19, 2014 at 5:24 PM, Frederic Esnault \<[esnault....@gmail.com](mailto:esnault....@gmail.com)  
> \<javascript:\>\> wrote:
> 
> > Hi Jörg and thanks for your answer.
> > 
> > I agree with, defining my custom analyzer directly would solve the  
> > problem, but i have another constraint, which makes this impossible.  
> > I want to be able to select an analyzer at runtime (when creating the  
> > index), depending on the user locale.
> > 
> > I had a locale adapter i made myself which converted the locale to an  
> > analyzer name, but i had problem with the french analyzer, which led me to  
> > the current problem.
> > 
> > So i want to be able to :
> > 
> > 1. override the french analyzer because the built-in french analyzer does  
> > not satisfy me;
> > 2. set the default analyzer to my custom french analyzer
> > 3. for people using another language, still be able to get a default  
> > analyzer to english snowball for example.
> > 
> > So i'd like to be able to do something like that :
> > 
> > {...{ "analyzer": "french" { "type":snowball", "language": "French" },  
> > ..., "default" : ""}
> > 
> > The program generated value would be a simple translation of my user's  
> > locale : fr \> french, en \> english, and so on...  
> > The challenge here is that if "default" is set to "french", it should  
> > reference the custom "french" analyzer.
> > 
> > Le mardi 19 août 2014 17:11:21 UTC+2, Jörg Prante a écrit :
> > 
> > > This sequence
> > > 
> > > "default":{  
> > > "type":"french"  
> > > }
> > > 
> > > will not work, you do not have an analyzer of type "french".
> > > 
> > > Just rename the analyzer with name "french" to the name "default" and it  
> > > will be used as default.
> > > 
> > > Jörg
> > > 
> > > --  
> > > 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/a33dec5c-b98b-4cee-a200-022d138e8ea3%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/a33dec5c-b98b-4cee-a200-022d138e8ea3%40googlegroups.com)  
> > > [https://groups.google.com/d/msgid/elasticsearch/a33dec5c-b98b-4cee-a200-022d138e8ea3%40googlegroups.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/a33dec5c-b98b-4cee-a200-022d138e8ea3%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/3304cac2-861e-4a63-82e6-ddd3bb620aed%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/3304cac2-861e-4a63-82e6-ddd3bb620aed%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![vineeth\_mohan\_2](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/vineeth_mohan_2/32/747_2.png) [@vineeth\_mohan\_2](https://discuss.elastic.co/u/vineeth_mohan_2)\
**Post date:** [August 26, 2014, 1:11pm UTC](https://discuss.elastic.co/t/overriding-built-in-analyzer-and-set-it-as-default/19338/10 "2014-08-26T13:11:24Z")

</div>

Hello Frederic ,

There is a default-mapping.json option too.  
This might be useful to you if you havnt already found it -

> **[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.

Thanks  
Vineeth

On Sat, Aug 23, 2014 at 4:59 PM, Frederic Esnault \<  
[esnault.frederic@gmail.com](mailto:esnault.frederic@gmail.com)\> wrote:

> Thanks a lot for the combo analyzer tip. I'll give it a try soon.  
> Right now i found a solution to my problem by setting my\_analyzer for all  
> text fields.  
> I'll see what the combo can do for me, but seems like a good solution.  
> Thx !
> 
> But i still think that would be nice to be allowed to just reference an  
> analyzer in the index settings default analyzer field, like 'default':  
> 'my-analyser'.
> 
> Le mercredi 20 août 2014 21:05:48 UTC+2, Jörg Prante a écrit :
> 
> > If you want to set up a small number of known analyzers but keep the same  
> > field to search on, the method ES provides is simple: use different  
> > mappings within an index.
> > 
> > For combining analyzers for multilanguage search in a single  
> > index/mapping, look at the combo analyzer:
> > 
> > [GitHub - yakaz/elasticsearch-analysis-combo: Elasticsearch Combo Analyzer](https://github.com/yakaz/elasticsearch-analysis-combo)
> > 
> > I use this analyzer token chaining method for german/english/french words  
> > in a single field with success, together with keyword repeat token filter,  
> > ICU normalizer, ICU folding, and unique filter, having no need to "switch"  
> > analyzers.
> > 
> > Jörg
> > 
> > On Tue, Aug 19, 2014 at 5:24 PM, Frederic Esnault [esnault....@gmail.com](mailto:esnault....@gmail.com)  
> > wrote:
> > 
> > > Hi Jörg and thanks for your answer.
> > > 
> > > I agree with, defining my custom analyzer directly would solve the  
> > > problem, but i have another constraint, which makes this impossible.  
> > > I want to be able to select an analyzer at runtime (when creating the  
> > > index), depending on the user locale.
> > > 
> > > I had a locale adapter i made myself which converted the locale to an  
> > > analyzer name, but i had problem with the french analyzer, which led me to  
> > > the current problem.
> > > 
> > > So i want to be able to :
> > > 
> > > 1. override the french analyzer because the built-in french analyzer  
> > > does not satisfy me;
> > > 2. set the default analyzer to my custom french analyzer
> > > 3. for people using another language, still be able to get a default  
> > > analyzer to english snowball for example.
> > > 
> > > So i'd like to be able to do something like that :
> > > 
> > > {...{ "analyzer": "french" { "type":snowball", "language": "French" },  
> > > ..., "default" : ""}
> > > 
> > > The program generated value would be a simple translation of my user's  
> > > locale : fr \> french, en \> english, and so on...  
> > > The challenge here is that if "default" is set to "french", it should  
> > > reference the custom "french" analyzer.
> > > 
> > > Le mardi 19 août 2014 17:11:21 UTC+2, Jörg Prante a écrit :
> > > 
> > > > This sequence
> > > > 
> > > > "default":{  
> > > > "type":"french"  
> > > > }
> > > > 
> > > > will not work, you do not have an analyzer of type "french".
> > > > 
> > > > Just rename the analyzer with name "french" to the name "default" and  
> > > > it will be used as default.
> > > > 
> > > > Jörg
> > > > 
> > > > --  
> > > > 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/a33dec5c-b98b-4cee-a200-022d138e8ea3%  
> > > > [40googlegroups.com](http://40googlegroups.com)  
> > > > [https://groups.google.com/d/msgid/elasticsearch/a33dec5c-b98b-4cee-a200-022d138e8ea3%40googlegroups.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/a33dec5c-b98b-4cee-a200-022d138e8ea3%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/3304cac2-861e-4a63-82e6-ddd3bb620aed%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/3304cac2-861e-4a63-82e6-ddd3bb620aed%40googlegroups.com)  
> > [https://groups.google.com/d/msgid/elasticsearch/3304cac2-861e-4a63-82e6-ddd3bb620aed%40googlegroups.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/3304cac2-861e-4a63-82e6-ddd3bb620aed%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/CAGdPd5kYoiOgRjH-0x4PJxKwKcA3oAJzFDEp%3Drp9jHAdhT10ug%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CAGdPd5kYoiOgRjH-0x4PJxKwKcA3oAJzFDEp%3Drp9jHAdhT10ug%40mail.gmail.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/overriding-built-in-analyzer-and-set-it-as-default/19338/11 "2017-07-06T01:06:25Z")

</div>


