From 685001eb4ec3b13f75db83f8a193097d949d6ac9 Mon Sep 17 00:00:00 2001 From: Michael Pratt Date: Fri, 24 May 2019 19:11:52 +0000 Subject: [PATCH] BAEL-2958: Add more examples --- .../java/com/baeldung/jest/JestDemoApplication.java | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/jest/jest-demo/src/main/java/com/baeldung/jest/JestDemoApplication.java b/jest/jest-demo/src/main/java/com/baeldung/jest/JestDemoApplication.java index 939ed8461f..c9720f958f 100644 --- a/jest/jest-demo/src/main/java/com/baeldung/jest/JestDemoApplication.java +++ b/jest/jest-demo/src/main/java/com/baeldung/jest/JestDemoApplication.java @@ -20,10 +20,7 @@ import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.context.ApplicationContext; import java.io.IOException; -import java.util.Arrays; -import java.util.HashMap; -import java.util.LinkedHashMap; -import java.util.Map; +import java.util.*; @SpringBootApplication public class JestDemoApplication { @@ -98,7 +95,7 @@ public class JestDemoApplication { jestClient.execute(new Index.Builder(employee).index("employees").build()); // Read document by ID - jestClient.execute(new Get.Builder("employees", "1").build()); + Employee getResult = jestClient.execute(new Get.Builder("employees", "1").build()).getSourceAsObject(Employee.class); // Search documents String search = "{\n" + @@ -110,7 +107,9 @@ public class JestDemoApplication { " }\n" + " }\n" + "}"; - jestClient.execute(new Search.Builder(search).build()); + List> searchResults = + jestClient.execute(new Search.Builder(search).build()) + .getHits(Employee.class); // Update document employee.setYears_of_service(3);