Search in sources :

Example 16 with IndexOperations

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

the class ElasticsearchOperationsCallbackIntegrationTests method tearDown.

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

Example 17 with IndexOperations

use of org.springframework.data.elasticsearch.core.IndexOperations in project mall by macrozheng.

the class MallSearchApplicationTests method testEsProductMapping.

@Test
public void testEsProductMapping() {
    IndexOperations indexOperations = elasticsearchTemplate.indexOps(EsProduct.class);
    indexOperations.putMapping(indexOperations.createMapping(EsProduct.class));
    Map mapping = indexOperations.getMapping();
    System.out.println(mapping);
}
Also used : IndexOperations(org.springframework.data.elasticsearch.core.IndexOperations) Map(java.util.Map) EsProduct(com.macro.mall.search.domain.EsProduct) SpringBootTest(org.springframework.boot.test.context.SpringBootTest) Test(org.junit.Test)

Example 18 with IndexOperations

use of org.springframework.data.elasticsearch.core.IndexOperations in project mall-swarm by macrozheng.

the class MallSearchApplicationTests method testEsProductMapping.

@Test
public void testEsProductMapping() {
    IndexOperations indexOperations = elasticsearchTemplate.indexOps(EsProduct.class);
    indexOperations.putMapping(indexOperations.createMapping(EsProduct.class));
    Map mapping = indexOperations.getMapping();
    System.out.println(mapping);
}
Also used : IndexOperations(org.springframework.data.elasticsearch.core.IndexOperations) Map(java.util.Map) EsProduct(com.macro.mall.search.domain.EsProduct) SpringBootTest(org.springframework.boot.test.context.SpringBootTest) Test(org.junit.Test)

Example 19 with IndexOperations

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

the class ImmutableElasticsearchRepositoryTests method before.

@BeforeEach
public void before() {
    IndexOperations indexOperations = operations.indexOps(ImmutableEntity.class);
    indexOperations.delete();
    indexOperations.create();
    indexOperations.refresh();
}
Also used : IndexOperations(org.springframework.data.elasticsearch.core.IndexOperations) BeforeEach(org.junit.jupiter.api.BeforeEach)

Example 20 with IndexOperations

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

the class DynamicIndexEntityIntegrationTests method indexOpsShouldUseDynamicallyProvidedName.

// DATAES-821
@Test
void indexOpsShouldUseDynamicallyProvidedName() {
    indexNameProvider.indexName = "index-dynamic";
    indexNameProvider.callsCount = 0;
    operations.indexOps(IndexCoordinates.of("index-dynamic")).delete();
    IndexOperations indexOps = operations.indexOps(DynamicIndexEntity.class);
    indexOps.create();
    indexOps.refresh();
    indexOps.refresh();
    // internally calls doExists
    indexOps.delete();
    assertThat(indexNameProvider.callsCount).isGreaterThan(0);
}
Also used : IndexOperations(org.springframework.data.elasticsearch.core.IndexOperations) Test(org.junit.jupiter.api.Test) SpringIntegrationTest(org.springframework.data.elasticsearch.junit.jupiter.SpringIntegrationTest)

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