{"id":16410,"date":"2023-12-05T10:24:19","date_gmt":"2023-12-05T02:24:19","guid":{"rendered":"https:\/\/wx.kaifamiao.info\/?p=16410"},"modified":"2023-12-16T11:21:02","modified_gmt":"2023-12-16T03:21:02","slug":"elasticsearch-de-ding-yi-ying-she","status":"publish","type":"post","link":"http:\/\/wx.kaifamiao.info\/index.php\/2023\/12\/05\/elasticsearch-de-ding-yi-ying-she\/","title":{"rendered":"Elasticsearch\u7684\u5b9a\u4e49\u6620\u5c04\uff1f"},"content":{"rendered":"<p>\u5728Elasticsearch\u4e2d\uff0c\u5b9a\u4e49\u6620\u5c04\u662f\u6307\u660e\u5982\u4f55\u5b58\u50a8\u548c\u7d22\u5f15\u6587\u6863\u4e2d\u5404\u4e2a\u5b57\u6bb5\u7684\u8fc7\u7a0b\u3002\u6620\u5c04\uff08Mapping\uff09\u5b9a\u4e49\u4e86\u7d22\u5f15\u4e2d\u7684\u5b57\u6bb5\u7c7b\u578b\u3001\u5206\u6790\u5668\u3001\u662f\u5426\u5b58\u50a8\u6e90\u6587\u6863\u7b49\u4fe1\u606f\u3002\u5408\u7406\u7684\u6620\u5c04\u6709\u52a9\u4e8e\u63d0\u9ad8\u641c\u7d22\u6548\u7387\u3001\u652f\u6301\u590d\u6742\u7684\u67e5\u8be2\uff0c\u5e76\u786e\u4fdd\u7d22\u5f15\u4e2d\u7684\u6570\u636e\u5f97\u5230\u6b63\u786e\u7684\u5b58\u50a8\u548c\u5904\u7406\u3002<\/p>\n<p>\u4ee5\u4e0b\u662f\u521b\u5efa\u548c\u5b9a\u4e49\u6620\u5c04\u7684\u4e00\u4e9b\u5efa\u8bae\u548c\u793a\u4f8b\uff1a<\/p>\n<ol>\n<li>\n<strong>\u624b\u52a8\u6620\u5c04\uff1a<\/strong><\/p>\n<ul>\n<li>\u53ef\u4ee5\u624b\u52a8\u5b9a\u4e49\u7d22\u5f15\u7684\u6620\u5c04\uff0c\u8fd9\u6837\u53ef\u4ee5\u66f4\u7cbe\u786e\u5730\u63a7\u5236\u5b57\u6bb5\u7684\u5904\u7406\u65b9\u5f0f\u3002\u624b\u52a8\u6620\u5c04\u901a\u5e38\u5728\u521b\u5efa\u7d22\u5f15\u65f6\u5b8c\u6210\u3002<\/li>\n<\/ul>\n<pre><code class=\"language-json\">PUT \/your_index\n{\n  &quot;mappings&quot;: {\n    &quot;properties&quot;: {\n      &quot;field1&quot;: {\n        &quot;type&quot;: &quot;text&quot;,\n        &quot;analyzer&quot;: &quot;standard&quot;\n      },\n      &quot;field2&quot;: {\n        &quot;type&quot;: &quot;keyword&quot;\n      }\n    }\n  }\n}\n<\/code><\/pre>\n<\/li>\n<li>\n<strong>\u81ea\u52a8\u6620\u5c04\uff1a<\/strong><\/p>\n<ul>\n<li>\u5982\u679c\u5728\u521b\u5efa\u7d22\u5f15\u65f6\u6ca1\u6709\u624b\u52a8\u5b9a\u4e49\u6620\u5c04\uff0cElasticsearch\u4f1a\u6839\u636e\u9996\u6b21\u7d22\u5f15\u7684\u6587\u6863\u81ea\u52a8\u63a8\u65ad\u6620\u5c04\u3002\u8fd9\u79f0\u4e3a\u81ea\u52a8\u6620\u5c04\u3002\u81ea\u52a8\u6620\u5c04\u5c1d\u8bd5\u6839\u636e\u6587\u6863\u4e2d\u7684\u5b57\u6bb5\u5185\u5bb9\u6765\u786e\u5b9a\u5b57\u6bb5\u7684\u7c7b\u578b\u3002<\/li>\n<\/ul>\n<pre><code class=\"language-json\">PUT \/your_index\n{\n  &quot;mappings&quot;: {\n    &quot;dynamic&quot;: &quot;true&quot;  \/\/ \u9ed8\u8ba4\u503c\u4e3a &quot;true&quot;\n  }\n}\n<\/code><\/pre>\n<\/li>\n<li>\n<strong>\u52a8\u6001\u6620\u5c04\u8bbe\u7f6e\uff1a<\/strong><\/p>\n<ul>\n<li>\u53ef\u4ee5\u8bbe\u7f6e\u52a8\u6001\u6620\u5c04\u7684\u884c\u4e3a\uff0c\u5305\u62ec\u542f\u7528\u6216\u7981\u7528\u52a8\u6001\u6620\u5c04\u3001\u5b9a\u4e49\u65e5\u671f\u683c\u5f0f\u3001\u5ffd\u7565\u5b57\u6bb5\u7b49\u3002<\/li>\n<\/ul>\n<pre><code class=\"language-json\">PUT \/your_index\n{\n  &quot;mappings&quot;: {\n    &quot;dynamic&quot;: &quot;strict&quot;,\n    &quot;date_detection&quot;: false,\n    &quot;properties&quot;: {\n      &quot;field1&quot;: {\n        &quot;type&quot;: &quot;text&quot;\n      },\n      &quot;field2&quot;: {\n        &quot;type&quot;: &quot;keyword&quot;\n      }\n    }\n  }\n}\n<\/code><\/pre>\n<\/li>\n<li>\n<strong>\u52a8\u6001\u6a21\u677f\uff1a<\/strong><\/p>\n<ul>\n<li>\u901a\u8fc7\u52a8\u6001\u6a21\u677f\uff0c\u53ef\u4ee5\u6839\u636e\u5b57\u6bb5\u540d\u7684\u6a21\u5f0f\u81ea\u52a8\u5e94\u7528\u6620\u5c04\u3002\u8fd9\u5bf9\u4e8e\u5177\u6709\u76f8\u4f3c\u547d\u540d\u89c4\u5219\u7684\u5b57\u6bb5\u975e\u5e38\u6709\u7528\u3002<\/li>\n<\/ul>\n<pre><code class=\"language-json\">PUT \/_template\/template_1\n{\n  &quot;index_patterns&quot;: [&quot;*&quot;],\n  &quot;mappings&quot;: {\n    &quot;dynamic_templates&quot;: [\n      {\n        &quot;strings&quot;: {\n          &quot;match_mapping_type&quot;: &quot;string&quot;,\n          &quot;mapping&quot;: {\n            &quot;type&quot;: &quot;text&quot;,\n            &quot;analyzer&quot;: &quot;standard&quot;\n          }\n        }\n      }\n    ]\n  }\n}\n<\/code><\/pre>\n<\/li>\n<\/ol>\n<p>\u6620\u5c04\u5b9a\u4e49\u5bf9\u4e8eElasticsearch\u7d22\u5f15\u4e2d\u7684\u6570\u636e\u975e\u5e38\u91cd\u8981\uff0c\u56e0\u4e3a\u5b83\u5f71\u54cd\u4e86\u6570\u636e\u7684\u5b58\u50a8\u3001\u68c0\u7d22\u548c\u5206\u6790\u65b9\u5f0f\u3002\u8bbe\u8ba1\u5408\u7406\u7684\u6620\u5c04\u6709\u52a9\u4e8e\u6700\u5927\u7a0b\u5ea6\u5730\u53d1\u6325Elasticsearch\u7684\u6027\u80fd\u548c\u529f\u80fd\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u5728Elasticsearch\u4e2d\uff0c\u5b9a\u4e49\u6620\u5c04\u662f\u6307\u660e\u5982\u4f55\u5b58\u50a8\u548c\u7d22\u5f15\u6587\u6863\u4e2d\u5404\u4e2a\u5b57\u6bb5\u7684\u8fc7\u7a0b\u3002\u6620\u5c04\uff08Mapping\uff09\u5b9a\u4e49\u4e86 [&hellip;]<\/p>\n","protected":false},"author":9,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[125],"tags":[],"class_list":["post-16410","post","type-post","status-publish","format-standard","hentry","category-elasticsearch"],"_links":{"self":[{"href":"http:\/\/wx.kaifamiao.info\/index.php\/wp-json\/wp\/v2\/posts\/16410","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/wx.kaifamiao.info\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/wx.kaifamiao.info\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/wx.kaifamiao.info\/index.php\/wp-json\/wp\/v2\/users\/9"}],"replies":[{"embeddable":true,"href":"http:\/\/wx.kaifamiao.info\/index.php\/wp-json\/wp\/v2\/comments?post=16410"}],"version-history":[{"count":2,"href":"http:\/\/wx.kaifamiao.info\/index.php\/wp-json\/wp\/v2\/posts\/16410\/revisions"}],"predecessor-version":[{"id":48425,"href":"http:\/\/wx.kaifamiao.info\/index.php\/wp-json\/wp\/v2\/posts\/16410\/revisions\/48425"}],"wp:attachment":[{"href":"http:\/\/wx.kaifamiao.info\/index.php\/wp-json\/wp\/v2\/media?parent=16410"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/wx.kaifamiao.info\/index.php\/wp-json\/wp\/v2\/categories?post=16410"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/wx.kaifamiao.info\/index.php\/wp-json\/wp\/v2\/tags?post=16410"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}