Java Code Examples for io.searchbox.core.Index#getType()

The following examples show how to use io.searchbox.core.Index#getType() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: JestBulkOperationsTest.java    From log4j2-elasticsearch with Apache License 2.0 6 votes vote down vote up
@Test
public void defaultJestBulkOperationsSetsDefaultMappingType() {

    // given
    BatchOperations<Bulk> bulkOperations = new JestBulkOperations();

    String testPayload = "{ \"testfield\": \"testvalue\" }";
    StringItemSource itemSource = spy(new StringItemSource(testPayload));
    Index item = (Index) bulkOperations.createBatchItem("testIndex", itemSource);

    // when
    String type = item.getType();

    // then
    assertEquals("index", type);

}
 
Example 2
Source File: JestBulkOperationsTest.java    From log4j2-elasticsearch with Apache License 2.0 6 votes vote down vote up
@Test
public void mappingTypeCanBeSet() {

    // given
    String expectedMappingType = UUID.randomUUID().toString();
    BatchOperations<Bulk> bulkOperations = new JestBulkOperations(expectedMappingType);

    String testPayload = "{ \"testfield\": \"testvalue\" }";
    StringItemSource itemSource = spy(new StringItemSource(testPayload));
    Index item = (Index) bulkOperations.createBatchItem("testIndex", itemSource);

    // when
    String type = item.getType();

    // then
    assertEquals(expectedMappingType, type);

}