use of org.springframework.data.elasticsearch.core.IndexOperations in project spring-data-elasticsearch by spring-projects.
the class MappingBuilderIntegrationTests method shouldWriteDenseVectorFieldMapping.
// #1700
@Test
@DisplayName("should write dense_vector field mapping")
void shouldWriteDenseVectorFieldMapping() {
IndexOperations indexOps = operations.indexOps(DenseVectorEntity.class);
indexOps.create();
indexOps.putMapping();
}
use of org.springframework.data.elasticsearch.core.IndexOperations in project spring-data-elasticsearch by spring-projects.
the class IndexTemplateIntegrationTests method shouldReturnNullOnNonExistingGetTemplate.
// DATAES-612
@Test
void shouldReturnNullOnNonExistingGetTemplate() {
String templateName = "template" + UUID.randomUUID().toString();
IndexOperations indexOps = operations.indexOps(IndexCoordinates.of("dont-care"));
GetTemplateRequest getTemplateRequest = new GetTemplateRequest(templateName);
TemplateData templateData = indexOps.getTemplate(getTemplateRequest);
assertThat(templateData).isNull();
}
use of org.springframework.data.elasticsearch.core.IndexOperations in project spring-data-elasticsearch by spring-projects.
the class IndexTemplateIntegrationTests method shouldGetTemplate.
// DATAES-612
@Test
void shouldGetTemplate() throws JSONException {
IndexOperations indexOps = operations.indexOps(IndexCoordinates.of("dont-care"));
org.springframework.data.elasticsearch.core.document.Document mapping = indexOps.createMapping(TemplateClass.class);
Settings settings = indexOps.createSettings(TemplateClass.class);
AliasActions aliasActions = new AliasActions(new AliasAction.Add(AliasActionParameters.builderForTemplate().withAliases("alias1", "alias2").build()));
PutTemplateRequest putTemplateRequest = //
PutTemplateRequest.builder("test-template", "log-*").withSettings(//
settings).withMappings(//
mapping).withAliasActions(//
aliasActions).withOrder(//
11).withVersion(//
42).build();
boolean acknowledged = indexOps.putTemplate(putTemplateRequest);
assertThat(acknowledged).isTrue();
GetTemplateRequest getTemplateRequest = new GetTemplateRequest(putTemplateRequest.getName());
TemplateData templateData = indexOps.getTemplate(getTemplateRequest);
assertThat(templateData).isNotNull();
assertThat(templateData.getIndexPatterns()).containsExactlyInAnyOrder(putTemplateRequest.getIndexPatterns());
assertEquals(settings.toJson(), templateData.getSettings().toJson(), false);
assertEquals(mapping.toJson(), templateData.getMapping().toJson(), false);
Map<String, AliasData> aliases = templateData.getAliases();
assertThat(aliases).hasSize(2);
AliasData alias1 = aliases.get("alias1");
assertThat(alias1.getAlias()).isEqualTo("alias1");
AliasData alias2 = aliases.get("alias2");
assertThat(alias2.getAlias()).isEqualTo("alias2");
assertThat(templateData.getOrder()).isEqualTo(putTemplateRequest.getOrder());
assertThat(templateData.getVersion()).isEqualTo(putTemplateRequest.getVersion());
}
use of org.springframework.data.elasticsearch.core.IndexOperations in project spring-data-elasticsearch by spring-projects.
the class GeoJsonIntegrationTests method setUp.
// endregion
// region setup
@BeforeEach
void setUp() {
indexOps = operations.indexOps(GeoJsonEntity.class);
indexOps.delete();
indexOps.create();
indexOps.putMapping();
IndexOperations indexOpsArea = operations.indexOps(Area.class);
indexOpsArea.delete();
indexOpsArea.create();
indexOpsArea.putMapping();
operations.save(Arrays.asList(area10To20, area30To40));
indexOpsArea.refresh();
}
use of org.springframework.data.elasticsearch.core.IndexOperations in project spring-data-elasticsearch by spring-projects.
the class EntityCustomConversionIntegrationTests method setUp.
@BeforeEach
void setUp() {
IndexOperations indexOps = operations.indexOps(Entity.class);
indexOps.create();
indexOps.putMapping();
}
Aggregations