Setting up default analyzer using elasticsearch.yml

Hi guys,

while setting up my elasticsearch I have encountered a problem setting up
the default index and default search analyzer. I want these analyzers to be
used for all indexed data (I am using Tire gem for Ruby on Rails), so I
guess that all I have to do is configure the elasticsearch.yml correctly.
This is what I have so far:

index:
analysis:
analyzer:
default_index:
type: custom
tokenizer: whitespace
filter: [word_delimiter, standard, lowercase, synonym,
edgeNGram]
default_search:
type: custom
tokenizer: whitespace
filter: [word_delimiter, standard, lowercase, synonym]

However, this analyzer does not seem to be applied while using the search
in my application. All other settings are set to default.
Any suggestions/corrections will be much appreciated. Thanks in advance.

PN

--

no hints?

--

Where are synonym and edgeNGram filters defined?
Do you see any errors in the log file when you start elasticsearch?
Did you reindex all records after changing the analyzer?
Did you try using _analyze command to see if your analyzer is having effect?

On Wednesday, January 9, 2013 12:47:45 PM UTC-5, Patrick Norwood wrote:

no hints?

--

  1. I was thinking that perhaps default settings would be applied so I did
    not define those filters, anyway, I left out synonym filter (don't need it
    for now) and the actual elasticsearch.yml looks like this:

index :
analysis :
analyzer :
default_index :
type : custom
tokenizer : whitespace
filter : [word_delimiter, standard, lowercase, edgeNGram]
default_search :
type : custom
tokenizer : whitespace
filter : [word_delimiter, standard, lowercase]
filter :
edgeNGram :
type : edgeNGram
min_gram : 2
max_gram : 15
side : front

  1. I don't see any errors after starting elasticsearch in the log file or
    console (running it with -f).

  2. I don't know whether I am doing reindexing right, I simply delete
    indexes, restart the server, and create indexes again using rails console
    and som Tire commands.

  3. I was playing with analyze API for quite some time, but I don't seem to
    get the right results, it seems that my analyzer does not have effect, or
    is not being loaded or I just don't know how to us analyze API :).
    Basically I tried it this way:

Probably wrong approach, because analyzer default_search or default_index
were not found (might this indicate they are not being loaded from .yml??):
curl -XGET 'localhost:9200/_analyze?analyzer=default_search' -d 'testing
string'
curl -XGET 'localhost:9200/_analyze?analyzer=default_index' -d 'testing
string'

Then I tried it like this, and it seemed to have used the standard analyzer.
curl -XGET 'localhost:9200/_analyze?analyzer=default' -d 'testing string'

I really don't know what I might be possibly doing wrong :).

On Wednesday, January 9, 2013 7:14:55 PM UTC+1, Igor Motov wrote:

Where are synonym and edgeNGram filters defined?
Do you see any errors in the log file when you start elasticsearch?
Did you reindex all records after changing the analyzer?
Did you try using _analyze command to see if your analyzer is having
effect?

On Wednesday, January 9, 2013 12:47:45 PM UTC-5, Patrick Norwood wrote:

no hints?

--

  1. This is strange because the mapping in 1. is wrong (filter: has wrong
    indentation, it has to be on the same level as analyzer), if you are
    editing correct config file, elasticsearch should fail to start.

  2. That should be fine

  3. As Clinton mentioned on IRC channel you need to specify an index.

On Wednesday, January 9, 2013 2:36:38 PM UTC-5, Patrick Norwood wrote:

  1. I was thinking that perhaps default settings would be applied so I did
    not define those filters, anyway, I left out synonym filter (don't need it
    for now) and the actual elasticsearch.yml looks like this:

index :
analysis :
analyzer :
default_index :
type : custom
tokenizer : whitespace
filter : [word_delimiter, standard, lowercase, edgeNGram]
default_search :
type : custom
tokenizer : whitespace
filter : [word_delimiter, standard, lowercase]
filter :
edgeNGram :
type : edgeNGram
min_gram : 2
max_gram : 15
side : front

  1. I don't see any errors after starting elasticsearch in the log file or
    console (running it with -f).

  2. I don't know whether I am doing reindexing right, I simply delete
    indexes, restart the server, and create indexes again using rails console
    and som Tire commands.

  3. I was playing with analyze API for quite some time, but I don't seem to
    get the right results, it seems that my analyzer does not have effect, or
    is not being loaded or I just don't know how to us analyze API :).
    Basically I tried it this way:

Probably wrong approach, because analyzer default_search or default_index
were not found (might this indicate they are not being loaded from .yml??):
curl -XGET 'localhost:9200/_analyze?analyzer=default_search' -d 'testing
string'
curl -XGET 'localhost:9200/_analyze?analyzer=default_index' -d 'testing
string'

Then I tried it like this, and it seemed to have used the standard
analyzer.
curl -XGET 'localhost:9200/_analyze?analyzer=default' -d 'testing string'

I really don't know what I might be possibly doing wrong :).

On Wednesday, January 9, 2013 7:14:55 PM UTC+1, Igor Motov wrote:

Where are synonym and edgeNGram filters defined?
Do you see any errors in the log file when you start elasticsearch?
Did you reindex all records after changing the analyzer?
Did you try using _analyze command to see if your analyzer is having
effect?

On Wednesday, January 9, 2013 12:47:45 PM UTC-5, Patrick Norwood wrote:

no hints?

--

Thanks a lot Igor, your feedback helped me solve this issue. The main
problem was indentation, how embarrassing :).

--