{"id":41267,"date":"2022-11-16T05:54:52","date_gmt":"2022-12-01T21:24:41","guid":{"rendered":"https:\/\/www.silicloud.com\/zh\/blog\/%e4%bb%8e%e5%88%9d%e5%ad%a6%e8%80%85%e7%9a%84%e8%a7%92%e5%ba%a6%e5%ad%a6%e4%b9%a0elasticsearch%e7%9a%84rest-api%e3%80%82\/"},"modified":"2024-04-29T00:53:31","modified_gmt":"2024-04-28T16:53:31","slug":"%e4%bb%8e%e5%88%9d%e5%ad%a6%e8%80%85%e7%9a%84%e8%a7%92%e5%ba%a6%e5%ad%a6%e4%b9%a0elasticsearch%e7%9a%84rest-api%e3%80%82","status":"publish","type":"post","link":"https:\/\/www.silicloud.com\/zh\/blog\/%e4%bb%8e%e5%88%9d%e5%ad%a6%e8%80%85%e7%9a%84%e8%a7%92%e5%ba%a6%e5%ad%a6%e4%b9%a0elasticsearch%e7%9a%84rest-api%e3%80%82\/","title":{"rendered":"\u4ece\u521d\u5b66\u8005\u7684\u89d2\u5ea6\u5b66\u4e60Elasticsearch\u7684Rest API"},"content":{"rendered":"<p>\u672c\u6587\u662f2015\u5e74Elasticsearch\u5723\u8bde\u65e5\u5386\u7b2c5\u5929\u7684\u6587\u7ae0\u3002<\/p>\n<p>\u5f88\u62b1\u6b49\u6211\u66f4\u65b0\u6587\u7ae0\u5f88\u6162\u3002<\/p>\n<h1>\u9996\u5148<\/h1>\n<p>\u5927\u5bb6\u662f\u7528\u4ec0\u9ebc\u5de5\u5177\u4f86\u6aa2\u8996\u548c\u5206\u6790Elasticsearch\u7684\u6578\u64da\u5462\uff1f<br \/>\n\u9664\u4e86Elasticsearch Head\u548cKibana\u7b49\u5de5\u5177\u5916\uff0c\u5728\u8655\u7406\u591a\u500b\u4f4d\u65bc\u4e0d\u540c\u74b0\u5883\u7684Elasticsearch\u6216\u5728\u958b\u767c\u968e\u6bb5\u63a2\u7d22\u6027\u5de5\u4f5c\u6642\uff0c\u76f4\u63a5\u4f7f\u7528REST API\u53ef\u4ee5\u7bc0\u7701\u4e0d\u5c11\u6642\u9593\u548c\u7cbe\u529b\u3002<\/p>\n<p>\u56e0\u4e3a\u6211\u81ea\u5df1\u76ee\u524d\u4f7f\u7528\u7684\u662fElasticsearch\u5df2\u7ecf\u6709\u4e24\u4e2a\u6708\u4e86\uff0c<br \/>\n\u6240\u4ee5\u76ee\u524d\u6765\u8bf4\uff0cPOSTMAN\u662f\u6700\u5f3a\u5927\u7684Elasticsearch\u5ba2\u6237\u7aef\u3002<\/p>\n<p>2016\/06\/17\u6700\u65b0\u60c5\u62a5\u662f\uff0cSense\u662f\u6700\u5f3a\u7684\u3002<\/p>\n<p>\u4e2d\u6587\u53ef\u4ee5\u8fd9\u6837\u7ffb\u8bd1\uff1a\u6240\u4ee5\u6211\u6574\u7406\u4e86\u6211\u7ecf\u5e38\u4f7f\u7528\u7684API\u5217\u8868\u3002<\/p>\n<p>\u53c2\u8003\u4e0b\u5217\u516c\u5f0fAPI\u5217\u8868<\/p>\n<h4>\u7248\u672c\u4fe1\u606f<\/h4>\n<p>Elasticsearch 1.5.2<br \/>\nElasticsearch 1.5.2 \u5f39\u6027\u641c\u7d22 1.5.2<\/p>\n<h2>1. Elasticsearch\u7684\u5065\u5eb7\u68c0\u67e5<\/h2>\n<p>\u9996\u5148\uff0c\u5728\u5f15\u5165Elasticsearch\u4e4b\u540e\uff0c\u6211\u8ba4\u4e3a\u7b2c\u4e00\u4ef6\u8981\u505a\u7684\u4e8b\u60c5\u662f\u542f\u52a8Elasticsearch\uff08\u8fd9\u662f\u7406\u6240\u5f53\u7136\u7684\uff09\u3002<br \/>\n\u53ef\u4ee5\u8fdb\u884c\u542f\u52a8\u72b6\u6001\u548c\u7248\u672c\u7684\u786e\u8ba4\u3002<\/p>\n<pre class=\"post-pre\"><code>$ curl -XGET 'localhost:9200\/'\r\n<\/code><\/pre>\n<h2>\u5730\u56fe\u5236\u4f5c<\/h2>\n<p>\u5728\u6570\u636e\u5e93\u4e2d\u521b\u5efa\u6570\u636e\u7ed3\u6784\uff08\u7c7b\u4f3c\u4e8eMySQL\u4e2d\u7684\u6570\u636e\u5e93\u548c\u8868\uff09\u3002<br \/>\n\u7531\u4e8e\u5728\u5f00\u53d1\u9636\u6bb5\u53cd\u590d\u521b\u5efa\u548c\u53d6\u6d88\u7d22\u5f15\uff0c\u6240\u4ee5\u7ecf\u5e38\u8c03\u7528\u6b64API\u3002<\/p>\n<p>\u5728mappings\u4e2d\u6307\u5b9a\u8981\u521b\u5efa\u7684Type\uff08\u8868\uff09\u548cFields\uff08\u5217\uff09\u3002<br \/>\n\u8fd9\u53ea\u662f\u4e00\u4e2a\u7b80\u5355\u7684\u4f8b\u5b50\uff0c\u5982\u679c\u53ea\u662f\u521b\u5efa\u7d22\u5f15\uff0c\u5219\u4e0d\u9700\u8981\u8bbe\u7f6e\u3002<\/p>\n<pre class=\"post-pre\"><code>$ curl -XPOST 'localhost:9200\/[index]?pretty' -d ' \r\n{\r\n    \"settings\": {\r\n        \"index\": {\r\n            \"creation_date\": \"1445580000000\",\r\n            \"uuid\": \"xxxxxxxxxxxxxxxxxxxxxx\",\r\n            \"number_of_replicas\": \"1\",\r\n            \"number_of_shards\": \"5\",\r\n            \"version\": {\r\n                \"created\": \"1050299\"\r\n            }\r\n        }\r\n    },\r\n    \"mappings\": {\r\n        \"[type]\": {\r\n            \"properties\": {\r\n                \"id\": {\r\n                    \"type\": \"long\"\r\n                },\r\n                \"last_name\": {\r\n                    \"type\": \"string\"\r\n                },\r\n                \"first_name\": {\r\n                    \"type\": \"string\"\r\n                },\r\n                \"created_at\": {\r\n                    \"format\": \"dateOptionalTime\",\r\n                    \"type\": \"date\"\r\n                }\r\n                \"updated_at\": {\r\n                    \"format\": \"dateOptionalTime\",\r\n                    \"type\": \"date\"\r\n                }\r\n            }\r\n        }\r\n    }\r\n}'\r\n<\/code><\/pre>\n<p>\u53ef\u4ee5\u901a\u8fc7\u4ee5\u4e0b\u7684API\u6765\u786e\u8ba4\u6620\u5c04\u7ed3\u679c\uff0c\u5e76\u8fd4\u56de\u5404\u5206\u7247\u5185\u7d22\u5f15\u7684\u60c5\u51b5\u7b49\u4fe1\u606f\u3002<\/p>\n<pre class=\"post-pre\"><code>$ curl -XGET 'localhost:9200\/[index]'\r\n<\/code><\/pre>\n<p>\u82e5\u8981\u8fdb\u884cIndex\u7684\u8be6\u7ec6\u72b6\u6001\u68c0\u67e5\uff0c\u8bf7\u5728URL\u672b\u5c3e\u6dfb\u52a0 _status\u3002<\/p>\n<pre class=\"post-pre\"><code>$ curl -XGET 'localhost:9200\/[index]\/_status'\r\n<\/code><\/pre>\n<p>\u5982\u679c\u53d1\u751f\u9519\u8bef\u6216\u6709\u4efb\u4f55\u66f4\u6539\uff0c\u8bf7\u4f7f\u7528\u4ee5\u4e0b\u7684API\u5220\u9664\u91cd\u65b0\u6784\u5efa\u914d\u7f6e\u3002<\/p>\n<pre class=\"post-pre\"><code>$ curl -XDELETE 'localhost:9200\/[index]\r\n<\/code><\/pre>\n<h2>3. \u64cd\u4f5c\u6587\u4ef6<\/h2>\n<h3>\u6587\u4ef6\u5236\u4f5c<\/h3>\n<p>\u5b8c\u6210\u6620\u5c04\u540e\uff0c\u63a5\u4e0b\u6765\u5c06\u6570\u636e\u63d2\u5165\u5230\u6307\u5b9a\u7684\u8868\u4e2d\u3002<br \/>\n\u5982\u679c\u672a\u6307\u5b9aid\uff0c\u5219\u4f1a\u8bbe\u7f6e\u4e00\u4e2a\u9002\u5f53\u7684\u503c\u3002<\/p>\n<pre class=\"post-pre\"><code>$ curl -XPOST 'localhost:9200\/[index]\/[type]\/[id]?pretty' -d '\r\n{\r\n    \"last_name\":\"\u306e\u3073\",\r\n    \"first_name\":\"\u306e\u3073\u305f\",\r\n    \"height\":150,\r\n    \"weight\":40,\r\n    \"created_at\":1406038,\r\n}'\r\n<\/code><\/pre>\n<p>\u5728\u6267\u884c\u6279\u91cf\u63d2\u5165\u65f6\uff0c\u5728\u6700\u540e\u6dfb\u52a0&#8221;_bulk&#8221;\u6807\u8bc6\u3002<\/p>\n<pre class=\"post-pre\"><code>$ curl -XPOST 'localhost:9200\/[index]\/[type]\/_bulk?pretty' -d '\r\n{ \"index\" : {}       }\r\n{ \"last_name\"  : \"\u306e\u306f\u3089\", \"first_name\": \"\u3072\u308d\u3057\", \"age\":35, \"height\":180.0 }\r\n{ \"index\" : {}       }\r\n{ \"last_name\"  : \"\u306e\u306f\u3089\", \"first_name\": \"\u307f\u3055\u3048\", \"age\":29, \"height\":160.2 }\r\n{ \"index\" : {}       }\r\n{ \"last_name\"  : \"\u306e\u306f\u3089\", \"first_name\": \"\u3057\u3093\u306e\u3059\u3051\", \"age\":5, \"height\": 105.9 }\r\n'\r\n<\/code><\/pre>\n<p>\u5728\u66f4\u65b0\u6587\u4ef6\u65f6\uff0c\u8bf7\u6307\u5b9a\u7c7b\u578b\u548c\u8bb0\u5f55ID\u3002<\/p>\n<pre class=\"post-pre\"><code>$ curl -XPUT 'localhost:9200\/[index]\/[type]\/[id]?pretty' -d '\r\n{\r\n    \"first_name\":\"\u3072\u307e\u308f\u308a\",\r\n    \"updated_at\":14000000\r\n}'\r\n<\/code><\/pre>\n<p>\u5220\u9664\u6587\u4ef6<\/p>\n<pre class=\"post-pre\"><code>$ curl -XDELETE 'localhost:9200\/[index]\/[type]\/[id]' \r\n<\/code><\/pre>\n<p>\u6211\u7ec8\u4e8e\u6210\u529f\u521b\u5efa\u4e86\u6570\u636e\u3002<\/p>\n<h2>4. \u67e5\u8be2<\/h2>\n<p>\u53ef\u4ee5\u641c\u7d22\u521b\u5efa\u7684\u6570\u636e\u3002<br \/>\n\u53ef\u4ee5\u4f7f\u7528default_operator\u6307\u5b9aAnd\u641c\u7d22\u6216or\u641c\u7d22\u3002<br \/>\nfields\u53ef\u4ee5\u591a\u6b21\u6307\u5b9a\uff0c\u5e76\u4e14\u53ef\u4ee5\u4f7f\u7528_all\u6765\u6307\u5b9a\u6240\u6709\u5b57\u6bb5\u4f5c\u4e3a\u76ee\u6807\u3002<\/p>\n<pre class=\"post-pre\"><code>$ curl -XGET 'localhost:9200\/[index]\/[type]\/_search?pretty' -d '\r\n{\r\n  \"query\" : {\r\n    \"simple_query_string\" : {\r\n      \"query\": \"\u307f\u306a\u3082\u3068 \u307b\u306d\u304b\u308f\",\r\n      \"fields\": [\"last_name\"],\r\n      \"default_operator\": \"or\"\r\n    }\r\n  }\r\n}'\r\n<\/code><\/pre>\n<p>\u5982\u679c\u60a8\u60f3\u5bf9\u6587\u6863\u8fdb\u884c\u6392\u5e8f\u5e76\u8fdb\u884c\u641c\u7d22\uff0c\u5219\u9700\u8981\u5728json\u4e2d\u6dfb\u52a0sort\uff0c\u5e76\u6dfb\u52a0\u8981\u6392\u5e8f\u7684\u6570\u7ec4\u3002<\/p>\n<pre class=\"post-pre\"><code>$ curl -XGET 'localhost:9200\/[index]\/[type]\/_search?pretty' -d '\r\n{\r\n  \"query\" : {\r\n    \"simple_query_string\" : {\r\n      \"query\": \"\u307e\u308b\u3053 \u3055\u304d\u3053\",\r\n      \"fields\": [\"first_name\"],\r\n      \"default_operator\": \"or\"\r\n    }\r\n  },\r\n  \"sort\" : [{ \"created_at\" : {\"order\" : \"desc\", \"missing\" : \"_last\"}}]\r\n}'\r\n<\/code><\/pre>\n<h2>5. \u7ee7\u7eed\u641c\u7d22<\/h2>\n<p>\u5982\u679c\u5728\u5e38\u89c4\u641c\u7d22\u4e2d\u6dfb\u52a0\u7279\u6b8a\u6761\u4ef6\uff0c\u53ef\u4ee5\u4f7f\u7528function_score\u3002<br \/>\n\u53ef\u4ee5\u4e3a\u6bcf\u4e2a\u641c\u7d22\u6761\u4ef6\u5206\u914d\u641c\u7d22\u5206\u6570\u7684\u6743\u91cd\uff0c\u6216\u8005\u4f7f\u7528\u5b57\u6bb5\u7684\u8ba1\u7b97\u503c\u6765\u8bc4\u5206\u7b49\u7b49\u3002\u8fd9\u662f\u6211\u5f00\u59cb\u4f7f\u7528Elasticsearch\u65f6\u6700\u4ee4\u6211\u5174\u594b\u7684\u90e8\u5206\uff01\uff08\u5c3d\u7ba1\u6211\u8fd8\u6ca1\u6709\u5b8c\u5168\u638c\u63e1\u5b83\uff09<\/p>\n<p>\u7531\u4e8e\u53ef\u4ee5\u7f16\u5199\u7b80\u5355\u7684\u6761\u4ef6\u8bed\u53e5\uff0c\u4f8b\u5982\u901a\u8fc7\u8eab\u9ad8\u3001\u4f53\u91cd\u8ba1\u7b97BMI\u503c\u5e76\u8fdb\u884c\u80a5\u80d6\u5224\u5b9a\u7684\u60c5\u51b5\uff0c\u53ef\u4ee5\u4ece\u641c\u7d22\u5206\u6570\u4e2d\u51cf\u53bb1\uff0c\u5982\u4e0b\u6240\u793a\u3002<\/p>\n<pre class=\"post-pre\"><code>$ curl -XGET 'localhost:9200\/[index]\/[type]\/_search?pretty' -d '\r\n{\r\n  \"query\" : {\r\n    \"function_score\" : {\r\n      \"query\" : {\r\n        \"simple_query_string\" : {\r\n          \"query\": \"\u3069\u3089\u3048\u3082\u3093 Q\u305f\u308d\u3046 \u3053\u308d\u3059\u3051\",\r\n          \"fields\": [\"first_name\"],\r\n          \"default_operator\": \"or\"\r\n        }\r\n      },\r\n      \"boost_mode\": \"replace\",\r\n      \"script_score\" : {\r\n          \"script\" : \"weight = doc['weight'].value; height = doc['height'].value; bmi = weight \/ ((height)*(height)+1);if (bmi &gt;= 25) return _score - 10 else return _score\"\r\n      }\r\n    }\r\n  }\r\n}'\r\n<\/code><\/pre>\n<ul class=\"post-ul\">\n<li style=\"list-style-type: none;\">\n<ul class=\"post-ul\">field\u306e\u5024\u306f doc[&#8216;field\u540d&#8217;].value \u3067\u53d6\u5f97\u3067\u304d\u308b<\/ul>\n<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<ul class=\"post-ul\">\n<li style=\"list-style-type: none;\">\n<ul class=\"post-ul\">\u6539\u884c\u3092\u5165\u308c\u308b\u3068\u30a8\u30e9\u30fc\u306b\u306a\u308b<\/ul>\n<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<ul class=\"post-ul\">\n<li style=\"list-style-type: none;\">\n<ul class=\"post-ul\">script\u5185\u306e\u5f0f\u306b\u3088\u3063\u3066\u5024\u304c0\u672a\u6e80\u306b\u306a\u3063\u305f\u5834\u5408\u30a8\u30e9\u30fc\u306b\u306a\u308b<\/ul>\n<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<ul class=\"post-ul\">\u4e0a\u8a18\u306e\u4f8b\u306e\u5834\u5408return\u306f\u7121\u304f\u3066\u3082\u6700\u5f8c\u306e\u5024\u3092\u3046\u307e\u3044\u3053\u3068\u3068\u3063\u3066\u304f\u308c\u308b\u306e\u3067\u4e0d\u8981\u3002\uff08\u50d5\u306f\u5206\u304b\u308a\u3084\u3059\u304f\u3059\u308b\u305f\u3081\u306b\u3044\u308c\u3066\u3044\u307e\u3059\u3002\uff09<\/ul>\n<h4>\u5982\u679cfunction_score\u4e0d\u80fd\u6b63\u5e38\u8fd0\u884c\u7684\u60c5\u51b5\u4e0b<\/h4>\n<p>\u4f7f\u7528\u4e86\u9ed8\u8ba4\u8bbe\u7f6e\u7684function_score\u67e5\u8be2\u65f6\u51fa\u73b0\u9519\u8bef\uff0c\u6211\u957f\u65f6\u95f4\u4ee5\u6765\u4e00\u76f4\u5c1d\u8bd5\u7740\u8c03\u8bd5\uff0c\u4ee5\u4e3a\u662fJSON\u683c\u5f0f\u51fa\u9519\u4e86\uff0c\u4f46\u5b9e\u9645\u4e0a\u9700\u8981\u5728\u8bbe\u7f6e\u4e2d\u542f\u7528function_score\u3002<\/p>\n<p>\u5728 elasticsearch.yml \u6587\u4ef6\u4e2d\u6dfb\u52a0\u542f\u7528\u811a\u672c\u7684\u914d\u7f6e\uff0c\u5e76\u91cd\u65b0\u542f\u52a8 Elasticsearch\u3002<\/p>\n<pre class=\"post-pre\"><code><span class=\"s\">script.groovy.sandbox.enabled<\/span><span class=\"pi\">:<\/span> <span class=\"no\">true<\/span>\r\n<\/code><\/pre>\n<h2>RestAPI\u7684\u901a\u7528\u9009\u9879<\/h2>\n<p>\u6211\u5df2\u7ecf\u6574\u7406\u4e86API\uff0c\u4f46\u5728\u8fd9\u91cc\u6211\u4eec\u4e5f\u4f7f\u7528\u4e86?pretty\u7b49\u54cd\u5e94\u9009\u9879\u6765\u4f7f\u5f97\u54cd\u5e94\u503c\u66f4\u6613\u8bfb\uff0c\u8fd8\u6709\u4e00\u4e9b\u53ef\u7528\u6765\u6307\u5b9a\u54cd\u5e94\u683c\u5f0f\u7684\u5e38\u7528\u9009\u9879\uff0c\u5982\u679c\u4e5f\u4f7f\u7528\u8fd9\u4e9b\u9009\u9879\uff0c\u53ef\u4ee5\u4f7f\u5f97\u786e\u8ba4\u66f4\u52a0\u65b9\u4fbf\u3002<br \/>\n\u8bf7\u53c2\u8003\uff1ahttps:\/\/www.elastic.co\/guide\/en\/elasticsearch\/reference\/current\/common-options.html<\/p>\n<h1>\u7ed3\u675f<\/h1>\n<p>\u7531\u4e8e Elasticsearch \u4ecd\u5904\u4e8e\u8bd5\u9519\u9636\u6bb5\uff0c\u53ef\u80fd\u5b58\u5728\u4e00\u4e9b\u4e0d\u591f\u6210\u719f\u7684\u90e8\u5206\u3002\u5982\u679c\u6709\u4efb\u4f55\u9519\u8bef\u6216\u5efa\u8bae\uff0c\u8bf7\u4e0d\u541d\u8d50\u6559\uff0c\u6211\u4f1a\u611f\u6fc0\u4e0d\u5c3d\u3002\u5e0c\u671b\u80fd\u591f\u5c3d\u5feb\u638c\u63e1 Elasticsearch\uff0c\u5ea6\u8fc7\u7f8e\u597d\u7684 Elasticsearch \u751f\u6d3b\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u672c\u6587\u662f2015\u5e74Elasticsearch\u5723\u8bde\u65e5\u5386\u7b2c5\u5929\u7684\u6587\u7ae0\u3002 \u5f88\u62b1\u6b49\u6211\u66f4\u65b0\u6587\u7ae0\u5f88\u6162\u3002 \u9996\u5148 \u5927\u5bb6\u662f\u7528\u4ec0\u9ebc\u5de5 [&hellip;]<\/p>\n","protected":false},"author":10,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-41267","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v21.5 (Yoast SEO v21.5) - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>\u4ece\u521d\u5b66\u8005\u7684\u89d2\u5ea6\u5b66\u4e60Elasticsearch\u7684Rest API - Blog - Silicon Cloud<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.silicloud.com\/zh\/blog\/\u4ece\u521d\u5b66\u8005\u7684\u89d2\u5ea6\u5b66\u4e60elasticsearch\u7684rest-api\u3002\/\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"\u4ece\u521d\u5b66\u8005\u7684\u89d2\u5ea6\u5b66\u4e60Elasticsearch\u7684Rest API\" \/>\n<meta property=\"og:description\" content=\"\u672c\u6587\u662f2015\u5e74Elasticsearch\u5723\u8bde\u65e5\u5386\u7b2c5\u5929\u7684\u6587\u7ae0\u3002 \u5f88\u62b1\u6b49\u6211\u66f4\u65b0\u6587\u7ae0\u5f88\u6162\u3002 \u9996\u5148 \u5927\u5bb6\u662f\u7528\u4ec0\u9ebc\u5de5 [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.silicloud.com\/zh\/blog\/\u4ece\u521d\u5b66\u8005\u7684\u89d2\u5ea6\u5b66\u4e60elasticsearch\u7684rest-api\u3002\/\" \/>\n<meta property=\"og:site_name\" content=\"Blog - Silicon Cloud\" \/>\n<meta property=\"article:published_time\" content=\"2022-12-01T21:24:41+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2024-04-28T16:53:31+00:00\" \/>\n<meta name=\"author\" content=\"\u5b87, \u534e\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"\u4f5c\u8005\" \/>\n\t<meta name=\"twitter:data1\" content=\"\u5b87, \u534e\" \/>\n\t<meta name=\"twitter:label2\" content=\"\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4\" \/>\n\t<meta name=\"twitter:data2\" content=\"2 \u5206\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/%e4%bb%8e%e5%88%9d%e5%ad%a6%e8%80%85%e7%9a%84%e8%a7%92%e5%ba%a6%e5%ad%a6%e4%b9%a0elasticsearch%e7%9a%84rest-api%e3%80%82\/\",\"url\":\"https:\/\/www.silicloud.com\/zh\/blog\/%e4%bb%8e%e5%88%9d%e5%ad%a6%e8%80%85%e7%9a%84%e8%a7%92%e5%ba%a6%e5%ad%a6%e4%b9%a0elasticsearch%e7%9a%84rest-api%e3%80%82\/\",\"name\":\"\u4ece\u521d\u5b66\u8005\u7684\u89d2\u5ea6\u5b66\u4e60Elasticsearch\u7684Rest API - Blog - Silicon Cloud\",\"isPartOf\":{\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/#website\"},\"datePublished\":\"2022-12-01T21:24:41+00:00\",\"dateModified\":\"2024-04-28T16:53:31+00:00\",\"author\":{\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/#\/schema\/person\/513018e4e121d3add1b7c5de8be21458\"},\"breadcrumb\":{\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/%e4%bb%8e%e5%88%9d%e5%ad%a6%e8%80%85%e7%9a%84%e8%a7%92%e5%ba%a6%e5%ad%a6%e4%b9%a0elasticsearch%e7%9a%84rest-api%e3%80%82\/#breadcrumb\"},\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.silicloud.com\/zh\/blog\/%e4%bb%8e%e5%88%9d%e5%ad%a6%e8%80%85%e7%9a%84%e8%a7%92%e5%ba%a6%e5%ad%a6%e4%b9%a0elasticsearch%e7%9a%84rest-api%e3%80%82\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/%e4%bb%8e%e5%88%9d%e5%ad%a6%e8%80%85%e7%9a%84%e8%a7%92%e5%ba%a6%e5%ad%a6%e4%b9%a0elasticsearch%e7%9a%84rest-api%e3%80%82\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9875\",\"item\":\"https:\/\/www.silicloud.com\/zh\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"\u4ece\u521d\u5b66\u8005\u7684\u89d2\u5ea6\u5b66\u4e60Elasticsearch\u7684Rest API\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/#website\",\"url\":\"https:\/\/www.silicloud.com\/zh\/blog\/\",\"name\":\"Blog - Silicon Cloud\",\"description\":\"\",\"inLanguage\":\"zh-Hans\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/#\/schema\/person\/513018e4e121d3add1b7c5de8be21458\",\"name\":\"\u5b87, \u534e\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-Hans\",\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/63cd45cbc05a35fc4ff7637a163c83c4962ef58d27472726c3a3e0c9c5194f0f?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/63cd45cbc05a35fc4ff7637a163c83c4962ef58d27472726c3a3e0c9c5194f0f?s=96&d=mm&r=g\",\"caption\":\"\u5b87, \u534e\"},\"url\":\"https:\/\/www.silicloud.com\/zh\/blog\/author\/yuhua\/\"},{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-Hans\",\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/%e4%bb%8e%e5%88%9d%e5%ad%a6%e8%80%85%e7%9a%84%e8%a7%92%e5%ba%a6%e5%ad%a6%e4%b9%a0elasticsearch%e7%9a%84rest-api%e3%80%82\/#local-main-organization-logo\",\"url\":\"\",\"contentUrl\":\"\",\"caption\":\"Blog - Silicon Cloud\"}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"\u4ece\u521d\u5b66\u8005\u7684\u89d2\u5ea6\u5b66\u4e60Elasticsearch\u7684Rest API - Blog - Silicon Cloud","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.silicloud.com\/zh\/blog\/\u4ece\u521d\u5b66\u8005\u7684\u89d2\u5ea6\u5b66\u4e60elasticsearch\u7684rest-api\u3002\/","og_locale":"zh_CN","og_type":"article","og_title":"\u4ece\u521d\u5b66\u8005\u7684\u89d2\u5ea6\u5b66\u4e60Elasticsearch\u7684Rest API","og_description":"\u672c\u6587\u662f2015\u5e74Elasticsearch\u5723\u8bde\u65e5\u5386\u7b2c5\u5929\u7684\u6587\u7ae0\u3002 \u5f88\u62b1\u6b49\u6211\u66f4\u65b0\u6587\u7ae0\u5f88\u6162\u3002 \u9996\u5148 \u5927\u5bb6\u662f\u7528\u4ec0\u9ebc\u5de5 [&hellip;]","og_url":"https:\/\/www.silicloud.com\/zh\/blog\/\u4ece\u521d\u5b66\u8005\u7684\u89d2\u5ea6\u5b66\u4e60elasticsearch\u7684rest-api\u3002\/","og_site_name":"Blog - Silicon Cloud","article_published_time":"2022-12-01T21:24:41+00:00","article_modified_time":"2024-04-28T16:53:31+00:00","author":"\u5b87, \u534e","twitter_card":"summary_large_image","twitter_misc":{"\u4f5c\u8005":"\u5b87, \u534e","\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4":"2 \u5206"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.silicloud.com\/zh\/blog\/%e4%bb%8e%e5%88%9d%e5%ad%a6%e8%80%85%e7%9a%84%e8%a7%92%e5%ba%a6%e5%ad%a6%e4%b9%a0elasticsearch%e7%9a%84rest-api%e3%80%82\/","url":"https:\/\/www.silicloud.com\/zh\/blog\/%e4%bb%8e%e5%88%9d%e5%ad%a6%e8%80%85%e7%9a%84%e8%a7%92%e5%ba%a6%e5%ad%a6%e4%b9%a0elasticsearch%e7%9a%84rest-api%e3%80%82\/","name":"\u4ece\u521d\u5b66\u8005\u7684\u89d2\u5ea6\u5b66\u4e60Elasticsearch\u7684Rest API - Blog - Silicon Cloud","isPartOf":{"@id":"https:\/\/www.silicloud.com\/zh\/blog\/#website"},"datePublished":"2022-12-01T21:24:41+00:00","dateModified":"2024-04-28T16:53:31+00:00","author":{"@id":"https:\/\/www.silicloud.com\/zh\/blog\/#\/schema\/person\/513018e4e121d3add1b7c5de8be21458"},"breadcrumb":{"@id":"https:\/\/www.silicloud.com\/zh\/blog\/%e4%bb%8e%e5%88%9d%e5%ad%a6%e8%80%85%e7%9a%84%e8%a7%92%e5%ba%a6%e5%ad%a6%e4%b9%a0elasticsearch%e7%9a%84rest-api%e3%80%82\/#breadcrumb"},"inLanguage":"zh-Hans","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.silicloud.com\/zh\/blog\/%e4%bb%8e%e5%88%9d%e5%ad%a6%e8%80%85%e7%9a%84%e8%a7%92%e5%ba%a6%e5%ad%a6%e4%b9%a0elasticsearch%e7%9a%84rest-api%e3%80%82\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.silicloud.com\/zh\/blog\/%e4%bb%8e%e5%88%9d%e5%ad%a6%e8%80%85%e7%9a%84%e8%a7%92%e5%ba%a6%e5%ad%a6%e4%b9%a0elasticsearch%e7%9a%84rest-api%e3%80%82\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"https:\/\/www.silicloud.com\/zh\/blog\/"},{"@type":"ListItem","position":2,"name":"\u4ece\u521d\u5b66\u8005\u7684\u89d2\u5ea6\u5b66\u4e60Elasticsearch\u7684Rest API"}]},{"@type":"WebSite","@id":"https:\/\/www.silicloud.com\/zh\/blog\/#website","url":"https:\/\/www.silicloud.com\/zh\/blog\/","name":"Blog - Silicon Cloud","description":"","inLanguage":"zh-Hans"},{"@type":"Person","@id":"https:\/\/www.silicloud.com\/zh\/blog\/#\/schema\/person\/513018e4e121d3add1b7c5de8be21458","name":"\u5b87, \u534e","image":{"@type":"ImageObject","inLanguage":"zh-Hans","@id":"https:\/\/www.silicloud.com\/zh\/blog\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/63cd45cbc05a35fc4ff7637a163c83c4962ef58d27472726c3a3e0c9c5194f0f?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/63cd45cbc05a35fc4ff7637a163c83c4962ef58d27472726c3a3e0c9c5194f0f?s=96&d=mm&r=g","caption":"\u5b87, \u534e"},"url":"https:\/\/www.silicloud.com\/zh\/blog\/author\/yuhua\/"},{"@type":"ImageObject","inLanguage":"zh-Hans","@id":"https:\/\/www.silicloud.com\/zh\/blog\/%e4%bb%8e%e5%88%9d%e5%ad%a6%e8%80%85%e7%9a%84%e8%a7%92%e5%ba%a6%e5%ad%a6%e4%b9%a0elasticsearch%e7%9a%84rest-api%e3%80%82\/#local-main-organization-logo","url":"","contentUrl":"","caption":"Blog - Silicon Cloud"}]}},"_links":{"self":[{"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/posts\/41267","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/users\/10"}],"replies":[{"embeddable":true,"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/comments?post=41267"}],"version-history":[{"count":2,"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/posts\/41267\/revisions"}],"predecessor-version":[{"id":69741,"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/posts\/41267\/revisions\/69741"}],"wp:attachment":[{"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/media?parent=41267"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/categories?post=41267"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/tags?post=41267"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}