# Setting default analyzer

**URL:** <https://discuss.elastic.co/t/setting-default-analyzer/8007>\
**Category:** Elasticsearch\
**Created:** [June 7, 2012, 1:25pm UTC](https://discuss.elastic.co/t/setting-default-analyzer/8007 "2012-06-07T13:25:17Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Michael\_Smolyak](https://avatars.discourse-cdn.com/v4/letter/m/7cd45c/32.png) [@Michael\_Smolyak](https://discuss.elastic.co/u/Michael_Smolyak)\
**Post date:** [June 7, 2012, 1:25pm UTC](https://discuss.elastic.co/t/setting-default-analyzer/8007/1 "2012-06-07T13:25:17Z")

</div>

Hello,

I am using Elastic Search with a Grails application through the Elastic  
Search Plugin. I am upgrading switching over from the Searchable plugin  
built on top of Compass framework. My problem is in trying to replicate the  
features available in Searchable. One of them is stemmed search. Searchable  
made it easy through Compass configuration to set a default analyzer. By  
using a Snowball analyzer we made indexing and searching processes use  
stemming.

Now I am trying to figure out how to do the same with Elastic Search  
Plugin. The plugin allows me to set the analyzer on the per-field basis  
which affects the mapping. Thus when I use fielded search, stemming works  
fine. But I am not sure how to make a Snowball analyzer a global one. The  
plugin does not support it directly, nor it is clear how I can use Groovy  
or Grails API directly to specify Snowball analyzer as the default one for  
my index.

What is the proper way to set a default analyzer for the entire index?

Thank you,

Michael

---

<div class="post-metadata">

**Author:** ![Anne\_Veling](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/anne_veling/32/1260_2.png) [@Anne\_Veling](https://discuss.elastic.co/u/Anne_Veling)\
**Post date:** [June 7, 2012, 3:00pm UTC](https://discuss.elastic.co/t/setting-default-analyzer/8007/2 "2012-06-07T15:00:59Z")

</div>

There is a section on Default Analyzers you can set here

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

You can also specify what type of analyzers you want to set per type or  
even use a dynamic template to have specific analyzers for fields that  
match a certain rule.

Is that what you meant?

Anne

On Thu, Jun 7, 2012 at 3:25 PM, Michael Smolyak \<  
[msmolyak.nextcentury@gmail.com](mailto:msmolyak.nextcentury@gmail.com)\> wrote:

> Hello,
> 
> I am using Elastic Search with a Grails application through the Elastic  
> Search Plugin. I am upgrading switching over from the Searchable plugin  
> built on top of Compass framework. My problem is in trying to replicate the  
> features available in Searchable. One of them is stemmed search. Searchable  
> made it easy through Compass configuration to set a default analyzer. By  
> using a Snowball analyzer we made indexing and searching processes use  
> stemming.
> 
> Now I am trying to figure out how to do the same with Elastic Search  
> Plugin. The plugin allows me to set the analyzer on the per-field basis  
> which affects the mapping. Thus when I use fielded search, stemming works  
> fine. But I am not sure how to make a Snowball analyzer a global one. The  
> plugin does not support it directly, nor it is clear how I can use Groovy  
> or Grails API directly to specify Snowball analyzer as the default one for  
> my index.
> 
> What is the proper way to set a default analyzer for the entire index?
> 
> Thank you,
> 
> Michael

--  
Anne Veling  
[BeyondTrees.com](http://BeyondTrees.com)  
+31 6 50 969 170  
@anneveling

---

<div class="post-metadata">

**Author:** ![Michael\_Smolyak](https://avatars.discourse-cdn.com/v4/letter/m/7cd45c/32.png) [@Michael\_Smolyak](https://discuss.elastic.co/u/Michael_Smolyak)\
**Post date:** [June 7, 2012, 8:04pm UTC](https://discuss.elastic.co/t/setting-default-analyzer/8007/3 "2012-06-07T20:04:17Z")

</div>

Anne,

Thank you for your reply. I am removed by several layers of abstraction  
from Elastic Search. The Grails plugin reads the annotation-like  
information from my domain classes, constructs the mapping based on it and  
sends it to the search engine.

It is not clear to me where I can specify the default analyzer. Is it in  
the mapping? Or is there a Java API call can I make to configure the  
default analyzer for my index.

How do I convert the information on the page you sent to an API call?

Thank you,

Michael

---

<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:** [June 10, 2012, 9:40pm UTC](https://discuss.elastic.co/t/setting-default-analyzer/8007/4 "2012-06-10T21:40:00Z")

</div>

Use the create index API And provide the settings there when you create the  
index. Thats the simplest way to do it. Another is to put this in the  
config of each node you have.

On Thu, Jun 7, 2012 at 10:04 PM, Michael Smolyak \<  
[msmolyak.nextcentury@gmail.com](mailto:msmolyak.nextcentury@gmail.com)\> wrote:

> Anne,
> 
> Thank you for your reply. I am removed by several layers of abstraction  
> from Elastic Search. The Grails plugin reads the annotation-like  
> information from my domain classes, constructs the mapping based on it and  
> sends it to the search engine.
> 
> It is not clear to me where I can specify the default analyzer. Is it in  
> the mapping? Or is there a Java API call can I make to configure the  
> default analyzer for my index.
> 
> How do I convert the information on the page you sent to an API call?
> 
> Thank you,
> 
> Michael

---

<div class="post-metadata">

**Author:** ![Michael\_Smolyak](https://avatars.discourse-cdn.com/v4/letter/m/7cd45c/32.png) [@Michael\_Smolyak](https://discuss.elastic.co/u/Michael_Smolyak)\
**Post date:** [June 11, 2012, 9:25pm UTC](https://discuss.elastic.co/t/setting-default-analyzer/8007/5 "2012-06-11T21:25:11Z")

</div>

Shay,

Thank you for your reply. It is still unclear to me how to set the default  
analyzer. I am not sure what this "create index API" corresponds to in Java  
API. Could you provide a reference?

Thank you,

Michael

>

---

<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:** [June 13, 2012, 6:30pm UTC](https://discuss.elastic.co/t/setting-default-analyzer/8007/6 "2012-06-13T18:30:07Z")

</div>

When you have a client index, using admin().indices().prepareCreate...

On Mon, Jun 11, 2012 at 11:25 PM, Michael Smolyak \<  
[msmolyak.nextcentury@gmail.com](mailto:msmolyak.nextcentury@gmail.com)\> wrote:

> Shay,
> 
> Thank you for your reply. It is still unclear to me how to set the default  
> analyzer. I am not sure what this "create index API" corresponds to in Java  
> API. Could you provide a reference?
> 
> Thank you,
> 
> Michael
> 
> >

---

<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:24am UTC](https://discuss.elastic.co/t/setting-default-analyzer/8007/7 "2017-07-06T03:24:27Z")

</div>


