-
-
Save ewltang/9c00155525784b620ca9 to your computer and use it in GitHub Desktop.
This file contains 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
Field Mapping | |
------------- | |
{ | |
"_id":{ | |
"type":"string", | |
"include_in_all":false | |
}, | |
"uname":{ | |
"fields":{ | |
"uname":{ | |
"type":"string", | |
"search_analyzer":"searchAnalyzer", | |
"index_analyzer":"indexAnalyzer", | |
"include_in_all":true, | |
"omit_norms":true | |
}, | |
"simpl":{ | |
"type":"string", | |
"analyzer":"standard" | |
}, | |
"autocomplete":{ | |
"type":"string", | |
"index_analyzer":"autocomplete", | |
"index":"analyzed", | |
"search_analyzer":"standard" | |
} | |
}, | |
"type":"multi_field" | |
} | |
} | |
Analyzers | |
--------_ | |
{ | |
"number_of_shards":6, | |
"number_of_replicas":0, | |
"routing":{ | |
"allocation":{ | |
"total_shards_per_node":0 | |
} | |
}, | |
"analysis":{ | |
"analyzer":{ | |
"indexAnalyzer":{ | |
"type":"custom", | |
"tokenizer":"standard", | |
"filter":[ | |
"lowercase", | |
"myNgram" | |
] | |
}, | |
"searchAnalyzer":{ | |
"type":"custom", | |
"tokenizer":"standard", | |
"filter":[ | |
"lowercase", | |
"standard" | |
] | |
}, | |
"autocomplete":{ | |
"tokenizer":"engram", | |
"filter":[ | |
"lowercase" | |
] | |
} | |
}, | |
"filter":{ | |
"myNgram":{ | |
"type":"nGram", | |
"min_gram":1, | |
"max_gram":20 | |
} | |
}, | |
"tokenizer":{ | |
"engram":{ | |
"type":"edgeNGram", | |
"min_gram":1, | |
"max_gram":18, | |
"side":"front" | |
} | |
} | |
} | |
} | |
Search Query | |
------------ | |
curl -XGET 'http://localhost:9200/users/search/_search?pretty=true&search_type=dfs_query_then_fetch&explain=true' -d ' | |
{ | |
"query":{ | |
"term":{ | |
"uname.autocomplete":{ | |
"value":"pauljones" | |
} | |
}, | |
"from":0, | |
"size":10 | |
} | |
} | |
'; | |
Results for search "pauljones" | |
------------------------------ | |
{ | |
"took" : 12, | |
"timed_out" : false, | |
"_shards" : { | |
"total" : 6, | |
"successful" : 6, | |
"failed" : 0 | |
}, | |
"hits" : { | |
"total" : 22, | |
"max_score" : 16.027834, | |
"hits" : [ { | |
"_shard" : 5, | |
"_node" : "or3X2V-XQNey4DZCWBqreQ", | |
"_index" : "users", | |
"_type" : "search", | |
"_id" : "1", | |
"_score" : 16.027834, "_source" : {"_id":"1","uname":"PaulJones94"}, | |
"_explanation" : { | |
"value" : 16.027834, | |
"description" : "weight(uname.autocomplete:pauljones in 13577) [PerFieldSimilarity], result of:", | |
"details" : [ { | |
"value" : 16.027834, | |
"description" : "fieldWeight in 13577, product of:", | |
"details" : [ { | |
"value" : 1.0, | |
"description" : "tf(freq=1.0), with freq of:", | |
"details" : [ { | |
"value" : 1.0, | |
"description" : "termFreq=1.0" | |
} ] | |
}, { | |
"value" : 16.027834, | |
"description" : "idf(docFreq=24, maxDocs=84032067)" | |
}, { | |
"value" : 1.0, | |
"description" : "fieldNorm(doc=13577)" | |
} ] | |
} ] | |
} | |
}, { | |
"_shard" : 5, | |
"_node" : "or3X2V-XQNey4DZCWBqreQ", | |
"_index" : "users", | |
"_type" : "search", | |
"_id" : "2", | |
"_score" : 16.027834, "_source" : {"_id":"2","uname":"pauljones33"}, | |
"_explanation" : { | |
"value" : 16.027834, | |
"description" : "weight(uname.autocomplete:pauljones in 1252763) [PerFieldSimilarity], result of:", | |
"details" : [ { | |
"value" : 16.027834, | |
"description" : "fieldWeight in 1252763, product of:", | |
"details" : [ { | |
"value" : 1.0, | |
"description" : "tf(freq=1.0), with freq of:", | |
"details" : [ { | |
"value" : 1.0, | |
"description" : "termFreq=1.0" | |
} ] | |
}, { | |
"value" : 16.027834, | |
"description" : "idf(docFreq=24, maxDocs=84032067)" | |
}, { | |
"value" : 1.0, | |
"description" : "fieldNorm(doc=1252763)" | |
} ] | |
} ] | |
} | |
}, { | |
"_shard" : 5, | |
"_node" : "or3X2V-XQNey4DZCWBqreQ", | |
"_index" : "users", | |
"_type" : "search", | |
"_id" : "3", | |
"_score" : 16.027834, "_source" : {"_id":"3","uname":"PaulJones81"}, | |
"_explanation" : { | |
"value" : 16.027834, | |
"description" : "weight(uname.autocomplete:pauljones in 1473308) [PerFieldSimilarity], result of:", | |
"details" : [ { | |
"value" : 16.027834, | |
"description" : "fieldWeight in 1473308, product of:", | |
"details" : [ { | |
"value" : 1.0, | |
"description" : "tf(freq=1.0), with freq of:", | |
"details" : [ { | |
"value" : 1.0, | |
"description" : "termFreq=1.0" | |
} ] | |
}, { | |
"value" : 16.027834, | |
"description" : "idf(docFreq=24, maxDocs=84032067)" | |
}, { | |
"value" : 1.0, | |
"description" : "fieldNorm(doc=1473308)" | |
} ] | |
} ] | |
} | |
}, { | |
"_shard" : 1, | |
"_node" : "F7KzUDN1QS-ArR6hi8JSyA", | |
"_index" : "users", | |
"_type" : "search", | |
"_id" : "4", | |
"_score" : 16.027834, "_source" : {"_id":"4","uname":"PaulJones4"}, | |
"_explanation" : { | |
"value" : 16.027834, | |
"description" : "weight(uname.autocomplete:pauljones in 385270) [PerFieldSimilarity], result of:", | |
"details" : [ { | |
"value" : 16.027834, | |
"description" : "fieldWeight in 385270, product of:", | |
"details" : [ { | |
"value" : 1.0, | |
"description" : "tf(freq=1.0), with freq of:", | |
"details" : [ { | |
"value" : 1.0, | |
"description" : "termFreq=1.0" | |
} ] | |
}, { | |
"value" : 16.027834, | |
"description" : "idf(docFreq=24, maxDocs=84032067)" | |
}, { | |
"value" : 1.0, | |
"description" : "fieldNorm(doc=385270)" | |
} ] | |
} ] | |
} | |
}, { | |
"_shard" : 0, | |
"_node" : "Wd2hRMy2TIOui6LzCJ1Hhg", | |
"_index" : "users", | |
"_type" : "search", | |
"_id" : "5", | |
"_score" : 16.027834, "_source" : {"_id":"5","uname":"pauljones10297"}, | |
"_explanation" : { | |
"value" : 16.027834, | |
"description" : "weight(uname.autocomplete:pauljones in 476728) [PerFieldSimilarity], result of:", | |
"details" : [ { | |
"value" : 16.027834, | |
"description" : "fieldWeight in 476728, product of:", | |
"details" : [ { | |
"value" : 1.0, | |
"description" : "tf(freq=1.0), with freq of:", | |
"details" : [ { | |
"value" : 1.0, | |
"description" : "termFreq=1.0" | |
} ] | |
}, { | |
"value" : 16.027834, | |
"description" : "idf(docFreq=24, maxDocs=84032067)" | |
}, { | |
"value" : 1.0, | |
"description" : "fieldNorm(doc=476728)" | |
} ] | |
} ] | |
} | |
}, { | |
"_shard" : 5, | |
"_node" : "or3X2V-XQNey4DZCWBqreQ", | |
"_index" : "users", | |
"_type" : "search", | |
"_id" : "6", | |
"_score" : 5.008698, "_source" : {"_id":"6","uname":"PaulJones"}, | |
"_explanation" : { | |
"value" : 5.008698, | |
"description" : "weight(uname.autocomplete:pauljones in 5071178) [PerFieldSimilarity], result of:", | |
"details" : [ { | |
"value" : 5.008698, | |
"description" : "fieldWeight in 5071178, product of:", | |
"details" : [ { | |
"value" : 1.0, | |
"description" : "tf(freq=1.0), with freq of:", | |
"details" : [ { | |
"value" : 1.0, | |
"description" : "termFreq=1.0" | |
} ] | |
}, { | |
"value" : 16.027834, | |
"description" : "idf(docFreq=24, maxDocs=84032067)" | |
}, { | |
"value" : 0.3125, | |
"description" : "fieldNorm(doc=5071178)" | |
} ] | |
} ] | |
} | |
}, { | |
"_shard" : 2, | |
"_node" : "s5smWx3AQ-2D4GSqes9HUQ", | |
"_index" : "users", | |
"_type" : "search", | |
"_id" : "7", | |
"_score" : 5.008698, "_source" : {"_id":"7","uname":"PaulJones8"}, | |
"_explanation" : { | |
"value" : 5.008698, | |
"description" : "weight(uname.autocomplete:pauljones in 1587494) [PerFieldSimilarity], result of:", | |
"details" : [ { | |
"value" : 5.008698, | |
"description" : "fieldWeight in 1587494, product of:", | |
"details" : [ { | |
"value" : 1.0, | |
"description" : "tf(freq=1.0), with freq of:", | |
"details" : [ { | |
"value" : 1.0, | |
"description" : "termFreq=1.0" | |
} ] | |
}, { | |
"value" : 16.027834, | |
"description" : "idf(docFreq=24, maxDocs=84032067)" | |
}, { | |
"value" : 0.3125, | |
"description" : "fieldNorm(doc=1587494)" | |
} ] | |
} ] | |
} | |
}, { | |
"_shard" : 2, | |
"_node" : "s5smWx3AQ-2D4GSqes9HUQ", | |
"_index" : "users", | |
"_type" : "search", | |
"_id" : "8", | |
"_score" : 5.008698, "_source" : {"_id":"8","uname":"PaulJones7"}, | |
"_explanation" : { | |
"value" : 5.008698, | |
"description" : "weight(uname.autocomplete:pauljones in 3201384) [PerFieldSimilarity], result of:", | |
"details" : [ { | |
"value" : 5.008698, | |
"description" : "fieldWeight in 3201384, product of:", | |
"details" : [ { | |
"value" : 1.0, | |
"description" : "tf(freq=1.0), with freq of:", | |
"details" : [ { | |
"value" : 1.0, | |
"description" : "termFreq=1.0" | |
} ] | |
}, { | |
"value" : 16.027834, | |
"description" : "idf(docFreq=24, maxDocs=84032067)" | |
}, { | |
"value" : 0.3125, | |
"description" : "fieldNorm(doc=3201384)" | |
} ] | |
} ] | |
} | |
}, { | |
"_shard" : 2, | |
"_node" : "s5smWx3AQ-2D4GSqes9HUQ", | |
"_index" : "users", | |
"_type" : "search", | |
"_id" : "9", | |
"_score" : 5.008698, "_source" : {"_id":"9","uname":"PaulJones5"}, | |
"_explanation" : { | |
"value" : 5.008698, | |
"description" : "weight(uname.autocomplete:pauljones in 7537206) [PerFieldSimilarity], result of:", | |
"details" : [ { | |
"value" : 5.008698, | |
"description" : "fieldWeight in 7537206, product of:", | |
"details" : [ { | |
"value" : 1.0, | |
"description" : "tf(freq=1.0), with freq of:", | |
"details" : [ { | |
"value" : 1.0, | |
"description" : "termFreq=1.0" | |
} ] | |
}, { | |
"value" : 16.027834, | |
"description" : "idf(docFreq=24, maxDocs=84032067)" | |
}, { | |
"value" : 0.3125, | |
"description" : "fieldNorm(doc=7537206)" | |
} ] | |
} ] | |
} | |
}, { | |
"_shard" : 1, | |
"_node" : "F7KzUDN1QS-ArR6hi8JSyA", | |
"_index" : "users", | |
"_type" : "search", | |
"_id" : "10", | |
"_score" : 5.008698, "_source" : {"_id":"10","uname":"PaulJones1"}, | |
"_explanation" : { | |
"value" : 5.008698, | |
"description" : "weight(uname.autocomplete:pauljones in 5033404) [PerFieldSimilarity], result of:", | |
"details" : [ { | |
"value" : 5.008698, | |
"description" : "fieldWeight in 5033404, product of:", | |
"details" : [ { | |
"value" : 1.0, | |
"description" : "tf(freq=1.0), with freq of:", | |
"details" : [ { | |
"value" : 1.0, | |
"description" : "termFreq=1.0" | |
} ] | |
}, { | |
"value" : 16.027834, | |
"description" : "idf(docFreq=24, maxDocs=84032067)" | |
}, { | |
"value" : 0.3125, | |
"description" : "fieldNorm(doc=5033404)" | |
} ] | |
} ] | |
} | |
} ] | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment