diff --git a/pom.xml b/pom.xml
index afb4932..4c36e89 100644
--- a/pom.xml
+++ b/pom.xml
@@ -18,7 +18,7 @@
UTF-8
- 1.2.2
+ 2.4.0
github
@@ -48,6 +48,12 @@
elasticsearch
${elasticsearch.version}
+
+ net.java.dev.jna
+ jna
+ 4.1.0
+ true
+
@@ -68,8 +74,8 @@
maven-compiler-plugin
2.3.2
- 1.6
- 1.6
+ 1.7
+ 1.7
diff --git a/src/main/java/com/github/tlrx/elasticsearch/test/EsSetup.java b/src/main/java/com/github/tlrx/elasticsearch/test/EsSetup.java
index 33a7669..b5073f4 100644
--- a/src/main/java/com/github/tlrx/elasticsearch/test/EsSetup.java
+++ b/src/main/java/com/github/tlrx/elasticsearch/test/EsSetup.java
@@ -20,8 +20,8 @@
import com.github.tlrx.elasticsearch.test.provider.*;
import com.github.tlrx.elasticsearch.test.request.*;
+import com.google.common.base.Preconditions;
import org.elasticsearch.client.Client;
-import org.elasticsearch.common.Preconditions;
import org.elasticsearch.common.settings.Settings;
/**
@@ -319,7 +319,7 @@ public Boolean exists(String index, String type, String id) {
* @return the total number of documents
*/
public Long countAll() {
- return doExecute(new Count());
+ return doExecute(new Count("_all"));
}
/**
diff --git a/src/main/java/com/github/tlrx/elasticsearch/test/annotations/ElasticsearchMapping.java b/src/main/java/com/github/tlrx/elasticsearch/test/annotations/ElasticsearchMapping.java
index 651579f..c05697f 100644
--- a/src/main/java/com/github/tlrx/elasticsearch/test/annotations/ElasticsearchMapping.java
+++ b/src/main/java/com/github/tlrx/elasticsearch/test/annotations/ElasticsearchMapping.java
@@ -29,16 +29,6 @@
*/
boolean source() default true;
- /**
- * The source's "compress" value (default to true (since v0.90))
- */
- boolean compress() default true;
-
- /**
- * Compress threshold value
- */
- String compressThreshold() default "";
-
/**
* Time To Live "enabled" value (default to false)
*/
@@ -54,12 +44,6 @@
*/
boolean timestamp() default false;
- /**
- * The path used to extract the timestamp from the document
- * (default to "", meaning the "_timestamp" field should be explicitly set when indexing)
- */
- String timestampPath() default "";
-
/**
* The date format of the "_timestamp" field (default to "dateOptionalTime")
*/
diff --git a/src/main/java/com/github/tlrx/elasticsearch/test/annotations/ElasticsearchMappingField.java b/src/main/java/com/github/tlrx/elasticsearch/test/annotations/ElasticsearchMappingField.java
index 547bdbc..08d311b 100644
--- a/src/main/java/com/github/tlrx/elasticsearch/test/annotations/ElasticsearchMappingField.java
+++ b/src/main/java/com/github/tlrx/elasticsearch/test/annotations/ElasticsearchMappingField.java
@@ -44,11 +44,6 @@
*/
String analyzerName() default DEFAULT_ANALYZER;
- /**
- * The analyzer used to analyze the text contents when analyzed during indexing.
- */
- String indexAnalyzerName() default DEFAULT_ANALYZER;
-
/**
* The analyzer used to analyze the field when part of a query string.
*/
diff --git a/src/main/java/com/github/tlrx/elasticsearch/test/provider/ClassPathJSONProvider.java b/src/main/java/com/github/tlrx/elasticsearch/test/provider/ClassPathJSONProvider.java
index f62e5e0..354340c 100644
--- a/src/main/java/com/github/tlrx/elasticsearch/test/provider/ClassPathJSONProvider.java
+++ b/src/main/java/com/github/tlrx/elasticsearch/test/provider/ClassPathJSONProvider.java
@@ -19,7 +19,7 @@
package com.github.tlrx.elasticsearch.test.provider;
import com.github.tlrx.elasticsearch.test.EsSetupRuntimeException;
-import org.elasticsearch.common.Preconditions;
+import com.google.common.base.Preconditions;
import org.elasticsearch.common.io.Streams;
import java.io.FileNotFoundException;
@@ -56,17 +56,26 @@ public String toJson() {
@Override
public String toString() {
try {
- if (klass != null) {
- InputStream inputStream = klass.getResourceAsStream(path);
- if (inputStream == null) {
- throw new FileNotFoundException("Resource [" + path + "] not found in classpath with class [" + klass.getName() + "]");
- }
- return Streams.copyToString(new InputStreamReader(inputStream, "UTF-8"));
- } else {
- return Streams.copyToStringFromClasspath(classLoader, path);
- }
+ InputStream inputStream = openStream();
+ return Streams.copyToString(new InputStreamReader(inputStream, "UTF-8"));
} catch (IOException e) {
throw new EsSetupRuntimeException(e);
}
}
+
+ private InputStream openStream() throws IOException {
+ InputStream inputStream;
+ if (klass != null) {
+ inputStream = klass.getResourceAsStream(path);
+ if (inputStream == null) {
+ throw new FileNotFoundException("Resource [" + path + "] not found in classpath with class [" + klass.getName() + "]");
+ }
+ } else {
+ inputStream = classLoader.getResourceAsStream(path);
+ if (inputStream == null) {
+ throw new FileNotFoundException("Resource [" + path + "] not found in classpath with classloader [" + classLoader + "]");
+ }
+ }
+ return inputStream;
+ }
}
diff --git a/src/main/java/com/github/tlrx/elasticsearch/test/provider/DefaultClientProvider.java b/src/main/java/com/github/tlrx/elasticsearch/test/provider/DefaultClientProvider.java
index 246e2e3..35d6356 100644
--- a/src/main/java/com/github/tlrx/elasticsearch/test/provider/DefaultClientProvider.java
+++ b/src/main/java/com/github/tlrx/elasticsearch/test/provider/DefaultClientProvider.java
@@ -18,8 +18,8 @@
*/
package com.github.tlrx.elasticsearch.test.provider;
+import com.google.common.base.Preconditions;
import org.elasticsearch.client.Client;
-import org.elasticsearch.common.Preconditions;
import org.elasticsearch.common.unit.TimeValue;
/**
diff --git a/src/main/java/com/github/tlrx/elasticsearch/test/provider/LocalClientProvider.java b/src/main/java/com/github/tlrx/elasticsearch/test/provider/LocalClientProvider.java
index 929fe99..c4377e1 100644
--- a/src/main/java/com/github/tlrx/elasticsearch/test/provider/LocalClientProvider.java
+++ b/src/main/java/com/github/tlrx/elasticsearch/test/provider/LocalClientProvider.java
@@ -19,16 +19,22 @@
package com.github.tlrx.elasticsearch.test.provider;
+import com.github.tlrx.elasticsearch.test.EsSetupRuntimeException;
import org.elasticsearch.client.Client;
-import org.elasticsearch.common.io.FileSystemUtils;
-import org.elasticsearch.common.network.NetworkUtils;
-import org.elasticsearch.common.settings.ImmutableSettings;
import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.common.unit.TimeValue;
import org.elasticsearch.node.Node;
import org.elasticsearch.node.NodeBuilder;
import java.io.File;
+import java.io.IOException;
+import java.net.InetAddress;
+import java.net.UnknownHostException;
+import java.nio.file.FileVisitResult;
+import java.nio.file.FileVisitor;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.attribute.BasicFileAttributes;
/**
* LocalClientProvider instantiates a local node with in-memory index store type.
@@ -79,19 +85,51 @@ public void close() {
if ((node != null) && (!node.isClosed())) {
node.close();
- FileSystemUtils.deleteRecursively(new File("./target/elasticsearch-test/"), true);
+ deleteRecursively(new File("./target/elasticsearch-test/"));
+ }
+ }
+
+ /**
+ * Recursively delete a directory.
+ * Links are not handled properly.
+ */
+ public static void deleteRecursively(File dir) {
+ try {
+ Files.walkFileTree(dir.toPath(), new FileVisitor() {
+ @Override
+ public FileVisitResult preVisitDirectory(Path dir, BasicFileAttributes attrs) throws IOException {
+ return FileVisitResult.CONTINUE;
+ }
+
+ @Override
+ public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) throws IOException {
+ Files.delete(file);
+ return FileVisitResult.CONTINUE;
+ }
+
+ @Override
+ public FileVisitResult visitFileFailed(Path file, IOException exc) throws IOException {
+ return FileVisitResult.TERMINATE;
+ }
+
+ @Override
+ public FileVisitResult postVisitDirectory(Path dir, IOException exc) throws IOException {
+ Files.delete(dir);
+ return FileVisitResult.CONTINUE;
+ }
+ });
+ } catch (IOException e) {
}
}
protected Settings buildNodeSettings() {
// Build settings
- ImmutableSettings.Builder builder = ImmutableSettings.settingsBuilder()
+
+ Settings.Builder builder = Settings.builder()
.put("node.name", "node-test-" + System.currentTimeMillis())
.put("node.data", true)
- .put("cluster.name", "cluster-test-" + NetworkUtils.getLocalAddress().getHostName())
- .put("index.store.type", "memory")
- .put("index.store.fs.memory.enabled", "true")
- .put("gateway.type", "none")
+ .put("cluster.name", "cluster-test-" + getLocalHostName())
+ .put("path.home", "./target/elasticsearch-test")
.put("path.data", "./target/elasticsearch-test/data")
.put("path.work", "./target/elasticsearch-test/work")
.put("path.logs", "./target/elasticsearch-test/logs")
@@ -106,4 +144,15 @@ protected Settings buildNodeSettings() {
return builder.build();
}
+
+ /**
+ * Get local hostname
+ */
+ public static String getLocalHostName() {
+ try {
+ return InetAddress.getLocalHost().getHostName();
+ } catch (UnknownHostException e) {
+ return "unknown";
+ }
+ }
}
diff --git a/src/main/java/com/github/tlrx/elasticsearch/test/request/CreateIndex.java b/src/main/java/com/github/tlrx/elasticsearch/test/request/CreateIndex.java
index 1e591b6..3c172ad 100644
--- a/src/main/java/com/github/tlrx/elasticsearch/test/request/CreateIndex.java
+++ b/src/main/java/com/github/tlrx/elasticsearch/test/request/CreateIndex.java
@@ -26,7 +26,6 @@
import org.elasticsearch.action.bulk.BulkRequestBuilder;
import org.elasticsearch.action.bulk.BulkResponse;
import org.elasticsearch.client.Client;
-import org.elasticsearch.common.settings.ImmutableSettings;
import org.elasticsearch.common.settings.Settings;
import java.util.ArrayList;
@@ -54,7 +53,7 @@ public CreateIndex withSettings(Settings settings) {
}
public CreateIndex withSettings(String source) {
- Settings settings = ImmutableSettings.settingsBuilder()
+ Settings settings = Settings.builder()
.loadFromSource(source)
.build();
withSettings(settings);
@@ -104,7 +103,7 @@ public Void execute(final Client client) throws ElasticsearchException {
bulkRequestBuilder = client.prepareBulk();
for (JSONProvider jsonProvider : bulks) {
byte[] content = jsonProvider.toJson().getBytes("UTF-8");
- bulkRequestBuilder.add(content, 0, content.length, true);
+ bulkRequestBuilder.add(content, 0, content.length);
}
}
diff --git a/src/main/java/com/github/tlrx/elasticsearch/test/request/CreateTemplate.java b/src/main/java/com/github/tlrx/elasticsearch/test/request/CreateTemplate.java
index 92261a5..2ad1725 100644
--- a/src/main/java/com/github/tlrx/elasticsearch/test/request/CreateTemplate.java
+++ b/src/main/java/com/github/tlrx/elasticsearch/test/request/CreateTemplate.java
@@ -25,7 +25,6 @@
import org.elasticsearch.action.admin.indices.template.put.PutIndexTemplateRequest;
import org.elasticsearch.action.admin.indices.template.put.PutIndexTemplateResponse;
import org.elasticsearch.client.Client;
-import org.elasticsearch.common.settings.ImmutableSettings;
import org.elasticsearch.common.settings.Settings;
import java.util.Map;
@@ -54,7 +53,7 @@ public CreateTemplate withSettings(Settings settings) {
}
public CreateTemplate withSettings(String source) {
- Settings settings = ImmutableSettings.settingsBuilder()
+ Settings settings = Settings.builder()
.loadFromSource(source)
.build();
withSettings(settings);
diff --git a/src/main/java/com/github/tlrx/elasticsearch/test/request/DeleteTemplates.java b/src/main/java/com/github/tlrx/elasticsearch/test/request/DeleteTemplates.java
index c93a6df..9d5f76a 100644
--- a/src/main/java/com/github/tlrx/elasticsearch/test/request/DeleteTemplates.java
+++ b/src/main/java/com/github/tlrx/elasticsearch/test/request/DeleteTemplates.java
@@ -19,6 +19,7 @@
package com.github.tlrx.elasticsearch.test.request;
import com.github.tlrx.elasticsearch.test.EsSetupRuntimeException;
+import com.google.common.collect.Lists;
import org.elasticsearch.ElasticsearchException;
import org.elasticsearch.action.admin.cluster.state.ClusterStateAction;
import org.elasticsearch.action.admin.cluster.state.ClusterStateRequestBuilder;
@@ -27,7 +28,6 @@
import org.elasticsearch.action.admin.indices.template.delete.DeleteIndexTemplateRequest;
import org.elasticsearch.action.admin.indices.template.delete.DeleteIndexTemplateResponse;
import org.elasticsearch.client.Client;
-import org.elasticsearch.common.collect.Lists;
import java.util.Arrays;
import java.util.Collection;
diff --git a/src/main/java/com/github/tlrx/elasticsearch/test/support/junit/handlers/annotations/ElasticsearchBulkRequestAnnotationHandler.java b/src/main/java/com/github/tlrx/elasticsearch/test/support/junit/handlers/annotations/ElasticsearchBulkRequestAnnotationHandler.java
index b8a6364..82690ad 100644
--- a/src/main/java/com/github/tlrx/elasticsearch/test/support/junit/handlers/annotations/ElasticsearchBulkRequestAnnotationHandler.java
+++ b/src/main/java/com/github/tlrx/elasticsearch/test/support/junit/handlers/annotations/ElasticsearchBulkRequestAnnotationHandler.java
@@ -59,7 +59,7 @@ public void handleBefore(Annotation annotation, Object instance, Map context, String nodeName, String indexName) throws ElasticsearchException, Exception {
- client(context, nodeName).prepareDeleteByQuery(indexName)
- .setQuery(QueryBuilders.matchAllQuery())
- .execute().actionGet();
+ AdminClient admin = admin(context, nodeName);
+ IndicesAdminClient indicesAdmin = admin.indices();
+ try(BytesStreamOutput streamOutput = new BytesStreamOutput()) {
+ // Get index settings
+ GetSettingsResponse indexSettings = indicesAdmin.prepareGetSettings(indexName).get();
+ indexSettings.writeTo(streamOutput);
+ streamOutput.flush();
+ // Delete index
+ DeleteIndexResponse deleteIndex = indicesAdmin.prepareDelete(indexName).get();
+ // Re-create index
+ indicesAdmin.prepareCreate(indexName)
+ .setSource(streamOutput.bytes())
+ .get();
+
+ // Wait for index to be yellow
+ admin.cluster().prepareHealth(indexName).setWaitForYellowStatus().get();
+ }
}
/**
@@ -168,7 +185,7 @@ protected void buildIndex(ElasticsearchIndex elasticsearchIndex, Map 0) {
@@ -176,8 +193,14 @@ private Settings buildIndexSettings(ElasticsearchIndex elasticsearchIndex) {
}
// Loads settings from settings file
- Settings configSettings = ImmutableSettings.settingsBuilder().loadFromClasspath(settingsFile).build();
- settingsBuilder.put(configSettings);
+ try(InputStream settingsStreams = Thread.currentThread().getContextClassLoader().getResourceAsStream(settingsFile)) {
+ if (settingsStreams != null) {
+ Settings configSettings = Settings.builder().loadFromStream(settingsFile, settingsStreams).build();
+ settingsBuilder.put(configSettings);
+ }
+ } catch (IOException e) {
+ throw new EsSetupRuntimeException("Failed to load settings "+settingsFile, e);
+ }
// Manage analysis filters & tokenizers
ElasticsearchAnalysis analysis = elasticsearchIndex.analysis();
@@ -230,11 +253,6 @@ private XContentBuilder buildField(ElasticsearchMappingField field, XContentBuil
builder.field("analyzer", field.analyzerName().toString().toLowerCase());
}
- if ((field.indexAnalyzerName() != null)
- && (!ElasticsearchMappingField.DEFAULT_ANALYZER.equals(field.indexAnalyzerName()))) {
- builder.field("index_analyzer", field.indexAnalyzerName().toString().toLowerCase());
- }
-
if ((field.searchAnalyzerName() != null)
&& (!ElasticsearchMappingField.DEFAULT_ANALYZER.equals(field.searchAnalyzerName()))) {
builder.field("search_analyzer", field.searchAnalyzerName().toString().toLowerCase());
@@ -314,16 +332,6 @@ private XContentBuilder buildMapping(ElasticsearchMapping mapping) {
.startObject(mapping.typeName())
.startObject("_source")
.field("enabled", String.valueOf(mapping.source()));
-
- if (!mapping.compress()) {
- builder.field("compress", String.valueOf(mapping.compress()));
- } else {
- builder.field("compress", String.valueOf(mapping.compress()));
-
- if (!"".equals(mapping.compressThreshold())) {
- builder.field("compress_threshold", mapping.compressThreshold());
- }
- }
builder.endObject();
if (!"".equals(mapping.parent())) {
@@ -344,9 +352,6 @@ private XContentBuilder buildMapping(ElasticsearchMapping mapping) {
if (mapping.timestamp()) {
builder = builder.startObject("_timestamp").field("enabled",
String.valueOf(mapping.timestamp()));
- if (mapping.timestampPath().length() > 0) {
- builder = builder.field("path", mapping.timestampPath());
- }
if (mapping.timestampFormat().length() > 0) {
builder = builder.field("format", mapping.timestampFormat());
}
diff --git a/src/main/java/com/github/tlrx/elasticsearch/test/support/junit/handlers/annotations/ElasticsearchNodeAnnotationHandler.java b/src/main/java/com/github/tlrx/elasticsearch/test/support/junit/handlers/annotations/ElasticsearchNodeAnnotationHandler.java
index 778ef4e..f3a5bc5 100644
--- a/src/main/java/com/github/tlrx/elasticsearch/test/support/junit/handlers/annotations/ElasticsearchNodeAnnotationHandler.java
+++ b/src/main/java/com/github/tlrx/elasticsearch/test/support/junit/handlers/annotations/ElasticsearchNodeAnnotationHandler.java
@@ -3,22 +3,26 @@
*/
package com.github.tlrx.elasticsearch.test.support.junit.handlers.annotations;
+import com.github.tlrx.elasticsearch.test.EsSetupRuntimeException;
import com.github.tlrx.elasticsearch.test.annotations.ElasticsearchNode;
import com.github.tlrx.elasticsearch.test.annotations.ElasticsearchSetting;
import com.github.tlrx.elasticsearch.test.support.junit.handlers.ClassLevelElasticsearchAnnotationHandler;
import com.github.tlrx.elasticsearch.test.support.junit.handlers.FieldLevelElasticsearchAnnotationHandler;
import org.elasticsearch.common.io.FileSystemUtils;
-import org.elasticsearch.common.settings.ImmutableSettings;
-import org.elasticsearch.common.settings.ImmutableSettings.Builder;
+import org.elasticsearch.common.settings.Settings.Builder;
import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.node.Node;
import org.elasticsearch.node.NodeBuilder;
import java.io.File;
+import java.io.IOException;
+import java.io.InputStream;
import java.lang.annotation.Annotation;
import java.lang.reflect.Field;
import java.util.Map;
+import static com.github.tlrx.elasticsearch.test.provider.LocalClientProvider.deleteRecursively;
+
/**
* Handle {@link ElasticsearchNode} annotation
*
@@ -59,7 +63,7 @@ public void afterClass(Object testClass, Map context) throws Exc
}
}
}
- FileSystemUtils.deleteRecursively(new File(ES_HOME));
+ deleteRecursively(new File(ES_HOME));
}
public void handleField(Annotation annotation, Object instance, Map context, Field field) throws Exception {
@@ -108,22 +112,25 @@ private Node buildNode(ElasticsearchNode elasticsearchNode, Map
private Settings buildNodeSettings(ElasticsearchNode elasticsearchNode) {
// Build default settings
- Builder settingsBuilder = ImmutableSettings.settingsBuilder()
+ Builder settingsBuilder = Settings.settingsBuilder()
.put(NODE_NAME, elasticsearchNode.name())
.put("node.data", elasticsearchNode.data())
.put("cluster.name", elasticsearchNode.clusterName())
- .put("index.store.type", "memory")
- .put("index.store.fs.memory.enabled", "true")
- .put("gateway.type", "none")
+ .put("path.home", ES_HOME)
.put("path.data", ES_HOME + "/data")
- .put("path.work", ES_HOME + "/work")
.put("path.logs", ES_HOME + "/logs")
.put("index.number_of_shards", "1")
.put("index.number_of_replicas", "0");
// Loads settings from configuration file
- Settings configSettings = ImmutableSettings.settingsBuilder().loadFromClasspath(elasticsearchNode.configFile()).build();
- settingsBuilder.put(configSettings);
+ String settingsFile = elasticsearchNode.configFile();
+ Settings configSettings;
+ try(InputStream settingsStreams = Thread.currentThread().getContextClassLoader().getResourceAsStream(settingsFile)) {
+ configSettings = Settings.builder().loadFromStream(settingsFile, settingsStreams).build();
+ settingsBuilder.put(configSettings);
+ } catch (IOException e) {
+ throw new EsSetupRuntimeException("Failed to load settings "+settingsFile, e);
+ }
// Other settings
ElasticsearchSetting[] settings = elasticsearchNode.settings();
diff --git a/src/main/java/com/github/tlrx/elasticsearch/test/support/junit/handlers/annotations/ElasticsearchTransportClientAnnotationHandler.java b/src/main/java/com/github/tlrx/elasticsearch/test/support/junit/handlers/annotations/ElasticsearchTransportClientAnnotationHandler.java
index e5358db..6b39743 100644
--- a/src/main/java/com/github/tlrx/elasticsearch/test/support/junit/handlers/annotations/ElasticsearchTransportClientAnnotationHandler.java
+++ b/src/main/java/com/github/tlrx/elasticsearch/test/support/junit/handlers/annotations/ElasticsearchTransportClientAnnotationHandler.java
@@ -7,12 +7,12 @@
import com.github.tlrx.elasticsearch.test.support.junit.handlers.ClassLevelElasticsearchAnnotationHandler;
import com.github.tlrx.elasticsearch.test.support.junit.handlers.FieldLevelElasticsearchAnnotationHandler;
import org.elasticsearch.client.transport.TransportClient;
-import org.elasticsearch.common.settings.ImmutableSettings;
import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.common.transport.InetSocketTransportAddress;
import java.lang.annotation.Annotation;
import java.lang.reflect.Field;
+import java.net.InetSocketAddress;
import java.util.Map;
import java.util.logging.Logger;
@@ -33,15 +33,15 @@ public void handleField(Annotation annotation, Object instance, Map source = (Map) def.get("_source");
assertNotNull("_source must exists", source);
- assertEquals(Boolean.FALSE, source.get("compress"));
assertEquals(Boolean.FALSE, source.get("enabled"));
// Check TTL
@@ -105,7 +102,6 @@ public void testElasticsearchMapping() {
assertNotNull("_timestamp must exist", timestamp);
assertEquals(Boolean.TRUE, timestamp.get("enabled"));
assertEquals("YYYY-MM-dd", timestamp.get("format"));
- assertEquals("publication_date", timestamp.get("path"));
// Check properties
Map properties = (Map) def.get("properties");
@@ -134,7 +130,7 @@ public void testElasticsearchMapping() {
assertNull("index = analyzed must be null", role.get("index"));
assertEquals("string", role.get("type"));
assertNull("Store = No must be null", role.get("store"));
- assertEquals("keyword", role.get("index_analyzer"));
+ assertEquals("keyword", role.get("analyzer"));
assertEquals("standard", role.get("search_analyzer"));
// Check name
@@ -169,9 +165,7 @@ public void testElasticsearchMapping() {
// Check _source
Map source = (Map) def.get("_source");
- assertNotNull("_source must exists", source);
- assertEquals(Boolean.TRUE, source.get("compress"));
- assertEquals("10kb", source.get("compress_threshold"));
+ assertNull("_source must exists", source);
// Check _parent
Map parent = (Map) def.get("_parent");
diff --git a/src/test/java/com/github/tlrx/elasticsearch/test/annotations/ElasticsearchSettingAnnotationTest.java b/src/test/java/com/github/tlrx/elasticsearch/test/annotations/ElasticsearchSettingAnnotationTest.java
index 105a4b0..a5bddcb 100644
--- a/src/test/java/com/github/tlrx/elasticsearch/test/annotations/ElasticsearchSettingAnnotationTest.java
+++ b/src/test/java/com/github/tlrx/elasticsearch/test/annotations/ElasticsearchSettingAnnotationTest.java
@@ -52,12 +52,12 @@ public void testElasticsearchSettings() {
ClusterStateResponse response = adminClient.cluster().prepareState()
.execute().actionGet();
- Settings indexSettings = response.getState().metaData().index("library").settings();
+ Settings indexSettings = response.getState().metaData().index("library").getSettings();
assertEquals("2", indexSettings.get("index.number_of_shards"));
assertEquals("1", indexSettings.get("index.number_of_replicas"));
// Check default settings
- indexSettings = response.getState().metaData().index("people").settings();
+ indexSettings = response.getState().metaData().index("people").getSettings();
assertEquals("1", indexSettings.get("index.number_of_shards"));
assertEquals("0", indexSettings.get("index.number_of_replicas"));
}