Problem in setting analyzer


(nachiket) #1

Hi.
I am trying to set my own analyzer in elasticsearch.yml file. Problem
is it is giving setting exception. Can somebody help me?

index :
analysis :
analyzer :
standard :
type : standard
stopwords : [stop1, stop2]
myAnalyzer1 :
type : standard
stopwords : [stop1, stop2, stop3]
max_token_length : 500
# configure a custom analyzer which is
# exactly like the default standard analyzer
myAnalyzer2 :
type: pattern
lowercase: true
pattern: ,|OR|AND
flag: "CASE_INSENSITIVE|COMMENTS"

SettingsException[Failed to load settings from [file:/home/user/
elasticsearch.yml]]
ParserException[while parsing a block mapping; expected ,
but found BlockMappingStart]

Regards.


(nachiket) #2

Hi. I am getting problem for setting analyzers for many types. Can
somebody please help me??
elasticsearch/0.16.2}: Setup Failed ...

  • SettingsException[Failed to load settings from [file:/home/nachiket/
    Softwares/elasticsearch-0.16.2/config/elasticsearch.yml]]
    ParserException[while parsing a block mapping; expected , but found BlockMappingStart]

My code is
index :
analysis :
analyzer :
myAnalyzer2 :
type : custom
tokenizer : myTokenizer1
filter : [myTokenFilter1, myTokenFilter2]
char_filter : [my_html]

myanalyzer1 :

type: standard

stopwords: [no , stopwords]

max_token_length: 20

    myAnalyzer3:
		type: english
		stopwords: [ stop , stop1 ]
    tokenizer :
        myTokenizer1 :
            type : pattern
            pattern : "(\\W*,\\W*)|(\\W*OR\\W*)|(\\W*AND\\W*)"
    filter :
        myTokenFilter1 :
            type : synonym
            synonyms_path : "synonym.txt"
        myTokenFilter2 :
            type : length
            min : 0
            max : 2000
    char_filter :
          my_html :
            type : html_strip
            escaped_tags : [xxx, yyy]
            read_ahead : 1024

(Clinton Gormley) #3

Hiya

On Thu, 2011-06-30 at 02:20 -0700, nachiket bhagwat wrote:

Hi. I am getting problem for setting analyzers for many types. Can
somebody please help me??
elasticsearch/0.16.2}: Setup Failed ...

  • SettingsException[Failed to load settings from [file:/home/nachiket/
    Softwares/elasticsearch-0.16.2/config/elasticsearch.yml]]
    ParserException[while parsing a block mapping; expected , but found BlockMappingStart]

This sounds like a YAML syntax error, but when I try the config you
posted, I can parse it correctly.

I wonder if it is not something else in your config file which is
throwing off the parsing.

I dumped the YAML that I parsed, and this was the output:


index:
analysis:
analyzer:
myAnalyzer2:
char_filter:
- my_html
filter:
- myTokenFilter1
- myTokenFilter2
tokenizer: myTokenizer1
type: custom
myAnalyzer3:
stopwords:
- stop
- stop1
type: english
char_filter:
my_html:
escaped_tags:
- xxx
- yyy
read_ahead: 1024
type: html_strip
filter:
myTokenFilter1:
synonyms_path: synonym.txt
type: synonym
myTokenFilter2:
max: 2000
min: 0
type: length
tokenizer:
myTokenizer1:
pattern: '(\W*,\W*)|(\WOR\W)|(\WAND\W)'
type: pattern

clint


(system) #4