{"id":1389,"date":"2023-03-19T11:07:13","date_gmt":"2023-03-19T03:07:13","guid":{"rendered":"https:\/\/www.appblog.cn\/?p=1389"},"modified":"2023-04-28T21:11:31","modified_gmt":"2023-04-28T13:11:31","slug":"elasticsearch-high-level-rest-api-document-basic-operations","status":"publish","type":"post","link":"https:\/\/www.appblog.cn\/index.php\/2023\/03\/19\/elasticsearch-high-level-rest-api-document-basic-operations\/","title":{"rendered":"ElasticSearch High Level REST API\uff081\uff09\u6587\u6863\u57fa\u672c\u64cd\u4f5c"},"content":{"rendered":"<h2>\u83b7\u53d6ES\u5ba2\u6237\u7aef<\/h2>\n<p>ES\u7684\u63d0\u4f9b\u4e86\u56db\u79cdJava\u5ba2\u6237\u7aef\uff0c\u5206\u522b\u4e3a\u8282\u70b9\u5ba2\u6237\u7aef(node client)\u3001\u4f20\u8f93\u5ba2\u6237\u7aef(Transport Client)\u3001\u4f4e\u7ea7REST\u5ba2\u6237\u7aef\u3001\u9ad8\u7ea7REST\u5ba2\u6237\u7aef\u3002<\/p>\n<p>\u8282\u70b9\u5ba2\u6237\u7aef\u4f5c\u4e3a\u96c6\u7fa4\u8282\u70b9\u7684\u4e00\u90e8\u5206\uff0c\u5728\u96c6\u7fa4\u8282\u70b9\u8f83\u591a\u7684\u60c5\u51b5\u4e0b\u4f1a\u5f71\u54cd\u96c6\u7fa4\u7684\u53cd\u5e94\u901f\u5ea6\u3002<\/p>\n<p><!-- more --><\/p>\n<p>\u4f20\u8f93\u5ba2\u6237\u7aef\u5ba2\u6237\u7aef\u867d\u7136\u5b9e\u73b0\u4e86\u548c\u96c6\u7fa4\u7684\u89e3\u8026\uff0c\u76f8\u5bf9\u8282\u70b9\u66f4\u201c\u8f7b\u201d\uff0c\u4f46\u662f\u4f1a\u5728ES7.0\u62168.0\u4e4b\u540e\u88ab\u79fb\u9664\uff0c\u88ab\u201c\u9ad8\u7ea7Rest\u5ba2\u6237\u7aef\u201d\u6240\u53d6\u4ee3\u3002<\/p>\n<p>\u5982\u4e0b\u4e3aES \u5ba2\u6237\u7aef\u7684\u521b\u5efa\uff1a<\/p>\n<pre><code class=\"language-java\">@Configuration\npublic class ElasticClient {\n    private String host = &quot;192.168.165.239&quot;;\n    private int port = 9200;\n\n    \/**\n     * \u83b7\u53d6Rest\u9ad8\u7ea7\u5ba2\u6237\u7aef\n     * @return\n     *\/\n    @Bean\n    public RestHighLevelClient getRestHighLevelClient(){\n        RestClientBuilder builder = RestClient.builder(new HttpHost(host, port));\n        return new RestHighLevelClient(builder);\n    }\n\n    \/**\n     * \u83b7\u53d6Rest\u4f4e\u7ea7\u5ba2\u6237\u7aef\n     * @return\n     *\/\n    @Bean\n    public RestClient getRestClient(){\n        RestClientBuilder builder = RestClient.builder(new HttpHost(host, port));\n        return builder.build();\n    }\n}<\/code><\/pre>\n<p>\u4e0b\u9762\u4ecb\u7ecdES\u5728Java\u4e2d\u57fa\u672c\u7684\u6587\u6863\u589e\u5220\u6539\u67e5\u64cd\u4f5c<\/p>\n<h2>\u7d22\u5f15\u64cd\u4f5c<\/h2>\n<p>\u7d22\u5f15\u5373\u6211\u4eec\u7684\u65b0\u589e\u64cd\u4f5c\uff0cES\u63d0\u4f9b\u4e86\u4e09\u79cd\u5f62\u5f0f\u7684\u7d22\u5f15\uff0c\u5206\u522b\u4e3a\u901a\u8fc7Json\u5b57\u7b26\u4e32\u3001Map\u96c6\u5408\u3001XContentBuilder\u5b9e\u73b0\u7d22\u5f15\u64cd\u4f5c<\/p>\n<pre><code class=\"language-java\">@Resource\nprivate RestHighLevelClient client;\n\n@GetMapping(&quot;\/index\/create&quot;)\npublic String createIndex() {\n    IndexRequest indexRequest = new IndexRequest(&quot;test&quot;);\n    \/*\n    \/\/Json\u5b57\u7b26\u4e32\u4f5c\u4e3a\u6570\u636e\u6e90\n    String jsonString = &quot;{&quot; +\n            &quot;\\&quot;name\\&quot;: \\&quot;Joe.Ye\\&quot;,&quot; +\n            &quot;\\&quot;email\\&quot;: \\&quot;yezhou@yezhou.org\\&quot;,&quot; +\n            &quot;\\&quot;homepage\\&quot;: \\&quot;http:\/\/www.appblog.cn\\&quot;&quot; +\n            &quot;}&quot;;\n    indexRequest.source(jsonString, XContentType.JSON);\n    *\/\n    \/\/Map\u96c6\u5408\u4f5c\u4e3a\u6570\u636e\u6e90\n    Map&lt;String, Object&gt; map = new HashMap&lt;&gt;();\n    map.put(&quot;name&quot;, &quot;Joe.Ye&quot;);\n    map.put(&quot;age&quot;, 28);\n    map.put(&quot;homepage&quot;, &quot;http:\/\/www.appblog.cn&quot;);\n    indexRequest.source(map);\n    \/*\n    \/\/XContentBuilder\u4f5c\u4e3a\u6570\u636e\u6e90\n    XContentBuilder builder = null;\n    try {\n        builder = XContentFactory.jsonBuilder();\n        builder.startObject();\n        builder.field(&quot;name&quot;, &quot;Joe.Ye&quot;);\n        builder.timeField(&quot;date&quot;, new Date());\n        builder.field(&quot;homepage&quot;, &quot;http:\/\/www.appblog.cn&quot;);\n        builder.endObject();\n    } catch (IOException e) {\n        e.printStackTrace();\n    }\n    indexRequest.source(builder);\n    *\/\n    try {\n        IndexResponse indexResponse = client.index(indexRequest, RequestOptions.DEFAULT);\n        log.info(&quot;Status: {}&quot;, indexResponse.status().getStatus());\n        \/\/client.close();\n        return JSON.toJSONString(indexResponse);\n    } catch (IOException e) {\n        e.printStackTrace();\n    }\n    return &quot;&quot;;\n}<\/code><\/pre>\n<pre><code>Status: 201<\/code><\/pre>\n<pre><code class=\"language-json\">{\n    &quot;fragment&quot;:false,\n    &quot;id&quot;:&quot;zGMq_WoBzwYnh4XWhOrH&quot;,\n    &quot;index&quot;:&quot;test&quot;,\n    &quot;primaryTerm&quot;:1,\n    &quot;result&quot;:&quot;CREATED&quot;,\n    &quot;seqNo&quot;:0,\n    &quot;shardId&quot;:{\n        &quot;fragment&quot;:true,\n        &quot;id&quot;:-1,\n        &quot;index&quot;:{\n            &quot;fragment&quot;:false,\n            &quot;name&quot;:&quot;test&quot;,\n            &quot;uUID&quot;:&quot;_na_&quot;\n        },\n        &quot;indexName&quot;:&quot;test&quot;\n    },\n    &quot;shardInfo&quot;:{\n        &quot;failed&quot;:0,\n        &quot;failures&quot;:[\n\n        ],\n        &quot;fragment&quot;:false,\n        &quot;successful&quot;:1,\n        &quot;total&quot;:2\n    },\n    &quot;type&quot;:&quot;_doc&quot;,\n    &quot;version&quot;:1\n}<\/code><\/pre>\n<h2>\u67e5\u8be2\u6587\u6863<\/h2>\n<p>\u6839\u636e\u7d22\u5f15\u3001ID\u67e5\u8be2\u6587\u6863<\/p>\n<pre><code class=\"language-java\">@GetMapping(&quot;\/index\/get&quot;)\npublic String getIndex() {\n    GetRequest getRequest = new GetRequest(\n            &quot;test&quot;,\n            &quot;zGMq_WoBzwYnh4XWhOrH&quot;);\n    try {\n        GetResponse getResponse = client.get(getRequest, RequestOptions.DEFAULT);\n        Map&lt;String, Object&gt; source = getResponse.getSource();\n        if (source != null &amp;&amp; !source.isEmpty()) {\n            for (Map.Entry&lt;String, Object&gt; entry : source.entrySet()) {\n                log.info(&quot;Key: {}, Value: {}&quot;, entry.getKey(), entry.getValue());\n            }\n        }\n        \/\/client.close();\n        return JSON.toJSONString(getResponse);\n    } catch (IOException e) {\n        e.printStackTrace();\n    }\n    return &quot;&quot;;\n}<\/code><\/pre>\n<pre><code>Key: name, Value: Joe.Ye\nKey: email, Value: yezhou@yezhou.org\nKey: homepage, Value: http:\/\/www.appblog.cn<\/code><\/pre>\n<pre><code class=\"language-json\">{\n    &quot;exists&quot;:true,\n    &quot;fields&quot;:{\n\n    },\n    &quot;fragment&quot;:false,\n    &quot;id&quot;:&quot;zGMq_WoBzwYnh4XWhOrH&quot;,\n    &quot;index&quot;:&quot;test&quot;,\n    &quot;primaryTerm&quot;:1,\n    &quot;seqNo&quot;:0,\n    &quot;source&quot;:{\n        &quot;name&quot;:&quot;Joe.Ye&quot;,\n        &quot;email&quot;:&quot;yezhou@yezhou.org&quot;,\n        &quot;homepage&quot;:&quot;http:\/\/www.appblog.cn&quot;\n    },\n    &quot;sourceAsBytes&quot;:&quot;eyJuYW1lIjoiSm9lLlllIiwiZW1haWwiOiJ5ZXpob3VAeWV6aG91Lm9yZyIsImhvbWVwYWdlIjoiaHR0cDovL3d3dy5hcHBibG9nLmNuIn0=&quot;,\n    &quot;sourceAsBytesRef&quot;:{\n        &quot;fragment&quot;:true\n    },\n    &quot;sourceAsMap&quot;:{\n        &quot;$ref&quot;:&quot;$.source&quot;\n    },\n    &quot;sourceAsString&quot;:&quot;{&quot;name&quot;:&quot;Joe.Ye&quot;,&quot;email&quot;:&quot;yezhou@yezhou.org&quot;,&quot;homepage&quot;:&quot;http:\/\/www.appblog.cn&quot;}&quot;,\n    &quot;sourceEmpty&quot;:false,\n    &quot;sourceInternal&quot;:{\n        &quot;$ref&quot;:&quot;$.sourceAsBytesRef&quot;\n    },\n    &quot;type&quot;:&quot;_doc&quot;,\n    &quot;version&quot;:1\n}<\/code><\/pre>\n<h2>\u5220\u9664\u6587\u6863<\/h2>\n<pre><code class=\"language-java\">@GetMapping(&quot;\/index\/delete&quot;)\npublic String deleteIndex() {\n    DeleteRequest deleteRequest = new DeleteRequest(&quot;test&quot;, &quot;DWMz_WoBzwYnh4XWA-s8&quot;);\n    deleteRequest.timeout(TimeValue.timeValueMinutes(10));\n    deleteRequest.setRefreshPolicy(WriteRequest.RefreshPolicy.WAIT_UNTIL);\n    try {\n        DeleteResponse deleteResponse = client.delete(deleteRequest, RequestOptions.DEFAULT);\n        log.info(&quot;Status: {}&quot;, deleteResponse.status().getStatus());\n        \/\/client.close();\n        return JSON.toJSONString(deleteResponse);\n    } catch (IOException e) {\n        e.printStackTrace();\n    }\n    return &quot;&quot;;\n}<\/code><\/pre>\n<pre><code>Status: 200<\/code><\/pre>\n<pre><code class=\"language-json\">{\n    &quot;fragment&quot;:false,\n    &quot;id&quot;:&quot;DWMz_WoBzwYnh4XWA-s8&quot;,\n    &quot;index&quot;:&quot;test&quot;,\n    &quot;primaryTerm&quot;:1,\n    &quot;result&quot;:&quot;DELETED&quot;,\n    &quot;seqNo&quot;:6,\n    &quot;shardId&quot;:{\n        &quot;fragment&quot;:true,\n        &quot;id&quot;:-1,\n        &quot;index&quot;:{\n            &quot;fragment&quot;:false,\n            &quot;name&quot;:&quot;test&quot;,\n            &quot;uUID&quot;:&quot;_na_&quot;\n        },\n        &quot;indexName&quot;:&quot;test&quot;\n    },\n    &quot;shardInfo&quot;:{\n        &quot;failed&quot;:0,\n        &quot;failures&quot;:[\n\n        ],\n        &quot;fragment&quot;:false,\n        &quot;successful&quot;:1,\n        &quot;total&quot;:2\n    },\n    &quot;type&quot;:&quot;_doc&quot;,\n    &quot;version&quot;:2\n}<\/code><\/pre>\n<p>\u518d\u6b21\u67e5\u8be2<\/p>\n<pre><code class=\"language-json\">{\n    &quot;exists&quot;:false,\n    &quot;fields&quot;:{\n\n    },\n    &quot;fragment&quot;:false,\n    &quot;id&quot;:&quot;DWMz_WoBzwYnh4XWA-s8&quot;,\n    &quot;index&quot;:&quot;test&quot;,\n    &quot;primaryTerm&quot;:0,\n    &quot;seqNo&quot;:-2,\n    &quot;sourceEmpty&quot;:true,\n    &quot;type&quot;:&quot;_doc&quot;,\n    &quot;version&quot;:-1\n}<\/code><\/pre>\n<h2>\u66f4\u65b0\u6587\u6863<\/h2>\n<pre><code class=\"language-java\">@GetMapping(&quot;\/index\/update&quot;)\npublic String updateIndex() {\n    UpdateRequest updateRequest = new UpdateRequest(&quot;test&quot;, &quot;nWNC_WoBzwYnh4XWTeun&quot;);\n    Map&lt;String, Object&gt; map = new HashMap&lt;&gt;();\n    map.put(&quot;name&quot;, &quot;Joe.Ye@AppBlog.CN&quot;);\n    map.put(&quot;age&quot;, 18);\n    updateRequest.doc(map, XContentType.JSON);\n    try {\n        UpdateResponse updateResponse = client.update(updateRequest, RequestOptions.DEFAULT);\n        log.info(&quot;Status: {}&quot;, updateResponse.status().getStatus());\n        \/\/client.close();\n        return JSON.toJSONString(updateResponse);\n    } catch (IOException e) {\n        e.printStackTrace();\n    }\n    return &quot;&quot;;\n}<\/code><\/pre>\n<pre><code>Status: 200<\/code><\/pre>\n<pre><code class=\"language-json\">{\n    &quot;fragment&quot;:false,\n    &quot;id&quot;:&quot;nWNC_WoBzwYnh4XWTeun&quot;,\n    &quot;index&quot;:&quot;test&quot;,\n    &quot;primaryTerm&quot;:1,\n    &quot;result&quot;:&quot;UPDATED&quot;,\n    &quot;seqNo&quot;:7,\n    &quot;shardId&quot;:{\n        &quot;fragment&quot;:true,\n        &quot;id&quot;:-1,\n        &quot;index&quot;:{\n            &quot;fragment&quot;:false,\n            &quot;name&quot;:&quot;test&quot;,\n            &quot;uUID&quot;:&quot;_na_&quot;\n        },\n        &quot;indexName&quot;:&quot;test&quot;\n    },\n    &quot;shardInfo&quot;:{\n        &quot;failed&quot;:0,\n        &quot;failures&quot;:[\n\n        ],\n        &quot;fragment&quot;:false,\n        &quot;successful&quot;:1,\n        &quot;total&quot;:2\n    },\n    &quot;type&quot;:&quot;_doc&quot;,\n    &quot;version&quot;:2\n}<\/code><\/pre>\n<h2>\u67e5\u8be2\u6587\u6863\u662f\u5426\u5b58\u5728<\/h2>\n<pre><code class=\"language-java\">@GetMapping(&quot;\/index\/exists&quot;)\npublic String existsIndex() {\n    GetRequest getRequest = new GetRequest(&quot;test&quot;,&quot;zGMq_WoBzwYnh4XWhOrH&quot;);\n    try {\n        getRequest.fetchSourceContext(new FetchSourceContext(false)); \/\/\u7981\u7528\u83b7\u53d6 _source\u5b57\u6bb5\n        getRequest.storedFields(&quot;_none_&quot;); \/\/\u7981\u7528\u83b7\u53d6\u5b58\u50a8\u5b57\u6bb5\n        boolean exists = client.exists(getRequest, RequestOptions.DEFAULT);\n        \/\/client.close();\n        return String.valueOf(exists);\n    } catch (Exception e) {\n        e.printStackTrace();\n    }\n    return &quot;&quot;;\n}<\/code><\/pre>\n<pre><code>true<\/code><\/pre>\n<h2>Bulk\u6279\u91cf\u64cd\u4f5c<\/h2>\n<p>bulk\u53ef\u4ee5\u6279\u91cf\u6267\u884c\u591a\u6761\u64cd\u4f5c\u8bed\u53e5\uff0cbulk\u652f\u6301\u6279\u91cf\u64cd\u4f5c\u4e0d\u540c\u7684\u547d\u4ee4\uff0c\u4f8b\u5982\u6279\u91cf\u66f4\u65b0\u548c\u5220\u9664<\/p>\n<pre><code class=\"language-java\">@GetMapping(&quot;\/bulk&quot;)\npublic String bulk() {\n    Person person1 = new Person(&quot;Joe.Ye&quot;, 28, 175.2);\n    Person person2 = new Person(&quot;Xiong&quot;, 26, 165.5);\n    BulkRequest bulkRequest = new BulkRequest();\n    IndexRequest indexRequest1 = new IndexRequest(&quot;person&quot;).source(JSON.toJSONString(person1), XContentType.JSON);\n    IndexRequest indexRequest2 = new IndexRequest(&quot;person&quot;).source(JSON.toJSONString(person2), XContentType.JSON);\n    DeleteRequest deleteRequest = new DeleteRequest(&quot;test&quot;, &quot;AGMx_WoBzwYnh4XWx-tL&quot;);\n    bulkRequest.add(indexRequest1);\n    bulkRequest.add(indexRequest2);\n    bulkRequest.add(deleteRequest);\n    try {\n        BulkResponse bulkResponse = client.bulk(bulkRequest, RequestOptions.DEFAULT);\n        log.info(&quot;Status: {}&quot;, bulkResponse.status().getStatus());\n        \/\/client.close();\n        return JSON.toJSONString(bulkResponse);\n    } catch (IOException e) {\n        e.printStackTrace();\n    }\n    return &quot;&quot;;\n}<\/code><\/pre>\n<pre><code>Status: 200<\/code><\/pre>\n<pre><code class=\"language-json\">{\n    &quot;fragment&quot;:false,\n    &quot;ingestTook&quot;:{\n        &quot;days&quot;:0,\n        &quot;daysFrac&quot;:-1.1574074074074074e-8,\n        &quot;hours&quot;:0,\n        &quot;hoursFrac&quot;:-2.7777777777777776e-7,\n        &quot;micros&quot;:-1000,\n        &quot;microsFrac&quot;:-1000,\n        &quot;millis&quot;:-1,\n        &quot;millisFrac&quot;:-1,\n        &quot;minutes&quot;:0,\n        &quot;minutesFrac&quot;:-0.000016666666666666667,\n        &quot;nanos&quot;:-1000000,\n        &quot;seconds&quot;:0,\n        &quot;secondsFrac&quot;:-0.001,\n        &quot;stringRep&quot;:&quot;-1&quot;\n    },\n    &quot;ingestTookInMillis&quot;:-1,\n    &quot;items&quot;:[\n        {\n            &quot;failed&quot;:false,\n            &quot;fragment&quot;:false,\n            &quot;id&quot;:&quot;n2Nh_WoBzwYnh4XWSuxi&quot;,\n            &quot;index&quot;:&quot;person&quot;,\n            &quot;itemId&quot;:0,\n            &quot;opType&quot;:&quot;INDEX&quot;,\n            &quot;response&quot;:{\n                &quot;fragment&quot;:false,\n                &quot;id&quot;:&quot;n2Nh_WoBzwYnh4XWSuxi&quot;,\n                &quot;index&quot;:&quot;person&quot;,\n                &quot;primaryTerm&quot;:1,\n                &quot;result&quot;:&quot;CREATED&quot;,\n                &quot;seqNo&quot;:0,\n                &quot;shardId&quot;:{\n                    &quot;fragment&quot;:true,\n                    &quot;id&quot;:-1,\n                    &quot;index&quot;:{\n                        &quot;fragment&quot;:false,\n                        &quot;name&quot;:&quot;person&quot;,\n                        &quot;uUID&quot;:&quot;_na_&quot;\n                    },\n                    &quot;indexName&quot;:&quot;person&quot;\n                },\n                &quot;shardInfo&quot;:{\n                    &quot;failed&quot;:0,\n                    &quot;failures&quot;:[\n\n                    ],\n                    &quot;fragment&quot;:false,\n                    &quot;successful&quot;:1,\n                    &quot;total&quot;:2\n                },\n                &quot;type&quot;:&quot;_doc&quot;,\n                &quot;version&quot;:1\n            },\n            &quot;type&quot;:&quot;_doc&quot;,\n            &quot;version&quot;:1\n        },\n        {\n            &quot;failed&quot;:false,\n            &quot;fragment&quot;:false,\n            &quot;id&quot;:&quot;oGNh_WoBzwYnh4XWSuxi&quot;,\n            &quot;index&quot;:&quot;person&quot;,\n            &quot;itemId&quot;:1,\n            &quot;opType&quot;:&quot;INDEX&quot;,\n            &quot;response&quot;:{\n                &quot;fragment&quot;:false,\n                &quot;id&quot;:&quot;oGNh_WoBzwYnh4XWSuxi&quot;,\n                &quot;index&quot;:&quot;person&quot;,\n                &quot;primaryTerm&quot;:1,\n                &quot;result&quot;:&quot;CREATED&quot;,\n                &quot;seqNo&quot;:1,\n                &quot;shardId&quot;:{\n                    &quot;fragment&quot;:true,\n                    &quot;id&quot;:-1,\n                    &quot;index&quot;:{\n                        &quot;fragment&quot;:false,\n                        &quot;name&quot;:&quot;person&quot;,\n                        &quot;uUID&quot;:&quot;_na_&quot;\n                    },\n                    &quot;indexName&quot;:&quot;person&quot;\n                },\n                &quot;shardInfo&quot;:{\n                    &quot;failed&quot;:0,\n                    &quot;failures&quot;:[\n\n                    ],\n                    &quot;fragment&quot;:false,\n                    &quot;successful&quot;:1,\n                    &quot;total&quot;:2\n                },\n                &quot;type&quot;:&quot;_doc&quot;,\n                &quot;version&quot;:1\n            },\n            &quot;type&quot;:&quot;_doc&quot;,\n            &quot;version&quot;:1\n        },\n        {\n            &quot;failed&quot;:false,\n            &quot;fragment&quot;:false,\n            &quot;id&quot;:&quot;AGMx_WoBzwYnh4XWx-tL&quot;,\n            &quot;index&quot;:&quot;test&quot;,\n            &quot;itemId&quot;:2,\n            &quot;opType&quot;:&quot;DELETE&quot;,\n            &quot;response&quot;:{\n                &quot;fragment&quot;:false,\n                &quot;id&quot;:&quot;AGMx_WoBzwYnh4XWx-tL&quot;,\n                &quot;index&quot;:&quot;test&quot;,\n                &quot;primaryTerm&quot;:1,\n                &quot;result&quot;:&quot;DELETED&quot;,\n                &quot;seqNo&quot;:8,\n                &quot;shardId&quot;:{\n                    &quot;fragment&quot;:true,\n                    &quot;id&quot;:-1,\n                    &quot;index&quot;:{\n                        &quot;fragment&quot;:false,\n                        &quot;name&quot;:&quot;test&quot;,\n                        &quot;uUID&quot;:&quot;_na_&quot;\n                    },\n                    &quot;indexName&quot;:&quot;test&quot;\n                },\n                &quot;shardInfo&quot;:{\n                    &quot;failed&quot;:0,\n                    &quot;failures&quot;:[\n\n                    ],\n                    &quot;fragment&quot;:false,\n                    &quot;successful&quot;:1,\n                    &quot;total&quot;:2\n                },\n                &quot;type&quot;:&quot;_doc&quot;,\n                &quot;version&quot;:2\n            },\n            &quot;type&quot;:&quot;_doc&quot;,\n            &quot;version&quot;:2\n        }\n    ],\n    &quot;took&quot;:{\n        &quot;days&quot;:0,\n        &quot;daysFrac&quot;:0.000004780092592592592,\n        &quot;hours&quot;:0,\n        &quot;hoursFrac&quot;:0.00011472222222222222,\n        &quot;micros&quot;:413000,\n        &quot;microsFrac&quot;:413000,\n        &quot;millis&quot;:413,\n        &quot;millisFrac&quot;:413,\n        &quot;minutes&quot;:0,\n        &quot;minutesFrac&quot;:0.006883333333333333,\n        &quot;nanos&quot;:413000000,\n        &quot;seconds&quot;:0,\n        &quot;secondsFrac&quot;:0.413,\n        &quot;stringRep&quot;:&quot;413ms&quot;\n    }\n}<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>\u83b7\u53d6ES\u5ba2\u6237\u7aef ES\u7684\u63d0\u4f9b\u4e86\u56db\u79cdJava\u5ba2\u6237\u7aef\uff0c\u5206\u522b\u4e3a\u8282\u70b9\u5ba2\u6237\u7aef(node client)\u3001\u4f20\u8f93\u5ba2\u6237\u7aef(Tra [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[301],"tags":[],"class_list":["post-1389","post","type-post","status-publish","format-standard","hentry","category-elasticsearch"],"_links":{"self":[{"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/posts\/1389","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/comments?post=1389"}],"version-history":[{"count":0,"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/posts\/1389\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/media?parent=1389"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/categories?post=1389"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/tags?post=1389"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}