{"id":4370,"date":"2019-06-27T18:29:27","date_gmt":"2019-06-27T10:29:27","guid":{"rendered":"http:\/\/www.xttblog.com\/?p=4370"},"modified":"2019-06-27T18:29:27","modified_gmt":"2019-06-27T10:29:27","slug":"bat-%e9%9d%a2%e8%af%95-elasticsearch-%e5%bf%85%e4%bc%9a%e7%9f%a5%e8%af%86%e7%82%b9%e6%80%bb%e7%bb%93","status":"publish","type":"post","link":"https:\/\/www.xttblog.com\/?p=4370","title":{"rendered":"BAT \u9762\u8bd5 Elasticsearch \u5fc5\u4f1a\u77e5\u8bc6\u70b9\u603b\u7ed3"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">Elasticsearch \u662f\u4e0a\u5e02\u516c\u53f8 Elastic \u5f00\u6e90\u7684\u4e00\u4e2a\u4ea7\u54c1\u3002\u800c Elasticsearch \u652f\u6491\u4e86\u6574\u4e2a Elastic \u516c\u53f8\u7684\u5927\u7ea6 50 \u4ebf\u7f8e\u5143\u7684\u5e02\u503c\uff0c\u8fd9\u4e2a\u5e02\u503c\u8d85\u8fc7\u5927\u591a\u6570 A \u80a1\u516c\u53f8\u3002\u8fd9\u8db3\u4ee5\u8bf4\u660e\u4e86 Elasticsearch \u7684\u5546\u4e1a\u4ef7\u503c\u548c\u5728\u6574\u4e2a\u4e92\u8054\u7f51\u4e2d\u7684\u91cd\u8981\u6027\u3002<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u5bf9\u56fd\u5185\u516c\u53f8\u6765\u8bf4\uff0cElasticsearch \u57fa\u672c\u4e0a\u662f\u4e3b\u6d41\u516c\u53f8\u7684\u5fc5\u7528\u6280\u672f\u3002\u76ee\u524d\uff0c\u5df2\u77e5\u7684\u662f BAT\u3001\u6ef4\u6ef4\u3001\u5934\u6761\u3001\u7f8e\u56e2\u7b49\u90fd\u6709\u4f7f\u7528\uff0c\u6240\u4ee5\u5982\u679c\u4f60\u60f3\u53bb\u8fd9\u4e9b\u516c\u53f8\uff0cElasticsearch \u662f\u4e00\u9053\u4f60\u5fc5\u987b\u8981\u8de8\u8d8a\u7684\u574e\uff01<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u6700\u8fd1\u521a\u597d\u7fa4\u91cc\u6709\u4eba\u5728\u8ba8\u8bba Elasticsearch\uff0c\u4e3a\u4e86\u4fbf\u4e8e\u4ea4\u6d41\uff0c\u6211\u8fd9\u91cc\u7ed9\u6ca1\u6709\u57fa\u7840\uff0c\u6216\u8005\u5df2\u6709\u57fa\u7840\u7684 ES \u4f7f\u7528\u8005\u603b\u7ed3\u4e86\u4e00\u4e9b\u77e5\u8bc6\u70b9\uff0c\u5927\u5bb6\u4e00\u8d77\u7cbe\u8fdb\uff01<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter\"><img decoding=\"async\" src=\"https:\/\/images.weserv.nl\/?url=https:\/\/wx1.sinaimg.cn\/large\/8fa5dcfcgy1g4fvwmpgf6j21aw0fr0x4.jpg\" alt=\"\" \/><figcaption>Elasticsearch \u9762\u8bd5\u77e5\u8bc6\u70b9\u603b\u7ed3<\/figcaption><\/figure><\/div>\n\n\n\n<p class=\"wp-block-paragraph\">\u6574\u4e2a\u77e5\u8bc6\u70b9\uff0c\u53ef\u4ee5\u7528\u4e0a\u9762\u7684\u8fd9\u5f20\u56fe\u6765\u603b\u7ed3\u3002\u4e0b\u9762\u6211\u9488\u5bf9\u90e8\u5206\u77e5\u8bc6\u70b9\u505a\u4e00\u4e9b\u767d\u8bdd\u89e3\u8bfb\uff0c\u5168\u662f\u6211\u4e00\u5bb6\u4e4b\u8a00\uff0c\u4e0d\u59a5\u4e4b\u5904\uff0c\u8bf7\u52a0\u6211\u5fae\u4fe1\uff1axttblog\uff0c\u5e2e\u6211\u6307\u6b63\uff01<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Near Realtime\uff08NRT\uff09<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">NRT \u4ee3\u8868\u8fd1\u5b9e\u65f6\uff0c\u4e24\u4e2a\u610f\u601d\uff0c\u4ece\u5199\u5165\u6570\u636e\u5230\u6570\u636e\u53ef\u4ee5\u88ab\u641c\u7d22\u5230\u6709\u4e00\u4e2a\u5c0f\u5ef6\u8fdf\uff08\u5927\u6982 1 \u79d2\uff09\uff1b\u57fa\u4e8e es \u6267\u884c\u641c\u7d22\u548c\u5206\u6790\u53ef\u4ee5\u8fbe\u5230\u79d2\u7ea7\u3002\u8fd9\u4e2a\u7279\u70b9\u5f88\u91cd\u8981\uff0c\u4e3e\u4e2a\u4f8b\u5b50\uff0c\u7535\u5546\u7cfb\u7edf\u4e2d\uff0c\u65b0\u4e0a\u67b6\u4e00\u4e2a\u5546\u54c1\uff0c\u8fd9\u4e2a\u5546\u54c1\u80fd\u7acb\u9a6c\u88ab\u641c\u7d22\u5230\u3002\u4e0b\u67b6\u4e00\u4e2a\u5546\u54c1\uff0c\u5c06\u7acb\u9a6c\u4e0d\u4f1a\u663e\u793a\u5728\u641c\u7d22\u4e2d\u3002\u548c Hadoop \u76f8\u6bd4\uff0c\u8fd9\u4e00\u4e2a\u4f18\u70b9\u975e\u5e38\u7684\u660e\u663e\u3002<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u96c6\u7fa4\uff08Cluster\uff09<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u96c6\u7fa4\uff0cCluster\uff0c\u5305\u542b\u591a\u4e2a\u8282\u70b9\uff0c\u6bcf\u4e2a\u8282\u70b9\u5c5e\u4e8e\u54ea\u4e2a\u96c6\u7fa4\u662f\u901a\u8fc7\u4e00\u4e2a\u914d\u7f6e\uff08\u96c6\u7fa4\u540d\u79f0\uff0c\u9ed8\u8ba4\u662f elasticsearch\uff09\u6765\u51b3\u5b9a\u7684\uff0c\u5bf9\u4e8e\u4e2d\u5c0f\u578b\u5e94\u7528\u6765\u8bf4\uff0c\u521a\u5f00\u59cb\u4e00\u4e2a\u96c6\u7fa4\u5c31\u4e00\u4e2a\u8282\u70b9\u5f88\u6b63\u5e38\u3002elasticsearch \u7684\u96c6\u7fa4\u642d\u5efa\u7b80\u5355\u5e76\u4e14\u5bb9\u6613\u6269\u5c55\u3002<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u8282\u70b9\uff08Node\uff09<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u96c6\u7fa4\u4e2d\u7684\u6bcf\u4e00\u4e2a\u8282\u70b9\u4e5f\u6709\u4e00\u4e2a\u540d\u79f0\uff08\u9ed8\u8ba4\u662f\u968f\u673a\u5206\u914d\u7684\uff09\uff0c\u8282\u70b9\u540d\u79f0\u5f88\u91cd\u8981\uff08\u5728\u6267\u884c\u8fd0\u7ef4\u7ba1\u7406\u64cd\u4f5c\u7684\u65f6\u5019\uff09\uff0c\u9ed8\u8ba4\u8282\u70b9\u4f1a\u53bb\u52a0\u5165\u4e00\u4e2a\u540d\u79f0\u4e3a\u201celasticsearch\u201d\u7684\u96c6\u7fa4\uff0c\u5982\u679c\u76f4\u63a5\u542f\u52a8\u4e00\u5806\u8282\u70b9\uff0c\u90a3\u4e48\u5b83\u4eec\u4f1a\u81ea\u52a8\u7ec4\u6210\u4e00\u4e2a elasticsearch \u96c6\u7fa4\uff0c\u5f53\u7136\u4e00\u4e2a\u8282\u70b9\u4e5f\u53ef\u4ee5\u7ec4\u6210\u4e00\u4e2a elasticsearch \u96c6\u7fa4\u3002<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u6587\u6863\uff08Document\uff09<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u6587\u6863\u662f es \u4e2d\u7684\u6700\u5c0f\u6570\u636e\u5355\u5143\uff0c\u4e00\u4e2a document \u53ef\u4ee5\u662f\u4e00\u6761\u5ba2\u6237\u6570\u636e\uff0c\u4e00\u6761\u5546\u54c1\u5206\u7c7b\u6570\u636e\uff0c\u4e00\u6761\u8ba2\u5355\u6570\u636e\uff0c\u901a\u5e38\u7528 JSON \u6570\u636e\u7ed3\u6784\u8868\u793a\uff0c\u6bcf\u4e2a index \u4e0b\u7684 type \u4e2d\uff0c\u90fd\u53ef\u4ee5\u53bb\u5b58\u50a8\u591a\u4e2a document\u3002\u4e00\u4e2a document \u91cc\u9762\u6709\u591a\u4e2a field\uff0c\u6bcf\u4e2a field \u5c31\u662f\u4e00\u4e2a\u6570\u636e\u5b57\u6bb5\u3002<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter\"><img decoding=\"async\" src=\"https:\/\/images.weserv.nl\/?url=https:\/\/wx1.sinaimg.cn\/large\/8fa5dcfcgy1g4fvymikitj20dx099t9q.jpg\" alt=\"\" \/><figcaption>ES \u4e2d Document\u3001Index\u3001Type \u4e4b\u95f4\u7684\u5173\u7cfb<\/figcaption><\/figure><\/div>\n\n\n\n<p class=\"wp-block-paragraph\">\u8bf4\u767d\u4e86\uff0c\u4f60\u53ef\u4ee5\u628a\u4e00\u4e2a Document \u770b\u6210\u662f\u4e00\u4e2a\u7c7b\u3002field \u5c31\u662f\u7c7b\u4e2d\u7684\u5c5e\u6027\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>product document {\n    \"product_id\": \"1\",\n    \"product_name\": \"\u5c0f\u76ee\u6807\",\n    \"product_desc\": \"\u5c0f\u76ee\u6807\u7f50\u88c5\u5564\u9152\",\n    \"category_id\": \"2\",\n    \"category_name\": \"\u9152\u7c7b\u7528\u54c1\"\n}<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">\u4e0e\u5173\u7cfb\u578b\u6570\u636e\u5e93\u7684\u5bf9\u6bd4\uff1a<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter\"><img decoding=\"async\" src=\"https:\/\/images.weserv.nl\/?url=https:\/\/wx1.sinaimg.cn\/large\/8fa5dcfcgy1g4fw1cimebj20cf08gjsd.jpg\" alt=\"\" \/><figcaption>Elasticsearch VS RDBMS<\/figcaption><\/figure><\/div>\n\n\n\n<p class=\"wp-block-paragraph\">\u7d22\u5f15\uff08Index\uff09<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u7d22\u5f15\u662f\u5305\u542b\u4e00\u5806\u6709\u76f8\u4f3c\u7ed3\u6784\u7684\u6587\u6863\u6570\u636e\uff0c\u6bd4\u5982\u53ef\u4ee5\u6709\u4e00\u4e2a\u5ba2\u6237\u7d22\u5f15\uff0c\u5546\u54c1\u5206\u7c7b\u7d22\u5f15\uff0c\u8ba2\u5355\u7d22\u5f15\uff0c\u7d22\u5f15\u6709\u4e00\u4e2a\u540d\u79f0\u3002\u4e00\u4e2a index \u5305\u542b\u5f88\u591a document\uff0c\u4e00\u4e2a index \u5c31\u4ee3\u8868\u4e86\u4e00\u7c7b\u7c7b\u4f3c\u7684\u6216\u8005\u76f8\u540c\u7684 document\u3002\u6bd4\u5982\u8bf4\u5efa\u7acb\u4e00\u4e2a product index\uff0c\u5546\u54c1\u7d22\u5f15\uff0c\u91cc\u9762\u53ef\u80fd\u5c31\u5b58\u653e\u4e86\u6240\u6709\u7684\u5546\u54c1\u6570\u636e\uff0c\u6240\u6709\u7684\u5546\u54c1 document\u3002<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u7c7b\u578b\uff08Type\uff09<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u6bcf\u4e2a\u7d22\u5f15\u91cc\u90fd\u53ef\u4ee5\u6709\u4e00\u4e2a\u6216\u591a\u4e2a type\uff0ctype \u662f index \u4e2d\u7684\u4e00\u4e2a\u903b\u8f91\u6570\u636e\u5206\u7c7b\uff0c\u4e00\u4e2a type \u4e0b\u7684 document\uff0c\u90fd\u6709\u76f8\u540c\u7684 field\uff0c\u6bd4\u5982\u535a\u5ba2\u7cfb\u7edf\uff0c\u6709\u4e00\u4e2a\u7d22\u5f15\uff0c\u53ef\u4ee5\u5b9a\u4e49\u7528\u6237\u6570\u636e type\uff0c\u535a\u5ba2\u6570\u636e type\uff0c\u8bc4\u8bba\u6570\u636e type\u3002<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u6bd4\u5982\uff0c\u5546\u54c1 type\u3002\u65e5\u5316\u5546\u54c1 type\u3001\u7535\u5668\u5546\u54c1 type\u3001\u751f\u9c9c\u5546\u54c1 type\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>\u65e5\u5316\u5546\u54c1 type\uff1aproduct_id\uff0cproduct_name\uff0cproduct_desc\uff0ccategory_id\uff0ccategory_name\n\u7535\u5668\u5546\u54c1 type\uff1aproduct_id\uff0cproduct_name\uff0cproduct_desc\uff0ccategory_id\uff0ccategory_name\uff0cservice_period\n\u751f\u9c9c\u5546\u54c1 type\uff1aproduct_id\uff0cproduct_name\uff0cproduct_desc\uff0ccategory_id\uff0ccategory_name\uff0ceat_period<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">\u6bcf\u4e2a\u5546\u54c1 type \u4e2d\u53ef\u4ee5\u5305\u62ec\u591a\u4e2a Document\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>{\n  \"product_id\": \"2\",\n  \"product_name\": \"\u5c0f\u7c73\u7535\u89c6\",\n  \"product_desc\": \"4k\u9ad8\u6e05\",\n  \"category_id\": \"3\",\n  \"category_name\": \"\u7535\u5668\",\n  \"service_period\": \"1\u5e74\"\n},{\n  \"product_id\": \"3\",\n  \"product_name\": \"\u5c0f\u7c73\u7a7a\u8c03\",\n  \"product_desc\": \"\u4e92\u8054\u7f51\u7a7a\u8c03\",\n  \"category_id\": \"3\",\n  \"category_name\": \"\u7535\u5668\",\n  \"service_period\": \"1\u5e74\"\n}<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">\u5206\u7247\uff08Shard\uff09<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u5355\u53f0\u673a\u5668\u65e0\u6cd5\u5b58\u50a8\u5927\u91cf\u6570\u636e\uff0ces \u53ef\u4ee5\u5c06\u4e00\u4e2a\u7d22\u5f15\u4e2d\u7684\u6570\u636e\u5207\u5206\u4e3a\u591a\u4e2a shard\uff0c\u5206\u5e03\u5728\u591a\u53f0\u670d\u52a1\u5668\u4e0a\u5b58\u50a8\u3002\u6709\u4e86 shard \u5c31\u53ef\u4ee5\u6a2a\u5411\u6269\u5c55\uff0c\u5b58\u50a8\u66f4\u591a\u6570\u636e\uff0c\u8ba9\u641c\u7d22\u548c\u5206\u6790\u7b49\u64cd\u4f5c\u5206\u5e03\u5230\u591a\u53f0\u670d\u52a1\u5668\u4e0a\u53bb\u6267\u884c\uff0c\u63d0\u5347\u541e\u5410\u91cf\u548c\u6027\u80fd\u3002\u6bcf\u4e2a shard \u90fd\u662f\u4e00\u4e2a lucene index\u3002\u5206\u7247\u7684\u597d\u5904\u662f\uff1a\u5141\u8bb8\u6c34\u5e73\u5207\u5206\/\u6269\u5c55\u96c6\u7fa4\u5bb9\u91cf\uff1b\u53ef\u5728\u591a\u4e2a\u5206\u7247\u4e0a\u8fdb\u884c\u5206\u5e03\u5f0f\u7684\u3001\u5e76\u884c\u7684\u64cd\u4f5c\uff0c\u63d0\u9ad8\u7cfb\u7edf\u7684\u6027\u80fd\u548c\u541e\u5410\u91cf\u3002<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u526f\u672c\uff08replica\uff09<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u4efb\u4f55\u4e00\u4e2a\u670d\u52a1\u5668\u968f\u65f6\u53ef\u80fd\u6545\u969c\u6216\u5b95\u673a\uff0c\u6b64\u65f6 shard \u53ef\u80fd\u5c31\u4f1a\u4e22\u5931\uff0c\u56e0\u6b64\u53ef\u4ee5\u4e3a\u6bcf\u4e2a shard \u521b\u5efa\u591a\u4e2a replica \u526f\u672c\u3002replica \u53ef\u4ee5\u5728 shard \u6545\u969c\u65f6\u63d0\u4f9b\u5907\u7528\u670d\u52a1\uff0c\u4fdd\u8bc1\u6570\u636e\u4e0d\u4e22\u5931\uff0c\u591a\u4e2a replica \u8fd8\u53ef\u4ee5\u63d0\u5347\u641c\u7d22\u64cd\u4f5c\u7684\u541e\u5410\u91cf\u548c\u6027\u80fd\u3002primary shard\uff08\u5efa\u7acb\u7d22\u5f15\u65f6\u4e00\u6b21\u8bbe\u7f6e\uff0c\u4e0d\u80fd\u4fee\u6539\uff0c\u9ed8\u8ba4 5 \u4e2a\uff09\uff0creplica shard\uff08\u968f\u65f6\u4fee\u6539\u6570\u91cf\uff0c\u9ed8\u8ba41\u4e2a\uff09\uff0c\u9ed8\u8ba4\u6bcf\u4e2a\u7d22\u5f15 10 \u4e2a shard\uff0c5 \u4e2a primary shard\uff0c5 \u4e2a replica shard\uff0c\u6700\u5c0f\u7684\u9ad8\u53ef\u7528\u914d\u7f6e\uff0c\u662f 2 \u53f0\u670d\u52a1\u5668\u3002<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u526f\u672c\u4e3b\u8981\u89e3\u51b3\u5355\u70b9\u95ee\u9898\uff0c\u63d0\u9ad8\u53ef\u7528\u6027\u548c\u5bb9\u9519\u6027: \u67d0\u4e2a\u8282\u70b9\u5931\u8d25\u65f6\u670d\u52a1\u4e0d\u53d7\u5f71\u54cd, \u53ef\u4ee5\u4ece\u526f\u672c\u4e2d\u6062\u590d\uff1b\u63d0\u9ad8\u67e5\u8be2\u6548\u7387\u548c\u67e5\u8be2\u65f6\u7684\u541e\u5410\u91cf: \u641c\u7d22\u53ef\u4ee5\u5728\u6240\u6709\u7684\u526f\u672c\u4e0a\u5e76\u884c\u6267\u884c\uff0c\u63d0\u9ad8\u4e86\u670d\u52a1\u7684\u5e76\u53d1\u91cf\u3002\u4e3b\u5206\u7247\u548c\u526f\u672c\u5206\u7247\u4e0d\u80fd\u5b58\u50a8\u5728\u540c\u4e00\u4e2a\u8282\u70b9\u4e2d\uff0c\u56e0\u4e3a\u8fd9\u6837\u505a\u65e0\u6cd5\u4fdd\u8bc1\u9ad8\u53ef\u7528\u3002<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u6570\u636e\u6e90\uff08river\uff09<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u4ece\u5176\u4ed6\u5b58\u50a8\u65b9\u5f0f (\u5982\u6570\u636e\u5e93) \u4e2d\u540c\u6b65\u6570\u636e\u5230ES\u7684\u65b9\u6cd5, \u5b83\u662f\u4ee5\u63d2\u4ef6\u65b9\u5f0f\u5b58\u5728\u7684\u4e00\u4e2a ES \u670d\u52a1, \u901a\u8fc7\u8bfb\u53d6 river \u4e2d\u7684\u6570\u636e\u5e76\u628a\u5b83\u7d22\u5f15\u5230 ES \u4e2d\u3002\u5b98\u65b9\u7684 river \u6709 CouchDB\u3001RabbitMQ \u7b49\u3002<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u6620\u5c04\uff08mapping\uff09<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u7c7b\u4f3c\u4e8e\u5173\u7cfb\u6570\u636e\u5e93\u4e2d\u7684 Table \u7ed3\u6784\uff0c\u6bcf\u4e2a index \u90fd\u6709\u4e00\u4e2a\u6620\u5c04: \u5b9a\u4e49\u7d22\u5f15\u4e2d\u6bcf\u4e2a\u5b57\u6bb5\u7684\u7c7b\u578b\u3002\u6240\u6709\u6587\u6863\u5728\u5199\u8fdb\u7d22\u5f15\u4e4b\u524d\u90fd\u4f1a\u5148\u8fdb\u884c\u5206\u6790\uff0c\u5982\u4f55\u5bf9\u6587\u672c\u8fdb\u884c\u5206\u8bcd\u3001\u54ea\u4e9b\u8bcd\u6761\u53c8\u4f1a\u88ab\u8fc7\u6ee4\uff0c\u8fd9\u7c7b\u884c\u4e3a\u53eb\u505a\u6620\u5c04(mapping)\u3002\u6620\u5c04\u53ef\u4ee5\u63d0\u524d\u5b9a\u4e49\uff0c\u4e5f\u53ef\u4ee5\u5728\u7b2c\u4e00\u6b21\u5b58\u50a8\u6587\u6863\u65f6\u81ea\u52a8\u8bc6\u522b\uff0c\u4e00\u822c\u7531\u7528\u6237\u81ea\u5df1\u5b9a\u4e49\u89c4\u5219\u3002\u7c7b\u4f3c\u4e8e Solr \u4e2d schema.xml \u7ea6\u675f\u6587\u4ef6\u7684\u4f5c\u7528\u3002<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u5b57\u6bb5\uff08field\uff09<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u5b57\u6bb5\u53ef\u4ee5\u662f\u4e00\u4e2a\u7b80\u5355\u7684\u503c(\u5982\u5b57\u7b26\u4e32\u3001\u6570\u5b57\u3001\u65e5\u671f), \u4e5f\u53ef\u4ee5\u662f\u4e00\u4e2a\u6570\u7ec4\uff0c\u8fd8\u53ef\u4ee5\u5d4c\u5957\u4e00\u4e2a\u5bf9\u8c61\u6216\u591a\u4e2a\u5bf9\u8c61\u3002\u5b57\u6bb5\u7c7b\u4f3c\u4e8e\u5173\u7cfb\u6570\u636e\u5e93\u4e2d\u8868\u6570\u636e\u7684\u5217\uff0c\u6bcf\u4e2a\u5b57\u6bb5\u90fd\u5bf9\u5e94\u4e00\u4e2a\u7c7b\u578b\u3002\u53ef\u4ee5\u6307\u5b9a\u5982\u4f55\u5206\u6790\u67d0\u4e00\u5b57\u6bb5\u7684\u503c\uff0c\u5373\u5bf9 field \u6307\u5b9a\u5206\u8bcd\u5668\u3002<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u5206\u8bcd\uff08analysis\uff09<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">analysis \u662f\u5c06\u6587\u672c\u8f6c\u6362\u4e3a\u7d22\u5f15\u8bcd\u7684\u8fc7\u7a0b\uff0c\u5206\u6790\u7684\u7ed3\u679c\u4f9d\u8d56\u4e8e\u5206\u8bcd\u5668\u3002<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u6bd4\u5982: \u516c\u4f17\u53f7 \u4e1a\u4f59\u8349\u3001\u516c\u4f17\u53f7-\u4e1a\u4f59\u8349\u548c\u4e1a\u4f59\u8349 \u516c\u4f17\u53f7\u53ef\u80fd\u4f1a\u88ab\u5206\u6790\u6210\u76f8\u540c\u7684\u7d22\u5f15\u8bcd \u4e1a\u4f59\u8349\u548c\u516c\u4f17\u53f7\uff0c\u7136\u540e\u88ab\u5b58\u50a8\u5230 ES \u7684\u7d22\u5f15\u5e93\u4e2d\u3002\u5f53\u901a\u8fc7\u4e1a\u4f59\u8349\u8fdb\u884c\u5168\u6587\u641c\u7d22\u7684\u65f6\u5019\uff0c\u641c\u7d22\u5f15\u64ce\u6839\u636e\u5339\u914d\u8ba1\u7b97\u4e5f\u80fd\u5728\u7d22\u5f15\u5e93\u4e2d\u67e5\u627e\u5230\u76f8\u5173\u7684\u5185\u5bb9\u3002<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u7d22\u5f15\u8bcd\uff08term\uff09<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u5728 ES \u4e2d\uff0c\u7d22\u5f15\u8bcd(term)\u662f\u4e00\u4e2a\u80fd\u591f\u88ab\u7d22\u5f15\u7684\u7cbe\u786e\u503c\uff0c\u53ef\u4ee5\u901a\u8fc7 term query \u8fdb\u884c\u51c6\u786e\u641c\u7d22\u3002\u6bd4\u5982: \u4e1a\u4f59\u8349\u3001xttblog\u3001\u516c\u4f17\u53f7\u90fd\u662f\u4e0d\u540c\u7684\u7d22\u5f15\u8bcd\u3002<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u6587\u672c\uff08text\uff09<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u6587\u672c\u662f\u4e00\u6bb5\u666e\u901a\u7684\u975e\u7ed3\u6784\u5316\u6587\u5b57\uff0c\u901a\u957f\u6587\u672c\u4f1a\u88ab\u5206\u6790\u6210\u591a\u4e2a Term\uff0c\u5b58\u50a8\u5728 ES \u7684\u7d22\u5f15\u5e93\u4e2d\u3002\u6587\u672c\u5b57\u6bb5\u4e00\u822c\u9700\u8981\u5148\u5206\u6790\u518d\u5b58\u50a8\uff0c\u67e5\u8be2\u6587\u672c\u4e2d\u7684\u5173\u952e\u8bcd\u65f6\uff0c\u9700\u8981\u6839\u636e\u641c\u7d22\u6761\u4ef6\u641c\u7d22\u51fa\u539f\u6587\u672c\u3002<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u6570\u636e\u6062\u590d\uff08recovery\uff09<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u6570\u636e\u6062\u590d\u53c8\u53eb\u6570\u636e\u91cd\u65b0\u5206\u5e03\u3002\u5f53\u6709\u8282\u70b9\u52a0\u5165\u6216\u9000\u51fa\u65f6\uff0cES \u4f1a\u6839\u636e\u673a\u5668\u7684\u8d1f\u8f7d\u5bf9\u7d22\u5f15\u5206\u7247\u8fdb\u884c\u91cd\u65b0\u5206\u914d\uff0c\u6302\u6389\u7684\u8282\u70b9\u91cd\u65b0\u542f\u52a8\u65f6\u4e5f\u4f1a\u8fdb\u884c\u6570\u636e\u6062\u590d\u3002Kibana \u5de5\u5177\u4e2d\u901a\u8fc7 GET _cat\/health?v\uff0c\u5c31\u53ef\u4ee5\u770b\u5230\u96c6\u7fa4\u6240\u5904\u7684\u72b6\u6001\u3002<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u65f6\u95f4\u5173\u7cfb\uff0cElasticsearch \u76f8\u5173\u7684\u5404\u79cd\u6838\u5fc3\u6982\u5ff5\u548c\u77e5\u8bc6\u6211\u5c31\u5148\u603b\u7ed3\u5230\u8fd9\u91cc\u3002\u540e\u9762\u6709\u673a\u4f1a\uff0c\u6211\u518d\u603b\u7ed3\u4e00\u4e9b Elasticsearch \u7684\u4f7f\u7528\u573a\u666f\uff0c\u7f51\u5173\uff0cLucene\uff0c\u670d\u52a1\u53d1\u73b0\uff0c\u652f\u6301\u7684\u811a\u672c\uff0c\u63d2\u4ef6\u7b49\u6a21\u5757\u505a\u4e00\u4e9b\u603b\u7ed3\u3002<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u4ee5\u4e0a\u8fd9\u4e9b\u5e0c\u671b\u80fd\u591f\u5e2e\u52a9\u5230\u6bcf\u4e00\u4e2a\u4eba\uff0c\u4e00\u8d77\u7cbe\u8fdb\uff01<\/p>\n<!-- <audio autoplay=\"autoplay\" height=\"100\" width=\"100\" hidden=\"true\"><source src=\"https:\/\/c.coka.la\/orAvPR.mp3\" type=\"audio\/mp3\"\/><\/audio><img decoding=\"async\" src=\"https:\/\/images.weserv.nl\/?url=https:\/\/ws3.sinaimg.cn\/large\/8fa5dcfcgy1g4em3rzar5j20ib089ae0.jpg\" alt=\"\u4e1a\u4f59\u8349\u516c\u4f17\u53f7\"\/> --><p><!-- <img decoding=\"async\" src=\"https:\/\/raw.githubusercontent.com\/xmt1139057136\/xttblog\/master\/8fa5dcfcgy1g4em3rzar5j20ib089ae0.jpg\" alt=\"\u4e1a\u4f59\u8349\u516c\u4f17\u53f7\"\/>--><img decoding=\"async\" src=\"https:\/\/saas.51autoparts.cn\/api\/admin\/sys-file\/oss\/file?fileName=84db51f8561e448f9a4fda2eff0811f9.jpg\" alt=\"\u4e1a\u4f59\u8349\u516c\u4f17\u53f7\"\/><\/p><p>\u6700\u540e\uff0c\u6b22\u8fce\u5173\u6ce8\u6211\u7684\u4e2a\u4eba\u5fae\u4fe1\u516c\u4f17\u53f7\uff1a\u4e1a\u4f59\u8349\uff08yyucao\uff09\uff01<b>\u53ef\u52a0\u4f5c\u8005\u5fae\u4fe1\u53f7\uff1a<font color=\"red\">xttblog2<\/font>\u3002\u5907\u6ce8\uff1a\u201c1\u201d\uff0c\u6dfb\u52a0\u535a\u4e3b\u5fae\u4fe1\u62c9\u4f60\u8fdb\u5fae\u4fe1\u7fa4\u3002\u5907\u6ce8\u9519\u8bef\u4e0d\u4f1a\u540c\u610f\u597d\u53cb\u7533\u8bf7\u3002<\/b>\u518d\u6b21\u611f\u8c22\u60a8\u7684\u5173\u6ce8\uff01\u540e\u7eed\u6709\u7cbe\u5f69\u5185\u5bb9\u4f1a\u7b2c\u4e00\u65f6\u95f4\u53d1\u7ed9\u60a8\uff01\u539f\u521b\u6587\u7ae0\u6295\u7a3f\u8bf7\u53d1\u9001\u81f3532009913@qq.com\u90ae\u7bb1\u3002\u5546\u52a1\u5408\u4f5c\u4e5f\u53ef\u6dfb\u52a0\u4f5c\u8005\u5fae\u4fe1\u8fdb\u884c\u8054\u7cfb\uff01<\/p><p>\u672c\u6587\u539f\u6587\u51fa\u5904\uff1a<a href=\"https:\/\/www.xttblog.com\">\u4e1a\u4f59\u8349<\/a>\uff1a &raquo; <a href=\"https:\/\/www.xttblog.com\/?p=4370\">BAT \u9762\u8bd5 Elasticsearch \u5fc5\u4f1a\u77e5\u8bc6\u70b9\u603b\u7ed3<\/a><\/p><!-- <div class=\"bd-reward-stl\"><button id=\"bdRewardBtn\"><span><\/span><\/button><\/div> -->","protected":false},"excerpt":{"rendered":"<p>Elasticsearch \u662f\u4e0a\u5e02\u516c\u53f8 Elastic \u5f00\u6e90\u7684\u4e00\u4e2a\u4ea7\u54c1\u3002\u800c Elasticsearch \u652f\u6491\u4e86 [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[5],"tags":[1652,1444,1446,1447,1448],"class_list":["post-4370","post","type-post","status-publish","format-standard","hentry","category-java","tag-elasticsearch","tag-lucene","tag-lucene-","tag-solrlucene"],"_links":{"self":[{"href":"https:\/\/www.xttblog.com\/index.php?rest_route=\/wp\/v2\/posts\/4370","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.xttblog.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.xttblog.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.xttblog.com\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.xttblog.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=4370"}],"version-history":[{"count":1,"href":"https:\/\/www.xttblog.com\/index.php?rest_route=\/wp\/v2\/posts\/4370\/revisions"}],"predecessor-version":[{"id":4371,"href":"https:\/\/www.xttblog.com\/index.php?rest_route=\/wp\/v2\/posts\/4370\/revisions\/4371"}],"wp:attachment":[{"href":"https:\/\/www.xttblog.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=4370"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.xttblog.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=4370"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.xttblog.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=4370"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}