diff --git a/pom.xml b/pom.xml
index af7d9122..b092dc51 100644
--- a/pom.xml
+++ b/pom.xml
@@ -49,7 +49,7 @@
2.1.2.RELEASE
5.1.4.RELEASE
- 3.1.2.RELEASE
+ 3.1.3.RELEASE
2.1.4.RELEASE
6.3.1
2.8.0
diff --git a/spring-data-jest/src/main/java/com/github/vanroy/springdata/jest/JestElasticsearchTemplate.java b/spring-data-jest/src/main/java/com/github/vanroy/springdata/jest/JestElasticsearchTemplate.java
index 8d3ebc4e..50f02ff8 100644
--- a/spring-data-jest/src/main/java/com/github/vanroy/springdata/jest/JestElasticsearchTemplate.java
+++ b/spring-data-jest/src/main/java/com/github/vanroy/springdata/jest/JestElasticsearchTemplate.java
@@ -202,12 +202,6 @@ public boolean createIndex(Class clazz, Object settings) {
return createIndex(getPersistentEntityFor(clazz).getIndexName(), settings);
}
- private String xContentBuilderToString(XContentBuilder builder) {
- builder.close();
- ByteArrayOutputStream bos = (ByteArrayOutputStream) builder.getOutputStream();
- return bos.toString();
- }
-
@Override
public boolean putMapping(Class clazz) {
if (clazz.isAnnotationPresent(Mapping.class)) {
@@ -230,7 +224,7 @@ public boolean putMapping(Class clazz) {
throw new IllegalArgumentException(String.format("No Id property for %s found", clazz.getSimpleName()));
}
- mapping =xContentBuilderToString( buildMapping(
+ mapping = xContentBuilderToString(buildMapping(
clazz,
persistentEntity.getIndexType(),
idProperty.getFieldName(),
@@ -256,7 +250,7 @@ public boolean putMapping(String indexName, String type, Object mapping) {
} else if (mapping instanceof Map) {
XContentBuilder builder = XContentFactory.contentBuilder(XContentType.JSON);
builder.map((Map) mapping);
- source = xContentBuilderToString( builder );
+ source = xContentBuilderToString(builder);
} else if (mapping instanceof XContentBuilder) {
source = xContentBuilderToString(((XContentBuilder) mapping));
} else if (mapping instanceof DocumentMapper) {
@@ -272,6 +266,12 @@ public boolean putMapping(String indexName, String type, Object mapping) {
}
}
+ private String xContentBuilderToString(XContentBuilder builder) {
+ builder.close();
+ ByteArrayOutputStream bos = (ByteArrayOutputStream) builder.getOutputStream();
+ return bos.toString();
+ }
+
@Override
public boolean putMapping(Class clazz, Object mapping) {
return putMapping(getPersistentEntityFor(clazz).getIndexName(), getPersistentEntityFor(clazz).getIndexType(), mapping);
@@ -1231,8 +1231,7 @@ private SearchResult executeSearch(Query query, SearchSourceBuilder request) {
private Index prepareIndex(IndexQuery query) {
try {
- String indexName = !hasText(query.getIndexName()) ? retrieveIndexNameFromPersistentEntity(query.getObject()
- .getClass())[0] : query.getIndexName();
+ String indexName = !hasText(query.getIndexName()) ? retrieveIndexNameFromPersistentEntity(query.getObject().getClass())[0] : query.getIndexName();
String type = !hasText(query.getType()) ? retrieveTypeFromPersistentEntity(query.getObject().getClass())[0]
: query.getType();
diff --git a/spring-data-jest/src/test/java/com/github/vanroy/springdata/jest/JestElasticsearchTemplateTests.java b/spring-data-jest/src/test/java/com/github/vanroy/springdata/jest/JestElasticsearchTemplateTests.java
index b439fe07..f9464650 100755
--- a/spring-data-jest/src/test/java/com/github/vanroy/springdata/jest/JestElasticsearchTemplateTests.java
+++ b/spring-data-jest/src/test/java/com/github/vanroy/springdata/jest/JestElasticsearchTemplateTests.java
@@ -2019,8 +2019,12 @@ public void shouldCreateIndexWithGivenSettings() {
" \"analysis\": {\n" +
" \"analyzer\": {\n" +
" \"emailAnalyzer\": {\n" +
- " \"type\": \"custom\",\n" +
- " \"tokenizer\": \"uax_url_email\"\n" +
+ " \"tokenizer\": \"emailTokenizer\"\n" +
+ " }\n" +
+ " },\n" +
+ " \"tokenizer\": {\n" +
+ " \"emailTokenizer\": {\n" +
+ " \"type\": \"standard\"\n" +
" }\n" +
" }\n" +
" }\n" +
@@ -2036,7 +2040,7 @@ public void shouldCreateIndexWithGivenSettings() {
String emailAnalyzer = (String) map.get("index.analysis.analyzer.emailAnalyzer.tokenizer");
assertThat(elasticsearchTemplate.indexExists("test-index"), is(true));
assertThat(hasAnalyzer, is(true));
- assertThat(emailAnalyzer, is("uax_url_email"));
+ assertThat(emailAnalyzer, is("emailTokenizer"));
}
/*
@@ -2073,8 +2077,12 @@ public void shouldCreateIndexWithGivenClassAndSettings() {
" \"analysis\": {\n" +
" \"analyzer\": {\n" +
" \"emailAnalyzer\": {\n" +
- " \"type\": \"custom\",\n" +
- " \"tokenizer\": \"uax_url_email\"\n" +
+ " \"tokenizer\": \"emailTokenizer\"\n" +
+ " }\n" +
+ " },\n" +
+ " \"tokenizer\": {\n" +
+ " \"emailTokenizer\": {\n" +
+ " \"type\": \"standard\"\n" +
" }\n" +
" }\n" +
" }\n" +
@@ -2201,8 +2209,11 @@ public void shouldReadFileFromClasspathRetainingNewlines() {
" analysis:\n" +
" analyzer:\n" +
" emailAnalyzer:\n" +
- " type: custom\n" +
- " tokenizer: uax_url_email\n"));
+ " tokenizer: emailTokenizer\n" +
+ " tokenizer:\n" +
+ " emailTokenizer:\n" +
+ " type: uax_url_email\n"
+ ));
}
@Test
diff --git a/spring-data-jest/src/test/resources/settings/test-settings.yml b/spring-data-jest/src/test/resources/settings/test-settings.yml
index 9b2ffa0a..d1c8d377 100644
--- a/spring-data-jest/src/test/resources/settings/test-settings.yml
+++ b/spring-data-jest/src/test/resources/settings/test-settings.yml
@@ -4,5 +4,7 @@ index:
analysis:
analyzer:
emailAnalyzer:
- type: custom
- tokenizer: uax_url_email
\ No newline at end of file
+ tokenizer: emailTokenizer
+ tokenizer:
+ emailTokenizer:
+ type: uax_url_email
\ No newline at end of file