{"id":3545,"date":"2021-09-30T11:05:36","date_gmt":"2021-09-30T02:05:36","guid":{"rendered":"https:\/\/www.skyer9.pe.kr\/wordpress\/?p=3545"},"modified":"2022-08-02T13:49:45","modified_gmt":"2022-08-02T04:49:45","slug":"elasticsearch-%ec%8b%9c%ec%9e%91%ed%95%98%ea%b8%b0","status":"publish","type":"post","link":"https:\/\/www.skyer9.pe.kr\/wordpress\/?p=3545","title":{"rendered":"ElasticSearch \uc2dc\uc791\ud558\uae30"},"content":{"rendered":"<h1>ElasticSearch \uc2dc\uc791\ud558\uae30<\/h1>\n<h2>\uc778\ub371\uc2a4<\/h2>\n<h3>\uc778\ub371\uc2a4 \uc0dd\uc131<\/h3>\n<pre><code class=\"language-bash\">PUT \/restaurant_info?pretty\n{\n  &quot;settings&quot; : {\n    &quot;number_of_shards&quot; : 1,\n    &quot;number_of_replicas&quot; : 0,\n    &quot;index&quot;:{\n      &quot;max_ngram_diff&quot;: 50,\n      &quot;analysis&quot;:{\n        &quot;analyzer&quot;:{\n          &quot;my_ngram_analyzer&quot;: {\n            &quot;tokenizer&quot;: &quot;my_ngram_tokenizer&quot;\n          }\n        },\n        &quot;tokenizer&quot;: {\n          &quot;my_ngram_tokenizer&quot;: {\n            &quot;type&quot;: &quot;ngram&quot;,\n            &quot;min_gram&quot;: &quot;2&quot;,\n            &quot;max_gram&quot;: &quot;10&quot;\n          }\n        }\n      }\n    }\n  },\n  &quot;mappings&quot; : {\n    &quot;properties&quot; : {\n      &quot;restaurant_name&quot; : {\n        &quot;type&quot; : &quot;text&quot;,\n        &quot;analyzer&quot;: &quot;my_ngram_analyzer&quot;\n      },\n      &quot;start_date&quot; : {\n        &quot;type&quot; : &quot;date&quot;,\n        &quot;format&quot;: &quot;yyyy-MM-dd HH:mm:ss||yyyy-MM-dd||yyyyMMdd||epoch_millis&quot;\n      },\n      &quot;tel&quot; : { &quot;type&quot; : &quot;keyword&quot; },\n      &quot;address&quot; : {\n        &quot;type&quot; : &quot;text&quot;,\n        &quot;analyzer&quot;: &quot;my_ngram_analyzer&quot;\n      },\n      &quot;road_address&quot; : {\n        &quot;type&quot; : &quot;text&quot;,\n        &quot;analyzer&quot;: &quot;my_ngram_analyzer&quot;\n      },\n      &quot;coordinate&quot; : { &quot;type&quot; : &quot;geo_point&quot; },\n      &quot;longitude&quot; : { &quot;type&quot; : &quot;float&quot; },\n      &quot;latitude&quot; : { &quot;type&quot; : &quot;float&quot; },\n      &quot;modify_time&quot; : {\n        &quot;type&quot; : &quot;date&quot;,\n        &quot;format&quot;: &quot;yyyy-MM-dd HH:mm:ss||yyyy-MM-dd||yyyyMMdd||epoch_millis&quot;\n      },\n      &quot;insert_time&quot; : {\n        &quot;type&quot; : &quot;date&quot;,\n        &quot;format&quot;: &quot;yyyy-MM-dd HH:mm:ss||yyyy-MM-dd||yyyyMMdd||epoch_millis&quot;\n      }\n    }\n  }\n}<\/code><\/pre>\n<h4>Type \uc885\ub958<\/h4>\n<p><a href=\"https:\/\/esbook.kimjmin.net\/07-settings-and-mappings\/7.2-mappings\">\ucc38\uc870<\/a><\/p>\n<ul>\n<li>String<\/li>\n<\/ul>\n<table>\n<thead>\n<tr>\n<th>\ud0c0\uc785<\/th>\n<th>\uc124\uba85<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td>text<\/td>\n<td>full text \uac80\uc0c9\uc774 \uac00\ub2a5\ud569\ub2c8\ub2e4. \ud615\ud0dc\uc18c \ubd84\uc11d \ub4f1 \uc778\ub371\uc2a4 \uc791\uc5c5\uc744 \ud569\ub2c8\ub2e4.<\/td>\n<\/tr>\n<tr>\n<td>keyword<\/td>\n<td>\ud615\ud0dc\uc18c \ubd84\uc11d\uc5c6\uc774 \uac80\uc0c9\uc5b4\uc640 \uc77c\uce58\ud558\ub294 \ub370\uc774\ud0c0\ub9cc \uac80\uc0c9\ub429\ub2c8\ub2e4.<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<ul>\n<li>Number<\/li>\n<\/ul>\n<table>\n<thead>\n<tr>\n<th>\ud0c0\uc785<\/th>\n<th>\uc124\uba85<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td>byte<\/td>\n<td>8\ube44\ud2b8 \uc815\uc218  (-128 ~ 127)<\/td>\n<\/tr>\n<tr>\n<td>short<\/td>\n<td>16\ube44\ud2b8 \uc815\uc218  (-32768 ~ 32767)<\/td>\n<\/tr>\n<tr>\n<td>integer<\/td>\n<td>32\ube44\ud2b8 \uc815\uc218<\/td>\n<\/tr>\n<tr>\n<td>long<\/td>\n<td>64\ube44\ud2b8 \uc815\uc218<\/td>\n<\/tr>\n<tr>\n<td>float<\/td>\n<td>32\ube44\ud2b8 \uc2e4\uc218<\/td>\n<\/tr>\n<tr>\n<td>double<\/td>\n<td>64\ube44\ud2b8 \uc2e4\uc218<\/td>\n<\/tr>\n<tr>\n<td>half_float<\/td>\n<td>16\ube44\ud2b8 \uc2e4\uc218<\/td>\n<\/tr>\n<tr>\n<td>scaled_float<\/td>\n<td>\ud1b5\ud654 (\uc608: $19.99) \uc800\uc7a5<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<ul>\n<li>Date<\/li>\n<\/ul>\n<table>\n<thead>\n<tr>\n<th>\ud0c0\uc785<\/th>\n<th>\uc124\uba85<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td>date<\/td>\n<td>ISO8601 \ud615\uc2dd\uc73c\ub85c \uc785\ub825\ud574\uc57c \ud569\ub2c8\ub2e4.<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<ul>\n<li>List<\/li>\n<\/ul>\n<table>\n<thead>\n<tr>\n<th>\ud0c0\uc785<\/th>\n<th>\uc124\uba85<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td>list<\/td>\n<td><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<ul>\n<li>Geo Point<\/li>\n<\/ul>\n<table>\n<thead>\n<tr>\n<th>\ud0c0\uc785<\/th>\n<th>\uc124\uba85<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td>geo_point<\/td>\n<td>\uc88c\ud45c\ub97c \uc785\ub825\ud560 \uc218 \uc788\uc2b5\ub2c8\ub2e4.<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h3>\ubb38\uc11c \uc785\ub825<\/h3>\n<pre><code class=\"language-bash\">PUT \/restaurant_info\/_doc\/2\n{\n  &quot;restaurant_name&quot;: &quot;\uac08\ube44\uba85\uac00\uc544\ub77c\ub124&quot;,\n  &quot;start_date&quot;: &quot;20140612&quot;,\n  &quot;tel&quot;: &quot;062 369 1582&quot;,\n  &quot;address&quot;: &quot;\uad11\uc8fc\uad11\uc5ed\uc2dc \ub0a8\uad6c \uc6d4\uc0b0\ub3d9 1048-182\ubc88\uc9c0 (1\uce35)&quot;,\n  &quot;road_address&quot;: &quot;\uad11\uc8fc\uad11\uc5ed\uc2dc \ub0a8\uad6c \uad70\ubd84\ub85c 26-1, 1\uce35 (\uc6d4\uc0b0\ub3d9)&quot;,\n  &quot;coordinate&quot;: {\n    &quot;lat&quot;: 181905.028328,\n    &quot;lon&quot;: 190363.418899\n  },\n  &quot;longitude&quot;: &quot;190363.418899&quot;,\n  &quot;latitude&quot;: &quot;181905.028328&quot;,\n  &quot;modify_time&quot;: &quot;2021-09-27 15:08:42&quot;,\n  &quot;insert_time&quot;: &quot;2021-09-27 15:08:42&quot;\n}<\/code><\/pre>\n<h3>\ubb38\uc11c \uac80\uc0c9<\/h3>\n<p><code>_search<\/code> \ub97c \uc774\uc6a9\ud574 \uac80\uc0c9\ud560 \uc218 \uc788\ub2e4.<\/p>\n<pre><code class=\"language-bash\">GET \/restaurant_info\/_search\n{\n  &quot;size&quot; : 100,\n  &quot;_source&quot; : false,\n  &quot;fields&quot; : [\n    {\n      &quot;field&quot; : &quot;tags&quot;\n    },\n    {\n      &quot;field&quot; : &quot;updated_at&quot;,\n      &quot;format&quot; : &quot;strict_date_optional_time_nanos&quot;\n    }\n  ],\n  &quot;sort&quot; : [\n    {\n      &quot;updated_at&quot; : {\n        &quot;order&quot; : &quot;desc&quot;,\n        &quot;missing&quot; : &quot;_first&quot;,\n        &quot;unmapped_type&quot; : &quot;date&quot;\n      }\n    }\n  ]\n}<\/code><\/pre>\n<p><code>SQL<\/code> \uc774 \uc775\uc219\ud558\ub2e4\uba74, \uc544\ub798\uc640 \uac19\uc774 \uc785\ub825\ud574\uc11c ES \ucffc\ub9ac\ub85c \ubcc0\ud658\ud560 \uc218 \uc788\ub2e4.<\/p>\n<pre><code class=\"language-bash\">GET \/_sql\/translate\n{\n  &quot;query&quot;: &quot;SELECT * FROM restaurant_info ORDER BY updated_at DESC LIMIT 100&quot;\n}<\/code><\/pre>\n<h3>\ubb38\uc11c \uc0ad\uc81c<\/h3>\n<pre><code class=\"language-bash\">POST \/restaurant_info\/_delete_by_query\n{\n    &quot;query&quot;: {\n        &quot;term&quot; : { &quot;itemId&quot; : &quot;979&quot; }\n    }\n}<\/code><\/pre>\n<h3>\uc778\ub371\uc2a4 \uc0ad\uc81c<\/h3>\n<pre><code class=\"language-bash\">DELETE restaurant_info<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>ElasticSearch \uc2dc\uc791\ud558\uae30 \uc778\ub371\uc2a4 \uc778\ub371\uc2a4 \uc0dd\uc131 PUT \/restaurant_info?pretty { &quot;settings&quot; : { &quot;number_of_shards&quot; : 1, &quot;number_of_replicas&quot; : 0, &quot;index&quot;:{ &quot;max_ngram_diff&quot;: 50, &quot;analysis&quot;:{ &quot;analyzer&quot;:{ &quot;my_ngram_analyzer&quot;: { &quot;tokenizer&quot;: &quot;my_ngram_tokenizer&quot; } }, &quot;tokenizer&quot;: { &quot;my_ngram_tokenizer&quot;: { &quot;type&quot;: &quot;ngram&quot;, &quot;min_gram&quot;: &quot;2&quot;, &quot;max_gram&quot;: &quot;10&quot; } } } } }, &quot;mappings&quot; : { &quot;properties&quot; : { &quot;restaurant_name&quot; : { &quot;type&quot; : &quot;text&quot;,\u2026 <span class=\"read-more\"><a href=\"https:\/\/www.skyer9.pe.kr\/wordpress\/?p=3545\">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-3545","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\/3545","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=3545"}],"version-history":[{"count":14,"href":"https:\/\/www.skyer9.pe.kr\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/3545\/revisions"}],"predecessor-version":[{"id":5887,"href":"https:\/\/www.skyer9.pe.kr\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/3545\/revisions\/5887"}],"wp:attachment":[{"href":"https:\/\/www.skyer9.pe.kr\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=3545"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.skyer9.pe.kr\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=3545"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.skyer9.pe.kr\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=3545"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}