Page tree

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Supported Operations

OperationMethods Supported
Insert
  • index
  • prepareIndex
  • indexAsync
Update
  • update
  • prepareUpdate
  • updateAsync
Select
  • get
  • prepareGet
  • multiGet
  • multigetAsync
  • prepareMultiGet
  • multiSearch
  • multisearchAsync
  • prepareMultiSearch
  • search
  • searchAsync
  • prepareSearch
  • searchScroll
  • searchScrollAsync
  • explain
  • prepareExplain
  • exists
  • existsAsync
  • fieldCaps
  • execute
  • executeAsync
Delete 
  • delete
  • prepareDelete

...

Link typeSource and destination of link Methods supported
parentLinkbelongsTo

Between From Java Elasticsearch Cluster Index object and to Java Elasticsearch Index Cluster object


useLinkBetween the caller .NET Class / Method objects and and Java Elasticsearch Index objects


  • bulk
  • bulkAsync
  • performRequest
  • performRequestAsync
useInsertLink
  • index
  • prepareIndex
  • indexAsync
useDeleteLink
  • delete
  • prepareDelete

useSelectLink

  • get
  • prepareGet
  • multiGet
  • multigetAsync
  • prepareMultiGet
  • multiSearch
  • multisearchAsync
  • prepareMultiSearch
  • search
  • searchAsync
  • prepareSearch
  • searchScroll
  • searchScrollAsync
  • explain
  • prepareExplain
  • exists
  • existsAsync
  • execute
  • fieldCaps
  • executeAsync
useUpdateLink
  • update
  • prepareUpdate
  • updateAsync


...

Expand
titleDelete Operation


Code Block
languagec#
titleDelete
 public String delete1(@PathVariable final String id) {

        DeleteResponse deleteResponse = client.prepareDelete("employee", "id", id).get();

        System.out.println(deleteResponse.getResult().toString());
        return deleteResponse.getResult().toString();
    }

Evolution

...

Jest Elasticsearch Java Client

APIs such as execute

...

Limitations

...

and executeAsync are used to perform all the CRUD operations. To identify which operation to be performed, type of Builder Request is analyzed.

Expand
titleInsert Operation


Code Block
languagejava
public static void main(String[] args) throws IOException {
	 	// Demo the JestClient
        JestClient jestClient = jestClient();
		// Index a document from String
        ObjectMapper mapper = new ObjectMapper();
        JsonNode employeeJsonNode = mapper.createObjectNode()
                .put("name", "Michael Pratt")
                .put("title", "Java Developer")
                .put("yearsOfService", 2)
                .set("skills", mapper.createArrayNode()
                        .add("java")
                        .add("spring")
                        .add("elasticsearch"));
        jestClient.execute(new Index.Builder(employeeJsonNode.toString()).index("employees").build());
}

Image Added


Expand
titleDelete Operation


Code Block
languagejava
public static void main(String[] args) throws IOException {
	 	// Demo the JestClient
        JestClient jestClient = jestClient();
		// Delete documents
        jestClient.execute(new Delete.Builder("2") .index("employees") .build());
}

Image Added


Expand
titleUpdate Operation


Code Block
languagejava
public static void main(String[] args) throws IOException {
	 	// Demo the JestClient
        JestClient jestClient = jestClient();
		// Update document
        employee.setYearsOfService(3);
        jestClient.execute(new Update.Builder(employee).index("employees").id("1").build());
}

Image Added


Expand
titleSelect Operation


Code Block
languagejava
public static void main(String[] args) throws IOException {
	 	// Demo the JestClient
        JestClient jestClient = jestClient();
		// Read document by ID
        Employee getResult = jestClient.execute(new Get.Builder("employees", "1").build()).getSourceAsObject(Employee.class);
}

Image Added


Expand
titleBulk Operations


Code Block
languagejava
public static void main(String[] args) throws IOException {
	 	// Demo the JestClient
        JestClient jestClient = jestClient();

		// Bulk operations
        Employee employeeObject1 = new Employee();
        employee.setName("John Smith");
        employee.setTitle("Python Developer");
        employee.setYearsOfService(10);
        employee.setSkills(Arrays.asList("python"));

        Employee employeeObject2 = new Employee();
        employee.setName("Kate Smith");
        employee.setTitle("Senior JavaScript Developer");
        employee.setYearsOfService(10);
        employee.setSkills(Arrays.asList("javascript", "angular"));

        jestClient.execute(new Bulk.Builder().defaultIndex("employees")
                .addAction(new Index.Builder(employeeObject1).build())
                .addAction(new Index.Builder(employeeObject2).build())
                .addAction(new Delete.Builder("3").build()) .build());
}

Image Added


Evolution

  • Increased resolution for cluster and index names
  • Support for APIs such as execute(), fieldcaps
  • Support for Jest Elasticsearch Client

Limitations

  • APIs such as bulk (only for Transport Client, High Level Client) and performRequst result in useLinks
  • Bulk API used in Jest Client always results in appropriate CRUD links with unknown Index.
  • Multiple clusters used for CRUD operations are not supported. Only first found cluster is used.

...