Created
May 9, 2019 08:22
-
-
Save GarKoZ/cb4427c8b132947c406ad3394864b7c2 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
POST /test/product/_search | |
{ | |
"query": { | |
"function_score": { | |
"query": { "match": { "name" : "การ์ดแสดงผล"} }, | |
"functions": [ | |
{ | |
"filter": { "match": { "name": "ASUS" } }, | |
"weight": 3 | |
}, | |
{ | |
"filter": { "match": { "name": "MSI" } }, | |
"weight": 5 | |
} | |
] | |
} | |
} | |
} | |
PUT test | |
{ | |
"settings": { | |
"analysis": { | |
"analyzer": { | |
"trigrams": { | |
"tokenizer": "trigram_tokenizer", | |
"filter": [ | |
"lowercase" | |
] | |
} | |
}, | |
"tokenizer": { | |
"trigram_tokenizer": { | |
"type": "ngram", | |
"min_gram": 3, | |
"max_gram": 3, | |
"token_chars": [] | |
} | |
} | |
} | |
}, | |
"mappings": { | |
"product": { | |
"properties": { | |
"name": { | |
"type": "text", | |
"analyzer": "trigrams" | |
}, | |
"cost" :{ | |
"type": "integer" | |
} | |
} | |
} | |
} | |
} | |
POST _bulk | |
{ "index" : { "_index" : "test", "_type" : "product", "_id" : "1" } } | |
{"name" : "VGA (การ์ดแสดงผล) ASUS CERBERUS GTX1070TI A8G", "cost":2300} | |
{ "index" : { "_index" : "test", "_type" : "product", "_id" : "2" } } | |
{"name" : "VGA (การ์ดแสดงผล) INNO3D GTX 1070 Ti X2 V2 8GB ( N107T-2SDN-P5DS )", "cost":2500} | |
{ "index" : { "_index" : "test", "_type" : "product", "_id" : "3" } } | |
{"name" : "VGA (การ์ดแสดงผล) MSI GTX 1080 Ti ARMOR 11G OC", "cost":2700} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment