{"id":94197,"date":"2026-08-13T22:24:55","date_gmt":"2026-08-13T14:24:55","guid":{"rendered":"https:\/\/www.wsisp.com\/helps\/94197.html"},"modified":"2026-08-13T22:24:55","modified_gmt":"2026-08-13T14:24:55","slug":"%e3%80%90elk%e3%80%91-3-elk%e7%b4%a2%e5%bc%95","status":"publish","type":"post","link":"https:\/\/www.wsisp.com\/helps\/94197.html","title":{"rendered":"\u3010ELK\u3011-3 ELK\u7d22\u5f15"},"content":{"rendered":"<\/p>\n<h4>\u6587\u7ae0\u76ee\u5f55<\/h4>\n<ul>\n<li>ES \u7d22\u5f15\u76f8\u5173\u64cd\u4f5c<\/li>\n<li>\n<ul>\n<li>\u4e00\u3001\u5206\u7247&#xff08;Sharding&#xff09;\u539f\u7406<\/li>\n<li>\n<ul>\n<li>\u96c6\u7fa4\u5065\u5eb7\u72b6\u6001&#xff08;Health Status&#xff09;<\/li>\n<li>\u4e3a\u4ec0\u4e48 ES \u53ea\u80fd\u4fee\u6539\u526f\u672c\u6570\u91cf&#xff0c;\u4e0d\u80fd\u4fee\u6539\u5206\u7247\u6570\u91cf&#xff1f;<\/li>\n<\/ul>\n<\/li>\n<li>\u4e8c\u3001\u7d22\u5f15\u7ba1\u7406&#xff08;Index Management&#xff09;<\/li>\n<li>\n<ul>\n<li>2.1 \u5e38\u7528\u64cd\u4f5c\u901f\u67e5<\/li>\n<li>2.2 \u521b\u5efa\u7d22\u5f15<\/li>\n<li>2.3 \u67e5\u770b\u7d22\u5f15\u4fe1\u606f<\/li>\n<li>2.4 \u4fee\u6539\u7d22\u5f15\u914d\u7f6e<\/li>\n<li>2.5 \u4fee\u6539\u7d22\u5f15\u5b57\u6bb5&#xff08;Mapping&#xff09;<\/li>\n<li>2.6 \u67e5\u770b\u7d22\u5f15\u5217\u8868<\/li>\n<li>2.7 \u5220\u9664\u7d22\u5f15<\/li>\n<li>2.8 \u7d22\u5f15\u522b\u540d&#xff08;Alias&#xff09;<\/li>\n<\/ul>\n<\/li>\n<li>\u4e09\u3001Mapping \u6570\u636e\u7c7b\u578b<\/li>\n<li>\n<ul>\n<li>\u6570\u5b57\u7c7b\u578b<\/li>\n<li>\u5b57\u7b26\u4e32\u7c7b\u578b<\/li>\n<li>\u65e5\u671f\u7c7b\u578b<\/li>\n<li>boolean \u7c7b\u578b<\/li>\n<li>\u4e8c\u8fdb\u5236\u6570\u636e<\/li>\n<li>\u591a\u5b57\u6bb5\u7279\u6027<\/li>\n<li>\u6570\u7ec4\u7c7b\u578b<\/li>\n<li>IP \u7c7b\u578b<\/li>\n<\/ul>\n<\/li>\n<li>\u56db\u3001\u6587\u6863\u64cd\u4f5c&#xff08;Document CRUD&#xff09;<\/li>\n<li>\n<ul>\n<li>4.1 \u521b\u5efa\u6587\u6863<\/li>\n<li>4.2 \u67e5\u8be2\u6587\u6863<\/li>\n<li>4.3 \u4fee\u6539\u6587\u6863<\/li>\n<li>4.4 \u5220\u9664\u6587\u6863<\/li>\n<li>4.5 \u6e05\u7a7a\u6587\u6863<\/li>\n<\/ul>\n<\/li>\n<li>\u4e94\u3001\u590d\u6742\u67e5\u8be2&#xff08;Complex Query&#xff09;<\/li>\n<li>\n<ul>\n<li>5.1 \u7b80\u5355\u67e5\u8be2&#xff08;term \u7cbe\u786e\u5339\u914d&#xff09;<\/li>\n<li>5.2 \u8fc7\u6ee4\u67e5\u8be2&#xff08;filter&#xff09;<\/li>\n<li>5.3 \u591a\u6761\u4ef6\u590d\u5408\u67e5\u8be2&#xff08;must&#xff09;<\/li>\n<li>5.4 terms \u591a\u503c\u67e5\u8be2&#xff08;\u7c7b\u4f3c MySQL IN&#xff09;<\/li>\n<li>5.5 should \u5d4c\u5957\u67e5\u8be2<\/li>\n<\/ul>\n<\/li>\n<li>\u516d\u3001\u96c6\u7fa4\u72b6\u6001\u5f02\u5e38&#xff08;Red&#xff09;\u5904\u7406<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<hr \/>\n<h2>ES \u7d22\u5f15\u76f8\u5173\u64cd\u4f5c<\/h2>\n<p>\u672c\u6587\u8986\u76d6 ES \u7d22\u5f15\u7684\u7ba1\u7406&#xff08;\u542b\u522b\u540d&#xff09;\u3001Mapping \u6570\u636e\u7c7b\u578b\u3001\u6587\u6863 CRUD \u4ee5\u53ca\u5e38\u7528\u67e5\u8be2\u8bed\u6cd5\u3002<\/p>\n<h3>\u4e00\u3001\u5206\u7247&#xff08;Sharding&#xff09;\u539f\u7406<\/h3>\n<p>\u6570\u636e\u4f1a\u6309\u7167\u54c8\u5e0c\u89c4\u5219\u88ab\u5207\u5206\u5230\u591a\u4e2a\u4e3b\u5206\u7247&#xff08;Primary Shard&#xff09;&#xff0c;\u6bcf\u4e2a\u4e3b\u5206\u7247\u53ef\u4ee5\u914d\u7f6e\u82e5\u5e72\u4e2a\u526f\u672c\u5206\u7247&#xff08;Replica Shard&#xff09;&#xff0c;\u526f\u672c\u7528\u4e8e\u5bb9\u707e\u5e76\u63d0\u5347\u8bfb\u53d6\u6027\u80fd\u3002<\/p>\n<p>\u793a\u4f8b&#xff1a;\u6570\u636e abc \u88ab\u5207\u5206\u4e3a 5 \u4e2a\u5206\u7247&#xff08;a\u3001b\u3001c\u3001d\u3001e&#xff09;&#xff0c;\u526f\u672c\u6570\u91cf\u4e3a 1\u3002<\/p>\n<table>\n<tr>\u5206\u7247abcde<\/tr>\n<tbody>\n<tr>\n<td>\u4e3b\u5206\u7247<\/td>\n<td>A<\/td>\n<td>B<\/td>\n<td>C<\/td>\n<td>D<\/td>\n<td>E<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>\u5206\u5e03\u5728 3 \u4e2a\u8282\u70b9\u4e0a&#xff1a;<\/p>\n<table>\n<tr>\u8282\u70b9\u4e3b\u5206\u7247\u526f\u672c\u5206\u7247<\/tr>\n<tbody>\n<tr>\n<td>node01<\/td>\n<td>a<\/td>\n<td>C<\/td>\n<\/tr>\n<tr>\n<td>node02<\/td>\n<td>d\u3001b<\/td>\n<td>E\u3001A<\/td>\n<\/tr>\n<tr>\n<td>node03<\/td>\n<td>e\u3001c<\/td>\n<td>D\u3001B<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>\u4eae\u8272\u4ee3\u8868\u4e3b\u5206\u7247&#xff0c;\u6697\u8272\u4ee3\u8868\u526f\u5206\u7247<\/p>\n<p>![[05_\u4e2d\u95f4\u4ef6\/ELK\/image\/Pasted image 20260704110934.png]]<\/p>\n<h4>\u96c6\u7fa4\u5065\u5eb7\u72b6\u6001&#xff08;Health Status&#xff09;<\/h4>\n<p>ES \u901a\u8fc7\u96c6\u7fa4\u5065\u5eb7\u68c0\u67e5\u8fd4\u56de\u4e09\u79cd\u72b6\u6001&#xff1a;<\/p>\n<table>\n<tr>\u72b6\u6001\u542b\u4e49<\/tr>\n<tbody>\n<tr>\n<td>Green&#xff08;\u7eff\u8272&#xff09;<\/td>\n<td>\u6240\u6709\u4e3b\u5206\u7247\u548c\u526f\u672c\u5206\u7247\u90fd\u5df2\u5206\u914d&#xff0c;\u96c6\u7fa4\u5b8c\u5168\u5065\u5eb7\u3002<\/td>\n<\/tr>\n<tr>\n<td>Yellow&#xff08;\u9ec4\u8272&#xff09;<\/td>\n<td>\u6240\u6709\u4e3b\u5206\u7247\u5df2\u5206\u914d&#xff0c;\u4f46\u81f3\u5c11\u6709\u4e00\u4e2a\u526f\u672c\u5206\u7247\u672a\u5206\u914d&#xff0c;\u6570\u636e\u5b8c\u6574\u4f46\u5b58\u5728\u5355\u70b9\u98ce\u9669\u3002<\/td>\n<\/tr>\n<tr>\n<td>Red&#xff08;\u7ea2\u8272&#xff09;<\/td>\n<td>\u81f3\u5c11\u6709\u4e00\u4e2a\u4e3b\u5206\u7247\u672a\u5206\u914d&#xff0c;\u90e8\u5206\u6570\u636e\u4e0d\u53ef\u7528&#xff0c;\u96c6\u7fa4\u65e0\u6cd5\u6b63\u5e38\u63d0\u4f9b\u5b8c\u6574\u670d\u52a1\u3002<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h4>\u4e3a\u4ec0\u4e48 ES \u53ea\u80fd\u4fee\u6539\u526f\u672c\u6570\u91cf&#xff0c;\u4e0d\u80fd\u4fee\u6539\u5206\u7247\u6570\u91cf&#xff1f;<\/h4>\n<p>\u6838\u5fc3\u539f\u56e0\u662f\u6587\u6863\u8def\u7531\u673a\u5236\u3002<\/p>\n<p>ES \u901a\u8fc7\u516c\u5f0f shard &#061; hash(_routing) % \u4e3b\u5206\u7247\u6570 \u51b3\u5b9a\u4e00\u7bc7\u6587\u6863\u5b58\u50a8\u5728\u54ea\u4e2a\u4e3b\u5206\u7247\u4e0a\u3002\u4e3b\u5206\u7247\u6570\u4e00\u65e6\u6539\u53d8&#xff0c;\u53d6\u6a21\u7ed3\u679c\u5168\u90e8\u53d8\u5316&#xff0c;\u6240\u6709\u6587\u6863\u7684\u5f52\u5c5e\u5206\u7247\u90fd\u4f1a\u9519\u4e71&#xff0c;\u76f8\u5f53\u4e8e\u8981\u628a\u6574\u4e2a\u7d22\u5f15\u7684\u6570\u636e\u91cd\u65b0\u6d17\u724c&#xff0c;\u4ee3\u4ef7\u6781\u5927\u4e14\u65e0\u6cd5\u5728\u7ebf\u5e73\u6ed1\u5b8c\u6210\u3002<\/p>\n<p>\u800c\u526f\u672c\u5206\u7247\u53ea\u662f\u4e3b\u5206\u7247\u7684&#034;\u62f7\u8d1d&#034;&#xff0c;\u589e\u51cf\u526f\u672c\u4e0d\u5f71\u54cd\u6587\u6863\u8def\u7531&#xff0c;\u53ea\u662f\u591a\u590d\u5236\u6216\u5c11\u590d\u5236\u51e0\u4efd\u6570\u636e&#xff0c;\u6240\u4ee5\u53ef\u4ee5\u968f\u65f6\u901a\u8fc7 number_of_replicas \u52a8\u6001\u8c03\u6574\u3002<\/p>\n<p>\u8865\u5145&#xff1a;ES \u63d0\u4f9b\u4e86 Split API&#xff08;\u589e\u52a0\u5206\u7247&#xff09;\u548c Shrink API&#xff08;\u51cf\u5c11\u5206\u7247&#xff09;&#xff0c;\u4f46\u672c\u8d28\u90fd\u662f\u521b\u5efa\u4e00\u4e2a\u65b0\u7d22\u5f15\u3001\u91cd\u65b0\u8fc1\u79fb\u6570\u636e&#xff0c;\u5e76\u975e\u539f\u5730\u76f4\u63a5\u4fee\u6539\u3002<\/p>\n<h3>\u4e8c\u3001\u7d22\u5f15\u7ba1\u7406&#xff08;Index Management&#xff09;<\/h3>\n<h4>2.1 \u5e38\u7528\u64cd\u4f5c\u901f\u67e5<\/h4>\n<table>\n<tr>\u65b9\u6cd5URL \u5730\u5740\u63cf\u8ff0<\/tr>\n<tbody>\n<tr>\n<td>PUT<\/td>\n<td>localhost:9200\/\u7d22\u5f15\u540d\u79f0\/\u7c7b\u578b\u540d\u79f0\/\u6587\u6863id<\/td>\n<td>\u521b\u5efa\u6587\u6863&#xff08;\u6307\u5b9a\u6587\u6863 id&#xff09;<\/td>\n<\/tr>\n<tr>\n<td>POST<\/td>\n<td>localhost:9200\/\u7d22\u5f15\u540d\u79f0\/\u7c7b\u578b\u540d\u79f0<\/td>\n<td>\u521b\u5efa\u6587\u6863&#xff08;\u968f\u673a\u6587\u6863 id&#xff09;<\/td>\n<\/tr>\n<tr>\n<td>POST<\/td>\n<td>localhost:9200\/\u7d22\u5f15\u540d\u79f0\/\u7c7b\u578b\u540d\u79f0\/\u6587\u6863id\/_update<\/td>\n<td>\u4fee\u6539\u6587\u6863<\/td>\n<\/tr>\n<tr>\n<td>DELETE<\/td>\n<td>localhost:9200\/\u7d22\u5f15\u540d\u79f0\/\u7c7b\u578b\u540d\u79f0\/\u6587\u6863id<\/td>\n<td>\u5220\u9664\u6587\u6863<\/td>\n<\/tr>\n<tr>\n<td>GET<\/td>\n<td>localhost:9200\/\u7d22\u5f15\u540d\u79f0\/\u7c7b\u578b\u540d\u79f0\/\u6587\u6863id<\/td>\n<td>\u901a\u8fc7\u6587\u6863 id \u67e5\u8be2\u6587\u6863<\/td>\n<\/tr>\n<tr>\n<td>POST<\/td>\n<td>localhost:9200\/\u7d22\u5f15\u540d\u79f0\/\u7c7b\u578b\u540d\u79f0\/_search<\/td>\n<td>\u67e5\u8be2\u6240\u6709\u6570\u636e<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>\u8bf4\u660e&#xff1a;7.x \u53ca\u4ee5\u4e0a\u7248\u672c\u5efa\u8bae\u4f7f\u7528\u56fa\u5b9a\u7c7b\u578b\u540d _doc&#xff0c;\u4f8b\u5982 my_index\/_doc\/1\u3002<\/p>\n<h4>2.2 \u521b\u5efa\u7d22\u5f15<\/h4>\n<p>\u521b\u5efa\u7d22\u5f15\u65f6\u53ef\u540c\u65f6\u6307\u5b9a settings&#xff08;\u5206\u7247 \/ \u526f\u672c\u53c2\u6570&#xff09;\u548c mappings&#xff08;\u5b57\u6bb5\u7ed3\u6784&#xff09;&#xff1a;<\/p>\n<p><span class=\"token function\">curl<\/span> <span class=\"token parameter variable\">-X<\/span> PUT <span class=\"token string\">&#039;localhost:9200\/my_index?pretty&#039;<\/span> <span class=\"token parameter variable\">-H<\/span> <span class=\"token string\">&#039;Content-Type: application\/json&#039;<\/span> -d<span class=\"token string\">&#039;<br \/>\n{<br \/>\n  &#034;settings&#034;: {                # \u7d22\u5f15\u53c2\u6570\u8bbe\u7f6e<br \/>\n    &#034;number_of_shards&#034;: 3,     # \u5206\u7247\u6570\u91cf&#xff0c;\u9ed8\u8ba4 1&#xff08;7.x \u4e4b\u524d\u9ed8\u8ba4 5&#xff09;<br \/>\n    &#034;number_of_replicas&#034;: 2    # \u526f\u672c\u6570\u91cf&#xff0c;\u9ed8\u8ba4 1<br \/>\n  },<br \/>\n  &#034;mappings&#034;: {                # \u5b57\u6bb5\u914d\u7f6e&#xff08;\u7c7b\u6bd4\u6570\u636e\u5e93\u8868\u7ed3\u6784&#xff1b;ES \u4e5f\u53ef\u5148\u5199\u5165\u6587\u6863\u518d\u81ea\u52a8\u751f\u6210 mapping&#xff09;<br \/>\n    &#034;properties&#034;: {<br \/>\n      &#034;id&#034;: { &#034;type&#034;: &#034;integer&#034; },   # \u5b57\u6bb5\u540d &#043; \u6570\u636e\u7c7b\u578b<br \/>\n      &#034;name&#034;: { &#034;type&#034;: &#034;keyword&#034; }<br \/>\n    }<br \/>\n  }<br \/>\n}<br \/>\n&#039;<\/span><\/p>\n<p>![[05_\u4e2d\u95f4\u4ef6\/ELK\/image\/Pasted image 20260704110850.png]]<\/p>\n<h4>2.3 \u67e5\u770b\u7d22\u5f15\u4fe1\u606f<\/h4>\n<p><span class=\"token comment\"># \u67e5\u770b\u7d22\u5f15\u8bbe\u7f6e&#xff08;?pretty \u7528\u4e8e\u7f8e\u5316\u8f93\u51fa&#xff0c;\u53ef\u7701\u7565&#xff09;<\/span><br \/>\n<span class=\"token function\">curl<\/span> <span class=\"token parameter variable\">-XGET<\/span> <span class=\"token string\">&#039;localhost:9200\/my_index\/_settings?pretty&#039;<\/span><\/p>\n<p><span class=\"token comment\"># \u67e5\u770b\u7d22\u5f15\u6620\u5c04<\/span><br \/>\n<span class=\"token function\">curl<\/span> <span class=\"token parameter variable\">-XGET<\/span> <span class=\"token string\">&#039;localhost:9200\/my_index\/_mapping?pretty&#039;<\/span><\/p>\n<h4>2.4 \u4fee\u6539\u7d22\u5f15\u914d\u7f6e<\/h4>\n<p><span class=\"token function\">curl<\/span> <span class=\"token parameter variable\">-XPUT<\/span> <span class=\"token string\">&#039;localhost:9200\/my_index\/_settings?pretty&#039;<\/span> <span class=\"token parameter variable\">-H<\/span> <span class=\"token string\">&#039;Content-Type: application\/json&#039;<\/span> <span class=\"token parameter variable\">-d<\/span> <span class=\"token string\">&#039;{&#034;number_of_replicas&#034;: 1}&#039;<\/span><\/p>\n<h4>2.5 \u4fee\u6539\u7d22\u5f15\u5b57\u6bb5&#xff08;Mapping&#xff09;<\/h4>\n<p>\u6ce8\u610f&#xff1a;\u53ea\u80fd\u65b0\u589e\u5b57\u6bb5&#xff0c;\u4e0d\u80fd\u5220\u9664\u6216\u4fee\u6539\u5df2\u6709\u5b57\u6bb5\u3002<\/p>\n<p><span class=\"token function\">curl<\/span> <span class=\"token parameter variable\">-XPOST<\/span> <span class=\"token string\">&#039;localhost:9200\/my_index\/_mapping?pretty&#039;<\/span> <span class=\"token parameter variable\">-H<\/span> <span class=\"token string\">&#039;Content-Type: application\/json&#039;<\/span> -d<span class=\"token string\">&#039;<br \/>\n{<br \/>\n  &#034;properties&#034;: {<br \/>\n    &#034;age&#034;: { &#034;type&#034;: &#034;short&#034; }<br \/>\n  }<br \/>\n}<br \/>\n&#039;<\/span><\/p>\n<h4>2.6 \u67e5\u770b\u7d22\u5f15\u5217\u8868<\/h4>\n<p><span class=\"token function\">curl<\/span> <span class=\"token parameter variable\">-XGET<\/span> <span class=\"token string\">&#039;localhost:9200\/_cat\/indices?v&#039;<\/span><\/p>\n<h4>2.7 \u5220\u9664\u7d22\u5f15<\/h4>\n<p><span class=\"token function\">curl<\/span> <span class=\"token parameter variable\">-XDELETE<\/span> <span class=\"token string\">&#039;localhost:9200\/my_index?pretty&#039;<\/span><\/p>\n<p>[[05_\u4e2d\u95f4\u4ef6\/ELK\/image\/5dc5d5eefc9cfff9e9ee0511df4f166c_MD5.jpg|Open: Pasted image 20260813103007.png]] ![[05_\u4e2d\u95f4\u4ef6\/ELK\/image\/5dc5d5eefc9cfff9e9ee0511df4f166c_MD5.jpg]]<\/p>\n<h4>2.8 \u7d22\u5f15\u522b\u540d&#xff08;Alias&#xff09;<\/h4>\n<p>\u522b\u540d&#xff08;alias&#xff09;\u76f8\u5f53\u4e8e\u7ed9\u7d22\u5f15\u8d77\u7684\u201c\u5916\u53f7\u201d&#xff1a;\u4e1a\u52a1\u4ee3\u7801\u53ea\u9762\u5411\u522b\u540d&#xff0c;\u5207\u6362\u7d22\u5f15\u65f6\u53ea\u9700\u4fee\u6539\u522b\u540d\u7684\u6307\u5411&#xff0c;\u4ee3\u7801\u4e0d\u7528\u52a8&#xff0c;\u662f ES \u91cc\u505a\u96f6\u505c\u673a\u91cd\u5efa\u7d22\u5f15&#xff08;reindex&#xff09;\u7684\u5e38\u7528\u624b\u6bb5\u3002<\/p>\n<p><span class=\"token comment\"># \u521b\u5efa\u7d22\u5f15\u522b\u540d<\/span><br \/>\n<span class=\"token function\">curl<\/span> <span class=\"token parameter variable\">-XPOST<\/span> <span class=\"token string\">&#039;localhost:9200\/_aliases?pretty&#039;<\/span> <span class=\"token parameter variable\">-H<\/span> <span class=\"token string\">&#039;Content-Type: application\/json&#039;<\/span> <span class=\"token parameter variable\">-d<\/span> <span class=\"token string\">&#039;<br \/>\n{<br \/>\n  &#034;actions&#034;: [<br \/>\n    { &#034;add&#034;: { &#034;index&#034;: &#034;my_index&#034;, &#034;alias&#034;: &#034;my_index_alias&#034; } }<br \/>\n  ]<br \/>\n}<br \/>\n&#039;<\/span><\/p>\n<p><span class=\"token comment\"># \u5220\u9664\u7d22\u5f15\u522b\u540d&#xff1a;\u628a add \u6539\u6210 remove&#xff0c;\u5176\u4f59\u7ed3\u6784\u4e00\u81f4<\/span><br \/>\n<span class=\"token function\">curl<\/span> <span class=\"token parameter variable\">-XPOST<\/span> <span class=\"token string\">&#039;localhost:9200\/_aliases?pretty&#039;<\/span> <span class=\"token parameter variable\">-H<\/span> <span class=\"token string\">&#039;Content-Type: application\/json&#039;<\/span> <span class=\"token parameter variable\">-d<\/span> <span class=\"token string\">&#039;<br \/>\n{<br \/>\n  &#034;actions&#034;: [<br \/>\n    { &#034;remove&#034;: { &#034;index&#034;: &#034;my_index&#034;, &#034;alias&#034;: &#034;my_index_alias&#034; } }<br \/>\n  ]<br \/>\n}<br \/>\n&#039;<\/span><\/p>\n<p>\u6280\u5de7&#xff1a;\u521b\u5efa\u522b\u540d\u7528 add&#xff0c;\u5220\u9664\u522b\u540d\u53ea\u9700\u628a add \u6539\u6210 remove\u3002<\/p>\n<p>[[05_\u4e2d\u95f4\u4ef6\/ELK\/image\/b5d736ee303f5dd6eb28ff3487cbabd3_MD5.jpg|Open: Pasted image 20260813114158.png]] ![[05_\u4e2d\u95f4\u4ef6\/ELK\/image\/b5d736ee303f5dd6eb28ff3487cbabd3_MD5.jpg]]<\/p>\n<h3>\u4e09\u3001Mapping \u6570\u636e\u7c7b\u578b<\/h3>\n<h4>\u6570\u5b57\u7c7b\u578b<\/h4>\n<ul>\n<li>\u6574\u578b&#xff1a;byte&#xff08;-128 ~ 127&#xff09;\u3001short&#xff08;-32768 ~ 32767&#xff09;\u3001integer&#xff08;-2^31 ~ 2<sup>31-1&#xff09;\u3001&#096;long&#096;&#xff08;-2<\/sup>63 ~ 2^63-1&#xff09;<\/li>\n<li>\u6d6e\u70b9\u578b&#xff1a;double\u3001float\u3001half_float\u3001scaled_float&#xff08;\u4ee5\u6574\u6570\u5f62\u5f0f\u8868\u793a\u5c0f\u6570&#xff0c;\u9700\u914d\u5408 scaling_factor \u6307\u660e\u7cbe\u5ea6&#xff09;<\/li>\n<\/ul>\n<h4>\u5b57\u7b26\u4e32\u7c7b\u578b<\/h4>\n<ul>\n<li>text&#xff1a;\u9002\u7528\u4e8e\u88ab\u5168\u6587\u641c\u7d22\u7684\u5b57\u6bb5&#xff08;\u5982\u6458\u8981\u3001\u4ea7\u54c1\u63cf\u8ff0&#xff09;\u3002\u4f1a\u88ab\u5206\u8bcd\u5668\u5206\u8bcd&#xff0c;\u5b58\u5165\u5012\u6392\u7d22\u5f15\u540e\u53ef\u5168\u6587\u68c0\u7d22&#xff0c;\u4f46\u5f88\u5c11\u7528\u4e8e\u6392\u5e8f\u548c\u805a\u5408\u5206\u6790\u3002<\/li>\n<li>keyword&#xff1a;\u9002\u7528\u4e8e\u7ed3\u6784\u5316\u5b57\u6bb5&#xff08;\u5982 email \u5730\u5740\u3001\u4e3b\u673a\u540d\u3001\u72b6\u6001\u7801\u3001\u6807\u7b7e&#xff09;\u3002\u4e0d\u5206\u8bcd&#xff0c;\u53ea\u80fd\u7cbe\u786e\u67e5\u8be2&#xff0c;\u65e0\u6cd5\u5168\u6587\u68c0\u7d22&#xff0c;\u5e38\u7528\u6765\u505a\u8fc7\u6ee4\u3001\u6392\u5e8f\u548c\u805a\u5408\u5206\u6790\u3002<\/li>\n<\/ul>\n<h4>\u65e5\u671f\u7c7b\u578b<\/h4>\n<ul>\n<li>date&#xff1a;ES \u6ca1\u6709\u56fa\u5b9a\u7684\u65e5\u671f\u7c7b\u578b&#xff0c;\u53ea\u8981\u7b26\u5408\u65e5\u671f\u683c\u5f0f\u5373\u53ef\u88ab\u89c6\u4f5c\u65e5\u671f&#xff0c;\u5982\u683c\u5f0f\u5316\u65e5\u671f\u5b57\u7b26\u4e32\u3001\u8868\u793a\u79d2\/\u6beb\u79d2\u7684\u6574\u6570\u7b49\u3002\u53ef\u901a\u8fc7 format \u6307\u5b9a\u591a\u79cd\u683c\u5f0f&#xff0c;\u4f8b\u5982 &#034;format&#034;: &#034;yyyy-MM-dd HH:mm:ss||yyyy-MM-dd||epoch_millis&#034;\u3002<\/li>\n<\/ul>\n<h4>boolean \u7c7b\u578b<\/h4>\n<ul>\n<li>true&#xff1a;true \u6216 &#034;true&#034;<\/li>\n<li>false&#xff1a;false \u6216 &#034;false&#034;<\/li>\n<\/ul>\n<h4>\u4e8c\u8fdb\u5236\u6570\u636e<\/h4>\n<ul>\n<li>binary&#xff1a;\u7528\u4e8e\u5b58\u50a8 Base64 \u7f16\u7801\u7684\u5b57\u7b26\u4e32&#xff0c;\u4e14\u5b57\u7b26\u4e32\u4e2d\u4e0d\u80fd\u5305\u542b\u6362\u884c\u7b26\u3002<\/li>\n<\/ul>\n<h4>\u591a\u5b57\u6bb5\u7279\u6027<\/h4>\n<p>\u53ef\u5bf9\u4e00\u4e2a\u5b57\u6bb5\u6dfb\u52a0\u591a\u4e2a\u5b50\u5b57\u6bb5&#xff1a;<\/p>\n<p><span class=\"token string-property property\">&#034;title&#034;<\/span><span class=\"token operator\">:<\/span> <span class=\"token punctuation\">{<\/span><br \/>\n  <span class=\"token string-property property\">&#034;type&#034;<\/span><span class=\"token operator\">:<\/span> <span class=\"token string\">&#034;text&#034;<\/span><span class=\"token punctuation\">,<\/span><br \/>\n  <span class=\"token string-property property\">&#034;fields&#034;<\/span><span class=\"token operator\">:<\/span> <span class=\"token punctuation\">{<\/span><br \/>\n    <span class=\"token string-property property\">&#034;desc&#034;<\/span><span class=\"token operator\">:<\/span> <span class=\"token punctuation\">{<\/span> <span class=\"token string-property property\">&#034;type&#034;<\/span><span class=\"token operator\">:<\/span> <span class=\"token string\">&#034;keyword&#034;<\/span> <span class=\"token punctuation\">}<\/span>   # desc \u4e3a\u5b50\u5b57\u6bb5\u540d&#xff0c;\u53ef\u81ea\u5b9a\u4e49<br \/>\n  <span class=\"token punctuation\">}<\/span><br \/>\n<span class=\"token punctuation\">}<\/span><\/p>\n<h4>\u6570\u7ec4\u7c7b\u578b<\/h4>\n<p>\u4e00\u4e2a\u5b57\u6bb5\u53ef\u5305\u542b\u591a\u4e2a\u503c&#xff0c;\u4f46\u9700\u8981\u4fdd\u8bc1\u6240\u6709\u503c\u7684\u6570\u636e\u7c7b\u578b\u4e00\u81f4&#xff1a;<\/p>\n<p><span class=\"token punctuation\">{<\/span><br \/>\n  <span class=\"token string-property property\">&#034;ids&#034;<\/span><span class=\"token operator\">:<\/span> <span class=\"token punctuation\">[<\/span><span class=\"token number\">1<\/span><span class=\"token punctuation\">,<\/span> <span class=\"token number\">2<\/span><span class=\"token punctuation\">]<\/span><span class=\"token punctuation\">,<\/span><br \/>\n  <span class=\"token string-property property\">&#034;tags&#034;<\/span><span class=\"token operator\">:<\/span> <span class=\"token punctuation\">[<\/span><span class=\"token string\">&#034;one&#034;<\/span><span class=\"token punctuation\">,<\/span> <span class=\"token string\">&#034;two&#034;<\/span><span class=\"token punctuation\">]<\/span><span class=\"token punctuation\">,<\/span><br \/>\n  <span class=\"token string-property property\">&#034;users&#034;<\/span><span class=\"token operator\">:<\/span> <span class=\"token punctuation\">[<\/span> <span class=\"token punctuation\">{<\/span> <span class=\"token string-property property\">&#034;name&#034;<\/span><span class=\"token operator\">:<\/span> <span class=\"token string\">&#034;Mary&#034;<\/span><span class=\"token punctuation\">,<\/span> <span class=\"token string-property property\">&#034;age&#034;<\/span><span class=\"token operator\">:<\/span> <span class=\"token number\">12<\/span> <span class=\"token punctuation\">}<\/span><span class=\"token punctuation\">,<\/span> <span class=\"token punctuation\">{<\/span> <span class=\"token string-property property\">&#034;name&#034;<\/span><span class=\"token operator\">:<\/span> <span class=\"token string\">&#034;John&#034;<\/span><span class=\"token punctuation\">,<\/span> <span class=\"token string-property property\">&#034;age&#034;<\/span><span class=\"token operator\">:<\/span> <span class=\"token number\">10<\/span> <span class=\"token punctuation\">}<\/span> <span class=\"token punctuation\">]<\/span><br \/>\n<span class=\"token punctuation\">}<\/span><\/p>\n<h4>IP \u7c7b\u578b<\/h4>\n<ul>\n<li>ip&#xff1a;\u7528\u4e8e\u5b58\u50a8 IPv4 \u6216 IPv6 \u5730\u5740\u3002<\/li>\n<\/ul>\n<h3>\u56db\u3001\u6587\u6863\u64cd\u4f5c&#xff08;Document CRUD&#xff09;<\/h3>\n<p>\u7248\u672c\u8bf4\u660e&#xff1a;ES 7.0 \u8d77\u5e9f\u5f03\u4e86 type&#xff08;\u7c7b\u578b&#xff09;\u6982\u5ff5&#xff0c;8.0 \u5df2\u5f7b\u5e95\u79fb\u9664\u3002\u4e0b\u6587\u793a\u4f8b\u5747\u4f7f\u7528 7.x \/ 8.x \u7684 _doc \u5199\u6cd5&#xff08;\u7d22\u5f15\u540d\/_doc\/\u6587\u6863ID&#xff09;&#xff1b;\u82e5\u4f7f\u7528 5.x \u53ca\u66f4\u65e9\u7248\u672c&#xff0c;\u9700\u8981\u5728\u7d22\u5f15\u540d\u540e\u52a0\u4e0a &lt;\u7c7b\u578b\u540d\u79f0&gt;\u3002<\/p>\n<h4>4.1 \u521b\u5efa\u6587\u6863<\/h4>\n<p>PUT \u5fc5\u987b\u6307\u5b9a\u6587\u6863 id&#xff1b;POST \u53ef\u4e0d\u6307\u5b9a&#xff0c;\u4e0d\u6307\u5b9a\u65f6\u81ea\u52a8\u751f\u6210\u968f\u673a id\u3002<\/p>\n<p><span class=\"token comment\"># \u6307\u5b9a\u6587\u6863 id<\/span><br \/>\n<span class=\"token function\">curl<\/span> <span class=\"token parameter variable\">-XPUT<\/span> <span class=\"token string\">&#039;localhost:9200\/my_index\/_doc\/1?pretty&#039;<\/span> <span class=\"token parameter variable\">-H<\/span> <span class=\"token string\">&#039;Content-Type: application\/json&#039;<\/span> -d<span class=\"token string\">&#039;<br \/>\n{<br \/>\n  &#034;id&#034;: 101,<br \/>\n  &#034;name&#034;: &#034;zhangsan&#034;,<br \/>\n  &#034;age&#034;: 18<br \/>\n}<br \/>\n&#039;<\/span><\/p>\n<p><span class=\"token comment\"># \u4e0d\u6307\u5b9a\u6587\u6863 id&#xff08;\u968f\u673a\u751f\u6210&#xff09;<\/span><br \/>\n<span class=\"token function\">curl<\/span> <span class=\"token parameter variable\">-XPOST<\/span> <span class=\"token string\">&#039;localhost:9200\/my_index\/_doc?pretty&#039;<\/span> <span class=\"token parameter variable\">-H<\/span> <span class=\"token string\">&#039;Content-Type: application\/json&#039;<\/span> -d<span class=\"token string\">&#039;<br \/>\n{<br \/>\n  &#034;id&#034;: 102,<br \/>\n  &#034;name&#034;: &#034;lisi&#034;,<br \/>\n  &#034;age&#034;: 19<br \/>\n}<br \/>\n&#039;<\/span><\/p>\n<h4>4.2 \u67e5\u8be2\u6587\u6863<\/h4>\n<p><span class=\"token comment\"># \u67e5\u8be2\u6240\u6709\u6587\u6863<\/span><br \/>\n<span class=\"token function\">curl<\/span> <span class=\"token parameter variable\">-XGET<\/span> <span class=\"token string\">&#039;localhost:9200\/my_index\/_search?pretty&#039;<\/span><\/p>\n<p><span class=\"token comment\"># \u6839\u636e id \u67e5\u8be2\u6307\u5b9a\u6587\u6863<\/span><br \/>\n<span class=\"token function\">curl<\/span> <span class=\"token parameter variable\">-XGET<\/span> <span class=\"token string\">&#039;localhost:9200\/my_index\/_doc\/1?pretty&#039;<\/span><\/p>\n<h4>4.3 \u4fee\u6539\u6587\u6863<\/h4>\n<p><span class=\"token comment\"># \u5168\u91cf\u4fee\u6539&#xff1a;PUT \/ POST \u5747\u53ef&#xff0c;\u5168\u90e8\u5b57\u6bb5\u90fd\u4f1a\u88ab\u66f4\u65b0<\/span><br \/>\n<span class=\"token function\">curl<\/span> <span class=\"token parameter variable\">-XPOST<\/span> <span class=\"token string\">&#039;localhost:9200\/my_index\/_doc\/1?pretty&#039;<\/span> <span class=\"token parameter variable\">-H<\/span> <span class=\"token string\">&#039;Content-Type: application\/json&#039;<\/span> -d<span class=\"token string\">&#039;<br \/>\n{<br \/>\n  &#034;id&#034;: 105,<br \/>\n  &#034;name&#034;: &#034;wangwu&#034;,<br \/>\n  &#034;age&#034;: 20<br \/>\n}<br \/>\n&#039;<\/span><\/p>\n<p><span class=\"token comment\"># \u90e8\u5206\u4fee\u6539&#xff1a;POST &#043; _update&#xff0c;\u53ea\u4fee\u6539\u6307\u5b9a\u5b57\u6bb5<\/span><br \/>\n<span class=\"token function\">curl<\/span> <span class=\"token parameter variable\">-XPOST<\/span> <span class=\"token string\">&#039;localhost:9200\/my_index\/_doc\/1\/_update?pretty&#039;<\/span> <span class=\"token parameter variable\">-H<\/span> <span class=\"token string\">&#039;Content-Type: application\/json&#039;<\/span> <span class=\"token parameter variable\">-d<\/span> <span class=\"token string\">&#039;{&#034;doc&#034;: {&#034;age&#034;: 40}}&#039;<\/span><\/p>\n<h4>4.4 \u5220\u9664\u6587\u6863<\/h4>\n<p><span class=\"token function\">curl<\/span> <span class=\"token parameter variable\">-XDELETE<\/span> <span class=\"token string\">&#039;localhost:9200\/my_index\/_doc\/1?pretty&#039;<\/span><\/p>\n<h4>4.5 \u6e05\u7a7a\u6587\u6863<\/h4>\n<p><span class=\"token comment\"># \u6e05\u7a7a\u7d22\u5f15\u5168\u90e8\u6587\u6863<\/span><br \/>\n<span class=\"token function\">curl<\/span> <span class=\"token parameter variable\">-XPOST<\/span> <span class=\"token string\">&#039;localhost:9200\/my_index\/_delete_by_query?pretty&#039;<\/span> <span class=\"token parameter variable\">-H<\/span> <span class=\"token string\">&#039;Content-Type: application\/json&#039;<\/span> <span class=\"token parameter variable\">-d<\/span> <span class=\"token string\">&#039;{&#034;query&#034;: {&#034;match_all&#034;: {}}}&#039;<\/span><\/p>\n<p><span class=\"token comment\"># \u6309\u67e5\u8be2\u6761\u4ef6\u6e05\u7406\u90e8\u5206\u6587\u6863<\/span><br \/>\n<span class=\"token function\">curl<\/span> <span class=\"token parameter variable\">-XPOST<\/span> <span class=\"token string\">&#039;localhost:9200\/my_index\/_delete_by_query?pretty&#039;<\/span> <span class=\"token parameter variable\">-H<\/span> <span class=\"token string\">&#039;Content-Type: application\/json&#039;<\/span> <span class=\"token parameter variable\">-d<\/span> <span class=\"token string\">&#039;<br \/>\n{<br \/>\n  &#034;query&#034;: {<br \/>\n    &#034;bool&#034;: {<br \/>\n      &#034;filter&#034;: [<br \/>\n        { &#034;range&#034;: { &#034;age&#034;: { &#034;gte&#034;: 18, &#034;lt&#034;: 20 } } }<br \/>\n      ]<br \/>\n    }<br \/>\n  }<br \/>\n}<br \/>\n&#039;<\/span><\/p>\n<h3>\u4e94\u3001\u590d\u6742\u67e5\u8be2&#xff08;Complex Query&#xff09;<\/h3>\n<p>\u8bed\u53e5\u6761\u4ef6&#xff1a;match \u5339\u914d\u67e5\u8be2\u3001bool \u8054\u5408\u67e5\u8be2\u3001term \u7cbe\u786e\u67e5\u8be2 \u7ea6\u675f\u6761\u4ef6&#xff1a;must\u3001must_not\u3001should\u3001filter<\/p>\n<table>\n<tr>\u5173\u952e\u5b57\u8bf4\u660e<\/tr>\n<tbody>\n<tr>\n<td>match<\/td>\n<td>\u5148\u5206\u6790\u6587\u6863&#xff0c;\u901a\u8fc7\u5206\u8bcd\u5668\u89e3\u6790\u540e\u518d\u67e5\u8be2\u3002text \u7c7b\u578b\u53ef\u5206\u8bcd\u67e5\u8be2&#xff1b;keyword \u7c7b\u578b\u4e0d\u5206\u8bcd&#xff0c;\u4e0d\u652f\u6301\u5206\u8bcd\u67e5\u8be2<\/td>\n<\/tr>\n<tr>\n<td>term<\/td>\n<td>\u4e0d\u5206\u8bcd&#xff0c;\u53ea\u505a\u7cbe\u786e\u67e5\u8be2<\/td>\n<\/tr>\n<tr>\n<td>bool<\/td>\n<td>\u901a\u5e38\u642d\u914d must\u3001should\u3001must_not\u3001filter \u4f7f\u7528<\/td>\n<\/tr>\n<tr>\n<td>must \/ must_not<\/td>\n<td>\u5fc5\u987b\u6ee1\u8db3 \/ \u5fc5\u987b\u4e0d\u6ee1\u8db3&#xff0c;\u7c7b\u4f3c MySQL \u4e2d AND \u7684\u7528\u6cd5<\/td>\n<\/tr>\n<tr>\n<td>should<\/td>\n<td>\u6ee1\u8db3\u5176\u4e00\u5373\u53ef&#xff0c;\u7c7b\u4f3c MySQL \u4e2d OR \u7684\u7528\u6cd5<\/td>\n<\/tr>\n<tr>\n<td>filter<\/td>\n<td>\u8fc7\u6ee4\u67e5\u8be2<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h4>5.1 \u7b80\u5355\u67e5\u8be2&#xff08;term \u7cbe\u786e\u5339\u914d&#xff09;<\/h4>\n<p><span class=\"token function\">curl<\/span> <span class=\"token parameter variable\">-XGET<\/span> <span class=\"token string\">&#039;localhost:9200\/my_index\/_search?pretty&#039;<\/span> <span class=\"token parameter variable\">-H<\/span> <span class=\"token string\">&#039;Content-Type: application\/json&#039;<\/span> <span class=\"token parameter variable\">-d<\/span> <span class=\"token string\">&#039;<br \/>\n{<br \/>\n  &#034;query&#034;: {<br \/>\n    &#034;term&#034;: { &#034;name&#034;: &#034;zhangsan&#034; }<br \/>\n  }<br \/>\n}<br \/>\n&#039;<\/span><\/p>\n<h4>5.2 \u8fc7\u6ee4\u67e5\u8be2&#xff08;filter&#xff09;<\/h4>\n<p><span class=\"token function\">curl<\/span> <span class=\"token parameter variable\">-XGET<\/span> <span class=\"token string\">&#039;localhost:9200\/my_index\/_search?pretty&#039;<\/span> <span class=\"token parameter variable\">-H<\/span> <span class=\"token string\">&#039;Content-Type: application\/json&#039;<\/span> <span class=\"token parameter variable\">-d<\/span> <span class=\"token string\">&#039;<br \/>\n{<br \/>\n  &#034;query&#034;: {<br \/>\n    &#034;bool&#034;: {<br \/>\n      &#034;filter&#034;: [<br \/>\n        { &#034;range&#034;: { &#034;age&#034;: { &#034;gte&#034;: 18, &#034;lt&#034;: 20 } } }<br \/>\n      ]<br \/>\n    }<br \/>\n  }<br \/>\n}<br \/>\n&#039;<\/span><\/p>\n<h4>5.3 \u591a\u6761\u4ef6\u590d\u5408\u67e5\u8be2&#xff08;must&#xff09;<\/h4>\n<p><span class=\"token function\">curl<\/span> <span class=\"token parameter variable\">-XGET<\/span> <span class=\"token string\">&#039;localhost:9200\/my_index\/_search?pretty&#039;<\/span> <span class=\"token parameter variable\">-H<\/span> <span class=\"token string\">&#039;Content-Type: application\/json&#039;<\/span> <span class=\"token parameter variable\">-d<\/span> <span class=\"token string\">&#039;<br \/>\n{<br \/>\n  &#034;query&#034;: {<br \/>\n    &#034;bool&#034;: {<br \/>\n      &#034;must&#034;: [<br \/>\n        { &#034;term&#034;: { &#034;name&#034;: &#034;zhangsan&#034; } },<br \/>\n        { &#034;term&#034;: { &#034;age&#034;: 18 } }<br \/>\n      ]<br \/>\n    }<br \/>\n  }<br \/>\n}<br \/>\n&#039;<\/span><\/p>\n<h4>5.4 terms \u591a\u503c\u67e5\u8be2&#xff08;\u7c7b\u4f3c MySQL IN&#xff09;<\/h4>\n<p><span class=\"token function\">curl<\/span> <span class=\"token parameter variable\">-XGET<\/span> <span class=\"token string\">&#039;localhost:9200\/my_index\/_search?pretty&#039;<\/span> <span class=\"token parameter variable\">-H<\/span> <span class=\"token string\">&#039;Content-Type: application\/json&#039;<\/span> <span class=\"token parameter variable\">-d<\/span> <span class=\"token string\">&#039;<br \/>\n{<br \/>\n  &#034;query&#034;: {<br \/>\n    &#034;bool&#034;: {<br \/>\n      &#034;must&#034;: [<br \/>\n        { &#034;terms&#034;: { &#034;age&#034;: [18, 19, 20] } }<br \/>\n      ]<br \/>\n    }<br \/>\n  }<br \/>\n}<br \/>\n&#039;<\/span><\/p>\n<h4>5.5 should \u5d4c\u5957\u67e5\u8be2<\/h4>\n<p>\u6ce8\u610f&#xff1a;must \u548c should \u4e0d\u53ef\u4ee5\u5e76\u5217\u4f7f\u7528&#xff0c;must \u548c must_not \u53ef\u4ee5\u5e76\u5217\u4f7f\u7528\u3002<\/p>\n<p><span class=\"token function\">curl<\/span> <span class=\"token parameter variable\">-XGET<\/span> <span class=\"token string\">&#039;localhost:9200\/my_index\/_search?pretty&#039;<\/span> <span class=\"token parameter variable\">-H<\/span> <span class=\"token string\">&#039;Content-Type: application\/json&#039;<\/span> <span class=\"token parameter variable\">-d<\/span> <span class=\"token string\">&#039;<br \/>\n{<br \/>\n  &#034;query&#034;: {<br \/>\n    &#034;bool&#034;: {<br \/>\n      &#034;should&#034;: [<br \/>\n        {<br \/>\n          &#034;bool&#034;: {<br \/>\n            &#034;must&#034;: [<br \/>\n              { &#034;term&#034;: { &#034;name&#034;: &#034;zhangsan&#034; } },<br \/>\n              { &#034;term&#034;: { &#034;age&#034;: 18 } }<br \/>\n            ]<br \/>\n          }<br \/>\n        },<br \/>\n        {<br \/>\n          &#034;bool&#034;: {<br \/>\n            &#034;must&#034;: [<br \/>\n              { &#034;term&#034;: { &#034;id&#034;: 105 } },<br \/>\n              { &#034;term&#034;: { &#034;age&#034;: 18 } }<br \/>\n            ]<br \/>\n          }<br \/>\n        }<br \/>\n      ]<br \/>\n    }<br \/>\n  }<br \/>\n}<br \/>\n&#039;<\/span><\/p>\n<h3>\u516d\u3001\u96c6\u7fa4\u72b6\u6001\u5f02\u5e38&#xff08;Red&#xff09;\u5904\u7406<\/h3>\n<p>\u5f53\u96c6\u7fa4\u72b6\u6001\u4e3a Red \u65f6&#xff0c;\u8bf4\u660e\u96c6\u7fa4\u51fa\u73b0\u5f02\u5e38&#xff1a;\u6709\u4e3b\u5206\u7247\u672a\u5206\u914d&#xff0c;\u90e8\u5206\u6570\u636e\u4e0d\u53ef\u7528&#xff0c;\u9700\u8981\u53ca\u65f6\u6392\u67e5\u8282\u70b9\u72b6\u6001\u4e0e\u5206\u7247 \/ \u526f\u672c\u7684\u5206\u914d\u60c5\u51b5\u3002<\/p>\n<p>![[05_\u4e2d\u95f4\u4ef6\/ELK\/image\/18749913d295840de907ee9fde89687f_MD5.jpg]]<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u6587\u7ae0\u76ee\u5f55ES \u7d22\u5f15\u76f8\u5173\u64cd\u4f5c\u4e00\u3001\u5206\u7247&#xff08;Sharding&#xff09;\u539f\u7406\u96c6\u7fa4\u5065\u5eb7\u72b6\u6001&#xff08;Health Status&#xff09;\u4e3a\u4ec0\u4e48 ES \u53ea\u80fd\u4fee\u6539\u526f\u672c\u6570\u91cf&#xff0c;\u4e0d\u80fd\u4fee\u6539\u5206\u7247\u6570\u91cf&#xff1f;\u4e8c\u3001\u7d22\u5f15\u7ba1\u7406&#xff08;Index Management&#xff09;2.1 \u5e38\u7528\u64cd\u4f5c\u901f\u67e52.2 \u521b\u5efa\u7d22\u5f152.3 \u67e5\u770b\u7d22\u5f15\u4fe1\u606f2.4 \u4fee\u6539\u7d22\u5f15\u914d\u7f6e2.5 \u4fee\u6539\u7d22\u5f15\u5b57\u6bb5&#xff08;Mapping&#xff09;2.6 \u67e5\u770b\u7d22\u5f15\u5217\u88682.7 <\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[2296,99,44],"topic":[],"class_list":["post-94197","post","type-post","status-publish","format-standard","hentry","category-server","tag-elk","tag-java","tag-44"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v20.3 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>\u3010ELK\u3011-3 ELK\u7d22\u5f15 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.wsisp.com\/helps\/94197.html\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"\u3010ELK\u3011-3 ELK\u7d22\u5f15 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"og:description\" content=\"\u6587\u7ae0\u76ee\u5f55ES \u7d22\u5f15\u76f8\u5173\u64cd\u4f5c\u4e00\u3001\u5206\u7247&#xff08;Sharding&#xff09;\u539f\u7406\u96c6\u7fa4\u5065\u5eb7\u72b6\u6001&#xff08;Health Status&#xff09;\u4e3a\u4ec0\u4e48 ES \u53ea\u80fd\u4fee\u6539\u526f\u672c\u6570\u91cf&#xff0c;\u4e0d\u80fd\u4fee\u6539\u5206\u7247\u6570\u91cf&#xff1f;\u4e8c\u3001\u7d22\u5f15\u7ba1\u7406&#xff08;Index Management&#xff09;2.1 \u5e38\u7528\u64cd\u4f5c\u901f\u67e52.2 \u521b\u5efa\u7d22\u5f152.3 \u67e5\u770b\u7d22\u5f15\u4fe1\u606f2.4 \u4fee\u6539\u7d22\u5f15\u914d\u7f6e2.5 \u4fee\u6539\u7d22\u5f15\u5b57\u6bb5&#xff08;Mapping&#xff09;2.6 \u67e5\u770b\u7d22\u5f15\u5217\u88682.7\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.wsisp.com\/helps\/94197.html\" \/>\n<meta property=\"og:site_name\" content=\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"article:published_time\" content=\"2026-08-13T14:24:55+00:00\" \/>\n<meta name=\"author\" content=\"admin\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"\u4f5c\u8005\" \/>\n\t<meta name=\"twitter:data1\" content=\"admin\" \/>\n\t<meta name=\"twitter:label2\" content=\"\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4\" \/>\n\t<meta name=\"twitter:data2\" content=\"5 \u5206\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/94197.html\",\"url\":\"https:\/\/www.wsisp.com\/helps\/94197.html\",\"name\":\"\u3010ELK\u3011-3 ELK\u7d22\u5f15 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"isPartOf\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\"},\"datePublished\":\"2026-08-13T14:24:55+00:00\",\"dateModified\":\"2026-08-13T14:24:55+00:00\",\"author\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\"},\"breadcrumb\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/94197.html#breadcrumb\"},\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.wsisp.com\/helps\/94197.html\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/94197.html#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9875\",\"item\":\"https:\/\/www.wsisp.com\/helps\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"\u3010ELK\u3011-3 ELK\u7d22\u5f15\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\",\"url\":\"https:\/\/www.wsisp.com\/helps\/\",\"name\":\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"description\":\"\u9999\u6e2f\u670d\u52a1\u5668_\u9999\u6e2f\u4e91\u670d\u52a1\u5668\u8d44\u8baf_\u670d\u52a1\u5668\u5e2e\u52a9\u6587\u6863_\u670d\u52a1\u5668\u6559\u7a0b\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.wsisp.com\/helps\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"zh-Hans\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\",\"name\":\"admin\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-Hans\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery\",\"contentUrl\":\"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery\",\"caption\":\"admin\"},\"sameAs\":[\"http:\/\/wp.wsisp.com\"],\"url\":\"https:\/\/www.wsisp.com\/helps\/author\/admin\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"\u3010ELK\u3011-3 ELK\u7d22\u5f15 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","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":"https:\/\/www.wsisp.com\/helps\/94197.html","og_locale":"zh_CN","og_type":"article","og_title":"\u3010ELK\u3011-3 ELK\u7d22\u5f15 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","og_description":"\u6587\u7ae0\u76ee\u5f55ES \u7d22\u5f15\u76f8\u5173\u64cd\u4f5c\u4e00\u3001\u5206\u7247&#xff08;Sharding&#xff09;\u539f\u7406\u96c6\u7fa4\u5065\u5eb7\u72b6\u6001&#xff08;Health Status&#xff09;\u4e3a\u4ec0\u4e48 ES \u53ea\u80fd\u4fee\u6539\u526f\u672c\u6570\u91cf&#xff0c;\u4e0d\u80fd\u4fee\u6539\u5206\u7247\u6570\u91cf&#xff1f;\u4e8c\u3001\u7d22\u5f15\u7ba1\u7406&#xff08;Index Management&#xff09;2.1 \u5e38\u7528\u64cd\u4f5c\u901f\u67e52.2 \u521b\u5efa\u7d22\u5f152.3 \u67e5\u770b\u7d22\u5f15\u4fe1\u606f2.4 \u4fee\u6539\u7d22\u5f15\u914d\u7f6e2.5 \u4fee\u6539\u7d22\u5f15\u5b57\u6bb5&#xff08;Mapping&#xff09;2.6 \u67e5\u770b\u7d22\u5f15\u5217\u88682.7","og_url":"https:\/\/www.wsisp.com\/helps\/94197.html","og_site_name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","article_published_time":"2026-08-13T14:24:55+00:00","author":"admin","twitter_card":"summary_large_image","twitter_misc":{"\u4f5c\u8005":"admin","\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4":"5 \u5206"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.wsisp.com\/helps\/94197.html","url":"https:\/\/www.wsisp.com\/helps\/94197.html","name":"\u3010ELK\u3011-3 ELK\u7d22\u5f15 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","isPartOf":{"@id":"https:\/\/www.wsisp.com\/helps\/#website"},"datePublished":"2026-08-13T14:24:55+00:00","dateModified":"2026-08-13T14:24:55+00:00","author":{"@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41"},"breadcrumb":{"@id":"https:\/\/www.wsisp.com\/helps\/94197.html#breadcrumb"},"inLanguage":"zh-Hans","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.wsisp.com\/helps\/94197.html"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.wsisp.com\/helps\/94197.html#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"https:\/\/www.wsisp.com\/helps"},{"@type":"ListItem","position":2,"name":"\u3010ELK\u3011-3 ELK\u7d22\u5f15"}]},{"@type":"WebSite","@id":"https:\/\/www.wsisp.com\/helps\/#website","url":"https:\/\/www.wsisp.com\/helps\/","name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","description":"\u9999\u6e2f\u670d\u52a1\u5668_\u9999\u6e2f\u4e91\u670d\u52a1\u5668\u8d44\u8baf_\u670d\u52a1\u5668\u5e2e\u52a9\u6587\u6863_\u670d\u52a1\u5668\u6559\u7a0b","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.wsisp.com\/helps\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"zh-Hans"},{"@type":"Person","@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41","name":"admin","image":{"@type":"ImageObject","inLanguage":"zh-Hans","@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/image\/","url":"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery","contentUrl":"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery","caption":"admin"},"sameAs":["http:\/\/wp.wsisp.com"],"url":"https:\/\/www.wsisp.com\/helps\/author\/admin"}]}},"_links":{"self":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/94197","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/comments?post=94197"}],"version-history":[{"count":0,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/94197\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/media?parent=94197"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/categories?post=94197"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/tags?post=94197"},{"taxonomy":"topic","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/topic?post=94197"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}