I have mutiple-fields for search, but each field with different
search_analyzer. when do highlighting i found that the fragments is
not as expected.
for example, i have two fields: name, phone, and i have two analyzers
in my elasticsearch.json
"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"
}
}
the mapping for the fields are:
"phone":{
"type" : "string",
"index": "analyzed",
"index_analyzer":"nGramAnalyzer",
"search_analyzer":"nGramAnalyzer",
"store":"yes",
"term_vector":"with_positions_offsets"
},
"phone":{
"type" : "string",
"index": "analyzed",
"index_analyzer":"nGramAnalyzer",
"search_analyzer":"standardAnalyzer",
"store":"yes",
"term_vector":"with_positions_offsets"
}
when i do query_string query like below:
curl '10.18.102.101:9201/pim/contact/_search?pretty=true' -d '{"from":
0,"size":2,"query":{"query_string":{"query":"18600","fields":
["name^5.0","phone^5.0"],"default_operator":"or","allow_leading_wildcard":false,"analyze_wildcard":true}},"filter":
{"bool":{"must":{"term":{"deleted":0}}}},"explain":false,"fields":
["name", "phone"],"highlight":{"pre_tags":["<span class="hl
">"],"post_tags":[""],"fields":{"name":{},"phone":{}}}}'
the highlight is show as:
18600044220</
em>
it seems the highlighter uses the nGramAnalyzer for highlighting, but
i expect it use the relevant search_analyzer to do hightlighting for
the field
any one do me a favor for this problem?
elasticsearch version 0.18.4