作者:荒--

Elasticsearch 两种更新操作

 /**
     * 更新
     * @throws IOException
     * @throws ExecutionException
     * @throws InterruptedException
     */
    @Test
    public void update1() throws IOException, ExecutionException, InterruptedException {
        UpdateRequest updateRequest = new UpdateRequest();
        updateRequest.index("twitter");
        updateRequest.type("tweet");
        updateRequest.id("AWQrxpiTF3aJ5qXnAM6l");
        updateRequest.doc(XContentFactory.jsonBuilder()
                .startObject()
                .field("age", 8)
                .endObject());
        client.update(updateRequest).get();
    }


    /**
     * 更新
     * @throws IOException
     * @throws ExecutionException
     * @throws Interrupted
lock