6.x
PUT /test_index?pretty{ "settings": { "number_of_shards": "3", "number_of_replicas": "1", "max_result_window": "200000", "analysis": { "filter":{ "my_syno_filter":{ "type":"synonym", "synonyms_path":"synonym.txt" } }, "analyzer": { "ik_max_syno": { "type":"custom", "tokenizer": "ik_max_word", "filter": [ "lowercase", "my_syno_filter" ] } } } }, "mappings": { "index": { "properties": { "name": { "type": "text", "analyzer": "ik_max_syno" } } } }}
{ "from": 0, "size": 500, "query": { "function_score": { "query": { "match": { "searchName": { "query": "工", "operator": "OR", "prefix_length": 0, "max_expansions": 50, "fuzzy_transpositions": true, "lenient": false, "zero_terms_query": "NONE", "auto_generate_synonyms_phrase_query": true, "boost": 1.0 } } }, "functions": [ { "filter": { "term": { "type": { "value": 1, "boost": 1.0 } } }, "weight": 1.1 }, { "filter": { "term": { "type": { "value": 2, "boost": 1.0 } } }, "weight": 1.2 }, { "filter": { "term": { "type": { "value": 3, "boost": 1.0 } } }, "weight": 1.3 }, { "filter": { "term": { "type": { "value": 4, "boost": 1.0 } } }, "weight": 1.0 }, { "filter": { "term": { "level": { "value": 1, "boost": 1.0 } } }, "weight": 1.0 }, { "filter": { "term": { "level": { "value": 2, "boost": 1.0 } } }, "weight": 1.3 }, { "filter": { "term": { "level": { "value": 3, "boost": 1.0 } } }, "weight": 1.5 } ], "score_mode": "multiply", "max_boost": 3.4028235E+38, "boost": 1.0 } }}