How to add per-field and customized analyzer to elastic search


(Weiwei Wang) #1

Hi, all
I need to used different analyzer for each field of my document and
also the analyzer can not be composed using the provided tokenizer,
filters by elasticsearch.

Can i put my *.class some where and configure elasticsearch to use it?


(Karussell) #2

You can specify a custom filter in elasticsearch.json with that it is
easy to specify the whole analyzer:

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

{
"index" : {
"analysis" : {
"analyzer" : {
"index_analyzer" : {
"tokenizer" : "whitespace",
"filter" : ["jetwickfilter", "lowercase",
"snowball"]
},
"search_analyzer" :
{
"tokenizer" : "whitespace",
"filter" : ["jetwickfilter", "lowercase",
"snowball"]
}
},
"filter" : {
"jetwickfilter": {
"type" : "de.jetwick.es.JetwickFilterFactory"
},
"snowball": {
"type" : "snowball",
"language" : "English"
}
}
}
}
}

On May 16, 12:04 pm, Weiwei Wang ww.wang...@gmail.com wrote:

Hi, all
I need to used different analyzer for each field of my document and
also the analyzer can not be composed using the provided tokenizer,
filters by elasticsearch.

Can i put my *.class some where and configure elasticsearch to use it?


(Weiwei Wang) #3

thanks,tableyourtime.

What i need is a per-field analyzer, how can i custom it and where
should i put my own *.class files?

On May 16, 7:21 pm, Karussell tableyourt...@googlemail.com wrote:

You can specify a custom filter in elasticsearch.json with that it is
easy to specify the whole analyzer:

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

{
"index" : {
"analysis" : {
"analyzer" : {
"index_analyzer" : {
"tokenizer" : "whitespace",
"filter" : ["jetwickfilter", "lowercase",
"snowball"]
},
"search_analyzer" :
{
"tokenizer" : "whitespace",
"filter" : ["jetwickfilter", "lowercase",
"snowball"]
}
},
"filter" : {
"jetwickfilter": {
"type" : "de.jetwick.es.JetwickFilterFactory"
},
"snowball": {
"type" : "snowball",
"language" : "English"
}
}
}
}

}

On May 16, 12:04 pm, Weiwei Wang ww.wang...@gmail.com wrote:

Hi, all
I need to used different analyzer for each field of my document and
also the analyzer can not be composed using the provided tokenizer,
filters by elasticsearch.

Can i put my *.class some where and configure elasticsearch to use it?


(system) #4