{"id":10006961,"date":"2022-12-14T17:05:04","date_gmt":"2022-12-14T09:05:04","guid":{"rendered":"https:\/\/ityet.com\/?p=10006961"},"modified":"2022-12-14T17:05:04","modified_gmt":"2022-12-14T09:05:04","slug":"elasticsearch-head%e6%8f%92%e4%bb%b6%e4%bd%bf%e7%94%a8%e5%b0%8f%e7%bb%93","status":"publish","type":"post","link":"https:\/\/itmax.cn\/?p=10006961","title":{"rendered":"Elasticsearch Head\u63d2\u4ef6\u4f7f\u7528\u5c0f\u7ed3"},"content":{"rendered":"<p><strong>\u4f5c\u8005\uff1a\u5d14\u96c4\u534e<\/strong><\/p>\n<h2>1 Elasticsearch Head\u662f\u4ec0\u4e48<\/h2>\n<p>ElasticSearch head\u5c31\u662f\u4e00\u6b3e\u80fd\u8fde\u63a5ElasticSearch\u641c\u7d22\u5f15\u64ce\uff0c\u5e76\u63d0\u4f9b\u53ef\u89c6\u5316\u7684\u64cd\u4f5c\u9875\u9762\u5bf9ElasticSearch\u641c\u7d22\u5f15\u64ce\u8fdb\u884c\u5404\u79cd\u8bbe\u7f6e\u548c\u6570\u636e\u68c0\u7d22\u529f\u80fd\u7684\u7ba1\u7406\u63d2\u4ef6\uff0c\u5982\u5728head\u63d2\u4ef6\u9875\u9762\u7f16\u5199RESTful\u63a5\u53e3\u98ce\u683c\u7684\u8bf7\u6c42\uff0c\u5c31\u53ef\u4ee5\u5bf9ElasticSearch\u4e2d\u7684\u6570\u636e\u8fdb\u884c\u589e\u5220\u6539\u67e5\u3001\u521b\u5efa\u6216\u8005\u5220\u9664\u7d22\u5f15\u7b49\u64cd\u4f5c\u3002\u7c7b\u4f3c\u4e8e\u4f7f\u7528navicat\u5de5\u5177\u8fde\u63a5MySQL\u8fd9\u79cd\u5173\u7cfb\u578b\u6570\u636e\u5e93\uff0c\u5bf9\u6570\u636e\u5e93\u505a\u64cd\u4f5c\u3002<\/p>\n<h2>2 \u672c\u5730\u5b89\u88c5<\/h2>\n<p>\u4e0b\u9762\u7b80\u5355\u4ecb\u7ecd\u4e0bES\u73af\u5883\u5b89\u88c5\u548cElasticsearch Head\u5728chrome\u6d4f\u89c8\u5668\u4e2d\u63d2\u4ef6\u5b89\u88c5\u3002<\/p>\n<h3>2.1 ES\u5b89\u88c5<\/h3>\n<p>\u5b89\u88c5\u94fe\u63a5\uff1a<a href=\"https:\/\/link.segmentfault.com\/?enc=6XesKobKAgPLAcMSlIOnew%3D%3D.Igh0qAYxTgJ5XJ0qoJGh3%2FJTMXQABusvWJy6jgn8p%2FL9gYR7oUwgLNUZ9Qt3odpPR1pPCThc2KBr4yPkY%2BBbrBXedgoQV%2BxQ3GAWj1UM%2BQ8kAvhVnQaJskV3V9wolNou3q5fj4NUVHTmS5A51fZfZrbfyxrsUL0lZhUIBud7rFg5f0Fzm4YC%2FeBYS7dJk2w0fERlwYOdXHNclh8oOYYAiw%3D%3D\" rel=\"nofollow\">https:\/\/www.elastic.co\/cn\/web&#8230;<\/a>  <br \/>1.\u53cc\u51fb\u8fd0\u884c<\/p>\n<p><img decoding=\"async\" referrerpolicy=\"no-referrer\" src=\"https:\/\/segmentfault.com\/img\/remote\/1460000043038177\" alt=\"\" title=\"\" loading=\"lazy\"><\/p>\n<p>2.\u542f\u52a8\u6210\u529f\u65e5\u5fd7<\/p>\n<p><img decoding=\"async\" referrerpolicy=\"no-referrer\" src=\"https:\/\/segmentfault.com\/img\/remote\/1460000043038178\" alt=\"\" title=\"\" loading=\"lazy\"><\/p>\n<p>3.\u67e5\u770b\u7248\u672c\u4fe1\u606f  <br \/>\u8bbf\u95ee\u5730\u5740\uff1a<a href=\"https:\/\/link.segmentfault.com\/?enc=JPYkaJULtflFJMSFdAfd7w%3D%3D.HzWj8LqeMFWLBBU9jCDJkNZQaOoyVXsVOVNh%2F9fLr%2BU%3D\" rel=\"nofollow\">http:\/\/localhost:9200\/<\/a>\u00a0\u51fa\u73b0\u5982\u4e0b\u4fe1\u606f\uff1a<\/p>\n<p><img decoding=\"async\" referrerpolicy=\"no-referrer\" src=\"https:\/\/segmentfault.com\/img\/remote\/1460000043038179\" alt=\"\" title=\"\" loading=\"lazy\"><\/p>\n<h3>2.2 head\u63d2\u4ef6\u5b89\u88c5<\/h3>\n<p>\u5b89\u88c5\u94fe\u63a5\uff1a<a href=\"https:\/\/link.segmentfault.com\/?enc=Hr32zFYjOOViwYdh%2FKx18A%3D%3D.hNI8srfGg77bMS3cEAEop8csPsj2shKxO4FYzvfKa8cdlGDupfCAW5g7zMALithaNjNNIEP8%2F%2B4%2BKePIUj1UJ4VH6pOEVahWQ%2BZhCJlpexE47DLK37d69w6lhvr2tH1FZRBfJfT2oEOC15y1oODaTA%3D%3D\" rel=\"nofollow\">https:\/\/chrome.google.com\/web&#8230;<\/a>  <br \/>git\u5730\u5740\uff1a<a href=\"https:\/\/link.segmentfault.com\/?enc=O4rSVUfbcizOEyDIAENO1g%3D%3D.yLLOlKeYmrkiAbqI0qNEG6eJUGHC5077DKHBShUQPQMQOLJmvOZ57%2BmxH79bLcJx\" rel=\"nofollow\">https:\/\/github.com\/mobz\/elast&#8230;<\/a>  <br \/>1.\u6253\u5f00head\u540e\u6548\u679c<\/p>\n<p><img decoding=\"async\" referrerpolicy=\"no-referrer\" src=\"https:\/\/segmentfault.com\/img\/remote\/1460000043038180\" alt=\"\" title=\"\" loading=\"lazy\"><\/p>\n<p><img decoding=\"async\" referrerpolicy=\"no-referrer\" src=\"https:\/\/segmentfault.com\/img\/remote\/1460000043038181\" alt=\"\" title=\"\" loading=\"lazy\"><\/p>\n<p>\u91cd\u8981\u4fe1\u606f\uff0c\u96c6\u7fa4\u5065\u5eb7\u503c\u3002Elasticsearch \u4e2d\u5176\u5b9e\u6709\u4e13\u95e8\u7684\u8861\u91cf\u7d22\u5f15\u5065\u5eb7\u72b6\u51b5\u7684\u6807\u5fd7\uff0c\u5206\u4e3a\u4e09\u4e2a\u7b49\u7ea7\uff1a<\/p>\n<ul>\n<li>green\uff0c\u7eff\u8272\u3002\u8fd9\u4ee3\u8868\u6240\u6709\u7684\u4e3b\u5206\u7247\u548c\u526f\u672c\u5206\u7247\u90fd\u5df2\u5206\u914d\u3002\u4f60\u7684\u96c6\u7fa4\u662f 100% \u53ef\u7528\u7684\u3002<\/li>\n<li>yellow\uff0c\u9ec4\u8272\u3002\u6240\u6709\u7684\u4e3b\u5206\u7247\u5df2\u7ecf\u5206\u7247\u4e86\uff0c\u4f46\u81f3\u5c11\u8fd8\u6709\u4e00\u4e2a\u526f\u672c\u662f\u7f3a\u5931\u7684\u3002<\/li>\n<li>red\uff0c\u7ea2\u8272\u3002\u81f3\u5c11\u4e00\u4e2a\u4e3b\u5206\u7247\u4ee5\u53ca\u5b83\u7684\u5168\u90e8\u526f\u672c\u90fd\u5728\u7f3a\u5931\u4e2d\u3002<\/li>\n<\/ul>\n<h2>3 \u57fa\u672c\u67e5\u8be2<\/h2>\n<h3>3.1 \u68c0\u7d22\u5173\u952e\u5b57<\/h3>\n<p>1.must\u5b50\u53e5  <br \/>\u6587\u6863\u5fc5\u987b\u5339\u914dmust\u6240\u6709\u5b50\u53e5\u67e5\u8be2<\/p>\n<p><img decoding=\"async\" referrerpolicy=\"no-referrer\" src=\"https:\/\/segmentfault.com\/img\/remote\/1460000043038182\" alt=\"\" title=\"\" loading=\"lazy\"><\/p>\n<p>2.should\u5b50\u53e5  <br \/>\u6587\u6863\u5e94\u8be5\u5339\u914dshould\u5b50\u53e5\u67e5\u8be2\u7684\u81f3\u5c11\u4e00\u4e2a<\/p>\n<p><img decoding=\"async\" referrerpolicy=\"no-referrer\" src=\"https:\/\/segmentfault.com\/img\/remote\/1460000043038183\" alt=\"\" title=\"\" loading=\"lazy\"><\/p>\n<p>3.must_not\u5b50\u53e5  <br \/>\u6587\u6863\u4e0d\u80fd\u5339\u914d\u8be5\u67e5\u8be2\u6761\u4ef6\uff0c\u76f8\u5f53\u4e8e\u201c\uff01=\u201d<\/p>\n<p><img decoding=\"async\" referrerpolicy=\"no-referrer\" src=\"https:\/\/segmentfault.com\/img\/remote\/1460000043038184\" alt=\"\" title=\"\" loading=\"lazy\"><\/p>\n<h3>3.2 \u68c0\u7d22\u6761\u4ef6<\/h3>\n<ul>\n<li>match\uff1a\u5206\u8bcd\u5339\u914d<\/li>\n<li>term\uff1a\u8868\u793a\u7cbe\u786e\u5339\u914d<\/li>\n<li>wildcard\uff1a\u901a\u914d\u7b26\u5339\u914d<\/li>\n<li>prefix\uff1a\u524d\u7f00\u5339\u914d<\/li>\n<li>range\uff1a\u533a\u95f4\u67e5\u8be2<\/li>\n<li>query_string\uff1a\u5141\u8bb8\u5728\u5355\u4e2a\u67e5\u8be2\u5b57\u7b26\u4e32\u4e2d\u6307\u5b9aAND<\/li>\n<li>text\uff1a\u6587\u672c<\/li>\n<li>missing\uff1a \u65e0\u503c\uff08\u7c7b\u4f3c\u4e8esql\u4e2dIS NULL\uff09<\/li>\n<\/ul>\n<h2>4 \u590d\u5408\u67e5\u8be2<\/h2>\n<p>ES\u4ee5RESTful\u63a5\u53e3\u98ce\u683c\u7684\u8bf7\u6c42\uff0c\u4f7f\u7528json\u8fdb\u884c\u590d\u6742\u7684\u67e5\u8be2\u3002\u8bf7\u6c42\u683c\u5f0f\uff1a<a href=\"http:\/\/ip:port\/%E7%B4%A2%E5%BC%95\/%E7%B1%BB%E5%9E%8B\/%E6%96%87%E6%A1%A3Id\">http:\/\/ip:port\/\u7d22\u5f15\/\u7c7b\u578b\/\u6587\u6863Id<\/a><\/p>\n<h3>4.1 \u67e5\u8be2\u6570\u636e\uff08GET\uff09<\/h3>\n<p>user\/user\/BmH494EB0DXGzMoya1Bu<\/p>\n<p><img decoding=\"async\" referrerpolicy=\"no-referrer\" src=\"https:\/\/segmentfault.com\/img\/remote\/1460000043038185\" alt=\"\" title=\"\" loading=\"lazy\"><\/p>\n<p>\u67e5\u8be2\u5b98\u65b9\u6587\u6863\uff1a<a href=\"https:\/\/link.segmentfault.com\/?enc=YxoEPjGZt8FpdVSKs26CIw%3D%3D.rDCb1iQs3XwXCRExtqdZn%2Fo9LhS3JNogH3%2FBFw7bSZThr0wmMr%2B1EL4rPnaCJw%2B12lpWbmE3P5HhxGLRSdc06undf2YbsYTQaBc8o6qbQTTSYD2rAD6IAqvEPqEoDo72\" rel=\"nofollow\">https:\/\/www.elastic.co\/guide\/&#8230;<\/a><\/p>\n<h3>4.2 \u63d2\u5165\u6570\u636e\uff08PUT\u3001POST\uff09<\/h3>\n<p>PUT\u65b9\u6cd5\u9700\u8981\u6307\u660eid<\/p>\n<p><img decoding=\"async\" referrerpolicy=\"no-referrer\" src=\"https:\/\/segmentfault.com\/img\/remote\/1460000043038186\" alt=\"\" title=\"\" loading=\"lazy\"><\/p>\n<p>POST\u65b9\u6cd5\u81ea\u52a8\u751f\u6210id<\/p>\n<p><img decoding=\"async\" referrerpolicy=\"no-referrer\" src=\"https:\/\/segmentfault.com\/img\/remote\/1460000043038187\" alt=\"\" title=\"\" loading=\"lazy\"><\/p>\n<p><img decoding=\"async\" referrerpolicy=\"no-referrer\" src=\"https:\/\/segmentfault.com\/img\/remote\/1460000043038188\" alt=\"\" title=\"\" loading=\"lazy\"><\/p>\n<h3>4.3 \u66f4\u65b0\u6570\u636e\uff08PUT\uff09<\/h3>\n<p><img decoding=\"async\" referrerpolicy=\"no-referrer\" src=\"https:\/\/segmentfault.com\/img\/remote\/1460000043038189\" alt=\"\" title=\"\" loading=\"lazy\"><\/p>\n<h3>4.4 \u5220\u9664\u6570\u636e\uff08DELETE\uff09<\/h3>\n<p><img decoding=\"async\" referrerpolicy=\"no-referrer\" src=\"https:\/\/segmentfault.com\/img\/remote\/1460000043038190\" alt=\"\" title=\"\" loading=\"lazy\"><\/p>\n<h3>4.5 \u7ed9\u7d22\u5f15\u6dfb\u52a0\u5b57\u6bb5<\/h3>\n<p>user\/user\/_mapping\u4e5f\u53ef\u4ee5\u6dfb\u52a0\u6210\u529f<\/p>\n<p><img decoding=\"async\" referrerpolicy=\"no-referrer\" src=\"https:\/\/segmentfault.com\/img\/remote\/1460000043038191\" alt=\"\" title=\"\" loading=\"lazy\"><\/p>\n<h2>5 \u5177\u4f53\u5b9e\u8df5<\/h2>\n<p>\u7eaf\u914dECLP\u8fd0\u5355\u6570\u636e\u9664\u4e86\u843dmysql\u6570\u636e\u5e93\u540c\u65f6\u4e5f\u4f1a\u5b58\u50a8ES\uff0c\u5546\u5bb6\u5de5\u4f5c\u53f0\u5bfc\u51fa\u3001\u8fd0\u5355\u5217\u8868\u529f\u80fd\u5c31\u662f\u67e5\u8be2ES\u6570\u636e\u3002  <br \/>\u4f8b\u5982\u4e0b\u9762\u5c31\u662f\u6839\u636e\u8fd0\u5355\u53f7\u67e5\u8be2\u8fd0\u5355\u6570\u636e\uff1a<\/p>\n<p><img decoding=\"async\" referrerpolicy=\"no-referrer\" src=\"https:\/\/segmentfault.com\/img\/remote\/1460000043038192\" alt=\"\" title=\"\" loading=\"lazy\"><\/p>\n<p>\u5de5\u4f5c\u4e2d\u9700\u8981\u5728\u8fd0\u5355\u6269\u5c55\u8868\u4e0a\u589e\u52a0\u5b57\u6bb5\uff0c\u9664\u4e86mysql\u6570\u636e\u8868\u9700\u8981\u589e\u52a0\u5b57\u6bb5\u5916\uff0cES\u4e5f\u8981\u589e\u52a0\u5b57\u6bb5\u3002lwb_main\u5c31\u662f\u8fd0\u5355\u6570\u636e\u7d22\u5f15\uff0c\u7ed9lwb_main\u7d22\u5f15\u589e\u52a0\u5b57\u6bb5\u6267\u884c\u8bed\u53e5\u5982\u4e0b\uff1alwb_main\/_mapping\/lwb_main?pretty\uff0cpretty\u4e3b\u8981\u505a\u7f8e\u5316\u4f5c\u7528\uff0c\u4e5f\u53ef\u4e0d\u8981\u3002<\/p>\n<p><img decoding=\"async\" referrerpolicy=\"no-referrer\" src=\"https:\/\/segmentfault.com\/img\/remote\/1460000043038193\" alt=\"\" title=\"\" loading=\"lazy\"><\/p>\n<h2>6 \u603b\u7ed3<\/h2>\n<p>Elasticsearch Head\u63d2\u4ef6\u76f4\u63a5\u5728chrome\u6d4f\u89c8\u5668\u5b89\u88c5\u540e\u5c31\u53ef\u4ee5\u4f7f\u7528\uff0c\u975e\u5e38\u65b9\u4fbf\uff0c\u5bf9\u4e8e\u521d\u5b66\u8005\u5927\u6709\u76ca\u5904\uff0c\u4f7f\u7528head\u63d2\u4ef6\u53ef\u4ee5\u5feb\u901f\u5b9e\u73b0ES\u7d22\u5f15\u6570\u636e\u7684\u589e\u5220\u6539\u67e5\u3001\u521b\u5efa\u6216\u8005\u5220\u9664\u7d22\u5f15\u7b49\u64cd\u4f5c\u3002<\/p>\n<p><a href=\"https:\/\/segmentfault.com\/a\/1190000043038175\">https:\/\/segmentfault.com\/a\/1190000043038175<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u4f5c\u8005\uff1a\u5d14\u96c4\u534e 1 Elasticsearch Head\u662f\u4ec0\u4e48 ElasticSearch head\u5c31\u662f\u4e00\u6b3e\u80fd\u8fde [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[4],"tags":[],"class_list":["post-10006961","post","type-post","status-publish","format-standard","hentry","category-share"],"jetpack_sharing_enabled":true,"jetpack_featured_media_url":"","_links":{"self":[{"href":"https:\/\/itmax.cn\/index.php?rest_route=\/wp\/v2\/posts\/10006961","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/itmax.cn\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/itmax.cn\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/itmax.cn\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/itmax.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=10006961"}],"version-history":[{"count":0,"href":"https:\/\/itmax.cn\/index.php?rest_route=\/wp\/v2\/posts\/10006961\/revisions"}],"wp:attachment":[{"href":"https:\/\/itmax.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=10006961"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/itmax.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=10006961"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/itmax.cn\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=10006961"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}