DATAES-305 - Allow to put mapping built from entity class to different index.
Original pull request: #319
This commit is contained in:
@@ -18,6 +18,7 @@ package org.springframework.data.elasticsearch.core;
|
||||
import static org.apache.commons.lang.RandomStringUtils.*;
|
||||
import static org.assertj.core.api.Assertions.*;
|
||||
import static org.elasticsearch.index.query.QueryBuilders.*;
|
||||
import static org.hamcrest.CoreMatchers.*;
|
||||
import static org.springframework.data.elasticsearch.annotations.FieldType.*;
|
||||
import static org.springframework.data.elasticsearch.utils.IndexBuilder.*;
|
||||
|
||||
@@ -1438,6 +1439,22 @@ public class ElasticsearchTemplateTests {
|
||||
assertThat(elasticsearchTemplate.putMapping(entity)).isTrue();
|
||||
}
|
||||
|
||||
@Test // DATAES-305
|
||||
public void shouldPutMappingWithCustomIndexName() throws Exception {
|
||||
|
||||
// given
|
||||
Class<SampleEntity> entity = SampleEntity.class;
|
||||
elasticsearchTemplate.deleteIndex(INDEX_1_NAME);
|
||||
elasticsearchTemplate.createIndex(INDEX_1_NAME);
|
||||
|
||||
// when
|
||||
elasticsearchTemplate.putMapping(INDEX_1_NAME, TYPE_NAME, entity);
|
||||
|
||||
// then
|
||||
Map<String, Object> mapping = elasticsearchTemplate.getMapping(INDEX_1_NAME, TYPE_NAME);
|
||||
assertThat(mapping.get("properties")).isNotNull();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void shouldDeleteIndexForGivenEntity() {
|
||||
|
||||
|
||||
Reference in New Issue
Block a user