{"id":222,"date":"2017-06-29T09:26:49","date_gmt":"2017-06-29T09:26:49","guid":{"rendered":""},"modified":"2017-06-29T09:26:49","modified_gmt":"2017-06-29T09:26:49","slug":"","status":"publish","type":"post","link":"http:\/\/weizn.net\/?p=222","title":{"rendered":"[\u8f6c] \u4f7f\u7528scroll\u5b9e\u73b0Elasticsearch\u6570\u636e\u904d\u5386\u548c\u6df1\u5ea6\u5206\u9875"},"content":{"rendered":"<div id=\"ez-toc-container\" class=\"ez-toc-v2_0_17 counter-hierarchy\">\n<div class=\"ez-toc-title-container\">\n<p class=\"ez-toc-title\">\u76ee\u5f55<\/p>\n<span class=\"ez-toc-title-toggle\"><a class=\"ez-toc-pull-right ez-toc-btn ez-toc-btn-xs ez-toc-btn-default ez-toc-toggle\" style=\"display: none;\"><i class=\"ez-toc-glyphicon ez-toc-icon-toggle\"><\/i><\/a><\/span><\/div>\n<nav><ul class=\"ez-toc-list ez-toc-list-level-1\"><li class=\"ez-toc-page-1 ez-toc-heading-level-3\"><a class=\"ez-toc-link ez-toc-heading-1\" href=\"http:\/\/weizn.net\/?p=222\/#%E8%83%8C%E6%99%AF\" title=\"\n\t\u80cc\u666f \n\">\n\t\u80cc\u666f \n<\/a><\/li><li class=\"ez-toc-page-1 ez-toc-heading-level-3\"><a class=\"ez-toc-link ez-toc-heading-2\" href=\"http:\/\/weizn.net\/?p=222\/#Elasticsearch_%E6%90%9C%E7%B4%A2%E5%86%85%E9%83%A8%E6%89%A7%E8%A1%8C%E5%8E%9F%E7%90%86\" title=\"\n\tElasticsearch \u641c\u7d22\u5185\u90e8\u6267\u884c\u539f\u7406 \n\">\n\tElasticsearch \u641c\u7d22\u5185\u90e8\u6267\u884c\u539f\u7406 \n<\/a><\/li><li class=\"ez-toc-page-1 ez-toc-heading-level-3\"><a class=\"ez-toc-link ez-toc-heading-3\" href=\"http:\/\/weizn.net\/?p=222\/#%E9%81%8D%E5%8E%86\" title=\"\n\t\u904d\u5386 \n\">\n\t\u904d\u5386 \n<\/a><\/li><li class=\"ez-toc-page-1 ez-toc-heading-level-3\"><a class=\"ez-toc-link ez-toc-heading-4\" href=\"http:\/\/weizn.net\/?p=222\/#%E6%80%BB%E7%BB%93\" title=\"\n\t\u603b\u7ed3 \n\">\n\t\u603b\u7ed3 \n<\/a><\/li><\/ul><\/nav><\/div>\n<h3 style=\"box-sizing:border-box;\"><span class=\"ez-toc-section\" id=\"%E8%83%8C%E6%99%AF\"><\/span>\n\t<span style=\"font-size:14px;\">\u80cc\u666f<\/span><br \/>\n<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<hr style=\"box-sizing:content-box;height:0px;margin:0px 0px 20px;border-right:0px;border-bottom:0px;border-left:0px;border-image:initial;border-top-style:solid;border-top-color:#DDDDDD;\" \/>\n<p style=\"box-sizing:border-box;margin-top:0px;margin-bottom:25px;word-break:break-word;\">\n\t<span style=\"font-size:14px;\">Elasticsearch \u662f\u4e00\u4e2a\u5b9e\u65f6\u7684\u5206\u5e03\u5f0f\u641c\u7d22\u4e0e\u5206\u6790\u5f15\u64ce\uff0c\u88ab\u5e7f\u6cdb\u7528\u6765\u505a\u5168\u6587\u641c\u7d22\u3001\u7ed3\u6784\u5316\u641c\u7d22\u3001\u5206\u6790\u3002\u5728\u4f7f\u7528\u8fc7\u7a0b\u4e2d\uff0c\u6709\u4e00\u4e9b\u5178\u578b\u7684\u4f7f\u7528\u573a\u666f\uff0c\u6bd4\u5982\u5206\u9875\u3001\u904d\u5386\u7b49\u3002\u5728\u4f7f\u7528\u5173\u7cfb\u578b\u6570\u636e\u5e93\u4e2d\uff0c\u6211\u4eec\u88ab\u544a\u77e5\u8981\u6ce8\u610f\u751a\u81f3\u88ab\u660e\u786e\u7981\u6b62\u4f7f\u7528\u6df1\u5ea6\u5206\u9875\uff0c\u540c\u7406\uff0c\u5728 Elasticsearch \u4e2d\uff0c\u4e5f\u5e94\u8be5\u5c3d\u91cf\u907f\u514d\u4f7f\u7528\u6df1\u5ea6\u5206\u9875\u3002\u8fd9\u7bc7\u6587\u7ae0\u4e3b\u8981\u4ecb\u7ecd Elasticsearch \u4e2d\u4f7f\u7528\u5206\u9875\u7684\u65b9\u5f0f\u3001Elasticsearch \u641c\u7d22\u6267\u884c\u8fc7\u7a0b\u4ee5\u53ca\u4e3a\u4ec0\u4e48\u6df1\u5ea6\u5206\u9875\u5e94\u8be5\u88ab\u7981\u6b62\uff0c\u6700\u540e\u518d\u4ecb\u7ecd\u4f7f\u7528 scroll \u7684\u65b9\u5f0f\u904d\u5386\u6570\u636e\u3002<\/span>\n<\/p>\n<h3 style=\"box-sizing:border-box;\"><span class=\"ez-toc-section\" id=\"Elasticsearch_%E6%90%9C%E7%B4%A2%E5%86%85%E9%83%A8%E6%89%A7%E8%A1%8C%E5%8E%9F%E7%90%86\"><\/span>\n\t<span style=\"font-size:14px;\">Elasticsearch \u641c\u7d22\u5185\u90e8\u6267\u884c\u539f\u7406<\/span><br \/>\n<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<hr style=\"box-sizing:content-box;height:0px;margin:0px 0px 20px;border-right:0px;border-bottom:0px;border-left:0px;border-image:initial;border-top-style:solid;border-top-color:#DDDDDD;\" \/>\n<p style=\"box-sizing:border-box;margin-top:0px;margin-bottom:25px;word-break:break-word;\">\n\t<span style=\"font-size:14px;\">\u4e00\u4e2a\u6700\u57fa\u672c\u7684 Elasticsearch \u67e5\u8be2\u8bed\u53e5\u662f\u8fd9\u6837\u7684\uff1a<\/span>\n<\/p>\n<pre style=\"box-sizing:border-box;overflow:auto;\">POST \/my_index\/my_type\/_search\n{\n    \"query\": { \"match_all\": {}},\n    \"from\": 100,\n    \"size\":  10\n}<\/pre>\n<p><br style=\"box-sizing:border-box;\" \/><br \/>\n<span style=\"font-size:14px;\">\u4e0a\u9762\u7684\u67e5\u8be2\u8868\u793a\u4ece\u641c\u7d22\u7ed3\u679c\u4e2d\u53d6\u7b2c100\u6761\u5f00\u59cb\u768410\u6761\u6570\u636e\u3002<\/span><br style=\"box-sizing:border-box;\" \/><br \/>\n<span style=\"font-size:14px;\">&#8211; \u4e0b\u9762\u8bb2\u89e3\u641c\u7d22\u8fc7\u7a0b\u65f6\u4e5f\u4ee5\u8fd9\u4e2a\u8bf7\u6c42\u4e3a\u4f8b\u3002<\/span><br style=\"box-sizing:border-box;\" \/><br \/>\n<span style=\"font-size:14px;\">\u90a3\u4e48\uff0c\u8fd9\u4e2a\u67e5\u8be2\u8bed\u53e5\u5728 Elasticsearch \u96c6\u7fa4\u5185\u90e8\u662f\u600e\u4e48\u6267\u884c\u7684\u5462\uff1f\u4e3a\u4e86\u65b9\u4fbf\u63cf\u8ff0\uff0c\u6211\u4eec\u5047\u8bbe\u8be5 index \u53ea\u6709primary shards\uff0c\u6ca1\u6709 replica shards\u3002<\/span><br style=\"box-sizing:border-box;\" \/><br \/>\n<span style=\"font-size:14px;\">\u5728 Elasticsearch \u4e2d\uff0c\u641c\u7d22\u4e00\u822c\u5305\u62ec\u4e24\u4e2a\u9636\u6bb5\uff0cquery \u548c fetch \u9636\u6bb5\uff0c\u53ef\u4ee5\u7b80\u5355\u7684\u7406\u89e3\uff0cquery \u9636\u6bb5\u786e\u5b9a\u8981\u53d6\u54ea\u4e9bdoc\uff0cfetch \u9636\u6bb5\u53d6\u51fa\u5177\u4f53\u7684 doc\u3002<\/span><br style=\"box-sizing:border-box;\" \/><br \/>\n<span style=\"font-size:14px;\">Query \u9636\u6bb5<\/span><br style=\"box-sizing:border-box;\" \/><\/p>\n<div class=\"image-package\" style=\"box-sizing:border-box;padding-bottom:25px;width:700px;margin-left:-40px;text-align:center;\">\n\t<img decoding=\"async\" src=\"http:\/\/upload-images.jianshu.io\/upload_images\/1307647-f27d40f7a8544fc0.jpg?imageMogr2\/auto-orient\/strip%7CimageView2\/2\" data-original-src=\"http:\/\/upload-images.jianshu.io\/upload_images\/1307647-f27d40f7a8544fc0.jpg?imageMogr2\/auto-orient\/strip%7CimageView2\/2\" style=\"box-sizing:border-box;vertical-align:middle;max-width:100%;height:auto;cursor:zoom-in;transition:all 0.25s ease-in-out;\" \/><br style=\"box-sizing:border-box;\" \/><\/p>\n<div class=\"image-caption\" style=\"box-sizing:border-box;min-width:20%;max-width:80%;min-height:22px;display:inline-block;padding:10px;margin:0px auto;border-bottom:1px solid #D9D9D9;line-height:1.7;\">\n\t\t<span style=\"font-size:14px;\">query<\/span>\n\t<\/div>\n<\/div>\n<p><br style=\"box-sizing:border-box;\" \/><br \/>\n<span style=\"font-size:14px;\">\u5982\u4e0a\u56fe\u6240\u793a\uff0c\u63cf\u8ff0\u4e86\u4e00\u6b21\u641c\u7d22\u8bf7\u6c42\u7684 query \u9636\u6bb5\u3002<\/span><br style=\"box-sizing:border-box;\" \/><br \/>\n<span style=\"font-size:14px;\">Client \u53d1\u9001\u4e00\u6b21\u641c\u7d22\u8bf7\u6c42\uff0cnode1 \u63a5\u6536\u5230\u8bf7\u6c42\uff0c\u7136\u540e\uff0cnode1 \u521b\u5efa\u4e00\u4e2a\u5927\u5c0f\u4e3a from + size \u7684\u4f18\u5148\u7ea7\u961f\u5217\u7528\u6765\u5b58\u7ed3\u679c\uff0c\u6211\u4eec\u7ba1 node1 \u53eb coordinating node\u3002<\/span><br style=\"box-sizing:border-box;\" \/><br \/>\n<span style=\"font-size:14px;\">coordinating node\u5c06\u8bf7\u6c42\u5e7f\u64ad\u5230\u6d89\u53ca\u5230\u7684 shards\uff0c\u6bcf\u4e2a shard \u5728\u5185\u90e8\u6267\u884c\u641c\u7d22\u8bf7\u6c42\uff0c\u7136\u540e\uff0c\u5c06\u7ed3\u679c\u5b58\u5230\u5185\u90e8\u7684\u5927\u5c0f\u540c\u6837\u4e3a from + size \u7684\u4f18\u5148\u7ea7\u961f\u5217\u91cc\uff0c\u53ef\u4ee5\u628a\u4f18\u5148\u7ea7\u961f\u5217\u7406\u89e3\u4e3a\u4e00\u4e2a\u5305\u542b top N \u7ed3\u679c\u7684\u5217\u8868\u3002<\/span><br style=\"box-sizing:border-box;\" \/><br \/>\n<span style=\"font-size:14px;\">\u6bcf\u4e2a shard \u628a\u6682\u5b58\u5728\u81ea\u8eab\u4f18\u5148\u7ea7\u961f\u5217\u91cc\u7684\u6570\u636e\u8fd4\u56de\u7ed9 coordinating node\uff0ccoordinating node \u62ff\u5230\u5404\u4e2a shards \u8fd4\u56de\u7684\u7ed3\u679c\u540e\u5bf9\u7ed3\u679c\u8fdb\u884c\u4e00\u6b21\u5408\u5e76\uff0c\u4ea7\u751f\u4e00\u4e2a\u5168\u5c40\u7684\u4f18\u5148\u7ea7\u961f\u5217\uff0c\u5b58\u5230\u81ea\u8eab\u7684\u4f18\u5148\u7ea7\u961f\u5217\u91cc\u3002<\/span><br style=\"box-sizing:border-box;\" \/><br \/>\n<span style=\"font-size:14px;\">\u5728\u4e0a\u9762\u7684\u4f8b\u5b50\u4e2d\uff0ccoordinating node \u62ff\u5230 (from + size)&nbsp;<\/span><span style=\"font-size:14px;\">6 \u6761\u6570\u636e\uff0c\u7136\u540e\u5408\u5e76\u5e76\u6392\u5e8f\u540e\u9009\u62e9\u524d\u9762\u7684 from + size \u6761\u6570\u636e\u5b58\u5230\u4f18\u5148\u7ea7\u961f\u5217\uff0c\u4ee5\u4fbf fetch \u9636\u6bb5\u4f7f\u7528\u3002\u53e6\u5916\uff0c\u5404\u4e2a\u5206\u7247\u8fd4\u56de\u7ed9 coordinating node \u7684\u6570\u636e\u7528\u4e8e\u9009\u51fa\u524d from + size \u6761\u6570\u636e\uff0c\u6240\u4ee5\uff0c\u53ea\u9700\u8981\u8fd4\u56de\u552f\u4e00\u6807\u8bb0 doc \u7684 _id \u4ee5\u53ca\u7528\u4e8e\u6392\u5e8f\u7684 _score \u5373\u53ef\uff0c\u8fd9\u6837\u4e5f\u53ef\u4ee5\u4fdd\u8bc1\u8fd4\u56de\u7684\u6570\u636e\u91cf\u8db3\u591f\u5c0f\u3002<\/span><br style=\"box-sizing:border-box;\" \/><br \/>\n<span style=\"font-size:14px;\">coordinating node \u8ba1\u7b97\u597d\u81ea\u5df1\u7684\u4f18\u5148\u7ea7\u961f\u5217\u540e\uff0cquery \u9636\u6bb5\u7ed3\u675f\uff0c\u8fdb\u5165 fetch \u9636\u6bb5\u3002<\/span><br style=\"box-sizing:border-box;\" \/><br \/>\n<span style=\"font-size:14px;\">###Fetch \u9636\u6bb5<\/span><br style=\"box-sizing:border-box;\" \/><br \/>\n<span style=\"font-size:14px;\">&#8212;<\/span><br style=\"box-sizing:border-box;\" \/><br \/>\n<span style=\"font-size:14px;\">query \u9636\u6bb5\u77e5\u9053\u4e86\u8981\u53d6\u54ea\u4e9b\u6570\u636e\uff0c\u4f46\u662f\u5e76\u6ca1\u6709\u53d6\u5177\u4f53\u7684\u6570\u636e\uff0c\u8fd9\u5c31\u662f fetch \u9636\u6bb5\u8981\u505a\u7684\u3002<\/span><br style=\"box-sizing:border-box;\" \/><\/p>\n<div class=\"image-package\" style=\"box-sizing:border-box;padding-bottom:25px;width:700px;margin-left:-40px;text-align:center;\">\n\t<img decoding=\"async\" src=\"http:\/\/upload-images.jianshu.io\/upload_images\/1307647-809c18ac33a66267.jpg?imageMogr2\/auto-orient\/strip%7CimageView2\/2\" data-original-src=\"http:\/\/upload-images.jianshu.io\/upload_images\/1307647-809c18ac33a66267.jpg?imageMogr2\/auto-orient\/strip%7CimageView2\/2\" style=\"box-sizing:border-box;vertical-align:middle;max-width:100%;height:auto;cursor:zoom-in;transition:all 0.25s ease-in-out;\" \/><br style=\"box-sizing:border-box;\" \/><\/p>\n<div class=\"image-caption\" style=\"box-sizing:border-box;min-width:20%;max-width:80%;min-height:22px;display:inline-block;padding:10px;margin:0px auto;border-bottom:1px solid #D9D9D9;line-height:1.7;\">\n\t\t<span style=\"font-size:14px;\">fetch<\/span>\n\t<\/div>\n<\/div>\n<p><br style=\"box-sizing:border-box;\" \/><br \/>\n<span style=\"font-size:14px;\">\u4e0a\u56fe\u5c55\u793a\u4e86 fetch \u8fc7\u7a0b\uff1a<\/span><br style=\"box-sizing:border-box;\" \/><br \/>\n<span style=\"font-size:14px;\">coordinating node \u53d1\u9001 GET \u8bf7\u6c42\u5230\u76f8\u5173shards\u3002<\/span><br style=\"box-sizing:border-box;\" \/><br \/>\n<span style=\"font-size:14px;\">shard \u6839\u636e doc \u7684 _id \u53d6\u5230\u6570\u636e\u8be6\u60c5\uff0c\u7136\u540e\u8fd4\u56de\u7ed9 coordinating node\u3002<\/span><br style=\"box-sizing:border-box;\" \/><br \/>\n<span style=\"font-size:14px;\">coordinating node \u8fd4\u56de\u6570\u636e\u7ed9 Client\u3002<\/span><br style=\"box-sizing:border-box;\" \/><br \/>\n<span style=\"font-size:14px;\">coordinating node \u7684\u4f18\u5148\u7ea7\u961f\u5217\u91cc\u6709 from + size \u4e2a _doc _id\uff0c\u4f46\u662f\uff0c\u5728 fetch \u9636\u6bb5\uff0c\u5e76\u4e0d\u9700\u8981\u53d6\u56de\u6240\u6709\u6570\u636e\uff0c\u5728\u4e0a\u9762\u7684\u4f8b\u5b50\u4e2d\uff0c\u524d100\u6761\u6570\u636e\u662f\u4e0d\u9700\u8981\u53d6\u7684\uff0c\u53ea\u9700\u8981\u53d6\u4f18\u5148\u7ea7\u961f\u5217\u91cc\u7684\u7b2c101\u5230110\u6761\u6570\u636e\u5373\u53ef\u3002<\/span><br style=\"box-sizing:border-box;\" \/><br \/>\n<span style=\"font-size:14px;\">\u9700\u8981\u53d6\u7684\u6570\u636e\u53ef\u80fd\u5728\u4e0d\u540c\u5206\u7247\uff0c\u4e5f\u53ef\u80fd\u5728\u540c\u4e00\u5206\u7247\uff0ccoordinating node \u4f7f\u7528 multi-get<\/span><br style=\"box-sizing:border-box;\" \/><br \/>\n<span style=\"font-size:14px;\">\u6765\u907f\u514d\u591a\u6b21\u53bb\u540c\u4e00\u5206\u7247\u53d6\u6570\u636e\uff0c\u4ece\u800c\u63d0\u9ad8\u6027\u80fd\u3002<\/span><br style=\"box-sizing:border-box;\" \/><br \/>\n<span style=\"font-size:14px;\">\u6df1\u5ea6\u5206\u9875\u7684\u95ee\u9898<\/span><br style=\"box-sizing:border-box;\" \/><br \/>\n<span style=\"font-size:14px;\">Elasticsearch \u7684\u8fd9\u79cd\u65b9\u5f0f\u63d0\u4f9b\u4e86\u5206\u9875\u7684\u529f\u80fd\uff0c\u540c\u65f6\uff0c\u4e5f\u6709\u76f8\u5e94\u7684\u9650\u5236\u3002\u4e3e\u4e2a\u4f8b\u5b50\uff0c\u4e00\u4e2a\u7d22\u5f15\uff0c\u670910\u4ebf\u6570\u636e\uff0c\u520610\u4e2a shards\uff0c\u7136\u540e\uff0c\u4e00\u4e2a\u641c\u7d22\u8bf7\u6c42\uff0cfrom=1,000,000\uff0csize=100\uff0c\u8fd9\u65f6\u5019\uff0c\u4f1a\u5e26\u6765\u4e25\u91cd\u7684\u6027\u80fd\u95ee\u9898\uff1a<\/span><br style=\"box-sizing:border-box;\" \/><br \/>\n<span style=\"font-size:14px;\">CPU<\/span><br style=\"box-sizing:border-box;\" \/><br \/>\n<span style=\"font-size:14px;\">\u5185\u5b58<\/span><br style=\"box-sizing:border-box;\" \/><br \/>\n<span style=\"font-size:14px;\">IO<\/span><br style=\"box-sizing:border-box;\" \/><br \/>\n<span style=\"font-size:14px;\">\u7f51\u7edc\u5e26\u5bbd<\/span><br style=\"box-sizing:border-box;\" \/><br \/>\n<span style=\"font-size:14px;\">CPU\u3001\u5185\u5b58\u548cIO\u6d88\u8017\u5bb9\u6613\u7406\u89e3\uff0c\u7f51\u7edc\u5e26\u5bbd\u95ee\u9898\u7a0d\u96be\u7406\u89e3\u4e00\u70b9\u3002\u5728 query \u9636\u6bb5\uff0c\u6bcf\u4e2ashards\u9700\u8981\u8fd4\u56de 1,000,100 \u6761\u6570\u636e\u7ed9 coordinating node\uff0c\u800c coordinating node \u9700\u8981\u63a5\u6536 10&nbsp;<\/span><span style=\"font-size:14px;\">1,000,100 \u6761\u6570\u636e\uff0c\u5373\u4f7f\u6bcf\u6761\u6570\u636e\u53ea\u6709 _doc _id \u548c _score\uff0c\u8fd9\u6570\u636e\u91cf\u4e5f\u5f88\u5927\u4e86\uff0c\u800c\u4e14\uff0c\u8fd9\u624d\u4e00\u4e2a\u67e5\u8be2\u8bf7\u6c42\uff0c\u90a3\u5982\u679c\u518d\u4e58\u4ee5100\u5462\uff1f<\/span><br style=\"box-sizing:border-box;\" \/><br \/>\n<span style=\"font-size:14px;\">\u5728\u53e6\u4e00\u65b9\u9762\uff0c\u6211\u4eec\u610f\u8bc6\u5230\uff0c\u8fd9\u79cd\u6df1\u5ea6\u5206\u9875\u7684\u8bf7\u6c42\u5e76\u4e0d\u5408\u7406\uff0c\u56e0\u4e3a\u6211\u4eec\u662f\u5f88\u5c11\u4eba\u4e3a\u7684\u770b\u5f88\u540e\u9762\u7684\u8bf7\u6c42\u7684\uff0c\u5728\u5f88\u591a\u7684\u4e1a\u52a1\u573a\u666f\u4e2d\uff0c\u90fd\u76f4\u63a5\u9650\u5236\u5206\u9875\uff0c\u6bd4\u5982\u53ea\u80fd\u770b\u524d100\u9875\u3002<\/span><br style=\"box-sizing:border-box;\" \/><br \/>\n<span style=\"font-size:14px;\">\u4e0d\u8fc7\uff0c\u8fd9\u79cd\u6df1\u5ea6\u5206\u9875\u786e\u5b9e\u5b58\u5728\uff0c\u6bd4\u5982\uff0c\u88ab\u722c\u866b\u4e86\uff0c\u8fd9\u4e2a\u65f6\u5019\uff0c\u76f4\u63a5\u5e72\u6389\u6df1\u5ea6\u5206\u9875\u5c31\u597d\uff1b\u53c8\u6216\u8005\uff0c\u4e1a\u52a1\u4e0a\u6709\u904d\u5386\u6570\u636e\u7684\u9700\u8981\uff0c\u6bd4\u5982\uff0c\u67091\u5343\u4e07\u7c89\u4e1d\u7684\u5fae\u4fe1\u5927V\uff0c\u8981\u7ed9\u6240\u6709\u7c89\u4e1d\u7fa4\u53d1\u6d88\u606f\uff0c\u6216\u8005\u7ed9\u67d0\u7701\u7c89\u4e1d\u7fa4\u53d1\uff0c\u8fd9\u65f6\u5019\u5c31\u9700\u8981\u53d6\u5f97\u6240\u6709\u7b26\u5408\u6761\u4ef6\u7684\u7c89\u4e1d\uff0c\u800c\u6700\u5bb9\u6613\u60f3\u5230\u7684\u5c31\u662f\u5229\u7528 from + size \u6765\u5b9e\u73b0\uff0c\u4e0d\u8fc7\uff0c\u8fd9\u4e2a\u662f\u4e0d\u73b0\u5b9e\u7684\uff0c\u8fd9\u65f6\uff0c\u53ef\u4ee5\u91c7\u7528 Elasticsearch \u63d0\u4f9b\u7684 scroll \u65b9\u5f0f\u6765\u5b9e\u73b0\u904d\u5386\u3002<\/span><br style=\"box-sizing:border-box;\" \/><br \/>\n<span style=\"font-size:14px;\">###\u5229\u7528 scroll \u904d\u5386\u6570\u636e<\/span><br style=\"box-sizing:border-box;\" \/><br \/>\n<span style=\"font-size:14px;\">&#8212;-<\/span><br style=\"box-sizing:border-box;\" \/><br \/>\n<span style=\"font-size:14px;\">\u53ef\u4ee5\u628a scroll \u7406\u89e3\u4e3a\u5173\u7cfb\u578b\u6570\u636e\u5e93\u91cc\u7684 cursor\uff0c\u56e0\u6b64\uff0cscroll \u5e76\u4e0d\u9002\u5408\u7528\u6765\u505a\u5b9e\u65f6\u641c\u7d22\uff0c\u800c\u66f4\u9002\u7528\u4e8e\u540e\u53f0\u6279\u5904\u7406\u4efb\u52a1\uff0c\u6bd4\u5982\u7fa4\u53d1\u3002<\/span><br style=\"box-sizing:border-box;\" \/><br \/>\n<span style=\"font-size:14px;\">\u53ef\u4ee5\u628a scroll \u5206\u4e3a\u521d\u59cb\u5316\u548c\u904d\u5386\u4e24\u6b65\uff0c\u521d\u59cb\u5316\u65f6\u5c06\u6240\u6709\u7b26\u5408\u641c\u7d22\u6761\u4ef6\u7684\u641c\u7d22\u7ed3\u679c\u7f13\u5b58\u8d77\u6765\uff0c\u53ef\u4ee5\u60f3\u8c61\u6210\u5feb\u7167\uff0c\u5728\u904d\u5386\u65f6\uff0c\u4ece\u8fd9\u4e2a\u5feb\u7167\u91cc\u53d6\u6570\u636e\uff0c\u4e5f\u5c31\u662f\u8bf4\uff0c\u5728\u521d\u59cb\u5316\u540e\u5bf9\u7d22\u5f15\u63d2\u5165\u3001\u5220\u9664\u3001\u66f4\u65b0\u6570\u636e\u90fd\u4e0d\u4f1a\u5f71\u54cd\u904d\u5386\u7ed3\u679c\u3002<\/span><br style=\"box-sizing:border-box;\" \/><br \/>\n<span style=\"font-size:14px;\">\u4f7f\u7528\u4ecb\u7ecd<\/span><br style=\"box-sizing:border-box;\" \/><br \/>\n<span style=\"font-size:14px;\">\u4e0b\u9762\u4ecb\u7ecd\u4e0bscroll\u7684\u4f7f\u7528\uff0c\u53ef\u4ee5\u901a\u8fc7 Elasticsearch \u7684 HTTP \u63a5\u53e3\u505a\u8bd5\u9a8c\u4e0b\uff0c\u5305\u62ec\u521d\u59cb\u5316\u548c\u904d\u5386\u4e24\u4e2a\u90e8\u5206\u3002<\/span><br style=\"box-sizing:border-box;\" \/><br \/>\n<span style=\"font-size:14px;\">\u521d\u59cb\u5316<\/span><br style=\"box-sizing:border-box;\" \/><\/p>\n<pre style=\"box-sizing:border-box;overflow:auto;\">POST ip:port\/my_index\/my_type\/_search?scroll=1m\n{\n    \"query\": { \"match_all\": {}}\n}<\/pre>\n<p><br style=\"box-sizing:border-box;\" \/><br \/>\n<span style=\"font-size:14px;\">\u521d\u59cb\u5316\u65f6\u9700\u8981\u50cf\u666e\u901a search \u4e00\u6837\uff0c\u6307\u660e index \u548c type (\u5f53\u7136\uff0csearch \u662f\u53ef\u4ee5\u4e0d\u6307\u660e index \u548c type \u7684)\uff0c\u7136\u540e\uff0c\u52a0\u4e0a\u53c2\u6570 scroll\uff0c\u8868\u793a\u6682\u5b58\u641c\u7d22\u7ed3\u679c\u7684\u65f6\u95f4\uff0c\u5176\u5b83\u5c31\u50cf\u4e00\u4e2a\u666e\u901a\u7684search\u8bf7\u6c42\u4e00\u6837\u3002<\/span><br style=\"box-sizing:border-box;\" \/><br \/>\n<span style=\"font-size:14px;\">\u521d\u59cb\u5316\u8fd4\u56de\u4e00\u4e2a _scroll_id\uff0c_scroll_id \u7528\u6765\u4e0b\u6b21\u53d6\u6570\u636e\u7528\u3002<\/span><br style=\"box-sizing:border-box;\" \/><br \/>\n<span style=\"font-size:14px;\">\u904d\u5386<\/span><br style=\"box-sizing:border-box;\" \/><\/p>\n<pre style=\"box-sizing:border-box;overflow:auto;\">POST \/_search?scroll=1m\n{\n    \"scroll_id\":\"XXXXXXXXXXXXXXXXXXXXXXX I am scroll id XXXXXXXXXXXXXXX\"\n}<\/pre>\n<p><br style=\"box-sizing:border-box;\" \/><br \/>\n<span style=\"font-size:14px;\">\u8fd9\u91cc\u7684 scroll_id \u5373 \u4e0a\u4e00\u6b21\u904d\u5386\u53d6\u56de\u7684 _scroll_id \u6216\u8005\u662f\u521d\u59cb\u5316\u8fd4\u56de\u7684 _scroll_id\uff0c\u540c\u6837\u7684\uff0c\u9700\u8981\u5e26 scroll \u53c2\u6570\u3002 \u91cd\u590d\u8fd9\u4e00\u6b65\u9aa4\uff0c\u76f4\u5230\u8fd4\u56de\u7684\u6570\u636e\u4e3a\u7a7a\uff0c\u5373\u904d\u5386\u5b8c\u6210\u3002<\/span><span style=\"font-size:14px;\">\u6ce8\u610f\uff0c\u6bcf\u6b21\u90fd\u8981\u4f20\u53c2\u6570 scroll\uff0c\u5237\u65b0\u641c\u7d22\u7ed3\u679c\u7684\u7f13\u5b58\u65f6\u95f4<\/span><span style=\"font-size:14px;\">\u3002\u53e6\u5916\uff0c<\/span><span style=\"font-size:14px;\">\u4e0d\u9700\u8981\u6307\u5b9a index \u548c type<\/span><span style=\"font-size:14px;\">\u3002<\/span><br style=\"box-sizing:border-box;\" \/><br \/>\n<span style=\"font-size:14px;\">\u8bbe\u7f6escroll\u7684\u65f6\u5019\uff0c\u9700\u8981\u4f7f\u641c\u7d22\u7ed3\u679c\u7f13\u5b58\u5230\u4e0b\u4e00\u6b21\u904d\u5386\u5b8c\u6210\uff0c\u540c\u65f6\uff0c\u4e5f\u4e0d\u80fd\u592a\u957f\uff0c\u6bd5\u7adf\u7a7a\u95f4\u6709\u9650\u3002<\/span><br style=\"box-sizing:border-box;\" \/><br \/>\n<span style=\"font-size:14px;\">Scroll-Scan<\/span><br style=\"box-sizing:border-box;\" \/><br \/>\n<span style=\"font-size:14px;\">Elasticsearch \u63d0\u4f9b\u4e86 Scroll-Scan \u65b9\u5f0f\u8fdb\u4e00\u6b65\u63d0\u9ad8\u904d\u5386\u6027\u80fd\u3002\u8fd8\u662f\u4e0a\u9762\u7684\u4f8b\u5b50\uff0c\u5fae\u4fe1\u5927V\u8981\u7ed9\u7c89\u4e1d\u7fa4\u53d1\u8fd9\u79cd\u540e\u53f0\u4efb\u52a1\uff0c\u662f\u4e0d\u9700\u8981\u5173\u6ce8\u987a\u5e8f\u7684\uff0c\u53ea\u8981\u80fd\u904d\u5386\u6240\u6709\u6570\u636e\u5373\u53ef\uff0c\u8fd9\u65f6\u5019\uff0c\u5c31\u53ef\u4ee5\u7528Scroll-Scan\u3002<\/span><br style=\"box-sizing:border-box;\" \/><br \/>\n<span style=\"font-size:14px;\">Scroll-Scan \u7684\u904d\u5386\u4e0e\u666e\u901a Scroll \u4e00\u6837\uff0c\u521d\u59cb\u5316\u5b58\u5728\u4e00\u70b9\u5dee\u522b\u3002<\/span><br style=\"box-sizing:border-box;\" \/><\/p>\n<pre style=\"box-sizing:border-box;overflow:auto;\">POST ip:port\/my_index\/my_type\/_search?search_type=scan&amp;scroll=1m&amp;size=50\n{\n    \"query\": { \"match_all\": {}}\n}<\/pre>\n<p><br style=\"box-sizing:border-box;\" \/><br \/>\n<span style=\"font-size:14px;\">\u9700\u8981\u6307\u660e\u53c2\u6570\uff1a<\/span><br style=\"box-sizing:border-box;\" \/><br \/>\n<span style=\"font-size:14px;\">search_type\u3002\u8d4b\u503c\u4e3ascan\uff0c\u8868\u793a\u91c7\u7528 Scroll-Scan \u7684\u65b9\u5f0f\u904d\u5386\uff0c\u540c\u65f6\u544a\u8bc9 Elasticsearch \u641c\u7d22\u7ed3\u679c\u4e0d\u9700\u8981\u6392\u5e8f\u3002<\/span><br style=\"box-sizing:border-box;\" \/><br \/>\n<span style=\"font-size:14px;\">scroll\u3002\u540c\u4e0a\uff0c\u4f20\u65f6\u95f4\u3002<\/span><br style=\"box-sizing:border-box;\" \/><br \/>\n<span style=\"font-size:14px;\">size\u3002\u4e0e\u666e\u901a\u7684 size \u4e0d\u540c\uff0c\u8fd9\u4e2a size \u8868\u793a\u7684\u662f\u6bcf\u4e2a shard \u8fd4\u56de\u7684 size \u6570\uff0c\u6700\u7ec8\u7ed3\u679c\u6700\u5927\u4e3a number_of_shards * size\u3002<\/span><br style=\"box-sizing:border-box;\" \/><br \/>\n<span style=\"font-size:14px;\">Scroll-Scan \u65b9\u5f0f\u4e0e\u666e\u901a scroll \u6709\u51e0\u70b9\u4e0d\u540c\uff1a<\/span><br style=\"box-sizing:border-box;\" \/><br \/>\n<span style=\"font-size:14px;\">Scroll-Scan \u7ed3\u679c\u6ca1\u6709\u6392\u5e8f\uff0c\u6309 index \u987a\u5e8f\u8fd4\u56de\uff0c\u6ca1\u6709\u6392\u5e8f\uff0c\u53ef\u4ee5\u63d0\u9ad8\u53d6\u6570\u636e\u6027\u80fd\u3002<\/span><br style=\"box-sizing:border-box;\" \/><br \/>\n<span style=\"font-size:14px;\">\u521d\u59cb\u5316\u65f6\u53ea\u8fd4\u56de _scroll_id\uff0c\u6ca1\u6709\u5177\u4f53\u7684 hits \u7ed3\u679c\u3002<\/span><br style=\"box-sizing:border-box;\" \/><br \/>\n<span style=\"font-size:14px;\">size \u63a7\u5236\u7684\u662f\u6bcf\u4e2a\u5206\u7247\u7684\u8fd4\u56de\u7684\u6570\u636e\u91cf\u800c\u4e0d\u662f\u6574\u4e2a\u8bf7\u6c42\u8fd4\u56de\u7684\u6570\u636e\u91cf\u3002<\/span><br style=\"box-sizing:border-box;\" \/><br \/>\n<span style=\"font-size:14px;\">###Java \u5b9e\u73b0<\/span><br style=\"box-sizing:border-box;\" \/><br \/>\n<span style=\"font-size:14px;\">&#8212;<\/span><br style=\"box-sizing:border-box;\" \/><br \/>\n<span style=\"font-size:14px;\">###\u7528 Java \u4e3e\u4e2a\u4f8b\u5b50\u3002<\/span><br style=\"box-sizing:border-box;\" \/><br \/>\n<span style=\"font-size:14px;\">###\u521d\u59cb\u5316<\/span><br style=\"box-sizing:border-box;\" \/><br \/>\n<span style=\"font-size:14px;\">&#8212;-<\/span><br style=\"box-sizing:border-box;\" \/><\/p>\n<pre style=\"box-sizing:border-box;overflow:auto;\">try {\n    response = esClient.prepareSearch(index)\n            .setTypes(type)\n            .setSearchType(SearchType.SCAN)\n            .setQuery(query)\n            .setScroll(new TimeValue(timeout))\n            .setSize(size)\n            .execute()\n            .actionGet();\n} catch (ElasticsearchException e) {\n    \/\/ handle Exception\n}<\/pre>\n<p style=\"box-sizing:border-box;margin-top:0px;margin-bottom:25px;word-break:break-word;\">\n\t<span style=\"font-size:14px;\">\u521d\u59cb\u5316\u8fd4\u56de _scroll_id\uff0c\u7136\u540e\uff0c\u7528 _scroll_id \u53bb\u904d\u5386\uff0c\u6ce8\u610f\uff0c\u4e0a\u9762\u7684query\u662f\u4e00\u4e2aJSONObject\uff0c\u4e0d\u8fc7\u8fd9\u91cc\u5f88\u591a\u79cd\u5b9e\u73b0\u65b9\u5f0f\uff0c\u6211\u8fd9\u513f\u53ea\u662f\u4e2a\u4f8b\u5b50\u3002<\/span>\n<\/p>\n<h3 style=\"box-sizing:border-box;\"><span class=\"ez-toc-section\" id=\"%E9%81%8D%E5%8E%86\"><\/span>\n\t<span style=\"font-size:14px;\">\u904d\u5386<\/span><br \/>\n<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<hr style=\"box-sizing:content-box;height:0px;margin:0px 0px 20px;border-right:0px;border-bottom:0px;border-left:0px;border-image:initial;border-top-style:solid;border-top-color:#DDDDDD;\" \/>\n<pre style=\"box-sizing:border-box;overflow:auto;\">try {\n    response = esClient.prepareSearchScroll(scrollId)\n            .setScroll(new TimeValue(timeout))\n            .execute()\n            .actionGet();\n} catch (ElasticsearchException e) {\n    \/\/ handle Exception\n}<\/pre>\n<h3 style=\"box-sizing:border-box;\"><span class=\"ez-toc-section\" id=\"%E6%80%BB%E7%BB%93\"><\/span>\n\t<span style=\"font-size:14px;\">\u603b\u7ed3<\/span><br \/>\n<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<hr style=\"box-sizing:content-box;height:0px;margin:0px 0px 20px;border-right:0px;border-bottom:0px;border-left:0px;border-image:initial;border-top-style:solid;border-top-color:#DDDDDD;\" \/>\n<ul style=\"box-sizing:border-box;margin-top:0px;margin-bottom:20px;padding:0px;word-break:break-word;margin-left:22px;\">\n<li style=\"box-sizing:border-box;line-height:30px;margin-bottom:10px;\">\n\t\t<span style=\"font-size:14px;\">\u6df1\u5ea6\u5206\u9875\u4e0d\u7ba1\u662f\u5173\u7cfb\u578b\u6570\u636e\u5e93\u8fd8\u662fElasticsearch\u8fd8\u662f\u5176\u4ed6\u641c\u7d22\u5f15\u64ce\uff0c\u90fd\u4f1a\u5e26\u6765\u5de8\u5927\u6027\u80fd\u5f00\u9500\uff0c\u7279\u522b\u662f\u5728\u5206\u5e03\u5f0f\u60c5\u51b5\u4e0b\u3002<\/span>\n\t<\/li>\n<li style=\"box-sizing:border-box;line-height:30px;margin-bottom:10px;\">\n\t\t<span style=\"font-size:14px;\">\u6709\u4e9b\u95ee\u9898\u53ef\u4ee5\u8003\u4e1a\u52a1\u89e3\u51b3\u800c\u4e0d\u662f\u9760\u6280\u672f\u89e3\u51b3\uff0c\u6bd4\u5982\u5f88\u591a\u4e1a\u52a1\u90fd\u5bf9\u9875\u7801\u6709\u9650\u5236\uff0cgoogle \u641c\u7d22\uff0c\u5f80\u540e\u7ffb\u5230\u4e00\u5b9a\u9875\u7801\u5c31\u4e0d\u884c\u4e86\u3002<\/span>\n\t<\/li>\n<li style=\"box-sizing:border-box;line-height:30px;margin-bottom:10px;\">\n\t\t<span style=\"font-size:14px;\">Elasticsearch \u63d0\u4f9b\u7684 Scroll \u63a5\u53e3\u4e13\u95e8\u7528\u6765\u83b7\u53d6\u5927\u91cf\u6570\u636e\u751a\u81f3\u5168\u90e8\u6570\u636e\uff0c\u5728\u987a\u5e8f\u65e0\u5173\u60c5\u51b5\u4e0b\uff0c\u9996\u63a8Scroll-Scan\u3002<\/span>\n\t<\/li>\n<li style=\"box-sizing:border-box;line-height:30px;margin-bottom:10px;\">\n\t\t<span style=\"font-size:14px;\">\u63cf\u8ff0\u641c\u7d22\u8fc7\u7a0b\u65f6\uff0c\u4e3a\u4e86\u7b80\u5316\u63cf\u8ff0\uff0c\u5047\u8bbe index \u6ca1\u6709\u5907\u4efd\uff0c\u5b9e\u9645\u4e0a\uff0cindex \u80af\u5b9a\u4f1a\u6709\u5907\u4efd\uff0c\u8fd9\u65f6\u5019\uff0c\u5c31\u6d89\u53ca\u5230\u9009\u62e9 shard\u3002<\/span>\n\t<\/li>\n<\/ul>\n<p style=\"box-sizing:border-box;margin-top:0px;margin-bottom:25px;word-break:break-word;\">\n\t<span style=\"font-size:14px;\">PS<\/span><span style=\"font-size:14px;\">\uff1aElasticsearch \u5404\u4e2a\u7248\u672c\u53ef\u80fd\u6709\u533a\u522b\uff0c\u4f46\u539f\u7406\u57fa\u672c\u76f8\u540c\uff0c\u672c\u6587\u5305\u62ec\u6587\u672b\u7684\u4ee3\u7801\u90fd\u57fa\u4e8eElasticsearch 1.3\u3002<\/span>\n<\/p>\n<p><span style=\"font-size:14px;\"><\/span> <\/p>\n<p>\n\t\n<\/p>\n<p>\n\tPython\u6709\u76f8\u5173\u7684\u5e93\uff0c\u793a\u4f8b\uff1a\n<\/p>\n<p>\n\tfrom elasticsearch import Elasticsearch<br \/>\nfrom elasticsearch import helpers<\/p>\n<p>def search_roll(esIp, esPort, index, searchBodyDic, doc_handler=None):<br \/>\n&nbsp; &nbsp; try:<br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; es = Elasticsearch(<br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; [{&#8220;host&#8221; : esIp, &#8220;port&#8221; : esPort}]<br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; )<\/p>\n<p>&nbsp; &nbsp; &nbsp; &nbsp; for docDic in helpers.scan(<br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; es,<br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; size=10000,<br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; index=index,<br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; query=searchBodyDic<br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; ):<br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if doc_handler is not None:<br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; try:<br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; doc_handler(docDic)<br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; except Exception, e:<br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; print &#8220;doc_handler error. Exception: &#8221; + str(e)<br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; else:<br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; print docDic<br \/>\n&nbsp; &nbsp; except Exception, e:<br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; print &#8220;Query failed. Exception: &#8221; + str(e)<br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; return False<\/p>\n<p>&nbsp; &nbsp; return True<\/p>\n","protected":false},"excerpt":{"rendered":"<div>\n\t<span style=\"font-size:14px;\">\u4f5c\u8005\uff1a\u661f\u7237<\/span><br \/>\n<span style=\"font-size:14px;\">\u51fa\u5904\uff1a<\/span><a href=\"http:\/\/lxwei.github.io\/posts\/%E4%BD%BF%E7%94%A8scroll%E5%AE%9E%E7%8E%B0Elasticsearch%E6%95%B0%E6%8D%AE%E9%81%8D%E5%8E%86%E5%92%8C%E6%B7%B1%E5%BA%A6%E5%88%86%E9%A1%B5.html\"><span style=\"font-size:14px;\">http:\/\/lxWei.github.io\/posts\/%E4%BD%BF%E7%94%A8scroll%E5%AE%9E%E7%8E%B0Elasticsearch%E6%95%B0%E6%8D%AE%E9%81%8D%E5%8E%86%E5%92%8C%E6%B7%B1%E5%BA%A6%E5%88%86%E9%A1%B5.html<\/span><\/a><br \/>\n<span style=\"font-size:14px;\">\u58f0\u660e\uff1a\u8f6c\u8f7d\u8bf7\u6ce8\u660e\u4f5c\u8005\u53ca\u51fa\u5904\u3002<\/span>\n<\/div>\n<h1 id=\"section\" style=\"margin:18px 0px 0.15em;text-rendering:optimizeLegibility;line-height:36px;\">\n\t<span style=\"font-size:14px;\">\u80cc\u666f<\/span><br \/>\n<\/h1>\n<p style=\"margin-top:0px;margin-bottom:9px;\">\n\t<span style=\"font-size:14px;\">Elasti&#8230;<\/span><\/p>\n","protected":false},"author":1,"featured_media":573,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[337],"tags":[],"class_list":["post-222","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v16.9 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>[\u8f6c] \u4f7f\u7528scroll\u5b9e\u73b0Elasticsearch\u6570\u636e\u904d\u5386\u548c\u6df1\u5ea6\u5206\u9875 - Wayne&#039;s Blog<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"http:\/\/weizn.net\/?p=222\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"[\u8f6c] \u4f7f\u7528scroll\u5b9e\u73b0Elasticsearch\u6570\u636e\u904d\u5386\u548c\u6df1\u5ea6\u5206\u9875 - Wayne&#039;s Blog\" \/>\n<meta property=\"og:description\" content=\"\u4f5c\u8005\uff1a\u661f\u7237 \u51fa\u5904\uff1ahttp:\/\/lxWei.github.io\/posts\/%E4%BD%BF%E7%94%A8scroll%E5%AE%9E%E7%8E%B0Elasticsearch%E6%95%B0%E6%8D%AE%E9%81%8D%E5%8E%86%E5%92%8C%E6%B7%B1%E5%BA%A6%E5%88%86%E9%A1%B5.html \u58f0\u660e\uff1a\u8f6c\u8f7d\u8bf7\u6ce8\u660e\u4f5c\u8005\u53ca\u51fa\u5904\u3002  \u80cc\u666f   Elasti...\" \/>\n<meta property=\"og:url\" content=\"http:\/\/weizn.net\/?p=222\" \/>\n<meta property=\"og:site_name\" content=\"Wayne&#039;s Blog\" \/>\n<meta property=\"article:published_time\" content=\"2017-06-29T09:26:49+00:00\" \/>\n<meta property=\"og:image\" content=\"http:\/\/weizn.net\/wp-content\/uploads\/2020\/10\/elastic-search.png\" \/>\n\t<meta property=\"og:image:width\" content=\"1024\" \/>\n\t<meta property=\"og:image:height\" content=\"471\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"\u4f5c\u8005\" \/>\n\t<meta name=\"twitter:data1\" content=\"zinan\" \/>\n\t<meta name=\"twitter:label2\" content=\"\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4\" \/>\n\t<meta name=\"twitter:data2\" content=\"2 \u5206\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebSite\",\"@id\":\"http:\/\/weizn.net\/#website\",\"url\":\"http:\/\/weizn.net\/\",\"name\":\"Wayne&#039;s Blog\",\"description\":\"\",\"publisher\":{\"@id\":\"http:\/\/weizn.net\/#\/schema\/person\/e88bc12c590502d8b6249326f960b264\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"http:\/\/weizn.net\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"zh-Hans\"},{\"@type\":\"ImageObject\",\"@id\":\"http:\/\/weizn.net\/?p=222#primaryimage\",\"inLanguage\":\"zh-Hans\",\"url\":\"http:\/\/weizn.net\/wp-content\/uploads\/2020\/10\/elastic-search.png\",\"contentUrl\":\"http:\/\/weizn.net\/wp-content\/uploads\/2020\/10\/elastic-search.png\",\"width\":1024,\"height\":471},{\"@type\":\"WebPage\",\"@id\":\"http:\/\/weizn.net\/?p=222#webpage\",\"url\":\"http:\/\/weizn.net\/?p=222\",\"name\":\"[\\u8f6c] \\u4f7f\\u7528scroll\\u5b9e\\u73b0Elasticsearch\\u6570\\u636e\\u904d\\u5386\\u548c\\u6df1\\u5ea6\\u5206\\u9875 - Wayne&#039;s Blog\",\"isPartOf\":{\"@id\":\"http:\/\/weizn.net\/#website\"},\"primaryImageOfPage\":{\"@id\":\"http:\/\/weizn.net\/?p=222#primaryimage\"},\"datePublished\":\"2017-06-29T09:26:49+00:00\",\"dateModified\":\"2017-06-29T09:26:49+00:00\",\"breadcrumb\":{\"@id\":\"http:\/\/weizn.net\/?p=222#breadcrumb\"},\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"http:\/\/weizn.net\/?p=222\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"http:\/\/weizn.net\/?p=222#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\\u9996\\u9875\",\"item\":\"http:\/\/weizn.net\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"[\\u8f6c] \\u4f7f\\u7528scroll\\u5b9e\\u73b0Elasticsearch\\u6570\\u636e\\u904d\\u5386\\u548c\\u6df1\\u5ea6\\u5206\\u9875\"}]},{\"@type\":\"Article\",\"@id\":\"http:\/\/weizn.net\/?p=222#article\",\"isPartOf\":{\"@id\":\"http:\/\/weizn.net\/?p=222#webpage\"},\"author\":{\"@id\":\"http:\/\/weizn.net\/#\/schema\/person\/e88bc12c590502d8b6249326f960b264\"},\"headline\":\"[\\u8f6c] \\u4f7f\\u7528scroll\\u5b9e\\u73b0Elasticsearch\\u6570\\u636e\\u904d\\u5386\\u548c\\u6df1\\u5ea6\\u5206\\u9875\",\"datePublished\":\"2017-06-29T09:26:49+00:00\",\"dateModified\":\"2017-06-29T09:26:49+00:00\",\"mainEntityOfPage\":{\"@id\":\"http:\/\/weizn.net\/?p=222#webpage\"},\"wordCount\":390,\"commentCount\":0,\"publisher\":{\"@id\":\"http:\/\/weizn.net\/#\/schema\/person\/e88bc12c590502d8b6249326f960b264\"},\"image\":{\"@id\":\"http:\/\/weizn.net\/?p=222#primaryimage\"},\"thumbnailUrl\":\"http:\/\/weizn.net\/wp-content\/uploads\/2020\/10\/elastic-search.png\",\"articleSection\":[\"\\u6570\\u636e\\u5206\\u6790\"],\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"http:\/\/weizn.net\/?p=222#respond\"]}]},{\"@type\":[\"Person\",\"Organization\"],\"@id\":\"http:\/\/weizn.net\/#\/schema\/person\/e88bc12c590502d8b6249326f960b264\",\"name\":\"zinan\",\"logo\":{\"@id\":\"http:\/\/weizn.net\/#personlogo\"}}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"[\u8f6c] \u4f7f\u7528scroll\u5b9e\u73b0Elasticsearch\u6570\u636e\u904d\u5386\u548c\u6df1\u5ea6\u5206\u9875 - Wayne&#039;s Blog","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"http:\/\/weizn.net\/?p=222","og_locale":"zh_CN","og_type":"article","og_title":"[\u8f6c] \u4f7f\u7528scroll\u5b9e\u73b0Elasticsearch\u6570\u636e\u904d\u5386\u548c\u6df1\u5ea6\u5206\u9875 - Wayne&#039;s Blog","og_description":"\u4f5c\u8005\uff1a\u661f\u7237 \u51fa\u5904\uff1ahttp:\/\/lxWei.github.io\/posts\/%E4%BD%BF%E7%94%A8scroll%E5%AE%9E%E7%8E%B0Elasticsearch%E6%95%B0%E6%8D%AE%E9%81%8D%E5%8E%86%E5%92%8C%E6%B7%B1%E5%BA%A6%E5%88%86%E9%A1%B5.html \u58f0\u660e\uff1a\u8f6c\u8f7d\u8bf7\u6ce8\u660e\u4f5c\u8005\u53ca\u51fa\u5904\u3002  \u80cc\u666f   Elasti...","og_url":"http:\/\/weizn.net\/?p=222","og_site_name":"Wayne&#039;s Blog","article_published_time":"2017-06-29T09:26:49+00:00","og_image":[{"width":1024,"height":471,"url":"http:\/\/weizn.net\/wp-content\/uploads\/2020\/10\/elastic-search.png","path":"\/app\/wp-content\/uploads\/2020\/10\/elastic-search.png","size":"full","id":573,"alt":"","pixels":482304,"type":"image\/png"}],"twitter_card":"summary_large_image","twitter_misc":{"\u4f5c\u8005":"zinan","\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4":"2 \u5206"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebSite","@id":"http:\/\/weizn.net\/#website","url":"http:\/\/weizn.net\/","name":"Wayne&#039;s Blog","description":"","publisher":{"@id":"http:\/\/weizn.net\/#\/schema\/person\/e88bc12c590502d8b6249326f960b264"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"http:\/\/weizn.net\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"zh-Hans"},{"@type":"ImageObject","@id":"http:\/\/weizn.net\/?p=222#primaryimage","inLanguage":"zh-Hans","url":"http:\/\/weizn.net\/wp-content\/uploads\/2020\/10\/elastic-search.png","contentUrl":"http:\/\/weizn.net\/wp-content\/uploads\/2020\/10\/elastic-search.png","width":1024,"height":471},{"@type":"WebPage","@id":"http:\/\/weizn.net\/?p=222#webpage","url":"http:\/\/weizn.net\/?p=222","name":"[\u8f6c] \u4f7f\u7528scroll\u5b9e\u73b0Elasticsearch\u6570\u636e\u904d\u5386\u548c\u6df1\u5ea6\u5206\u9875 - Wayne&#039;s Blog","isPartOf":{"@id":"http:\/\/weizn.net\/#website"},"primaryImageOfPage":{"@id":"http:\/\/weizn.net\/?p=222#primaryimage"},"datePublished":"2017-06-29T09:26:49+00:00","dateModified":"2017-06-29T09:26:49+00:00","breadcrumb":{"@id":"http:\/\/weizn.net\/?p=222#breadcrumb"},"inLanguage":"zh-Hans","potentialAction":[{"@type":"ReadAction","target":["http:\/\/weizn.net\/?p=222"]}]},{"@type":"BreadcrumbList","@id":"http:\/\/weizn.net\/?p=222#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"http:\/\/weizn.net\/"},{"@type":"ListItem","position":2,"name":"[\u8f6c] \u4f7f\u7528scroll\u5b9e\u73b0Elasticsearch\u6570\u636e\u904d\u5386\u548c\u6df1\u5ea6\u5206\u9875"}]},{"@type":"Article","@id":"http:\/\/weizn.net\/?p=222#article","isPartOf":{"@id":"http:\/\/weizn.net\/?p=222#webpage"},"author":{"@id":"http:\/\/weizn.net\/#\/schema\/person\/e88bc12c590502d8b6249326f960b264"},"headline":"[\u8f6c] \u4f7f\u7528scroll\u5b9e\u73b0Elasticsearch\u6570\u636e\u904d\u5386\u548c\u6df1\u5ea6\u5206\u9875","datePublished":"2017-06-29T09:26:49+00:00","dateModified":"2017-06-29T09:26:49+00:00","mainEntityOfPage":{"@id":"http:\/\/weizn.net\/?p=222#webpage"},"wordCount":390,"commentCount":0,"publisher":{"@id":"http:\/\/weizn.net\/#\/schema\/person\/e88bc12c590502d8b6249326f960b264"},"image":{"@id":"http:\/\/weizn.net\/?p=222#primaryimage"},"thumbnailUrl":"http:\/\/weizn.net\/wp-content\/uploads\/2020\/10\/elastic-search.png","articleSection":["\u6570\u636e\u5206\u6790"],"inLanguage":"zh-Hans","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["http:\/\/weizn.net\/?p=222#respond"]}]},{"@type":["Person","Organization"],"@id":"http:\/\/weizn.net\/#\/schema\/person\/e88bc12c590502d8b6249326f960b264","name":"zinan","logo":{"@id":"http:\/\/weizn.net\/#personlogo"}}]}},"_links":{"self":[{"href":"http:\/\/weizn.net\/index.php?rest_route=\/wp\/v2\/posts\/222","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/weizn.net\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/weizn.net\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/weizn.net\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/weizn.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=222"}],"version-history":[{"count":0,"href":"http:\/\/weizn.net\/index.php?rest_route=\/wp\/v2\/posts\/222\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"http:\/\/weizn.net\/index.php?rest_route=\/wp\/v2\/media\/573"}],"wp:attachment":[{"href":"http:\/\/weizn.net\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=222"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/weizn.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=222"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/weizn.net\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=222"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}