Search in sources :

Example 21 with IndexOperations

use of org.springframework.data.elasticsearch.core.IndexOperations in project spring-data-elasticsearch by spring-projects.

the class ElasticsearchOperationsCallbackIntegrationTests method setUp.

@BeforeEach
void setUp() {
    seqNoPrimaryTerm = null;
    operations = (AbstractElasticsearchTemplate) spy(originalOperations);
    IndexOperations indexOps = operations.indexOps(SampleEntity.class);
    indexOps.delete();
    indexOps.create();
    indexOps.putMapping(SampleEntity.class);
    // store one entity to have a seq_no and primary_term
    final SampleEntity initial = new SampleEntity("1", "initial");
    final SampleEntity saved = operations.save(initial);
    seqNoPrimaryTerm = saved.getSeqNoPrimaryTerm();
}
Also used : IndexOperations(org.springframework.data.elasticsearch.core.IndexOperations) BeforeEach(org.junit.jupiter.api.BeforeEach)

Example 22 with IndexOperations

use of org.springframework.data.elasticsearch.core.IndexOperations in project spring-data-elasticsearch by spring-projects.

the class ReactiveElasticsearchOperationsCallbackTest method tearDown.

@AfterEach
void tearDown() {
    IndexOperations indexOps = nonreactiveOperations.indexOps(SampleEntity.class);
    indexOps.delete();
}
Also used : IndexOperations(org.springframework.data.elasticsearch.core.IndexOperations) AfterEach(org.junit.jupiter.api.AfterEach)

Example 23 with IndexOperations

use of org.springframework.data.elasticsearch.core.IndexOperations in project spring-data-elasticsearch by spring-projects.

the class ReactiveElasticsearchOperationsCallbackTest method setUp.

@BeforeEach
void setUp() {
    IndexOperations indexOps = nonreactiveOperations.indexOps(SampleEntity.class);
    indexOps.create();
    indexOps.putMapping(SampleEntity.class);
}
Also used : IndexOperations(org.springframework.data.elasticsearch.core.IndexOperations) BeforeEach(org.junit.jupiter.api.BeforeEach)

Example 24 with IndexOperations

use of org.springframework.data.elasticsearch.core.IndexOperations in project spring-data-elasticsearch by spring-projects.

the class MappingBuilderIntegrationTests method shouldNotFailOnCircularReference.

@Test
public void shouldNotFailOnCircularReference() {
    IndexOperations indexOperations = operations.indexOps(SimpleRecursiveEntity.class);
    indexOperations.createWithMapping();
    indexOperations.refresh();
}
Also used : IndexOperations(org.springframework.data.elasticsearch.core.IndexOperations) Test(org.junit.jupiter.api.Test) SpringIntegrationTest(org.springframework.data.elasticsearch.junit.jupiter.SpringIntegrationTest)

Example 25 with IndexOperations

use of org.springframework.data.elasticsearch.core.IndexOperations in project spring-data-elasticsearch by spring-projects.

the class MappingBuilderIntegrationTests method shouldWriteDynamicMapping.

// #1871
@Test
@DisplayName("should write dynamic mapping")
void shouldWriteDynamicMapping() {
    IndexOperations indexOps = operations.indexOps(DynamicMappingEntity.class);
    indexOps.create();
    indexOps.putMapping();
}
Also used : IndexOperations(org.springframework.data.elasticsearch.core.IndexOperations) Test(org.junit.jupiter.api.Test) SpringIntegrationTest(org.springframework.data.elasticsearch.junit.jupiter.SpringIntegrationTest) DisplayName(org.junit.jupiter.api.DisplayName)

Aggregations

IndexOperations (org.springframework.data.elasticsearch.core.IndexOperations)35 Test (org.junit.jupiter.api.Test)24 SpringIntegrationTest (org.springframework.data.elasticsearch.junit.jupiter.SpringIntegrationTest)24 DisplayName (org.junit.jupiter.api.DisplayName)11 BeforeEach (org.junit.jupiter.api.BeforeEach)6 Map (java.util.Map)5 HashMap (java.util.HashMap)3 AfterEach (org.junit.jupiter.api.AfterEach)3 EsProduct (com.macro.mall.search.domain.EsProduct)2 Test (org.junit.Test)2 SpringBootTest (org.springframework.boot.test.context.SpringBootTest)2 NativeSearchQuery (org.springframework.data.elasticsearch.core.query.NativeSearchQuery)2 NativeSearchQueryBuilder (org.springframework.data.elasticsearch.core.query.NativeSearchQueryBuilder)2 LocalDate (java.time.LocalDate)1 Date (java.util.Date)1 IndexInformation (org.springframework.data.elasticsearch.core.IndexInformation)1 IndexCoordinates (org.springframework.data.elasticsearch.core.mapping.IndexCoordinates)1