-
-
Save ewltang/33ab829c404130c935ac 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
Query on original field | |
----------------------- | |
curl -XGET 'http://localhost:9200/users/search/_search?pretty=true&search_type=dfs_query_then_fetch&explain=true' -d ' | |
{ | |
"query":{ | |
"match":{ | |
"uname.autocomplete":"pauljones" | |
}, | |
"from":0, | |
"size":10 | |
} | |
'; | |
{ | |
"took" : 36, | |
"timed_out" : false, | |
"_shards" : { | |
"total" : 6, | |
"successful" : 6, | |
"failed" : 0 | |
}, | |
"hits" : { | |
"total" : 22, | |
"max_score" : 4.9576526, | |
"hits" : [ { | |
"_shard" : 5, | |
"_node" : "8RDl6ZtNSUus0mLpXqUgfg", | |
"_index" : "users", | |
"_type" : "search", | |
"_id" : "1", | |
"_score" : 4.9576526, "_source" : {"_id":"1","uname":"PaulJones"}, | |
"_explanation" : { | |
"value" : 4.9576526, | |
"description" : "weight(uname.autocomplete:pauljones in 2204644) [PerFieldSimilarity], result of:", | |
"details" : [ { | |
"value" : 4.9576526, | |
"description" : "fieldWeight in 2204644, product of:", | |
"details" : [ { | |
"value" : 1.0, | |
"description" : "tf(freq=1.0), with freq of:", | |
"details" : [ { | |
"value" : 1.0, | |
"description" : "termFreq=1.0" | |
} ] | |
}, { | |
"value" : 15.864489, | |
"description" : "idf(docFreq=22, maxDocs=65658835)" | |
}, { | |
"value" : 0.3125, | |
"description" : "fieldNorm(doc=2204644)" | |
} ] | |
} ] | |
} | |
}, { | |
"_shard" : 2, | |
"_node" : "H9nIrcEISvCLRKbzRmIJeA", | |
"_index" : "users", | |
"_type" : "search", | |
"_id" : "2", | |
"_score" : 4.9576526, "_source" : {"_id":"2","uname":"PaulJones5"}, | |
"_explanation" : { | |
"value" : 4.9576526, | |
"description" : "weight(uname.autocomplete:pauljones in 2813267) [PerFieldSimilarity], result of:", | |
"details" : [ { | |
"value" : 4.9576526, | |
"description" : "fieldWeight in 2813267, product of:", | |
"details" : [ { | |
"value" : 1.0, | |
"description" : "tf(freq=1.0), with freq of:", | |
"details" : [ { | |
"value" : 1.0, | |
"description" : "termFreq=1.0" | |
} ] | |
}, { | |
"value" : 15.864489, | |
"description" : "idf(docFreq=22, maxDocs=65658835)" | |
}, { | |
"value" : 0.3125, | |
"description" : "fieldNorm(doc=2813267)" | |
} ] | |
} ] | |
} | |
}, { | |
"_shard" : 2, | |
"_node" : "H9nIrcEISvCLRKbzRmIJeA", | |
"_index" : "users", | |
"_type" : "search", | |
"_id" : "3", | |
"_score" : 4.9576526, "_source" : {"_id":"3","uname":"PaulJones7"}, | |
"_explanation" : { | |
"value" : 4.9576526, | |
"description" : "weight(uname.autocomplete:pauljones in 564094) [PerFieldSimilarity], result of:", | |
"details" : [ { | |
"value" : 4.9576526, | |
"description" : "fieldWeight in 564094, product of:", | |
"details" : [ { | |
"value" : 1.0, | |
"description" : "tf(freq=1.0), with freq of:", | |
"details" : [ { | |
"value" : 1.0, | |
"description" : "termFreq=1.0" | |
} ] | |
}, { | |
"value" : 15.864489, | |
"description" : "idf(docFreq=22, maxDocs=65658835)" | |
}, { | |
"value" : 0.3125, | |
"description" : "fieldNorm(doc=564094)" | |
} ] | |
} ] | |
} | |
}, { | |
"_shard" : 2, | |
"_node" : "H9nIrcEISvCLRKbzRmIJeA", | |
"_index" : "users", | |
"_type" : "search", | |
"_id" : "4", | |
"_score" : 4.9576526, "_source" : {"_id":"4","uname":"PaulJones8"}, | |
"_explanation" : { | |
"value" : 4.9576526, | |
"description" : "weight(uname.autocomplete:pauljones in 1922294) [PerFieldSimilarity], result of:", | |
"details" : [ { | |
"value" : 4.9576526, | |
"description" : "fieldWeight in 1922294, product of:", | |
"details" : [ { | |
"value" : 1.0, | |
"description" : "tf(freq=1.0), with freq of:", | |
"details" : [ { | |
"value" : 1.0, | |
"description" : "termFreq=1.0" | |
} ] | |
}, { | |
"value" : 15.864489, | |
"description" : "idf(docFreq=22, maxDocs=65658835)" | |
}, { | |
"value" : 0.3125, | |
"description" : "fieldNorm(doc=1922294)" | |
} ] | |
} ] | |
} | |
}, { | |
"_shard" : 1, | |
"_node" : "kgoF7QntQaSAFbJpvW4HJg", | |
"_index" : "users", | |
"_type" : "search", | |
"_id" : "5", | |
"_score" : 4.9576526, "_source" : {"_id":"5","uname":"PaulJones1"}, | |
"_explanation" : { | |
"value" : 4.9576526, | |
"description" : "weight(uname.autocomplete:pauljones in 298180) [PerFieldSimilarity], result of:", | |
"details" : [ { | |
"value" : 4.9576526, | |
"description" : "fieldWeight in 298180, product of:", | |
"details" : [ { | |
"value" : 1.0, | |
"description" : "tf(freq=1.0), with freq of:", | |
"details" : [ { | |
"value" : 1.0, | |
"description" : "termFreq=1.0" | |
} ] | |
}, { | |
"value" : 15.864489, | |
"description" : "idf(docFreq=22, maxDocs=65658835)" | |
}, { | |
"value" : 0.3125, | |
"description" : "fieldNorm(doc=298180)" | |
} ] | |
} ] | |
} | |
}, { | |
"_shard" : 1, | |
"_node" : "kgoF7QntQaSAFbJpvW4HJg", | |
"_index" : "users", | |
"_type" : "search", | |
"_id" : "6", | |
"_score" : 4.9576526, "_source" : {"_id":"6","uname":"PaulJones4"}, | |
"_explanation" : { | |
"value" : 4.9576526, | |
"description" : "weight(uname.autocomplete:pauljones in 2078364) [PerFieldSimilarity], result of:", | |
"details" : [ { | |
"value" : 4.9576526, | |
"description" : "fieldWeight in 2078364, product of:", | |
"details" : [ { | |
"value" : 1.0, | |
"description" : "tf(freq=1.0), with freq of:", | |
"details" : [ { | |
"value" : 1.0, | |
"description" : "termFreq=1.0" | |
} ] | |
}, { | |
"value" : 15.864489, | |
"description" : "idf(docFreq=22, maxDocs=65658835)" | |
}, { | |
"value" : 0.3125, | |
"description" : "fieldNorm(doc=2078364)" | |
} ] | |
} ] | |
} | |
}, { | |
"_shard" : 3, | |
"_node" : "PZ9NpUI1TrqSlvaXa4Wb5Q", | |
"_index" : "users", | |
"_type" : "search", | |
"_id" : "7", | |
"_score" : 4.9576526, "_source" : {"_id":"7","uname":"PaulJones3"}, | |
"_explanation" : { | |
"value" : 4.9576526, | |
"description" : "weight(uname.autocomplete:pauljones in 1260620) [PerFieldSimilarity], result of:", | |
"details" : [ { | |
"value" : 4.9576526, | |
"description" : "fieldWeight in 1260620, product of:", | |
"details" : [ { | |
"value" : 1.0, | |
"description" : "tf(freq=1.0), with freq of:", | |
"details" : [ { | |
"value" : 1.0, | |
"description" : "termFreq=1.0" | |
} ] | |
}, { | |
"value" : 15.864489, | |
"description" : "idf(docFreq=22, maxDocs=65658835)" | |
}, { | |
"value" : 0.3125, | |
"description" : "fieldNorm(doc=1260620)" | |
} ] | |
} ] | |
} | |
}, { | |
"_shard" : 3, | |
"_node" : "PZ9NpUI1TrqSlvaXa4Wb5Q", | |
"_index" : "users", | |
"_type" : "search", | |
"_id" : "8", | |
"_score" : 4.9576526, "_source" : {"_id":"8","uname":"PaulJones6"}, | |
"_explanation" : { | |
"value" : 4.9576526, | |
"description" : "weight(uname.autocomplete:pauljones in 1006348) [PerFieldSimilarity], result of:", | |
"details" : [ { | |
"value" : 4.9576526, | |
"description" : "fieldWeight in 1006348, product of:", | |
"details" : [ { | |
"value" : 1.0, | |
"description" : "tf(freq=1.0), with freq of:", | |
"details" : [ { | |
"value" : 1.0, | |
"description" : "termFreq=1.0" | |
} ] | |
}, { | |
"value" : 15.864489, | |
"description" : "idf(docFreq=22, maxDocs=65658835)" | |
}, { | |
"value" : 0.3125, | |
"description" : "fieldNorm(doc=1006348)" | |
} ] | |
} ] | |
} | |
}, { | |
"_shard" : 0, | |
"_node" : "o0EbsqZITSeJFJA1zSreJw", | |
"_index" : "users", | |
"_type" : "search", | |
"_id" : "9", | |
"_score" : 4.9576526, "_source" : {"_id":"9","uname":"PaulJones0"}, | |
"_explanation" : { | |
"value" : 4.9576526, | |
"description" : "weight(uname.autocomplete:pauljones in 1981167) [PerFieldSimilarity], result of:", | |
"details" : [ { | |
"value" : 4.9576526, | |
"description" : "fieldWeight in 1981167, product of:", | |
"details" : [ { | |
"value" : 1.0, | |
"description" : "tf(freq=1.0), with freq of:", | |
"details" : [ { | |
"value" : 1.0, | |
"description" : "termFreq=1.0" | |
} ] | |
}, { | |
"value" : 15.864489, | |
"description" : "idf(docFreq=22, maxDocs=65658835)" | |
}, { | |
"value" : 0.3125, | |
"description" : "fieldNorm(doc=1981167)" | |
} ] | |
} ] | |
} | |
}, { | |
"_shard" : 0, | |
"_node" : "o0EbsqZITSeJFJA1zSreJw", | |
"_index" : "users", | |
"_type" : "search", | |
"_id" : "10", | |
"_score" : 4.9576526, "_source" : {"_id":"10","uname":"PaulJones2"}, | |
"_explanation" : { | |
"value" : 4.9576526, | |
"description" : "weight(uname.autocomplete:pauljones in 2518914) [PerFieldSimilarity], result of:", | |
"details" : [ { | |
"value" : 4.9576526, | |
"description" : "fieldWeight in 2518914, product of:", | |
"details" : [ { | |
"value" : 1.0, | |
"description" : "tf(freq=1.0), with freq of:", | |
"details" : [ { | |
"value" : 1.0, | |
"description" : "termFreq=1.0" | |
} ] | |
}, { | |
"value" : 15.864489, | |
"description" : "idf(docFreq=22, maxDocs=65658835)" | |
}, { | |
"value" : 0.3125, | |
"description" : "fieldNorm(doc=2518914)" | |
} ] | |
} ] | |
} | |
} ] | |
} | |
} | |
Query on new field | |
---------------------- | |
curl -XGET 'http://localhost:9200/users/search/_search?pretty=true&search_type=dfs_query_then_fetch&explain=true' -d ' | |
{ | |
"query":{ | |
"term":{ | |
"uname.autocompletenew":{ | |
"value":"pauljones" | |
} | |
}, | |
"from":0, | |
"size":10 | |
} | |
'; | |
{ | |
"took" : 19, | |
"timed_out" : false, | |
"_shards" : { | |
"total" : 6, | |
"successful" : 6, | |
"failed" : 0 | |
}, | |
"hits" : { | |
"total" : 22, | |
"max_score" : 15.864489, | |
"hits" : [ { | |
"_shard" : 5, | |
"_node" : "jwXM9qAtRO6lkTVcU2SpiA", | |
"_index" : "users", | |
"_type" : "search", | |
"_id" : "1", | |
"_score" : 15.864489, "_source" : {"_id":"1","uname":"pauljones14606"}, | |
"_explanation" : { | |
"value" : 15.864489, | |
"description" : "weight(uname.autocompletenew:pauljones in 2336981) [PerFieldSimilarity], result of:", | |
"details" : [ { | |
"value" : 15.864489, | |
"description" : "fieldWeight in 2336981, product of:", | |
"details" : [ { | |
"value" : 1.0, | |
"description" : "tf(freq=1.0), with freq of:", | |
"details" : [ { | |
"value" : 1.0, | |
"description" : "termFreq=1.0" | |
} ] | |
}, { | |
"value" : 15.864489, | |
"description" : "idf(docFreq=22, maxDocs=65658835)" | |
}, { | |
"value" : 1.0, | |
"description" : "fieldNorm(doc=2336981)" | |
} ] | |
} ] | |
} | |
}, { | |
"_shard" : 5, | |
"_node" : "jwXM9qAtRO6lkTVcU2SpiA", | |
"_index" : "users", | |
"_type" : "search", | |
"_id" : "2", | |
"_score" : 15.864489, "_source" : {"_id":"2","uname":"PaulJones"}, | |
"_explanation" : { | |
"value" : 15.864489, | |
"description" : "weight(uname.autocompletenew:pauljones in 2379374) [PerFieldSimilarity], result of:", | |
"details" : [ { | |
"value" : 15.864489, | |
"description" : "fieldWeight in 2379374, product of:", | |
"details" : [ { | |
"value" : 1.0, | |
"description" : "tf(freq=1.0), with freq of:", | |
"details" : [ { | |
"value" : 1.0, | |
"description" : "termFreq=1.0" | |
} ] | |
}, { | |
"value" : 15.864489, | |
"description" : "idf(docFreq=22, maxDocs=65658835)" | |
}, { | |
"value" : 1.0, | |
"description" : "fieldNorm(doc=2379374)" | |
} ] | |
} ] | |
} | |
}, { | |
"_shard" : 5, | |
"_node" : "jwXM9qAtRO6lkTVcU2SpiA", | |
"_index" : "users", | |
"_type" : "search", | |
"_id" : "3", | |
"_score" : 15.864489, "_source" : {"_id":"3","uname":"pauljones111111111"}, | |
"_explanation" : { | |
"value" : 15.864489, | |
"description" : "weight(uname.autocompletenew:pauljones in 628023) [PerFieldSimilarity], result of:", | |
"details" : [ { | |
"value" : 15.864489, | |
"description" : "fieldWeight in 628023, product of:", | |
"details" : [ { | |
"value" : 1.0, | |
"description" : "tf(freq=1.0), with freq of:", | |
"details" : [ { | |
"value" : 1.0, | |
"description" : "termFreq=1.0" | |
} ] | |
}, { | |
"value" : 15.864489, | |
"description" : "idf(docFreq=22, maxDocs=65658835)" | |
}, { | |
"value" : 1.0, | |
"description" : "fieldNorm(doc=628023)" | |
} ] | |
} ] | |
} | |
}, { | |
"_shard" : 5, | |
"_node" : "jwXM9qAtRO6lkTVcU2SpiA", | |
"_index" : "users", | |
"_type" : "search", | |
"_id" : "4", | |
"_score" : 15.864489, "_source" : {"_id":"4","uname":"pauljones180870"}, | |
"_explanation" : { | |
"value" : 15.864489, | |
"description" : "weight(uname.autocompletenew:pauljones in 470205) [PerFieldSimilarity], result of:", | |
"details" : [ { | |
"value" : 15.864489, | |
"description" : "fieldWeight in 470205, product of:", | |
"details" : [ { | |
"value" : 1.0, | |
"description" : "tf(freq=1.0), with freq of:", | |
"details" : [ { | |
"value" : 1.0, | |
"description" : "termFreq=1.0" | |
} ] | |
}, { | |
"value" : 15.864489, | |
"description" : "idf(docFreq=22, maxDocs=65658835)" | |
}, { | |
"value" : 1.0, | |
"description" : "fieldNorm(doc=470205)" | |
} ] | |
} ] | |
} | |
}, { | |
"_shard" : 5, | |
"_node" : "jwXM9qAtRO6lkTVcU2SpiA", | |
"_index" : "users", | |
"_type" : "search", | |
"_id" : "5", | |
"_score" : 15.864489, "_source" : {"_id":"5","uname":"PaulJones94"}, | |
"_explanation" : { | |
"value" : 15.864489, | |
"description" : "weight(uname.autocompletenew:pauljones in 2539278) [PerFieldSimilarity], result of:", | |
"details" : [ { | |
"value" : 15.864489, | |
"description" : "fieldWeight in 2539278, product of:", | |
"details" : [ { | |
"value" : 1.0, | |
"description" : "tf(freq=1.0), with freq of:", | |
"details" : [ { | |
"value" : 1.0, | |
"description" : "termFreq=1.0" | |
} ] | |
}, { | |
"value" : 15.864489, | |
"description" : "idf(docFreq=22, maxDocs=65658835)" | |
}, { | |
"value" : 1.0, | |
"description" : "fieldNorm(doc=2539278)" | |
} ] | |
} ] | |
} | |
}, { | |
"_shard" : 5, | |
"_node" : "jwXM9qAtRO6lkTVcU2SpiA", | |
"_index" : "users", | |
"_type" : "search", | |
"_id" : "6", | |
"_score" : 15.864489, "_source" : {"_id":"6","uname":"PaulJones81"}, | |
"_explanation" : { | |
"value" : 15.864489, | |
"description" : "weight(uname.autocompletenew:pauljones in 223775) [PerFieldSimilarity], result of:", | |
"details" : [ { | |
"value" : 15.864489, | |
"description" : "fieldWeight in 223775, product of:", | |
"details" : [ { | |
"value" : 1.0, | |
"description" : "tf(freq=1.0), with freq of:", | |
"details" : [ { | |
"value" : 1.0, | |
"description" : "termFreq=1.0" | |
} ] | |
}, { | |
"value" : 15.864489, | |
"description" : "idf(docFreq=22, maxDocs=65658835)" | |
}, { | |
"value" : 1.0, | |
"description" : "fieldNorm(doc=223775)" | |
} ] | |
} ] | |
} | |
}, { | |
"_shard" : 5, | |
"_node" : "jwXM9qAtRO6lkTVcU2SpiA", | |
"_index" : "users", | |
"_type" : "search", | |
"_id" : "7", | |
"_score" : 15.864489, "_source" : {"_id":"7","uname":"pauljones33"}, | |
"_explanation" : { | |
"value" : 15.864489, | |
"description" : "weight(uname.autocompletenew:pauljones in 240295) [PerFieldSimilarity], result of:", | |
"details" : [ { | |
"value" : 15.864489, | |
"description" : "fieldWeight in 240295, product of:", | |
"details" : [ { | |
"value" : 1.0, | |
"description" : "tf(freq=1.0), with freq of:", | |
"details" : [ { | |
"value" : 1.0, | |
"description" : "termFreq=1.0" | |
} ] | |
}, { | |
"value" : 15.864489, | |
"description" : "idf(docFreq=22, maxDocs=65658835)" | |
}, { | |
"value" : 1.0, | |
"description" : "fieldNorm(doc=240295)" | |
} ] | |
} ] | |
} | |
}, { | |
"_shard" : 2, | |
"_node" : "H9nIrcEISvCLRKbzRmIJeA", | |
"_index" : "users", | |
"_type" : "search", | |
"_id" : "8", | |
"_score" : 15.864489, "_source" : {"_id":"8","uname":"pauljonesdeausen"}, | |
"_explanation" : { | |
"value" : 15.864489, | |
"description" : "weight(uname.autocompletenew:pauljones in 2339658) [PerFieldSimilarity], result of:", | |
"details" : [ { | |
"value" : 15.864489, | |
"description" : "fieldWeight in 2339658, product of:", | |
"details" : [ { | |
"value" : 1.0, | |
"description" : "tf(freq=1.0), with freq of:", | |
"details" : [ { | |
"value" : 1.0, | |
"description" : "termFreq=1.0" | |
} ] | |
}, { | |
"value" : 15.864489, | |
"description" : "idf(docFreq=22, maxDocs=65658835)" | |
}, { | |
"value" : 1.0, | |
"description" : "fieldNorm(doc=2339658)" | |
} ] | |
} ] | |
} | |
}, { | |
"_shard" : 2, | |
"_node" : "H9nIrcEISvCLRKbzRmIJeA", | |
"_index" : "users", | |
"_type" : "search", | |
"_id" : "9", | |
"_score" : 15.864489, "_source" : {"_id":"9","uname":"PaulJones5"}, | |
"_explanation" : { | |
"value" : 15.864489, | |
"description" : "weight(uname.autocompletenew:pauljones in 2813267) [PerFieldSimilarity], result of:", | |
"details" : [ { | |
"value" : 15.864489, | |
"description" : "fieldWeight in 2813267, product of:", | |
"details" : [ { | |
"value" : 1.0, | |
"description" : "tf(freq=1.0), with freq of:", | |
"details" : [ { | |
"value" : 1.0, | |
"description" : "termFreq=1.0" | |
} ] | |
}, { | |
"value" : 15.864489, | |
"description" : "idf(docFreq=22, maxDocs=65658835)" | |
}, { | |
"value" : 1.0, | |
"description" : "fieldNorm(doc=2813267)" | |
} ] | |
} ] | |
} | |
}, { | |
"_shard" : 2, | |
"_node" : "H9nIrcEISvCLRKbzRmIJeA", | |
"_index" : "users", | |
"_type" : "search", | |
"_id" : "10", | |
"_score" : 15.864489, "_source" : {"_id":"10","uname":"PaulJones7"}, | |
"_explanation" : { | |
"value" : 15.864489, | |
"description" : "weight(uname.autocompletenew:pauljones in 564094) [PerFieldSimilarity], result of:", | |
"details" : [ { | |
"value" : 15.864489, | |
"description" : "fieldWeight in 564094, product of:", | |
"details" : [ { | |
"value" : 1.0, | |
"description" : "tf(freq=1.0), with freq of:", | |
"details" : [ { | |
"value" : 1.0, | |
"description" : "termFreq=1.0" | |
} ] | |
}, { | |
"value" : 15.864489, | |
"description" : "idf(docFreq=22, maxDocs=65658835)" | |
}, { | |
"value" : 1.0, | |
"description" : "fieldNorm(doc=564094)" | |
} ] | |
} ] | |
} | |
} ] | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment