{"id":3827,"date":"2021-11-10T22:01:20","date_gmt":"2021-11-10T13:01:20","guid":{"rendered":"https:\/\/www.skyer9.pe.kr\/wordpress\/?p=3827"},"modified":"2021-11-14T19:54:43","modified_gmt":"2021-11-14T10:54:43","slug":"elasticsearch-%ea%b2%80%ec%83%89%ec%96%b4%ec%97%90%ec%84%9c-%ec%86%8d%ec%84%b1-%ec%b6%94%ec%b6%9c","status":"publish","type":"post","link":"https:\/\/www.skyer9.pe.kr\/wordpress\/?p=3827","title":{"rendered":"Elasticsearch \uac80\uc0c9\uc5b4\uc5d0\uc11c \uc18d\uc131 \ucd94\ucd9c"},"content":{"rendered":"<h1>Elasticsearch \uac80\uc0c9\uc5b4\uc5d0\uc11c \uc18d\uc131 \ucd94\ucd9c<\/h1>\n<p>\uac04\ub2e8\ud558\uc9c0\ub9cc \uad1c\ucc2e\uc740 \uc544\uc774\ub514\uc5b4\uac00 \uc0dd\uac01\ub0ac\ub2e4.<\/p>\n<p>\ube0c\ub79c\ub4dc\/\uce74\ud14c\uace0\ub9ac\/\uc0c1\ud488\uc18d\uc131 \uc778\ub371\uc2a4\ub97c \uc0dd\uc131\ud55c\ub2e4.<\/p>\n<p>\uac80\uc0c9\uc5b4\ub97c \uac00\uc9c0\uace0 \uac01\uac01\uc758 \uc778\ub371\uc2a4\ub97c \uac80\uc0c9\ud55c\ub2e4.<\/p>\n<p>\uac80\uc0c9\ub41c \uacb0\uacfc\uac00 \uac80\uc0c9\uc5b4\uc5d0 \ud3ec\ud568\ub41c \uc18d\uc131\uc774 \ub41c\ub2e4.<\/p>\n<p>\uc608\ub97c\ub4e4\uc5b4 <code>\ube68\uac04 \uc6b0\uc0b0<\/code> \uc744 \ud0a4\uc6cc\ub4dc\ub85c \uac80\uc0c9\ud588\uc744 \ub54c,<br \/>\n\uc0c1\ud488\uc18d\uc131 \uc778\ub371\uc2a4\uc5d0 \uac80\uc0c9\ud558\uba74 <code>\ube68\uac04<\/code> \uc774 \uac80\uc0c9\uacb0\uacfc\ub85c \ub098\uc62c \uac83\uc774\uace0,<br \/>\n\uadf8 \uac80\uc0c9\uacb0\uacfc\uac00 \uac80\uc0c9\uc5b4\uc5d0 \ud3ec\ud568\ub41c \uc18d\uc131\uc774 \ub41c\ub2e4.<\/p>\n<h2>nori \uc124\uce58<\/h2>\n<p>ngram + synonym \uc870\ud569\uc73c\ub85c \uac04\ub2e8\ud558\uac8c \ud615\ud0dc\uc18c\ubd84\uc11d \uc5c6\uc774 \uc9c4\ud589\ud558\ub824 \ud558\uc600\uc73c\ub098,<br \/>\nCJK \uad00\ub828\ud574\uc11c \uc624\uc791\ub3d9 \ud558\ub294\ub4ef \ud558\ub2e4.<\/p>\n<p>\uacb0\uad6d nori \ud615\ud0dc\uc18c \ubd84\uc11d\uc73c\ub85c \ubc29\ud5a5\uc744 \uc815\ud588\ub2e4.<\/p>\n<pre><code class=\"language-bash\">bin\/elasticsearch-plugin install --batch analysis-nori<\/code><\/pre>\n<h2>\ub3d9\uc758\uc5b4 \uc0ac\uc804 \uc0dd\uc131<\/h2>\n<p>\/usr\/share\/elasticsearch\/config\/analysis\/synonyms_brand.txt<\/p>\n<pre><code class=\"language-text\">0100,\uacf5\ubc31\nmmmg,\ubc00\ub9ac\ubbf8\ud130\ubc00\ub9ac\uadf8\ub78c,\uc5e0\uc5e0\uc5e0\uc9c0\nithinkso,\uc544\uc774\ub775\uc18c\niconic,\uc544\uc774\ucf54\ub2c9<\/code><\/pre>\n<p>\/usr\/share\/elasticsearch\/config\/analysis\/synonyms_category.txt<\/p>\n<pre><code class=\"language-text\">t-shirt,\ud2f0\uc154\uce20\ndiary,\ub2e4\uc774\uc5b4\ub9ac\numbrella,\uc6b0\uc0b0\npouch,\ud30c\uc6b0\uce58<\/code><\/pre>\n<p>\/usr\/share\/elasticsearch\/config\/analysis\/synonyms_attribute.txt<\/p>\n<pre><code class=\"language-text\">red,\ube68\uac15,\ube68\uac04,\ub808\ub4dc\nblack,\uac80\uc815,\uac80\uc740,\ube14\ub799\n280mm,280\n1800mm,1800<\/code><\/pre>\n<h2>\uc778\ub371\uc2a4 \uc0dd\uc131<\/h2>\n<pre><code class=\"language-bash\">curl -XDELETE &#039;localhost:9200\/att_brand_info?pretty&#039;\ncurl -XDELETE &#039;localhost:9200\/att_category_info?pretty&#039;\ncurl -XDELETE &#039;localhost:9200\/att_attribute_info?pretty&#039;<\/code><\/pre>\n<pre><code class=\"language-bash\">curl -XPUT &#039;nb.skyer9.pe.kr:9200\/att_brand_info?pretty&#039; -H &#039;Content-Type: application\/json&#039; -d&#039;\n{\n  &quot;settings&quot;: {\n    &quot;index&quot;: {\n      &quot;number_of_replicas&quot;: &quot;0&quot;,\n      &quot;analysis&quot;: {\n        &quot;analyzer&quot;: {\n          &quot;nori_analyzer&quot;: {\n            &quot;tokenizer&quot;: &quot;nori_tokenizer&quot;,\n            &quot;filter&quot;: [\n              &quot;lowercase&quot;,\n              &quot;cjk_width&quot;,\n              &quot;synonym_filter&quot;\n            ]\n          }\n        },\n        &quot;filter&quot;: {\n          &quot;synonym_filter&quot;: {\n            &quot;type&quot;: &quot;synonym&quot;,\n            &quot;synonyms_path&quot;: &quot;analysis\/synonyms_brand.txt&quot;,\n            &quot;updateable&quot;: true\n          }\n        }\n      }\n    }\n  },\n  &quot;mappings&quot;: {\n    &quot;properties&quot;: {\n      &quot;brand_name&quot;: {\n        &quot;type&quot;: &quot;text&quot;,\n        &quot;search_analyzer&quot;: &quot;nori_analyzer&quot;\n      }\n    }\n  }\n}&#039;<\/code><\/pre>\n<pre><code class=\"language-bash\">curl -XPUT &#039;nb.skyer9.pe.kr:9200\/att_category_info?pretty&#039; -H &#039;Content-Type: application\/json&#039; -d&#039;\n{\n  &quot;settings&quot;: {\n    &quot;index&quot;: {\n      &quot;number_of_replicas&quot;: &quot;0&quot;,\n      &quot;analysis&quot;: {\n        &quot;analyzer&quot;: {\n          &quot;nori_analyzer&quot;: {\n            &quot;tokenizer&quot;: &quot;nori_tokenizer&quot;,\n            &quot;filter&quot;: [\n              &quot;lowercase&quot;,\n              &quot;cjk_width&quot;,\n              &quot;synonym_filter&quot;\n            ]\n          }\n        },\n        &quot;filter&quot;: {\n          &quot;synonym_filter&quot;: {\n            &quot;type&quot;: &quot;synonym&quot;,\n            &quot;synonyms_path&quot;: &quot;analysis\/synonyms_category.txt&quot;,\n            &quot;updateable&quot;: true\n          }\n        }\n      }\n    }\n  },\n  &quot;mappings&quot;: {\n    &quot;properties&quot;: {\n      &quot;category&quot;: {\n        &quot;type&quot;: &quot;text&quot;,\n        &quot;search_analyzer&quot;: &quot;nori_analyzer&quot;\n      }\n    }\n  }\n}&#039;<\/code><\/pre>\n<pre><code class=\"language-bash\">curl -XPUT &#039;nb.skyer9.pe.kr:9200\/att_attribute_info?pretty&#039; -H &#039;Content-Type: application\/json&#039; -d&#039;\n{\n  &quot;settings&quot;: {\n    &quot;index&quot;: {\n      &quot;number_of_replicas&quot;: &quot;0&quot;,\n      &quot;analysis&quot;: {\n        &quot;analyzer&quot;: {\n          &quot;nori_analyzer&quot;: {\n            &quot;tokenizer&quot;: &quot;nori_tokenizer&quot;,\n            &quot;filter&quot;: [\n              &quot;lowercase&quot;,\n              &quot;cjk_width&quot;,\n              &quot;synonym_filter&quot;\n            ]\n          }\n        },\n        &quot;filter&quot;: {\n          &quot;synonym_filter&quot;: {\n            &quot;type&quot;: &quot;synonym&quot;,\n            &quot;synonyms_path&quot;: &quot;analysis\/synonyms_attribute.txt&quot;,\n            &quot;updateable&quot;: true\n          }\n        }\n      }\n    }\n  },\n  &quot;mappings&quot;: {\n    &quot;properties&quot;: {\n      &quot;attribute_name&quot;: {\n        &quot;type&quot;: &quot;text&quot;,\n        &quot;search_analyzer&quot;: &quot;nori_analyzer&quot;\n      }\n    }\n  }\n}&#039;<\/code><\/pre>\n<h2>\ub370\uc774\ud0c0 \uc785\ub825<\/h2>\n<p>brand.json<\/p>\n<pre><code class=\"language-json\">{ &quot;index&quot;: { &quot;_index&quot;: &quot;att_brand_info&quot;, &quot;_type&quot;: &quot;_doc&quot; } }\n{ &quot;brand_name&quot;: &quot;ithinkso&quot; }\n{ &quot;index&quot;: { &quot;_index&quot;: &quot;att_brand_info&quot;, &quot;_type&quot;: &quot;_doc&quot; } }\n{ &quot;brand_name&quot;: &quot;mmmg&quot; }\n{ &quot;index&quot;: { &quot;_index&quot;: &quot;att_brand_info&quot;, &quot;_type&quot;: &quot;_doc&quot; } }\n{ &quot;brand_name&quot;: &quot;iconic&quot; }<\/code><\/pre>\n<p>category.json<\/p>\n<pre><code class=\"language-json\">{ &quot;index&quot;: { &quot;_index&quot;: &quot;att_category_info&quot;, &quot;_type&quot;: &quot;_doc&quot; } }\n{ &quot;category&quot;: &quot;t-shirt&quot; }\n{ &quot;index&quot;: { &quot;_index&quot;: &quot;att_category_info&quot;, &quot;_type&quot;: &quot;_doc&quot; } }\n{ &quot;category&quot;: &quot;diary&quot; }\n{ &quot;index&quot;: { &quot;_index&quot;: &quot;att_category_info&quot;, &quot;_type&quot;: &quot;_doc&quot; } }\n{ &quot;category&quot;: &quot;umbrella&quot; }<\/code><\/pre>\n<p>attribute.json<\/p>\n<pre><code class=\"language-json\">{ &quot;index&quot;: { &quot;_index&quot;: &quot;att_attribute_info&quot;, &quot;_type&quot;: &quot;_doc&quot; } }\n{ &quot;attribute_name&quot;: &quot;red&quot;, &quot;attribute_type&quot;: &quot;color&quot; }\n{ &quot;index&quot;: { &quot;_index&quot;: &quot;att_attribute_info&quot;, &quot;_type&quot;: &quot;_doc&quot; } }\n{ &quot;attribute_name&quot;: &quot;black&quot;, &quot;attribute_type&quot;: &quot;color&quot; }\n{ &quot;index&quot;: { &quot;_index&quot;: &quot;att_attribute_info&quot;, &quot;_type&quot;: &quot;_doc&quot; } }\n{ &quot;attribute_name&quot;: &quot;280mm&quot;, &quot;attribute_type&quot;: &quot;size&quot; }\n{ &quot;index&quot;: { &quot;_index&quot;: &quot;att_attribute_info&quot;, &quot;_type&quot;: &quot;_doc&quot; } }\n{ &quot;attribute_name&quot;: &quot;180cm&quot;, &quot;attribute_type&quot;: &quot;size&quot; }<\/code><\/pre>\n<pre><code class=\"language-bash\">curl -XPOST &#039;localhost:9200\/_bulk?pretty&#039; -H &#039;Content-Type: application\/json&#039; --data-binary @brand.json\ncurl -XPOST &#039;localhost:9200\/_bulk?pretty&#039; -H &#039;Content-Type: application\/json&#039; --data-binary @category.json\ncurl -XPOST &#039;localhost:9200\/_bulk?pretty&#039; -H &#039;Content-Type: application\/json&#039; --data-binary @attribute.json<\/code><\/pre>\n<h2>\uac80\uc0c9\uc5b4 analyze<\/h2>\n<pre><code class=\"language-bash\">curl -XGET &#039;localhost:9200\/att_brand_info\/_analyze?pretty&#039; -H &#039;Content-Type: application\/json&#039; -d&#039;\n{\n  &quot;analyzer&quot;: &quot;synonym_analyzer&quot;,\n  &quot;text&quot;: &quot;\uc544\uc774\ucf54\ub2c9\uac80\uc815\uc6b0\uc0b0&quot;\n}&#039;<\/code><\/pre>\n<pre><code class=\"language-bash\">curl -XGET &#039;localhost:9200\/att_category_info\/_analyze?pretty&#039; -H &#039;Content-Type: application\/json&#039; -d&#039;\n{\n  &quot;analyzer&quot;: &quot;synonym_analyzer&quot;,\n  &quot;text&quot;: &quot;\uc544\uc774\ucf54\ub2c9\uac80\uc815\uc6b0\uc0b0&quot;\n}&#039;<\/code><\/pre>\n<pre><code class=\"language-bash\">curl -XGET &#039;localhost:9200\/att_attribute_info\/_analyze?pretty&#039; -H &#039;Content-Type: application\/json&#039; -d&#039;\n{\n  &quot;analyzer&quot;: &quot;synonym_analyzer&quot;,\n  &quot;text&quot;: &quot;\uc544\uc774\ucf54\ub2c9\uac80\uc815\uc6b0\uc0b0&quot;\n}&#039;<\/code><\/pre>\n<h2>\ub370\uc774\ud0c0 \uac80\uc0c9<\/h2>\n<p>\uac80\uc0c9\uc5b4 <code>\uc544\uc774\ucf54\ub2c9 \uac80\uc815 \uc6b0\uc0b0<\/code> \uc5d0 \ub300\ud574,<br \/>\n\uac01\uac01 \ube0c\ub79c\ub4dc\/\uce74\ud14c\uace0\ub9ac\/\uc0c1\ud488\uc18d\uc131\uc5d0 \ucd94\ucd9c\ub41c\ub2e4.<\/p>\n<pre><code class=\"language-bash\">curl -XGET &#039;localhost:9200\/att_brand_info\/_search?pretty&#039; -H &#039;Content-Type: application\/json&#039; -d&#039;\n{\n  &quot;from&quot;: 0,\n  &quot;size&quot;: 20,\n  &quot;sort&quot;: {\n    &quot;_score&quot;: &quot;desc&quot;\n  },\n  &quot;query&quot;: {\n    &quot;bool&quot;: {\n      &quot;should&quot;: {\n        &quot;match&quot;: {\n          &quot;brand_name&quot;: &quot;\uc544\uc774\ucf54\ub2c9\uac80\uc815\uc6b0\uc0b0&quot;\n        }\n      }\n    }\n  }\n}&#039;<\/code><\/pre>\n<pre><code class=\"language-bash\">curl -XGET &#039;localhost:9200\/att_category_info\/_search?pretty&#039; -H &#039;Content-Type: application\/json&#039; -d&#039;\n{\n  &quot;from&quot;: 0,\n  &quot;size&quot;: 20,\n  &quot;sort&quot;: {\n    &quot;_score&quot;: &quot;desc&quot;\n  },\n  &quot;query&quot;: {\n    &quot;bool&quot;: {\n      &quot;should&quot;: {\n        &quot;match&quot;: {\n          &quot;category&quot;: &quot;\uc544\uc774\ucf54\ub2c9\uac80\uc815\uc6b0\uc0b0&quot;\n        }\n      }\n    }\n  }\n}&#039;<\/code><\/pre>\n<pre><code class=\"language-bash\">curl -XGET &#039;localhost:9200\/att_attribute_info\/_search?pretty&#039; -H &#039;Content-Type: application\/json&#039; -d&#039;\n{\n  &quot;from&quot;: 0,\n  &quot;size&quot;: 20,\n  &quot;sort&quot;: {\n    &quot;_score&quot;: &quot;desc&quot;\n  },\n  &quot;query&quot;: {\n    &quot;bool&quot;: {\n      &quot;should&quot;: {\n        &quot;match&quot;: {\n          &quot;attribute_name&quot;: &quot;\uc544\uc774\ucf54\ub2c9\uac80\uc815\uc6b0\uc0b0&quot;\n        }\n      }\n    }\n  }\n}&#039;<\/code><\/pre>\n<h2>\ub3d9\uc758\uc5b4 \uc0c8\ub85c\uace0\uce68<\/h2>\n<pre><code class=\"language-bash\">curl -XPOST &#039;localhost:9200\/att_brand_info\/_reload_search_analyzers?pretty&#039;\ncurl -XPOST &#039;localhost:9200\/att_category_info\/_reload_search_analyzers?pretty&#039;\ncurl -XPOST &#039;localhost:9200\/att_attribute_info\/_reload_search_analyzers?pretty&#039;<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Elasticsearch \uac80\uc0c9\uc5b4\uc5d0\uc11c \uc18d\uc131 \ucd94\ucd9c \uac04\ub2e8\ud558\uc9c0\ub9cc \uad1c\ucc2e\uc740 \uc544\uc774\ub514\uc5b4\uac00 \uc0dd\uac01\ub0ac\ub2e4. \ube0c\ub79c\ub4dc\/\uce74\ud14c\uace0\ub9ac\/\uc0c1\ud488\uc18d\uc131 \uc778\ub371\uc2a4\ub97c \uc0dd\uc131\ud55c\ub2e4. \uac80\uc0c9\uc5b4\ub97c \uac00\uc9c0\uace0 \uac01\uac01\uc758 \uc778\ub371\uc2a4\ub97c \uac80\uc0c9\ud55c\ub2e4. \uac80\uc0c9\ub41c \uacb0\uacfc\uac00 \uac80\uc0c9\uc5b4\uc5d0 \ud3ec\ud568\ub41c \uc18d\uc131\uc774 \ub41c\ub2e4. \uc608\ub97c\ub4e4\uc5b4 \ube68\uac04 \uc6b0\uc0b0 \uc744 \ud0a4\uc6cc\ub4dc\ub85c \uac80\uc0c9\ud588\uc744 \ub54c, \uc0c1\ud488\uc18d\uc131 \uc778\ub371\uc2a4\uc5d0 \uac80\uc0c9\ud558\uba74 \ube68\uac04 \uc774 \uac80\uc0c9\uacb0\uacfc\ub85c \ub098\uc62c \uac83\uc774\uace0, \uadf8 \uac80\uc0c9\uacb0\uacfc\uac00 \uac80\uc0c9\uc5b4\uc5d0 \ud3ec\ud568\ub41c \uc18d\uc131\uc774 \ub41c\ub2e4. nori \uc124\uce58 ngram + synonym \uc870\ud569\uc73c\ub85c \uac04\ub2e8\ud558\uac8c \ud615\ud0dc\uc18c\ubd84\uc11d \uc5c6\uc774 \uc9c4\ud589\ud558\ub824 \ud558\uc600\uc73c\ub098, CJK\u2026 <span class=\"read-more\"><a href=\"https:\/\/www.skyer9.pe.kr\/wordpress\/?p=3827\">Read More &raquo;<\/a><\/span><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[6],"tags":[],"class_list":["post-3827","post","type-post","status-publish","format-standard","hentry","category-elasticsearch"],"_links":{"self":[{"href":"https:\/\/www.skyer9.pe.kr\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/3827","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.skyer9.pe.kr\/wordpress\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.skyer9.pe.kr\/wordpress\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.skyer9.pe.kr\/wordpress\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.skyer9.pe.kr\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=3827"}],"version-history":[{"count":13,"href":"https:\/\/www.skyer9.pe.kr\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/3827\/revisions"}],"predecessor-version":[{"id":3861,"href":"https:\/\/www.skyer9.pe.kr\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/3827\/revisions\/3861"}],"wp:attachment":[{"href":"https:\/\/www.skyer9.pe.kr\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=3827"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.skyer9.pe.kr\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=3827"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.skyer9.pe.kr\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=3827"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}