{"id":136,"date":"2020-01-23T19:40:20","date_gmt":"2020-01-23T11:40:20","guid":{"rendered":"http:\/\/blog.yuekegu.com\/?p=136"},"modified":"2020-01-23T19:40:20","modified_gmt":"2020-01-23T11:40:20","slug":"elasticsearch%e5%88%9b%e5%bb%ba%e7%b4%a2%e5%bc%95","status":"publish","type":"post","link":"https:\/\/book.yuekegu.com\/index.php\/2020\/01\/23\/elasticsearch%e5%88%9b%e5%bb%ba%e7%b4%a2%e5%bc%95\/","title":{"rendered":"elasticsearch\u4f7f\u7528\u65b9\u6cd5\uff08\u4e00\uff09"},"content":{"rendered":"\n<p>\u521b\u5efa\u7d22\u5f15<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">curl -XPUT 'http:\/\/localhost:9200\/blogs' -d '\n{\n     \"settings\": {\n         \"number_of_shards\": 3,\n         \"number_of_replicas\": 1\n     }, \n     \"mappings\": {\n    } \n} <\/pre>\n\n\n\n<p>\u6dfb\u52a0\u6570\u636e\uff08\u4e00\uff09<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">curl -XPUT 'http:\/\/localhost:9200\/blogs\/_doc\/{_id}' -d '\n{\n     \"title\":\"This is a article about Docker\",\n     \"category\":\"Docker Info\", \n}<\/pre>\n\n\n\n<p>\u4fee\u6539\u6570\u636e\uff08\u4e00)<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">curl -XPOST ' localhost:9200\/blogs\/user\/1\/_update' -d '\n{\n     \"doc\":{\n         \"category\":\"Docker anyone\"\n     }\n }<\/pre>\n\n\n\n<p>\u4fee\u6539\u6570\u636e\uff08\u4e8c\uff09<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">curl 'http:\/\/127.0.0.1:9200\/blogs\/_doc\/1\/_update' -d '\n {\n     \"script\":{\n         \"lang\":\"painless\",\n         \"inline\":\"ctx._source.hit += 10\"\n     }\n }'<\/pre>\n\n\n\n<p>\u4fee\u6539\u6570\u636e\uff08\u4e09\uff09<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">curl 'http:\/\/127.0.0.1:9200\/blogs\/_doc\/1\/_update' -d '\n {\n     \"script\":{\n         \"lang\":\"painless\",\n         \"inline\":\"ctx._source.hits = params.hits\",\n         \"params\":{\n             \"hits\":100\n         }\n     }\n }'<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>\u521b\u5efa\u7d22\u5f15 curl -XPUT &#8216;http:\/\/localhost:9200\/blogs&#8217; -d &#8216; { &#8220;settings&#8221;: { &#8220;number_of_shards&#8221;: 3, &#8220;number_of_replicas&#8221;: 1 }, &#8220;mappings&#8221;: { } } \u6dfb\u52a0\u6570\u636e\uff08\u4e00\uff09 curl -XPUT &#8216;http:\/\/localhost:9200\/blogs\/_doc\/{_id}&#8217; -d &#8216; { &#8220;title&#8221;:&#8221;This is a article about Docker&#8221;, &#8220;category&#8221;:&#8221;Docker Info&#8221;, } \u4fee\u6539\u6570\u636e\uff08\u4e00) curl -XPOST &#8216; localhost:9200\/blogs\/user\/1\/_update&#8217; -d &#8216; { [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[5],"tags":[],"class_list":["post-136","post","type-post","status-publish","format-standard","hentry","category-elasticsearch"],"_links":{"self":[{"href":"https:\/\/book.yuekegu.com\/index.php\/wp-json\/wp\/v2\/posts\/136","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/book.yuekegu.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/book.yuekegu.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/book.yuekegu.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/book.yuekegu.com\/index.php\/wp-json\/wp\/v2\/comments?post=136"}],"version-history":[{"count":0,"href":"https:\/\/book.yuekegu.com\/index.php\/wp-json\/wp\/v2\/posts\/136\/revisions"}],"wp:attachment":[{"href":"https:\/\/book.yuekegu.com\/index.php\/wp-json\/wp\/v2\/media?parent=136"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/book.yuekegu.com\/index.php\/wp-json\/wp\/v2\/categories?post=136"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/book.yuekegu.com\/index.php\/wp-json\/wp\/v2\/tags?post=136"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}