Problem about index_analyzer and search_analyzer


(Weiwei Wang) #1

I have my analyzers defined in config/elasticsearch.json as below
##########################################################################################
"analysis" : {
"analyzer" : {
"nGramAnalyzer":{
"type":"custom",
"tokenizer":"standard",
"filter":
["standard","lowercase","englishSnowball","nGramFilter"]
},
"standardAnalyzer":{
"type":"custom",
"tokenizer":"standard",
"filter":
["standard","lowercase","englishSnowball"]
}
},
"filter":{
"nGramFilter":{
"type":"nGram",
"min_gram":1,
"max_gram":64
},
"edgeNGramFilter":{
"type":"edgeNGram",
"min_gram":1,
"max_gram":64,
"side":"front"
},
"englishSnowball":{
"type":"snowball",
"language":"English"
}
}

and for one of may mapping json config, I have a field phone is
configured like this
"phone":{
"type" : "string",
"index": "analyzed",
"index_analyzer":"nGramAnalyzer",
"search_analyzer":"standardAnalyzer",
"store":"yes",
"term_vector":"with_positions_offsets"
}

through elasticsearch-head, i can see the configuration have taken
effect, however, when i search phone field with query_string, the
highlight is not as expected, for example
i have a phone field for indexing with value 15103605354, i search
with query 1510, the highlight is expected as this:
15103605354, however, the actual result is this: 1</
em>5103605354

could anyone give me an explanation for this problem?


(system) #2