use of org.springframework.data.elasticsearch.core.IndexOperations in project spring-data-elasticsearch by spring-projects.
the class MappingBuilderIntegrationTests method shouldWriteMappingForDisabledProperty.
// #1370
@Test
@DisplayName("should write mapping for disabled property")
void shouldWriteMappingForDisabledProperty() {
IndexOperations indexOps = operations.indexOps(DisabledMappingProperty.class);
indexOps.create();
indexOps.putMapping();
}
use of org.springframework.data.elasticsearch.core.IndexOperations in project spring-data-elasticsearch by spring-projects.
the class MappingBuilderIntegrationTests method shouldWriteDynamicDetectionValues.
// #638
@Test
@DisplayName("should write dynamic detection values")
void shouldWriteDynamicDetectionValues() {
IndexOperations indexOps = operations.indexOps(DynamicDetectionMapping.class);
indexOps.create();
indexOps.putMapping();
}
use of org.springframework.data.elasticsearch.core.IndexOperations in project spring-data-elasticsearch by spring-projects.
the class MappingBuilderIntegrationTests method shouldAddStockPriceDocumentToIndex.
// DATAES-530
@Test
public void shouldAddStockPriceDocumentToIndex() {
// Given
IndexOperations indexOps = operations.indexOps(StockPrice.class);
// When
indexOps.create();
indexOps.putMapping(StockPrice.class);
String symbol = "AU";
double price = 2.34;
String id = "abc";
IndexCoordinates index = IndexCoordinates.of("test-index-stock-mapping-builder");
//
StockPrice stockPrice = new StockPrice();
stockPrice.setId(id);
stockPrice.setSymbol(symbol);
stockPrice.setPrice(BigDecimal.valueOf(price));
operations.index(buildIndex(stockPrice), index);
operations.indexOps(StockPrice.class).refresh();
NativeSearchQuery searchQuery = new NativeSearchQueryBuilder().withQuery(matchAllQuery()).build();
SearchHits<StockPrice> result = operations.search(searchQuery, StockPrice.class, index);
// Then
assertThat(result).hasSize(1);
StockPrice entry = result.getSearchHit(0).getContent();
assertThat(entry.getSymbol()).isEqualTo(symbol);
assertThat(entry.getPrice()).isCloseTo(BigDecimal.valueOf(price), Percentage.withPercentage(0.01));
}
use of org.springframework.data.elasticsearch.core.IndexOperations in project spring-data-elasticsearch by spring-projects.
the class MappingBuilderIntegrationTests method shouldWriteWildcardFieldMapping.
// DATAES-946
@Test
@DisplayName("should write wildcard field mapping")
void shouldWriteWildcardFieldMapping() {
IndexOperations indexOps = operations.indexOps(WildcardEntity.class);
indexOps.create();
indexOps.putMapping();
}
use of org.springframework.data.elasticsearch.core.IndexOperations in project spring-data-elasticsearch by spring-projects.
the class MappingBuilderIntegrationTests method shouldWriteSourceExcludes.
// #796
@Test
@DisplayName("should write source excludes")
void shouldWriteSourceExcludes() {
IndexOperations indexOps = operations.indexOps(ExcludedFieldEntity.class);
indexOps.create();
indexOps.putMapping();
}
Aggregations