Setting default analyzer


(Michael Smolyak) #1

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) #2

There is a section on Default Analyzers you can set here

http://www.elasticsearch.org/guide/reference/index-modules/analysis/

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> 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
+31 6 50 969 170
@anneveling


(Michael Smolyak) #3

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


(Shay Banon) #4

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> 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


(Michael Smolyak) #5

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


(Shay Banon) #6

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> 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


(system) #7