{"id":5676,"date":"2022-07-08T14:29:27","date_gmt":"2022-07-08T05:29:27","guid":{"rendered":"https:\/\/www.skyer9.pe.kr\/wordpress\/?p=5676"},"modified":"2022-07-08T14:30:25","modified_gmt":"2022-07-08T05:30:25","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-v2","status":"publish","type":"post","link":"https:\/\/www.skyer9.pe.kr\/wordpress\/?p=5676","title":{"rendered":"Elasticsearch \uac80\uc0c9\uc5b4\uc5d0\uc11c \uc18d\uc131 \ucd94\ucd9c v2"},"content":{"rendered":"<h1>Elasticsearch \uac80\uc0c9\uc5b4\uc5d0\uc11c \uc18d\uc131 \ucd94\ucd9c v2<\/h1>\n<p><a href=\"https:\/\/www.skyer9.pe.kr\/wordpress\/?p=3827\">\uc5ec\uae30<\/a> \uc5d0\uc11c \uc0dd\uac01\ud588\ub358 \uc544\uc774\ub514\uc5b4\ub97c \uc880 \ub354 \ub2e4\ub4ec\uc5b4 \ubcf8\ub2e4.<\/p>\n<h2>\ubb38\uc81c\uc810<\/h2>\n<p>\ub2e4\uc218\uc758 ES \uc11c\ubc84\uc5d0 \ub3d9\uc758\uc5b4 \uc0ac\uc804 \ud14d\uc2a4\ud2b8 \ud30c\uc77c\uc744 \ubc30\ud3ec\ud558\ub294 \uac83\ub3c4 \ubb38\uc81c\uc810\uc774\uace0,<br \/>\n\ub2e4\uc2dc \uc791\uc5c5\uc744 \ud574\ubcf4\ub2c8 ngram \uc774 \uc815\uc0c1 \uc791\ub3d9\ud558\uc5ec nori \ud615\ud0dc\uc18c \ubd84\uc11d\uc5c6\uc774 \uac00\ub2a5\ud588\ub2e4.<\/p>\n<h2>\uc778\ub371\uc2a4 \uc0dd\uc131<\/h2>\n<pre><code class=\"language-bash\">curl -XDELETE &#039;localhost:9200\/item_attribute_brand?pretty&#039;\ncurl -XDELETE &#039;localhost:9200\/item_attribute_color?pretty&#039;\ncurl -XDELETE &#039;localhost:9200\/item_attribute_category?pretty&#039;<\/code><\/pre>\n<pre><code class=\"language-bash\">curl -XPUT &#039;nb.skyer9.pe.kr:9200\/item_attribute_brand?pretty&#039; -H &#039;Content-Type: application\/json&#039; -d&#039;\n{\n  &quot;settings&quot;: {\n    &quot;number_of_shards&quot;: 5,\n    &quot;max_ngram_diff&quot;: 20,\n    &quot;number_of_replicas&quot;: 1,\n    &quot;analysis&quot;: {\n      &quot;tokenizer&quot;: {\n        &quot;my_ngram_tokenizer&quot;: {\n          &quot;type&quot;: &quot;ngram&quot;,\n          &quot;min_gram&quot;: 1,\n          &quot;max_gram&quot;: 20,\n          &quot;token_chars&quot;: [\n            &quot;letter&quot;,\n            &quot;digit&quot;,\n            &quot;punctuation&quot;\n          ]\n        }\n      },\n      &quot;analyzer&quot;: {\n        &quot;my_ngram_analyzer&quot;: {\n          &quot;type&quot;: &quot;custom&quot;,\n          &quot;tokenizer&quot;: &quot;my_ngram_tokenizer&quot;,\n          &quot;filter&quot;: [\n            &quot;lowercase&quot;\n          ]\n        }\n      }\n    }\n  },\n  &quot;mappings&quot;: {\n    &quot;properties&quot;: {\n      &quot;id&quot;: {\n        &quot;type&quot;: &quot;text&quot;,\n        &quot;analyzer&quot;: &quot;whitespace&quot;,\n        &quot;search_analyzer&quot;: &quot;my_ngram_analyzer&quot;\n      },\n      &quot;kwd&quot;: {\n        &quot;type&quot;: &quot;keyword&quot;\n      }\n    }\n  }\n}\n&#039;<\/code><\/pre>\n<pre><code class=\"language-bash\">curl -XPUT &#039;nb.skyer9.pe.kr:9200\/item_attribute_color?pretty&#039; -H &#039;Content-Type: application\/json&#039; -d&#039;\n{\n  &quot;settings&quot;: {\n    &quot;number_of_shards&quot;: 5,\n    &quot;max_ngram_diff&quot;: 20,\n    &quot;number_of_replicas&quot;: 1,\n    &quot;analysis&quot;: {\n      &quot;tokenizer&quot;: {\n        &quot;my_ngram_tokenizer&quot;: {\n          &quot;type&quot;: &quot;ngram&quot;,\n          &quot;min_gram&quot;: 1,\n          &quot;max_gram&quot;: 20,\n          &quot;token_chars&quot;: [\n            &quot;letter&quot;,\n            &quot;digit&quot;,\n            &quot;punctuation&quot;\n          ]\n        }\n      },\n      &quot;analyzer&quot;: {\n        &quot;my_ngram_analyzer&quot;: {\n          &quot;type&quot;: &quot;custom&quot;,\n          &quot;tokenizer&quot;: &quot;my_ngram_tokenizer&quot;,\n          &quot;filter&quot;: [\n            &quot;lowercase&quot;\n          ]\n        }\n      }\n    }\n  },\n  &quot;mappings&quot;: {\n    &quot;properties&quot;: {\n      &quot;id&quot;: {\n        &quot;type&quot;: &quot;text&quot;,\n        &quot;analyzer&quot;: &quot;whitespace&quot;,\n        &quot;search_analyzer&quot;: &quot;my_ngram_analyzer&quot;\n      },\n      &quot;kwd&quot;: {\n        &quot;type&quot;: &quot;keyword&quot;\n      }\n    }\n  }\n}\n&#039;<\/code><\/pre>\n<pre><code class=\"language-bash\">curl -XPUT &#039;nb.skyer9.pe.kr:9200\/item_attribute_category?pretty&#039; -H &#039;Content-Type: application\/json&#039; -d&#039;\n{\n  &quot;settings&quot;: {\n    &quot;number_of_shards&quot;: 5,\n    &quot;max_ngram_diff&quot;: 20,\n    &quot;number_of_replicas&quot;: 1,\n    &quot;analysis&quot;: {\n      &quot;tokenizer&quot;: {\n        &quot;my_ngram_tokenizer&quot;: {\n          &quot;type&quot;: &quot;ngram&quot;,\n          &quot;min_gram&quot;: 1,\n          &quot;max_gram&quot;: 20,\n          &quot;token_chars&quot;: [\n            &quot;letter&quot;,\n            &quot;digit&quot;,\n            &quot;punctuation&quot;\n          ]\n        }\n      },\n      &quot;analyzer&quot;: {\n        &quot;my_ngram_analyzer&quot;: {\n          &quot;type&quot;: &quot;custom&quot;,\n          &quot;tokenizer&quot;: &quot;my_ngram_tokenizer&quot;,\n          &quot;filter&quot;: [\n            &quot;lowercase&quot;\n          ]\n        }\n      }\n    }\n  },\n  &quot;mappings&quot;: {\n    &quot;properties&quot;: {\n      &quot;id&quot;: {\n        &quot;type&quot;: &quot;text&quot;,\n        &quot;analyzer&quot;: &quot;whitespace&quot;,\n        &quot;search_analyzer&quot;: &quot;my_ngram_analyzer&quot;\n      },\n      &quot;kwd&quot;: {\n        &quot;type&quot;: &quot;keyword&quot;\n      }\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;item_attribute_brand&quot;, &quot;_id&quot;: &quot;\uc544\uc774\ucf54\ub2c9&quot; } }\n{ &quot;id&quot;: &quot;\uc544\uc774\ucf54\ub2c9&quot;, &quot;kwd&quot;: &quot;\uc544\uc774\ucf54\ub2c9&quot; }\n{ &quot;index&quot;: { &quot;_index&quot;: &quot;item_attribute_brand&quot;, &quot;_id&quot;: &quot;iconic&quot; } }\n{ &quot;id&quot;: &quot;iconic&quot;, &quot;kwd&quot;: &quot;\uc544\uc774\ucf54\ub2c9&quot; }<\/code><\/pre>\n<p>color.json<\/p>\n<pre><code class=\"language-json\">{ &quot;index&quot;: { &quot;_index&quot;: &quot;item_attribute_color&quot;, &quot;_id&quot;: &quot;\uac80\uc815&quot; } }\n{ &quot;id&quot;: &quot;\uac80\uc815&quot;, &quot;kwd&quot;: &quot;\uac80\uc815&quot; }\n{ &quot;index&quot;: { &quot;_index&quot;: &quot;item_attribute_color&quot;, &quot;_id&quot;: &quot;black&quot; } }\n{ &quot;id&quot;: &quot;black&quot;, &quot;kwd&quot;: &quot;\uac80\uc815&quot; }<\/code><\/pre>\n<p>category.json<\/p>\n<pre><code class=\"language-json\">{ &quot;index&quot;: { &quot;_index&quot;: &quot;item_attribute_category&quot;, &quot;_id&quot;: &quot;\uc6b0\uc0b0&quot; } }\n{ &quot;id&quot;: &quot;\uc6b0\uc0b0&quot;, &quot;kwd&quot;: &quot;\uc6b0\uc0b0&quot; }\n{ &quot;index&quot;: { &quot;_index&quot;: &quot;item_attribute_category&quot;, &quot;_id&quot;: &quot;umbrella&quot; } }\n{ &quot;id&quot;: &quot;umbrella&quot;, &quot;kwd&quot;: &quot;\uc6b0\uc0b0&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 @color.json\ncurl -XPOST &#039;localhost:9200\/_bulk?pretty&#039; -H &#039;Content-Type: application\/json&#039; --data-binary @category.json<\/code><\/pre>\n<h2>\uac80\uc0c9\uc5b4 analyze<\/h2>\n<pre><code class=\"language-bash\">curl -XGET &#039;http:\/\/localhost:9200\/item_attribute_brand\/_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;id&quot;: &quot;\uc544\uc774\ucf54\ub2c9\uac80\uc815\uc6b0\uc0b0&quot;\n        }\n      }\n    }\n  }\n}&#039;\n\ncurl -XGET &#039;http:\/\/localhost:9200\/item_attribute_color\/_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;id&quot;: &quot;\uc544\uc774\ucf54\ub2c9\uac80\uc815\uc6b0\uc0b0&quot;\n        }\n      }\n    }\n  }\n}&#039;\n\ncurl -XGET &#039;http:\/\/localhost:9200\/item_attribute_category\/_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;id&quot;: &quot;\uc544\uc774\ucf54\ub2c9\uac80\uc815\uc6b0\uc0b0&quot;\n        }\n      }\n    }\n  }\n}&#039;<\/code><\/pre>\n<h2>\uacb0\ub860<\/h2>\n<p>\uc544\ubb34\ub7f0 \ucd94\uac00 \uae30\ub2a5 \uc5c6\uc774 ngram \ub9cc\uc73c\ub85c \uac80\uc0c9\uc5b4\uc5d0\uc11c \uc18d\uc131\ucd94\ucd9c\uc774 \uac00\ub2a5\ud558\ub2e4.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Elasticsearch \uac80\uc0c9\uc5b4\uc5d0\uc11c \uc18d\uc131 \ucd94\ucd9c v2 \uc5ec\uae30 \uc5d0\uc11c \uc0dd\uac01\ud588\ub358 \uc544\uc774\ub514\uc5b4\ub97c \uc880 \ub354 \ub2e4\ub4ec\uc5b4 \ubcf8\ub2e4. \ubb38\uc81c\uc810 \ub2e4\uc218\uc758 ES \uc11c\ubc84\uc5d0 \ub3d9\uc758\uc5b4 \uc0ac\uc804 \ud14d\uc2a4\ud2b8 \ud30c\uc77c\uc744 \ubc30\ud3ec\ud558\ub294 \uac83\ub3c4 \ubb38\uc81c\uc810\uc774\uace0, \ub2e4\uc2dc \uc791\uc5c5\uc744 \ud574\ubcf4\ub2c8 ngram \uc774 \uc815\uc0c1 \uc791\ub3d9\ud558\uc5ec nori \ud615\ud0dc\uc18c \ubd84\uc11d\uc5c6\uc774 \uac00\ub2a5\ud588\ub2e4. \uc778\ub371\uc2a4 \uc0dd\uc131 curl -XDELETE &#039;localhost:9200\/item_attribute_brand?pretty&#039; curl -XDELETE &#039;localhost:9200\/item_attribute_color?pretty&#039; curl -XDELETE &#039;localhost:9200\/item_attribute_category?pretty&#039; curl -XPUT &#039;nb.skyer9.pe.kr:9200\/item_attribute_brand?pretty&#039; -H &#039;Content-Type: application\/json&#039; -d&#039; { &quot;settings&quot;:\u2026 <span class=\"read-more\"><a href=\"https:\/\/www.skyer9.pe.kr\/wordpress\/?p=5676\">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-5676","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\/5676","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=5676"}],"version-history":[{"count":2,"href":"https:\/\/www.skyer9.pe.kr\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/5676\/revisions"}],"predecessor-version":[{"id":5678,"href":"https:\/\/www.skyer9.pe.kr\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/5676\/revisions\/5678"}],"wp:attachment":[{"href":"https:\/\/www.skyer9.pe.kr\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=5676"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.skyer9.pe.kr\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=5676"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.skyer9.pe.kr\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=5676"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}