赞
踩
- /**
- * 更新
- * @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 InterruptedException
- */
- @Test
- public void update2() throws IOException {
- client.prepareUpdate("twitter", "tweet", "AWQrxpiTF3aJ5qXnAM6l")
- .setDoc(XContentFactory.jsonBuilder()
- .startObject()
- .field("user", "male2")
- .endObject())
- .get();
- }
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。