{"id":3813,"date":"2021-11-10T16:17:01","date_gmt":"2021-11-10T07:17:01","guid":{"rendered":"https:\/\/www.skyer9.pe.kr\/wordpress\/?p=3813"},"modified":"2021-11-12T15:27:24","modified_gmt":"2021-11-12T06:27:24","slug":"elasticsearch-%eb%8f%99%ec%9d%98%ec%96%b4-%ec%82%ac%ec%a0%84-%ec%b6%94%ea%b0%80synonym","status":"publish","type":"post","link":"https:\/\/www.skyer9.pe.kr\/wordpress\/?p=3813","title":{"rendered":"Elasticsearch \ub3d9\uc758\uc5b4 \uc0ac\uc804 \ucd94\uac00(synonym)"},"content":{"rendered":"<h1>Elasticsearch \ub3d9\uc758\uc5b4 \uc0ac\uc804 \ucd94\uac00(synonym)<\/h1>\n<p><a href=\"https:\/\/www.elastic.co\/guide\/en\/elasticsearch\/reference\/current\/analysis-synonym-tokenfilter.html\">\ucc38\uc870<\/a><\/p>\n<p><a href=\"https:\/\/wedul.site\/595\">\ucc38\uc870<\/a><\/p>\n<p>\ub3d9\uc758\uc5b4 \uc0ac\uc804\uc744 \ucd94\uac00\ud558\uc5ec, \uac80\uc0c9\uc758 \ud488\uc9c8\uc744 \ub192\uc77c \uc218 \uc788\ub2e4.<\/p>\n<h2>\ub3d9\uc758\uc5b4 \uc0ac\uc804 \uc704\uce58<\/h2>\n<p>\ub3d9\uc758\uc5b4 \uc0ac\uc804\uc740 \uc124\uc815\ud30c\uc77c\uc5d0\uc11c\uc758 \uc0c1\ub300\uacbd\ub85c\ub85c \uc9c0\uc815\ub41c\ub2e4.<\/p>\n<p>\uc124\uc815\ud30c\uc77c\uc774 \ub514\ud3f4\ud2b8\ub85c <code>\/usr\/share\/elasticsearch\/config<\/code> \uc5d0 \uc704\uce58\ud558\ubbc0\ub85c,<br \/>\n\uc774 \uacbd\ub85c\uc5d0\uc11c\uc758 \uc0c1\ub300\uacbd\ub85c\ub85c \uc124\uc815\ud55c\ub2e4.<\/p>\n<h2>\ub3d9\uc758\uc5b4 \uc0ac\uc804 \ud615\uc2dd<\/h2>\n<p>\/usr\/share\/elasticsearch\/config\/analysis\/synonyms.txt<\/p>\n<pre><code class=\"language-text\">0100,\uacf5\ubc31\nmmmg,\ubc00\ub9ac\ubbf8\ud130\ubc00\ub9ac\uadf8\ub78c,\uc5e0\uc5e0\uc5e0\uc9c0<\/code><\/pre>\n<h2>\ub3d9\uc758\uc5b4 \uc0ac\uc804 \uc801\uc6a9 \ubc29\uc2dd<\/h2>\n<ul>\n<li>\n<p>\uc778\ub371\uc2a4 \uc0dd\uc131\/\uc218\uc815\uc2dc<\/p>\n<p>\ub3d9\uc758\uc5b4 \uc0ac\uc804\uc5d0 \uc0c8\ub85c\uc6b4 \ub2e8\uc5b4\ub97c \ucd94\uac00\ud574\ub3c4, \uc778\ub371\uc2a4\ub97c \uc7ac\uc0dd\uc131\ud558\uc9c0 \uc54a\uc73c\uba74 \ubc18\uc601\uc774 \uc54a\ub41c\ub2e4.<\/p>\n<\/li>\n<li>\n<p>\uac80\uc0c9\uc5b4\uc5d0 \uc801\uc6a9<\/p>\n<p>\uc778\ub371\uc2a4 \uc7ac\uc0dd\uc131\uc5c6\uc774 \uc989\uc2dc \ubc18\uc601\uc774 \ub41c\ub2e4.<\/p>\n<\/li>\n<\/ul>\n<h2>\uc778\ub371\uc2a4 \uc0dd\uc131<\/h2>\n<pre><code class=\"language-bash\">curl -XDELETE &#039;localhost:9200\/synonyms_test?pretty&#039;<\/code><\/pre>\n<p><code>search_string<\/code> \ud544\ub4dc\uc5d0 \ub300\ud574, <code>search_analyzer<\/code> \ub97c \uc9c0\uc815\ud574 \uc900\ub2e4.<\/p>\n<pre><code class=\"language-bash\">curl -XPUT &#039;localhost:9200\/synonyms_test?pretty&#039; -H &#039;Content-Type: application\/json&#039; -d&#039;\n{\n  &quot;settings&quot;: {\n    &quot;index&quot;: {\n      &quot;analysis&quot;: {\n        &quot;analyzer&quot;: {\n          &quot;synonym_analyzer&quot;: {\n            &quot;tokenizer&quot;: &quot;whitespace&quot;,\n            &quot;filter&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.txt&quot;,\n            &quot;updateable&quot;: true\n          }\n        }\n      }\n    }\n  },\n  &quot;mappings&quot;: {\n    &quot;properties&quot;: {\n      &quot;search_string&quot;: {\n        &quot;type&quot;: &quot;text&quot;,\n        &quot;search_analyzer&quot;: &quot;synonym_analyzer&quot;\n      }\n    }\n  }\n}&#039;<\/code><\/pre>\n<h2>\ub370\uc774\ud0c0 \uc785\ub825<\/h2>\n<pre><code class=\"language-bash\">vi data.json<\/code><\/pre>\n<pre><code class=\"language-json\">{ &quot;index&quot;:{ &quot;_index&quot; : &quot;synonyms_test&quot;, &quot;_type&quot; : &quot;_doc&quot; } }\n{ &quot;search_string&quot;:&quot;0100&quot;}\n{ &quot;index&quot;:{ &quot;_index&quot; : &quot;synonyms_test&quot;, &quot;_type&quot; : &quot;_doc&quot; } }\n{ &quot;search_string&quot;:&quot;\uacf5\ubc31&quot;}\n{ &quot;index&quot;:{ &quot;_index&quot; : &quot;synonyms_test&quot;, &quot;_type&quot; : &quot;_doc&quot; } }\n{ &quot;search_string&quot;:&quot;mmmg&quot;}\n{ &quot;index&quot;:{ &quot;_index&quot; : &quot;synonyms_test&quot;, &quot;_type&quot; : &quot;_doc&quot; } }\n{ &quot;search_string&quot;:&quot;\ubc00\ub9ac\ubbf8\ud130\ubc00\ub9ac\uadf8\ub78c&quot;}\n{ &quot;index&quot;:{ &quot;_index&quot; : &quot;synonyms_test&quot;, &quot;_type&quot; : &quot;_doc&quot; } }\n{ &quot;search_string&quot;:&quot;\uc5e0\uc5e0\uc5e0\uc9c0&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 @data.json<\/code><\/pre>\n<h2>\uac80\uc0c9\uc5b4 analyze<\/h2>\n<pre><code class=\"language-bash\">curl -XGET &#039;localhost:9200\/synonyms_test\/_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;\uc5e0\uc5e0\uc5e0\uc9c0&quot;\n}&#039;<\/code><\/pre>\n<h2>\ub370\uc774\ud0c0 \uac80\uc0c9<\/h2>\n<p><code>search_string<\/code> \uc5d0 \ub300\ud574, \ub3d9\uc758\uc5b4 \uac80\uc0c9\uc774 \ub41c\ub2e4.<\/p>\n<pre><code class=\"language-bash\">curl -XGET &#039;localhost:9200\/synonyms_test\/_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;must&quot;: {\n        &quot;match&quot;: {\n          &quot;search_string&quot;: &quot;mmmg&quot;\n        }\n      }\n    }\n  }\n}&#039;<\/code><\/pre>\n<h2>\ub3d9\uc5b4\uc5b4 \uc0ac\uc804 Reload<\/h2>\n<p>\ub3d9\uc758\uc5b4 \uc0ac\uc804\uc774 \ubcc0\uacbd\ub41c \uacbd\uc6b0 \uc544\ub798 \uba85\ub839\uc73c\ub85c Reload \ud560 \uc218 \uc788\ub2e4.<\/p>\n<pre><code class=\"language-bash\">curl -XPOST &#039;localhost:9200\/synonyms_test\/_reload_search_analyzers?pretty&#039;<\/code><\/pre>\n<h2>\ub3d9\uc758\uc5b4\uc0ac\uc804 \uad00\ub9ac \uc790\ub3d9\ud654<\/h2>\n<p>\ube0c\ub79c\ub4dc\uba85, \uce74\ud14c\uace0\ub9ac\uba85, \uc0c1\ud488\uc18d\uc131(\uc0c9\uc0c1, \uc0ac\uc774\uc988 \ub4f1)\uc740 \uc27d\uac8c \ubcc0\uacbd\ub418\uc9c0 \uc54a\uc73c\ubbc0\ub85c,<br \/>\n\uc77c\ub2e8\uc704\ub85c \uc790\ub3d9 \uc5c5\ub370\uc774\ud2b8 \ubc0f \uc218\ub3d9\ucd94\uac00\ud558\uba74 \uc0ac\uc804\uad00\ub9ac\uac00 \ub420 \ub4ef \ud55c\ub2e4.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Elasticsearch \ub3d9\uc758\uc5b4 \uc0ac\uc804 \ucd94\uac00(synonym) \ucc38\uc870 \ucc38\uc870 \ub3d9\uc758\uc5b4 \uc0ac\uc804\uc744 \ucd94\uac00\ud558\uc5ec, \uac80\uc0c9\uc758 \ud488\uc9c8\uc744 \ub192\uc77c \uc218 \uc788\ub2e4. \ub3d9\uc758\uc5b4 \uc0ac\uc804 \uc704\uce58 \ub3d9\uc758\uc5b4 \uc0ac\uc804\uc740 \uc124\uc815\ud30c\uc77c\uc5d0\uc11c\uc758 \uc0c1\ub300\uacbd\ub85c\ub85c \uc9c0\uc815\ub41c\ub2e4. \uc124\uc815\ud30c\uc77c\uc774 \ub514\ud3f4\ud2b8\ub85c \/usr\/share\/elasticsearch\/config \uc5d0 \uc704\uce58\ud558\ubbc0\ub85c, \uc774 \uacbd\ub85c\uc5d0\uc11c\uc758 \uc0c1\ub300\uacbd\ub85c\ub85c \uc124\uc815\ud55c\ub2e4. \ub3d9\uc758\uc5b4 \uc0ac\uc804 \ud615\uc2dd \/usr\/share\/elasticsearch\/config\/analysis\/synonyms.txt 0100,\uacf5\ubc31 mmmg,\ubc00\ub9ac\ubbf8\ud130\ubc00\ub9ac\uadf8\ub78c,\uc5e0\uc5e0\uc5e0\uc9c0 \ub3d9\uc758\uc5b4 \uc0ac\uc804 \uc801\uc6a9 \ubc29\uc2dd \uc778\ub371\uc2a4 \uc0dd\uc131\/\uc218\uc815\uc2dc \ub3d9\uc758\uc5b4 \uc0ac\uc804\uc5d0 \uc0c8\ub85c\uc6b4 \ub2e8\uc5b4\ub97c \ucd94\uac00\ud574\ub3c4, \uc778\ub371\uc2a4\ub97c \uc7ac\uc0dd\uc131\ud558\uc9c0 \uc54a\uc73c\uba74 \ubc18\uc601\uc774 \uc54a\ub41c\ub2e4. \uac80\uc0c9\uc5b4\uc5d0 \uc801\uc6a9\u2026 <span class=\"read-more\"><a href=\"https:\/\/www.skyer9.pe.kr\/wordpress\/?p=3813\">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-3813","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\/3813","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=3813"}],"version-history":[{"count":17,"href":"https:\/\/www.skyer9.pe.kr\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/3813\/revisions"}],"predecessor-version":[{"id":3833,"href":"https:\/\/www.skyer9.pe.kr\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/3813\/revisions\/3833"}],"wp:attachment":[{"href":"https:\/\/www.skyer9.pe.kr\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=3813"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.skyer9.pe.kr\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=3813"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.skyer9.pe.kr\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=3813"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}