Thank you @danielmitterdorfer for your suggestion but I am using the multi-fields already.
Here I want to make some explanation first.
Since my data are mixed with Chinese and English name.
And I have to support simple Chinese, traditional Chinese and English search. So, I decided to convert the simple Chinese to traditional Chinese first (which I used a custom analyzer call "stcn" ), and then go for searching.
Also, I need to support auto complete, and I used the guide of auto complete example (the analyzer trigram and reverse ).
recently, I need to add the stop word and synonym function in elasticsearch (so i created two new analyzer call stop and syno).
And there a problem comes out, I found that the search doesn't support multi analyzer (or I don't how to write the mapping.)
Can you explain more about using multi-field ?
Here is my index setting and mapping
{
"settings": {
"index": {
"analysis": {
"analyzer": {
"trigram": {
"type": "custom",
"tokenizer": "standard",
"filter": [
"standard",
"shingle",
"uppercase"
]
},
"reverse": {
"type": "custom",
"tokenizer": "standard",
"filter": [
"standard",
"reverse"
]
},
"cn": {
"type": "custom",
"tokenizer": "icu"
},
"stcn": {
"type": "custom",
"tokenizer": "stconvert"
},
"stop": {
"type": "custom",
"tokenizer": "icu",
"filter": [
"my_stop_en",
"my_stop_cn"
]
},
"syno":{
"type": "custom",
"tokenizer": "standard",
"filter": [
"synonym"
]
}
},
"tokenizer": {
"icu": {
"type": "icu_tokenizer"
},
"stconvert": {
"type": "stconvert",
"delimiter": "/",
"keep_both": false,
"convert_type": "s2t"
}
},
"filter": {
"shingle": {
"type": "shingle",
"min_shingle_size": 2,
"max_shingle_size": 3
},
"synonym": {
"type": "synonym",
"synonyms_path": "syno/synonym.txt"
},
"my_stop_en": {
"type": "stop",
"stopwords_path": "stopword/english.txt"
},
"my_stop_cn": {
"type": "stop",
"stopwords_path": "stopword/chinese.txt"
}
}
}
}
}
"mappings": {
"product": {
"properties": {
"display_name": {
"type": "text",
"include_in_all": true,
"fields": {
"stcn": {
"type": "text",
"analyzer": "stcn"
},
"cn": {
"type": "text",
"analyzer": "cn"
},
"trigram": {
"type": "text",
"analyzer": "trigram"
},
"reverse": {
"type": "text",
"analyzer": "reverse"
},
"stop": {
"type": "text",
"analyzer": "stop"
},
"syno":{
"type": "text",
"analyzer": "syno"
}
}
}