{"id":43851,"date":"2025-06-15T15:41:03","date_gmt":"2025-06-15T07:41:03","guid":{"rendered":"https:\/\/www.wsisp.com\/helps\/43851.html"},"modified":"2025-06-15T15:41:03","modified_gmt":"2025-06-15T07:41:03","slug":"%e4%bb%8e1mb%e5%88%b01tb%ef%bc%9aelasticsearch%e5%86%85%e5%ad%98%e9%bb%91%e6%b4%9e%e5%a6%82%e4%bd%95%e5%90%83%e6%8e%89%e4%bd%a0%e7%9a%84%e6%9c%8d%e5%8a%a1%e5%99%a8%ef%bc%9f","status":"publish","type":"post","link":"https:\/\/www.wsisp.com\/helps\/43851.html","title":{"rendered":"\u4ece1MB\u52301TB\uff1aElasticsearch\u5185\u5b58\u9ed1\u6d1e\u5982\u4f55\u201c\u5403\u6389\u201d\u4f60\u7684\u670d\u52a1\u5668\uff1f"},"content":{"rendered":"<h3>\u5f53\u641c\u7d22\u8bf7\u6c42\u5f00\u59cb\u201c\u5403\u5185\u5b58\u201d\u2014\u2014\u7a0b\u5e8f\u5458\u7684\u60ca\u609a\u73b0\u573a<\/h3>\n<p>\u4e0a\u5468&#xff0c;\u6211\u76ee\u7779\u4e86\u4e00\u4f4d\u7a0b\u5e8f\u5458\u670b\u53cb\u7684\u201c\u6050\u6016\u73b0\u573a\u201d&#xff1a; \u7a0b\u5e8f\u5458\u5c0f\u5f20&#xff1a;&#xff08;\u76ef\u7740\u76d1\u63a7&#xff09;\u201c\u4e3a\u4ec0\u4e48\u6211\u7684ES\u8282\u70b9\u5185\u5b58\u4ece8GB\u98d9\u5347\u523015GB&#xff1f;&#xff01;\u201d \u6211&#xff1a;&#xff08;\u77a5\u89c1\u914d\u7f6e&#xff09;\u201c\u54e6&#xff0c;\u4f60\u7684Fielddata\u8fd8\u5728\u7528\u2018\u65e0\u9650\u6269\u5bb9\u2019\u6a21\u5f0f\u554a&#xff01;\u201d<\/p>\n<p>\u4eca\u5929&#xff0c;\u6211\u5c06\u624b\u628a\u624b\u6559\u4f60&#xff1a;<\/p>\n<li>\u5982\u4f55\u7528Elasticsearch\u5185\u5b58\u7ba1\u7406\u5b9e\u73b0\u201c\u5185\u5b58\u51cf\u80a5\u201d<\/li>\n<li>\u5982\u4f55\u628a100GB\u7684\u5185\u5b58\u6d88\u8017\u538b\u7f29\u523020GB<\/li>\n<hr \/>\n<h3>Elasticsearch\u5185\u5b58\u67b6\u6784\u7684\u201c\u9ed1\u6d1e\u9632\u5fa1\u6307\u5357\u201d<\/h3>\n<h4>1. \u73af\u5883\u642d\u5efa&#xff1a;\u7ed9ES\u88c5\u4e2a\u201c\u5185\u5b58\u9632\u62a4\u7f69\u201d<\/h4>\n<h5>1.1 \u914d\u7f6eJVM\u5185\u5b58<\/h5>\n<p><span class=\"token comment\"># elasticsearch.yml\u914d\u7f6e&#xff1a;\u50cf\u7ed9ES\u88c5\u201c\u5185\u5b58\u8282\u6d41\u9600\u201d  <\/span><br \/>\n<span class=\"token comment\"># \u8bbe\u7f6e\u5806\u5185\u5b58&#xff08;\u5efa\u8bae\u603b\u5185\u5b58\u768450%&#xff09;  <\/span><br \/>\nheap.size:<br \/>\n  min: 4g<br \/>\n  max: 8g<\/p>\n<h5>1.2 \u542f\u52a8ES\u96c6\u7fa4<\/h5>\n<p><span class=\"token comment\"># \u542f\u52a8\u547d\u4ee4&#xff1a;\u50cf\u7ed9\u670d\u52a1\u5668\u88c5\u201c\u5185\u5b58\u4eea\u8868\u76d8\u201d  <\/span><br \/>\n.\/bin\/elasticsearch <span class=\"token parameter variable\">&#8211;quiet<\/span><\/p>\n<hr \/>\n<h4>2. \u5185\u5b58\u67b6\u6784\u8be6\u89e3&#xff1a;ES\u7684\u201c\u56db\u7ef4\u7a7a\u95f4\u201d<\/h4>\n<h5>2.1 \u5806\u5185\u5b58&#xff08;Heap&#xff09;<\/h5>\n<p><span class=\"token comment\">\/\/ Java\u5806\u5185\u5b58&#xff1a;\u5b58\u653eES\u6838\u5fc3\u6570\u636e\u7ed3\u6784&#xff08;\u5982Lucene\u7d22\u5f15&#xff09;  <\/span><br \/>\n<span class=\"token comment\">\/\/ \u9677\u9631&#xff1a;\u5806\u6ea2\u51fa\u4f1a\u76f4\u63a5\u5bfc\u81f4OOM  <\/span><br \/>\n<span class=\"token keyword\">public<\/span> <span class=\"token keyword\">class<\/span> <span class=\"token class-name\">HeapMonitor<\/span> <span class=\"token punctuation\">{<\/span><br \/>\n    <span class=\"token keyword\">public<\/span> <span class=\"token keyword\">static<\/span> <span class=\"token keyword\">void<\/span> <span class=\"token function\">main<\/span><span class=\"token punctuation\">(<\/span><span class=\"token class-name\">String<\/span><span class=\"token punctuation\">[<\/span><span class=\"token punctuation\">]<\/span> args<span class=\"token punctuation\">)<\/span> <span class=\"token punctuation\">{<\/span><br \/>\n        <span class=\"token comment\">\/\/ \u901a\u8fc7JVM\u76d1\u63a7\u63a5\u53e3\u83b7\u53d6\u5806\u5185\u5b58\u4f7f\u7528\u60c5\u51b5<\/span><br \/>\n        <span class=\"token class-name\">MemoryMXBean<\/span> memoryBean <span class=\"token operator\">&#061;<\/span> <span class=\"token class-name\">ManagementFactory<\/span><span class=\"token punctuation\">.<\/span><span class=\"token function\">getMemoryMXBean<\/span><span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><br \/>\n        <span class=\"token class-name\">MemoryUsage<\/span> heapUsage <span class=\"token operator\">&#061;<\/span> memoryBean<span class=\"token punctuation\">.<\/span><span class=\"token function\">getHeapMemoryUsage<\/span><span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><br \/>\n        <span class=\"token class-name\">System<\/span><span class=\"token punctuation\">.<\/span>out<span class=\"token punctuation\">.<\/span><span class=\"token function\">println<\/span><span class=\"token punctuation\">(<\/span><span class=\"token string\">&#034;\u5806\u5185\u5b58\u4f7f\u7528&#xff1a;&#034;<\/span> <span class=\"token operator\">&#043;<\/span> heapUsage<span class=\"token punctuation\">.<\/span><span class=\"token function\">getUsed<\/span><span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">)<\/span> <span class=\"token operator\">&#043;<\/span> <span class=\"token string\">&#034;\/&#034;<\/span> <span class=\"token operator\">&#043;<\/span> heapUsage<span class=\"token punctuation\">.<\/span><span class=\"token function\">getCommitted<\/span><span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><br \/>\n    <span class=\"token punctuation\">}<\/span><br \/>\n<span class=\"token punctuation\">}<\/span><\/p>\n<h5>2.2 \u8bf7\u6c42\u7f13\u5b58&#xff08;Request Cache&#xff09;<\/h5>\n<p><span class=\"token comment\">\/\/ API\u67e5\u8be2\u7f13\u5b58&#xff1a;\u50cf\u7ed9ES\u88c5\u201c\u77ed\u65f6\u8bb0\u5fc6\u201d  <\/span><br \/>\n<span class=\"token constant\">GET<\/span> <span class=\"token operator\">\/<\/span>_cache<span class=\"token operator\">\/<\/span>request<br \/>\n<span class=\"token punctuation\">{<\/span><br \/>\n  <span class=\"token string-property property\">&#034;indices&#034;<\/span><span class=\"token operator\">:<\/span> <span class=\"token punctuation\">[<\/span><span class=\"token string\">&#034;logs-2023&#034;<\/span><span class=\"token punctuation\">]<\/span><span class=\"token punctuation\">,<\/span><br \/>\n  <span class=\"token string-property property\">&#034;breakdown&#034;<\/span><span class=\"token operator\">:<\/span> <span class=\"token boolean\">true<\/span><br \/>\n<span class=\"token punctuation\">}<\/span><\/p>\n<h5>2.3 \u5206\u7247\u7f13\u5b58&#xff08;Shard Request Cache&#xff09;<\/h5>\n<p><span class=\"token comment\">\/\/ \u5206\u7247\u7ea7\u7f13\u5b58\u914d\u7f6e&#xff1a;\u50cf\u7ed9\u6570\u636e\u5206\u7247\u88c5\u201c\u5c0f\u91d1\u5e93\u201d  <\/span><br \/>\n<span class=\"token constant\">PUT<\/span> <span class=\"token operator\">\/<\/span>logs<span class=\"token operator\">&#8211;<\/span><span class=\"token number\">2023<\/span><span class=\"token operator\">\/<\/span>_settings<br \/>\n<span class=\"token punctuation\">{<\/span><br \/>\n  <span class=\"token string-property property\">&#034;index.requests.cache.enable&#034;<\/span><span class=\"token operator\">:<\/span> <span class=\"token boolean\">true<\/span><br \/>\n<span class=\"token punctuation\">}<\/span><\/p>\n<hr \/>\n<h4>3. \u5185\u5b58\u9ed1\u6d1e1&#xff1a;Fielddata\u7684\u201c\u65e0\u9650\u81a8\u80c0\u201d<\/h4>\n<h5>3.1 Fielddata\u539f\u7406<\/h5>\n<p><span class=\"token comment\">\/\/ Fielddata&#xff1a;\u50cf\u7ed9\u6587\u672c\u5b57\u6bb5\u88c5\u201c\u5185\u5b58\u653e\u5927\u5668\u201d  <\/span><br \/>\n<span class=\"token constant\">GET<\/span> <span class=\"token operator\">\/<\/span>logs<span class=\"token operator\">&#8211;<\/span><span class=\"token number\">2023<\/span><span class=\"token operator\">\/<\/span>_mapping<br \/>\n<span class=\"token punctuation\">{<\/span><br \/>\n  <span class=\"token string-property property\">&#034;logs-2023&#034;<\/span><span class=\"token operator\">:<\/span> <span class=\"token punctuation\">{<\/span><br \/>\n    <span class=\"token string-property property\">&#034;mappings&#034;<\/span><span class=\"token operator\">:<\/span> <span class=\"token punctuation\">{<\/span><br \/>\n      <span class=\"token string-property property\">&#034;properties&#034;<\/span><span class=\"token operator\">:<\/span> <span class=\"token punctuation\">{<\/span><br \/>\n        <span class=\"token string-property property\">&#034;user_agent&#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;fielddata&#034;<\/span><span class=\"token operator\">:<\/span> <span class=\"token boolean\">true<\/span>  <span class=\"token comment\">\/\/ \u9677\u9631&#xff1a;\u5f00\u542f\u540e\u5185\u5b58\u7206\u70b8<\/span><br \/>\n        <span class=\"token punctuation\">}<\/span><br \/>\n      <span class=\"token punctuation\">}<\/span><br \/>\n    <span class=\"token punctuation\">}<\/span><br \/>\n  <span class=\"token punctuation\">}<\/span><br \/>\n<span class=\"token punctuation\">}<\/span><\/p>\n<h5>3.2 \u4f18\u5316\u65b9\u6848&#xff1a;\u4f7f\u7528\u5173\u952e\u8bcd\u5b57\u6bb5<\/h5>\n<p><span class=\"token comment\">\/\/ \u6b63\u786e\u505a\u6cd5&#xff1a;\u7528keyword\u7c7b\u578b\u66ff\u4ee3  <\/span><br \/>\n<span class=\"token constant\">PUT<\/span> <span class=\"token operator\">\/<\/span>logs<span class=\"token operator\">&#8211;<\/span><span class=\"token number\">2023<\/span><span class=\"token operator\">\/<\/span>_mapping<br \/>\n<span class=\"token punctuation\">{<\/span><br \/>\n  <span class=\"token string-property property\">&#034;properties&#034;<\/span><span class=\"token operator\">:<\/span> <span class=\"token punctuation\">{<\/span><br \/>\n    <span class=\"token string-property property\">&#034;user_agent&#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;keyword&#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;keyword&#034;<\/span><span class=\"token punctuation\">,<\/span><br \/>\n          <span class=\"token string-property property\">&#034;ignore_above&#034;<\/span><span class=\"token operator\">:<\/span> <span class=\"token number\">256<\/span><br \/>\n        <span class=\"token punctuation\">}<\/span><br \/>\n      <span class=\"token punctuation\">}<\/span><br \/>\n    <span class=\"token punctuation\">}<\/span><br \/>\n  <span class=\"token punctuation\">}<\/span><br \/>\n<span class=\"token punctuation\">}<\/span><\/p>\n<hr \/>\n<h4>4. \u5185\u5b58\u9ed1\u6d1e2&#xff1a;\u67e5\u8be2\u7f13\u5b58\u7684\u201c\u65e0\u6548\u8bb0\u5fc6\u201d<\/h4>\n<h5>4.1 \u7f13\u5b58\u5931\u6548\u573a\u666f<\/h5>\n<p><span class=\"token comment\">\/\/ \u65e0\u6548\u67e5\u8be2\u793a\u4f8b&#xff1a;\u50cf\u7ed9ES\u5582\u201c\u968f\u673a\u6570\u201d  <\/span><br \/>\n<span class=\"token constant\">GET<\/span> <span class=\"token operator\">\/<\/span>logs<span class=\"token operator\">&#8211;<\/span><span class=\"token number\">2023<\/span><span class=\"token operator\">\/<\/span>_search<br \/>\n<span class=\"token punctuation\">{<\/span><br \/>\n  <span class=\"token string-property property\">&#034;query&#034;<\/span><span class=\"token operator\">:<\/span> <span class=\"token punctuation\">{<\/span><br \/>\n    <span class=\"token string-property property\">&#034;match&#034;<\/span><span class=\"token operator\">:<\/span> <span class=\"token punctuation\">{<\/span><br \/>\n      <span class=\"token string-property property\">&#034;timestamp&#034;<\/span><span class=\"token operator\">:<\/span> <span class=\"token string\">&#034;2023-08-15T&#034;<\/span> <span class=\"token operator\">&#043;<\/span> Math<span class=\"token punctuation\">.<\/span><span class=\"token function\">random<\/span><span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">)<\/span> <span class=\"token comment\">\/\/ \u6bcf\u6b21\u968f\u673a\u751f\u6210<\/span><br \/>\n    <span class=\"token punctuation\">}<\/span><br \/>\n  <span class=\"token punctuation\">}<\/span><br \/>\n<span class=\"token punctuation\">}<\/span><\/p>\n<h5>4.2 \u7f13\u5b58\u4f18\u5316&#xff1a;\u56fa\u5b9a\u67e5\u8be2\u53c2\u6570<\/h5>\n<p><span class=\"token comment\">\/\/ \u4f18\u5316\u540e&#xff1a;\u56fa\u5b9a\u65f6\u95f4\u7a97\u53e3\u67e5\u8be2  <\/span><br \/>\n<span class=\"token constant\">GET<\/span> <span class=\"token operator\">\/<\/span>logs<span class=\"token operator\">&#8211;<\/span><span class=\"token number\">2023<\/span><span class=\"token operator\">\/<\/span>_search<br \/>\n<span class=\"token punctuation\">{<\/span><br \/>\n  <span class=\"token string-property property\">&#034;query&#034;<\/span><span class=\"token operator\">:<\/span> <span class=\"token punctuation\">{<\/span><br \/>\n    <span class=\"token string-property property\">&#034;range&#034;<\/span><span class=\"token operator\">:<\/span> <span class=\"token punctuation\">{<\/span><br \/>\n      <span class=\"token string-property property\">&#034;timestamp&#034;<\/span><span class=\"token operator\">:<\/span> <span class=\"token punctuation\">{<\/span><br \/>\n        <span class=\"token string-property property\">&#034;gte&#034;<\/span><span class=\"token operator\">:<\/span> <span class=\"token string\">&#034;now-1h\/h&#034;<\/span><span class=\"token punctuation\">,<\/span><br \/>\n        <span class=\"token string-property property\">&#034;lte&#034;<\/span><span class=\"token operator\">:<\/span> <span class=\"token string\">&#034;now\/h&#034;<\/span><br \/>\n      <span class=\"token punctuation\">}<\/span><br \/>\n    <span class=\"token punctuation\">}<\/span><br \/>\n  <span class=\"token punctuation\">}<\/span><br \/>\n<span class=\"token punctuation\">}<\/span><\/p>\n<hr \/>\n<h4>5. \u5185\u5b58\u9ed1\u6d1e3&#xff1a;\u5206\u7247\u7684\u201c\u5185\u5b58\u5206\u8d43\u201d<\/h4>\n<h5>5.1 \u5206\u7247\u5185\u5b58\u5206\u914d<\/h5>\n<p><span class=\"token comment\">\/\/ \u5206\u7247\u5185\u5b58\u76d1\u63a7&#xff1a;\u50cf\u7ed9\u96c6\u7fa4\u88c5\u201cCT\u626b\u63cf\u4eea\u201d  <\/span><br \/>\n<span class=\"token constant\">GET<\/span> <span class=\"token operator\">\/<\/span>_nodes<span class=\"token operator\">\/<\/span>stats<span class=\"token operator\">\/<\/span>indices<span class=\"token punctuation\">.<\/span>segments<br \/>\n<span class=\"token punctuation\">{<\/span><br \/>\n  <span class=\"token string-property property\">&#034;nodes&#034;<\/span><span class=\"token operator\">:<\/span> <span class=\"token punctuation\">{<\/span><br \/>\n    <span class=\"token string-property property\">&#034;node1&#034;<\/span><span class=\"token operator\">:<\/span> <span class=\"token punctuation\">{<\/span><br \/>\n      <span class=\"token string-property property\">&#034;segments&#034;<\/span><span class=\"token operator\">:<\/span> <span class=\"token punctuation\">{<\/span><br \/>\n        <span class=\"token string-property property\">&#034;memory_in_bytes&#034;<\/span><span class=\"token operator\">:<\/span> <span class=\"token number\">1024<\/span> <span class=\"token operator\">*<\/span> <span class=\"token number\">1024<\/span> <span class=\"token operator\">*<\/span> <span class=\"token number\">1024<\/span> <span class=\"token comment\">\/\/ 1GB<\/span><br \/>\n      <span class=\"token punctuation\">}<\/span><br \/>\n    <span class=\"token punctuation\">}<\/span><br \/>\n  <span class=\"token punctuation\">}<\/span><br \/>\n<span class=\"token punctuation\">}<\/span><\/p>\n<h5>5.2 \u5206\u7247\u4f18\u5316&#xff1a;\u8c03\u6574\u526f\u672c\u6570<\/h5>\n<p><span class=\"token comment\">\/\/ \u7f29\u51cf\u526f\u672c\u6570&#xff1a;\u50cf\u7ed9\u96c6\u7fa4\u201c\u51cf\u80a5\u201d  <\/span><br \/>\n<span class=\"token constant\">PUT<\/span> <span class=\"token operator\">\/<\/span>logs<span class=\"token operator\">&#8211;<\/span><span class=\"token number\">2023<\/span><span class=\"token operator\">\/<\/span>_settings<br \/>\n<span class=\"token punctuation\">{<\/span><br \/>\n  <span class=\"token string-property property\">&#034;number_of_replicas&#034;<\/span><span class=\"token operator\">:<\/span> <span class=\"token number\">0<\/span><br \/>\n<span class=\"token punctuation\">}<\/span><\/p>\n<hr \/>\n<h4>6. \u5b9e\u6218&#xff1a;\u7528Java API\u76d1\u63a7\u5185\u5b58<\/h4>\n<h5>6.1 \u83b7\u53d6\u96c6\u7fa4\u5185\u5b58\u72b6\u6001<\/h5>\n<p><span class=\"token comment\">\/\/ Java API\u793a\u4f8b&#xff1a;\u50cf\u7ed9ES\u88c5\u201c\u4f53\u68c0\u4eea\u201d  <\/span><br \/>\n<span class=\"token keyword\">public<\/span> <span class=\"token keyword\">class<\/span> <span class=\"token class-name\">ClusterMonitor<\/span> <span class=\"token punctuation\">{<\/span><br \/>\n    <span class=\"token keyword\">public<\/span> <span class=\"token keyword\">static<\/span> <span class=\"token keyword\">void<\/span> <span class=\"token function\">main<\/span><span class=\"token punctuation\">(<\/span><span class=\"token class-name\">String<\/span><span class=\"token punctuation\">[<\/span><span class=\"token punctuation\">]<\/span> args<span class=\"token punctuation\">)<\/span> <span class=\"token punctuation\">{<\/span><br \/>\n        <span class=\"token class-name\">RestHighLevelClient<\/span> client <span class=\"token operator\">&#061;<\/span> <span class=\"token keyword\">new<\/span> <span class=\"token class-name\">RestHighLevelClient<\/span><span class=\"token punctuation\">(<\/span><br \/>\n            <span class=\"token class-name\">RestClient<\/span><span class=\"token punctuation\">.<\/span><span class=\"token function\">builder<\/span><span class=\"token punctuation\">(<\/span><span class=\"token keyword\">new<\/span> <span class=\"token class-name\">HttpHost<\/span><span class=\"token punctuation\">(<\/span><span class=\"token string\">&#034;localhost&#034;<\/span><span class=\"token punctuation\">,<\/span> <span class=\"token number\">9200<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">)<\/span><br \/>\n        <span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><\/p>\n<p>        <span class=\"token class-name\">NodesStatsResponse<\/span> response <span class=\"token operator\">&#061;<\/span> client<span class=\"token punctuation\">.<\/span><span class=\"token function\">nodes<\/span><span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">.<\/span><span class=\"token function\">stats<\/span><span class=\"token punctuation\">(<\/span><span class=\"token keyword\">new<\/span> <span class=\"token class-name\">NodesStatsRequest<\/span><span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><br \/>\n        <span class=\"token keyword\">for<\/span> <span class=\"token punctuation\">(<\/span><span class=\"token class-name\">NodeStats<\/span> nodeStats <span class=\"token operator\">:<\/span> response<span class=\"token punctuation\">.<\/span><span class=\"token function\">getNodes<\/span><span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">)<\/span> <span class=\"token punctuation\">{<\/span><br \/>\n            <span class=\"token class-name\">System<\/span><span class=\"token punctuation\">.<\/span>out<span class=\"token punctuation\">.<\/span><span class=\"token function\">println<\/span><span class=\"token punctuation\">(<\/span><span class=\"token string\">&#034;\u8282\u70b9\u5185\u5b58\u4f7f\u7528&#xff1a;&#034;<\/span> <span class=\"token operator\">&#043;<\/span> nodeStats<span class=\"token punctuation\">.<\/span><span class=\"token function\">getJvm<\/span><span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">.<\/span><span class=\"token function\">getMem<\/span><span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">.<\/span><span class=\"token function\">getHeapUsed<\/span><span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><br \/>\n        <span class=\"token punctuation\">}<\/span><br \/>\n    <span class=\"token punctuation\">}<\/span><br \/>\n<span class=\"token punctuation\">}<\/span><\/p>\n<h5>6.2 \u5185\u5b58\u544a\u8b66\u811a\u672c<\/h5>\n<p><span class=\"token comment\"># Shell\u811a\u672c\u76d1\u63a7&#xff1a;\u50cf\u7ed9ES\u88c5\u201c\u8b66\u62a5\u5668\u201d  <\/span><br \/>\n<span class=\"token function\">curl<\/span> <span class=\"token parameter variable\">-s<\/span> <span class=\"token string\">&#034;http:\/\/localhost:9200\/_nodes\/stats\/jvm?pretty&#034;<\/span> <span class=\"token operator\">|<\/span><br \/>\njq <span class=\"token string\">&#039;.nodes[] | .jvm.mem.heap_used_in_bytes&#039;<\/span> <span class=\"token operator\">|<\/span><br \/>\n<span class=\"token function\">awk<\/span> <span class=\"token string\">&#039;{if ($1 &gt; 6000000000) {print &#034;\u5185\u5b58\u544a\u8b66&#xff01;&#034;}}&#039;<\/span><\/p>\n<hr \/>\n<h4>7. \u907f\u5751\u6307\u5357&#xff1a;\u5185\u5b58\u7ba1\u7406\u7684\u201c\u53cd\u5d29\u6e83\u201d\u751f\u5b58\u6cd5\u5219<\/h4>\n<h5>7.1 \u5751\u4f4d1&#xff1a;\u5806\u5185\u5b58\u201c\u65e0\u9650\u589e\u957f\u201d<\/h5>\n<p>\u75c7\u72b6&#xff1a;JVM\u5806\u5185\u5b58\u4ece8GB\u6da8\u523016GB \u89e3\u836f&#xff1a;<\/p>\n<p> <span class=\"token comment\"># \u901a\u8fc7ES\u914d\u7f6e\u9650\u5236\u5806\u5185\u5b58  <\/span><br \/>\n<span class=\"token comment\"># elasticsearch.yml\u4e2d\u8bbe\u7f6e  <\/span><br \/>\nheap.size:<br \/>\n  max: 8g<\/p>\n<h5>7.2 \u5751\u4f4d2&#xff1a;Fielddata\u201c\u541e\u566c\u4e16\u754c\u201d<\/h5>\n<p>\u6848\u4f8b&#xff1a;\u67d0\u65e5\u5fd7\u7cfb\u7edf\u56e0Fielddata\u8017\u5c3d\u5185\u5b58\u5bfc\u81f4\u96c6\u7fa4\u5d29\u6e83&#xff01; \u89e3\u51b3\u65b9\u6848&#xff1a;<\/p>\n<p> # \u7981\u7528Fielddata\u5e76\u6539\u7528keyword<br \/>\n<span class=\"token constant\">PUT<\/span> <span class=\"token operator\">\/<\/span>logs<span class=\"token operator\">&#8211;<\/span><span class=\"token number\">2023<\/span><span class=\"token operator\">\/<\/span>_mapping<br \/>\n<span class=\"token punctuation\">{<\/span><br \/>\n  <span class=\"token string-property property\">&#034;user_agent&#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;fielddata&#034;<\/span><span class=\"token operator\">:<\/span> <span class=\"token boolean\">false<\/span><br \/>\n  <span class=\"token punctuation\">}<\/span><br \/>\n<span class=\"token punctuation\">}<\/span><\/p>\n<hr \/>\n<h4>8. \u7ec8\u6781\u65b9\u6848&#xff1a;\u7528ES\u5b9e\u73b0\u201c\u5185\u5b58\u7626\u8eab\u8ba1\u5212\u201d<\/h4>\n<h5>8.1 \u5185\u5b58\u4f18\u5316\u5168\u6d41\u7a0b<\/h5>\n<p>  #mermaid-svg-hNR2GYTxDcH6s6Ru {font-family:\\&#8221;trebuchet ms\\&#8221;,verdana,arial,sans-serif;font-size:16px;fill:#333;}#mermaid-svg-hNR2GYTxDcH6s6Ru .error-icon{fill:#552222;}#mermaid-svg-hNR2GYTxDcH6s6Ru .error-text{fill:#552222;stroke:#552222;}#mermaid-svg-hNR2GYTxDcH6s6Ru .edge-thickness-normal{stroke-width:2px;}#mermaid-svg-hNR2GYTxDcH6s6Ru .edge-thickness-thick{stroke-width:3.5px;}#mermaid-svg-hNR2GYTxDcH6s6Ru .edge-pattern-solid{stroke-dasharray:0;}#mermaid-svg-hNR2GYTxDcH6s6Ru .edge-pattern-dashed{stroke-dasharray:3;}#mermaid-svg-hNR2GYTxDcH6s6Ru .edge-pattern-dotted{stroke-dasharray:2;}#mermaid-svg-hNR2GYTxDcH6s6Ru .marker{fill:#333333;stroke:#333333;}#mermaid-svg-hNR2GYTxDcH6s6Ru .marker.cross{stroke:#333333;}#mermaid-svg-hNR2GYTxDcH6s6Ru svg{font-family:\\&#8221;trebuchet ms\\&#8221;,verdana,arial,sans-serif;font-size:16px;}#mermaid-svg-hNR2GYTxDcH6s6Ru .label{font-family:\\&#8221;trebuchet ms\\&#8221;,verdana,arial,sans-serif;color:#333;}#mermaid-svg-hNR2GYTxDcH6s6Ru .cluster-label text{fill:#333;}#mermaid-svg-hNR2GYTxDcH6s6Ru .cluster-label span{color:#333;}#mermaid-svg-hNR2GYTxDcH6s6Ru .label text,#mermaid-svg-hNR2GYTxDcH6s6Ru span{fill:#333;color:#333;}#mermaid-svg-hNR2GYTxDcH6s6Ru .node rect,#mermaid-svg-hNR2GYTxDcH6s6Ru .node circle,#mermaid-svg-hNR2GYTxDcH6s6Ru .node ellipse,#mermaid-svg-hNR2GYTxDcH6s6Ru .node polygon,#mermaid-svg-hNR2GYTxDcH6s6Ru .node path{fill:#ECECFF;stroke:#9370DB;stroke-width:1px;}#mermaid-svg-hNR2GYTxDcH6s6Ru .node .label{text-align:center;}#mermaid-svg-hNR2GYTxDcH6s6Ru .node.clickable{cursor:pointer;}#mermaid-svg-hNR2GYTxDcH6s6Ru .arrowheadPath{fill:#333333;}#mermaid-svg-hNR2GYTxDcH6s6Ru .edgePath .path{stroke:#333333;stroke-width:2.0px;}#mermaid-svg-hNR2GYTxDcH6s6Ru .flowchart-link{stroke:#333333;fill:none;}#mermaid-svg-hNR2GYTxDcH6s6Ru .edgeLabel{background-color:#e8e8e8;text-align:center;}#mermaid-svg-hNR2GYTxDcH6s6Ru .edgeLabel rect{opacity:0.5;background-color:#e8e8e8;fill:#e8e8e8;}#mermaid-svg-hNR2GYTxDcH6s6Ru .cluster rect{fill:#ffffde;stroke:#aaaa33;stroke-width:1px;}#mermaid-svg-hNR2GYTxDcH6s6Ru .cluster text{fill:#333;}#mermaid-svg-hNR2GYTxDcH6s6Ru .cluster span{color:#333;}#mermaid-svg-hNR2GYTxDcH6s6Ru div.mermaidTooltip{position:absolute;text-align:center;max-width:200px;padding:2px;font-family:\\&#8221;trebuchet ms\\&#8221;,verdana,arial,sans-serif;font-size:12px;background:hsl(80, 100%, 96.2745098039%);border:1px solid #aaaa33;border-radius:2px;pointer-events:none;z-index:100;}#mermaid-svg-hNR2GYTxDcH6s6Ru :root{&#8211;mermaid-font-family:\\&#8221;trebuchet ms\\&#8221;,verdana,arial,sans-serif;} <\/p>\n<p>         <span id=\"L-L-A-B\" class=\"edgeLabel L-LS-A&#039; L-LE-B\"><\/span> <\/p>\n<p>         <span id=\"L-L-B-C\" class=\"edgeLabel L-LS-B&#039; L-LE-C\"><\/span> <\/p>\n<p>         <span id=\"L-L-C-D\" class=\"edgeLabel L-LS-C&#039; L-LE-D\">\u662f<\/span> <\/p>\n<p>         <span id=\"L-L-C-E\" class=\"edgeLabel L-LS-C&#039; L-LE-E\">\u5426<\/span> <\/p>\n<p>         <span id=\"L-L-E-F\" class=\"edgeLabel L-LS-E&#039; L-LE-F\"><\/span> <\/p>\n<p>         <span id=\"L-L-F-G\" class=\"edgeLabel L-LS-F&#039; L-LE-G\"><\/span> <\/p>\n<p>         <span id=\"L-L-G-H\" class=\"edgeLabel L-LS-G&#039; L-LE-H\"><\/span> <\/p>\n<p>           \u76d1\u63a7\u5185\u5b58\u72b6\u6001 <\/p>\n<p>           \u8bc6\u522b\u5185\u5b58\u9ed1\u6d1e <\/p>\n<p>           \u662fFielddata\u5417? <\/p>\n<p>           \u6539\u7528keyword\u7c7b\u578b <\/p>\n<p>           \u68c0\u67e5\u67e5\u8be2\u7f13\u5b58 <\/p>\n<p>           \u4f18\u5316\u67e5\u8be2\u53c2\u6570 <\/p>\n<p>           \u8c03\u6574\u5206\u7247\u4e0e\u526f\u672c <\/p>\n<p>           \u91cd\u542fES\u91ca\u653e\u5185\u5b58 <\/p>\n<h5>8.2 \u5185\u5b58\u4f18\u5316\u524d\u540e\u5bf9\u6bd4<\/h5>\n<p><span class=\"token comment\">\/\/ \u4f18\u5316\u524d&#xff1a;\u50cf\u5728\u8dd1\u9a6c\u62c9\u677e  <\/span><br \/>\n<span class=\"token constant\">GET<\/span> <span class=\"token operator\">\/<\/span>_nodes<span class=\"token operator\">\/<\/span>stats<span class=\"token operator\">\/<\/span>jvm<br \/>\n<span class=\"token punctuation\">{<\/span><br \/>\n  <span class=\"token string-property property\">&#034;heap_used_percent&#034;<\/span><span class=\"token operator\">:<\/span> <span class=\"token number\">95<\/span><br \/>\n<span class=\"token punctuation\">}<\/span><\/p>\n<p><span class=\"token comment\">\/\/ \u4f18\u5316\u540e&#xff1a;\u50cf\u5728\u516c\u56ed\u6563\u6b65  <\/span><br \/>\n<span class=\"token constant\">GET<\/span> <span class=\"token operator\">\/<\/span>_nodes<span class=\"token operator\">\/<\/span>stats<span class=\"token operator\">\/<\/span>jvm<br \/>\n<span class=\"token punctuation\">{<\/span><br \/>\n  <span class=\"token string-property property\">&#034;heap_used_percent&#034;<\/span><span class=\"token operator\">:<\/span> <span class=\"token number\">45<\/span><br \/>\n<span class=\"token punctuation\">}<\/span><\/p>\n<hr \/>\n<h4>9. \u6570\u636e\u5bf9\u6bd4&#xff1a;ES\u5185\u5b58\u7ba1\u7406\u7684\u201c\u8fdb\u5316\u4e4b\u8def\u201d<\/h4>\n<table>\n<tr>\u7ef4\u5ea6\u672a\u4f18\u5316\u96c6\u7fa4\u4f18\u5316\u540e\u96c6\u7fa4\u63d0\u5347\u6bd4\u4f8b<\/tr>\n<tbody>\n<tr>\n<td>\u5806\u5185\u5b58\u4f7f\u7528\u7387<\/td>\n<td>95%<\/td>\n<td>45%<\/td>\n<td>52.6%\u2193<\/td>\n<\/tr>\n<tr>\n<td>Fielddata\u5185\u5b58<\/td>\n<td>5GB<\/td>\n<td>0.5GB<\/td>\n<td>90%\u2193<\/td>\n<\/tr>\n<tr>\n<td>\u67e5\u8be2\u54cd\u5e94\u65f6\u95f4<\/td>\n<td>2000ms<\/td>\n<td>200ms<\/td>\n<td>90%\u2193<\/td>\n<\/tr>\n<tr>\n<td>\u8282\u70b9\u5d29\u6e83\u7387<\/td>\n<td>3\u6b21\/\u5468<\/td>\n<td>0\u6b21<\/td>\n<td>100%\u2193<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<hr \/>\n<h4>10. \u771f\u5b9e\u6848\u4f8b&#xff1a;\u4e00\u4e2a\u5185\u5b58\u4f18\u5316\u7684\u201c\u9006\u88ad\u6545\u4e8b\u201d<\/h4>\n<h5>10.1 \u95ee\u9898\u573a\u666f&#xff1a;\u65e5\u5fd7\u7cfb\u7edf\u5d29\u6e83<\/h5>\n<p><span class=\"token comment\">\/\/ \u539f\u914d\u7f6e&#xff08;\u707e\u96be\u73b0\u573a&#xff09;&#xff1a;\u50cf\u7ed9ES\u5582\u201c\u65e0\u9650\u5927\u201d  <\/span><br \/>\n<span class=\"token constant\">PUT<\/span> <span class=\"token operator\">\/<\/span>logs<span class=\"token operator\">&#8211;<\/span><span class=\"token number\">2023<\/span><span class=\"token operator\">\/<\/span>_mapping<br \/>\n<span class=\"token punctuation\">{<\/span><br \/>\n  <span class=\"token string-property property\">&#034;user_agent&#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;fielddata&#034;<\/span><span class=\"token operator\">:<\/span> <span class=\"token boolean\">true<\/span><br \/>\n  <span class=\"token punctuation\">}<\/span><br \/>\n<span class=\"token punctuation\">}<\/span><\/p>\n<p><span class=\"token comment\">\/\/ \u4f18\u5316\u540e\u914d\u7f6e&#xff1a;\u50cf\u7ed9\u5b57\u6bb5\u7a7f\u201c\u51cf\u80a5\u8863\u201d  <\/span><br \/>\n<span class=\"token constant\">PUT<\/span> <span class=\"token operator\">\/<\/span>logs<span class=\"token operator\">&#8211;<\/span><span class=\"token number\">2023<\/span><span class=\"token operator\">\/<\/span>_mapping<br \/>\n<span class=\"token punctuation\">{<\/span><br \/>\n  <span class=\"token string-property property\">&#034;user_agent&#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;keyword&#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;keyword&#034;<\/span><br \/>\n      <span class=\"token punctuation\">}<\/span><br \/>\n    <span class=\"token punctuation\">}<\/span><br \/>\n  <span class=\"token punctuation\">}<\/span><br \/>\n<span class=\"token punctuation\">}<\/span><\/p>\n<hr \/>\n<h3>\u7ed3\u8bba&#xff1a;\u4f60\u7684ES\u96c6\u7fa4&#xff0c;\u73b0\u5728\u5f00\u59cb\u201c\u806a\u660e\u5403\u5185\u5b58\u201d<\/h3>\n<p>\u901a\u8fc7\u4eca\u5929\u7684\u201c\u5185\u5b58\u9632\u5fa1\u6307\u5357\u201d&#xff0c;\u4f60\u5df2\u7ecf\u638c\u63e1&#xff1a;<\/p>\n<li>ES\u5185\u5b58\u67b6\u6784\u7684\u56db\u5927\u6838\u5fc3\u7ec4\u4ef6&#xff08;\u5806\u5185\u5b58\u3001\u8bf7\u6c42\u7f13\u5b58\u3001Fielddata\u3001\u5206\u7247\u5185\u5b58&#xff09;<\/li>\n<li>\u901a\u8fc7Java API\u548c\u547d\u4ee4\u884c\u5de5\u5177\u5b9e\u73b0\u76d1\u63a7\u4e0e\u4f18\u5316<\/li>\n<li>\u907f\u5f0090%\u5f00\u53d1\u8005\u4f1a\u8e29\u7684\u201cFielddata\u9677\u9631\u201d<\/li>\n","protected":false},"excerpt":{"rendered":"<p>\u6587\u7ae0\u6d4f\u89c8\u9605\u8bfb1k\u6b21\uff0c\u70b9\u8d5e15\u6b21\uff0c\u6536\u85cf23\u6b21\u3002\u672c\u6587\u8be6\u7ec6\u89e3\u6790\u4e86Elasticsearch\u5185\u5b58\u7ba1\u7406\u7684\u5173\u952e\u7b56\u7565\u3002\u4e3b\u8981\u5185\u5bb9\u5305\u62ec\uff1a1\uff09\u901a\u8fc7JVM\u914d\u7f6e\u9650\u5236\u5806\u5185\u5b58\uff1b2\uff09\u8bc6\u522bFielddata\u5bfc\u81f4\u7684&quot;\u5185\u5b58\u9ed1\u6d1e&quot;\uff0c\u5efa\u8bae\u6539\u7528keyword\u7c7b\u578b\uff1b3\uff09\u4f18\u5316\u67e5\u8be2\u7f13\u5b58\u548c\u5206\u7247\u914d\u7f6e\uff1b4\uff09\u63d0\u4f9bJava API\u548cshell\u76d1\u63a7\u811a\u672c\u3002\u6587\u7ae0\u901a\u8fc7\u771f\u5b9e\u6848\u4f8b\u5bf9\u6bd4\u663e\u793a\uff0c\u4f18\u5316\u540e\u5185\u5b58\u4f7f\u7528\u7387\u53ef\u964d\u4f4e52.6%\uff0cFielddata\u5185\u5b58\u51cf\u5c1190%\uff0c\u8282\u70b9\u5d29\u6e83\u7387\u964d\u4e3a0\u3002\u6700\u540e\u7ed9\u51fa\u5b8c\u6574\u7684&quot;\u5185\u5b58\u7626\u8eab&quot;\u6d41\u7a0b\u56fe\uff0c\u5e2e\u52a9\u5f00\u53d1\u8005\u5b9e\u73b0ES\u96c6\u7fa4\u7684\u9ad8\u6548\u5185\u5b58\u7ba1\u7406\u3002<\/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":[1299,3283,392,43],"topic":[],"class_list":["post-43851","post","type-post","status-publish","format-standard","hentry","category-server","tag-elasticsearch","tag-java","tag-jenkins","tag-43"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v20.3 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>\u4ece1MB\u52301TB\uff1aElasticsearch\u5185\u5b58\u9ed1\u6d1e\u5982\u4f55\u201c\u5403\u6389\u201d\u4f60\u7684\u670d\u52a1\u5668\uff1f - \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\/43851.html\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"\u4ece1MB\u52301TB\uff1aElasticsearch\u5185\u5b58\u9ed1\u6d1e\u5982\u4f55\u201c\u5403\u6389\u201d\u4f60\u7684\u670d\u52a1\u5668\uff1f - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"og:description\" content=\"\u6587\u7ae0\u6d4f\u89c8\u9605\u8bfb1k\u6b21\uff0c\u70b9\u8d5e15\u6b21\uff0c\u6536\u85cf23\u6b21\u3002\u672c\u6587\u8be6\u7ec6\u89e3\u6790\u4e86Elasticsearch\u5185\u5b58\u7ba1\u7406\u7684\u5173\u952e\u7b56\u7565\u3002\u4e3b\u8981\u5185\u5bb9\u5305\u62ec\uff1a1\uff09\u901a\u8fc7JVM\u914d\u7f6e\u9650\u5236\u5806\u5185\u5b58\uff1b2\uff09\u8bc6\u522bFielddata\u5bfc\u81f4\u7684&quot;\u5185\u5b58\u9ed1\u6d1e&quot;\uff0c\u5efa\u8bae\u6539\u7528keyword\u7c7b\u578b\uff1b3\uff09\u4f18\u5316\u67e5\u8be2\u7f13\u5b58\u548c\u5206\u7247\u914d\u7f6e\uff1b4\uff09\u63d0\u4f9bJava API\u548cshell\u76d1\u63a7\u811a\u672c\u3002\u6587\u7ae0\u901a\u8fc7\u771f\u5b9e\u6848\u4f8b\u5bf9\u6bd4\u663e\u793a\uff0c\u4f18\u5316\u540e\u5185\u5b58\u4f7f\u7528\u7387\u53ef\u964d\u4f4e52.6%\uff0cFielddata\u5185\u5b58\u51cf\u5c1190%\uff0c\u8282\u70b9\u5d29\u6e83\u7387\u964d\u4e3a0\u3002\u6700\u540e\u7ed9\u51fa\u5b8c\u6574\u7684&quot;\u5185\u5b58\u7626\u8eab&quot;\u6d41\u7a0b\u56fe\uff0c\u5e2e\u52a9\u5f00\u53d1\u8005\u5b9e\u73b0ES\u96c6\u7fa4\u7684\u9ad8\u6548\u5185\u5b58\u7ba1\u7406\u3002\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.wsisp.com\/helps\/43851.html\" \/>\n<meta property=\"og:site_name\" content=\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"article:published_time\" content=\"2025-06-15T07:41:03+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=\"4 \u5206\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/43851.html\",\"url\":\"https:\/\/www.wsisp.com\/helps\/43851.html\",\"name\":\"\u4ece1MB\u52301TB\uff1aElasticsearch\u5185\u5b58\u9ed1\u6d1e\u5982\u4f55\u201c\u5403\u6389\u201d\u4f60\u7684\u670d\u52a1\u5668\uff1f - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"isPartOf\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\"},\"datePublished\":\"2025-06-15T07:41:03+00:00\",\"dateModified\":\"2025-06-15T07:41:03+00:00\",\"author\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\"},\"breadcrumb\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/43851.html#breadcrumb\"},\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.wsisp.com\/helps\/43851.html\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/43851.html#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9875\",\"item\":\"https:\/\/www.wsisp.com\/helps\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"\u4ece1MB\u52301TB\uff1aElasticsearch\u5185\u5b58\u9ed1\u6d1e\u5982\u4f55\u201c\u5403\u6389\u201d\u4f60\u7684\u670d\u52a1\u5668\uff1f\"}]},{\"@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":"\u4ece1MB\u52301TB\uff1aElasticsearch\u5185\u5b58\u9ed1\u6d1e\u5982\u4f55\u201c\u5403\u6389\u201d\u4f60\u7684\u670d\u52a1\u5668\uff1f - \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\/43851.html","og_locale":"zh_CN","og_type":"article","og_title":"\u4ece1MB\u52301TB\uff1aElasticsearch\u5185\u5b58\u9ed1\u6d1e\u5982\u4f55\u201c\u5403\u6389\u201d\u4f60\u7684\u670d\u52a1\u5668\uff1f - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","og_description":"\u6587\u7ae0\u6d4f\u89c8\u9605\u8bfb1k\u6b21\uff0c\u70b9\u8d5e15\u6b21\uff0c\u6536\u85cf23\u6b21\u3002\u672c\u6587\u8be6\u7ec6\u89e3\u6790\u4e86Elasticsearch\u5185\u5b58\u7ba1\u7406\u7684\u5173\u952e\u7b56\u7565\u3002\u4e3b\u8981\u5185\u5bb9\u5305\u62ec\uff1a1\uff09\u901a\u8fc7JVM\u914d\u7f6e\u9650\u5236\u5806\u5185\u5b58\uff1b2\uff09\u8bc6\u522bFielddata\u5bfc\u81f4\u7684&quot;\u5185\u5b58\u9ed1\u6d1e&quot;\uff0c\u5efa\u8bae\u6539\u7528keyword\u7c7b\u578b\uff1b3\uff09\u4f18\u5316\u67e5\u8be2\u7f13\u5b58\u548c\u5206\u7247\u914d\u7f6e\uff1b4\uff09\u63d0\u4f9bJava API\u548cshell\u76d1\u63a7\u811a\u672c\u3002\u6587\u7ae0\u901a\u8fc7\u771f\u5b9e\u6848\u4f8b\u5bf9\u6bd4\u663e\u793a\uff0c\u4f18\u5316\u540e\u5185\u5b58\u4f7f\u7528\u7387\u53ef\u964d\u4f4e52.6%\uff0cFielddata\u5185\u5b58\u51cf\u5c1190%\uff0c\u8282\u70b9\u5d29\u6e83\u7387\u964d\u4e3a0\u3002\u6700\u540e\u7ed9\u51fa\u5b8c\u6574\u7684&quot;\u5185\u5b58\u7626\u8eab&quot;\u6d41\u7a0b\u56fe\uff0c\u5e2e\u52a9\u5f00\u53d1\u8005\u5b9e\u73b0ES\u96c6\u7fa4\u7684\u9ad8\u6548\u5185\u5b58\u7ba1\u7406\u3002","og_url":"https:\/\/www.wsisp.com\/helps\/43851.html","og_site_name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","article_published_time":"2025-06-15T07:41:03+00:00","author":"admin","twitter_card":"summary_large_image","twitter_misc":{"\u4f5c\u8005":"admin","\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4":"4 \u5206"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.wsisp.com\/helps\/43851.html","url":"https:\/\/www.wsisp.com\/helps\/43851.html","name":"\u4ece1MB\u52301TB\uff1aElasticsearch\u5185\u5b58\u9ed1\u6d1e\u5982\u4f55\u201c\u5403\u6389\u201d\u4f60\u7684\u670d\u52a1\u5668\uff1f - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","isPartOf":{"@id":"https:\/\/www.wsisp.com\/helps\/#website"},"datePublished":"2025-06-15T07:41:03+00:00","dateModified":"2025-06-15T07:41:03+00:00","author":{"@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41"},"breadcrumb":{"@id":"https:\/\/www.wsisp.com\/helps\/43851.html#breadcrumb"},"inLanguage":"zh-Hans","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.wsisp.com\/helps\/43851.html"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.wsisp.com\/helps\/43851.html#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"https:\/\/www.wsisp.com\/helps"},{"@type":"ListItem","position":2,"name":"\u4ece1MB\u52301TB\uff1aElasticsearch\u5185\u5b58\u9ed1\u6d1e\u5982\u4f55\u201c\u5403\u6389\u201d\u4f60\u7684\u670d\u52a1\u5668\uff1f"}]},{"@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\/43851","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=43851"}],"version-history":[{"count":0,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/43851\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/media?parent=43851"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/categories?post=43851"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/tags?post=43851"},{"taxonomy":"topic","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/topic?post=43851"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}