PUT test_index
{
"settings": {
"number_of_shards": 1,
"analysis": {
"filter": {
"remote_synonym" : {
"type":"dynamic_synonym",
"synonyms_path":"http://localhost:8083/file/synonym.txt"
}
},
"analyzer": {
"ik_syno":{
"type":"custom",
"tokenizer":"ik_smart",
"filter":["remote_synonym"]
},
"ik_syno_max":{
"type":"custom",
"tokenizer":"ik_max_word",
"filter":["remote_synonym"]
}
}
}
},
"mappings": {
"properties": {
"item_name":{
"type": "text",
"analyzer": "ik_smart",
"search_analyzer": "ik_smart"
}
}
}
}
GET test_synonym/_analyze
{
"field": "item_name",
"text":"男人"
}
{
"tokens" : [
{
"token" : "男人",
"start_offset" : 0,
"end_offset" : 2,
"type" : "CN_WORD",
"position" : 0
},
{
"token" : "男孩",
"start_offset" : 0,
"end_offset" : 2,
"type" : "SYNONYM",
"position" : 0
},
{
"token" : "男子",
"start_offset" : 0,
"end_offset" : 2,
"type" : "SYNONYM",
"position" : 0
},
{
"token" : "男性",
"start_offset" : 0,
"end_offset" : 2,
"type" : "SYNONYM",
"position" : 0
},
{
"token" : "男孩子",
"start_offset" : 0,
"end_offset" : 2,
"type" : "SYNONYM",
"position" : 0
},
{
"token" : "男同胞",
"start_offset" : 0,
"end_offset" : 2,
"type" : "SYNONYM",
"position" : 0
},
{
"token" : "男孩",
"start_offset" : 0,
"end_offset" : 2,
"type" : "SYNONYM",
"position" : 1
},
{
"token" : "同胞",
"start_offset" : 0,
"end_offset" : 2,
"type" : "SYNONYM",
"position" : 1
},
{
"token" : "孩子",
"start_offset" : 0,
"end_offset" : 2,
"type" : "SYNONYM",
"position" : 2
}
]
}