DATAES-531 - Fixed getMapping from ElasticsearchRestTemplate.
The getMapping methods in the ElasticsearchRestTemplate now behave like the methods in the ElasticsearchTemplate and return the mapping for the specified index and type. Original pull request: #239
This commit is contained in:
@@ -79,6 +79,7 @@ import static org.springframework.data.elasticsearch.utils.IndexBuilder.*;
|
||||
* @author Sascha Woo
|
||||
* @author Jean-Baptiste Nizet
|
||||
* @author Zetang Zeng
|
||||
* @author Peter Nowak
|
||||
*/
|
||||
|
||||
@Ignore
|
||||
@@ -2350,6 +2351,18 @@ public class ElasticsearchTemplateTests {
|
||||
" tokenizer: uax_url_email\n"));
|
||||
}
|
||||
|
||||
@Test // DATAES-531
|
||||
public void shouldReturnMappingForGivenEntityClass() {
|
||||
// when
|
||||
boolean created = elasticsearchTemplate.createIndex(SampleEntity.class);
|
||||
elasticsearchTemplate.putMapping(SampleEntity.class);
|
||||
final Map mapping = elasticsearchTemplate.getMapping(SampleEntity.class);
|
||||
// then
|
||||
assertThat(created, is(true));
|
||||
assertThat(mapping, notNullValue());
|
||||
assertThat(((Map) ((Map) mapping.get("properties")).get("message")).get("type"), Matchers.<Object>is("text"));
|
||||
}
|
||||
|
||||
private IndexQuery getIndexQuery(SampleEntity sampleEntity) {
|
||||
return new IndexQueryBuilder()
|
||||
.withId(sampleEntity.getId())
|
||||
|
||||
Reference in New Issue
Block a user