Repository: searchbox-io/Jest
Pull request #603 (2018-07-31 10:27:36)

6.x
Changes for ES6


Patch:
diff --git a/README.md b/README.md
index 3cdbad67..43662e54 100644
--- a/README.md
+++ b/README.md
@@ -26,6 +26,7 @@ Compatibility
 ------------
 Jest Version | Elasticsearch Version
 --- | ---
+\>= 6.0.0 | 6
 \>= 5.0.0 | 5
 \>= 2.0.0 | 2
 0.1.0 - 1.0.0 | 1
diff --git a/jest-common/pom.xml b/jest-common/pom.xml
index 5dcd629f..c7d13c10 100644
--- a/jest-common/pom.xml
+++ b/jest-common/pom.xml
@@ -45,7 +45,7 @@
     <parent>
         <groupId>io.searchbox</groupId>
         <artifactId>jest-parent</artifactId>
-        <version>5.3.4-SNAPSHOT</version>
+        <version>6.3.0-SNAPSHOT</version>
     </parent>
 
     <dependencies>
diff --git a/jest-common/src/main/java/io/searchbox/core/Percolate.java b/jest-common/src/main/java/io/searchbox/core/Percolate.java
deleted file mode 100644
index e1fbd9da..00000000
--- a/jest-common/src/main/java/io/searchbox/core/Percolate.java
+++ /dev/null
@@ -1,48 +0,0 @@
-package io.searchbox.core;
-
-import io.searchbox.action.GenericResultAbstractAction;
-import io.searchbox.client.config.ElasticsearchVersion;
-
-/**
- * Use this action to query on registered percolaters.
- *
- * @author Dogukan Sonmez
- * @author cihat keser
- */
-public class Percolate extends GenericResultAbstractAction {
-
-    protected Percolate(Builder builder) {
-        super(builder);
-
-        this.indexName = builder.index;
-        this.typeName = builder.type;
-        this.payload = builder.query;
-    }
-
-    @Override
-    public String getRestMethodName() {
-        return "POST";
-    }
-
-    @Override
-    protected String buildURI(ElasticsearchVersion elasticsearchVersion) {
-        return super.buildURI(elasticsearchVersion) + "/_percolate";
-    }
-
-    public static class Builder extends GenericResultAbstractAction.Builder<Percolate, Builder> {
-        private String index;
-        private String type;
-        private Object query;
-
-        public Builder(String index, String type, Object query) {
-            this.index = index;
-            this.type = type;
-            this.query = query;
-        }
-
-        @Override
-        public Percolate build() {
-            return new Percolate(this);
-        }
-    }
-}
diff --git a/jest-common/src/main/java/io/searchbox/core/Suggest.java b/jest-common/src/main/java/io/searchbox/core/Suggest.java
deleted file mode 100644
index cb668ea1..00000000
--- a/jest-common/src/main/java/io/searchbox/core/Suggest.java
+++ /dev/null
@@ -1,61 +0,0 @@
-package io.searchbox.core;
-
-import com.google.gson.Gson;
-import io.searchbox.action.AbstractAction;
-import io.searchbox.action.AbstractMultiTypeActionBuilder;
-import io.searchbox.client.config.ElasticsearchVersion;
-
-public class Suggest extends AbstractAction<SuggestResult> {
-
-    protected Suggest(final Builder builder) {
-        super(builder);
-        this.payload = builder.getQuery();
-    }
-
-    @Override
-    public SuggestResult createNewElasticSearchResult(final String json, final int statusCode, final String reasonPhrase, final Gson gson) {
-        return this.createNewElasticSearchResult(new SuggestResult(gson), json, statusCode, reasonPhrase, gson);
-    }
-
-    @Override
-    public String getRestMethodName() {
-        return "POST";
-    }
-
-    public String getIndex() {
-        return this.indexName;
-    }
-
-    public String getType() {
-        return this.typeName;
-    }
-
-    @Override
-    protected String buildURI(ElasticsearchVersion elasticsearchVersion) {
-        return super.buildURI(elasticsearchVersion) + "/_suggest";
-    }
-
-    public static class Builder extends AbstractMultiTypeActionBuilder<Suggest, Builder> {
-
-        private final String query;
-
-        /**
-         * Suggest requests executed against the _suggest endpoint should omit the
-         * surrounding suggest element which is only used if the suggest request is part of a search.
-         */
-        public Builder(final String query) {
-            this.query = query;
-        }
-
-        public final String getQuery() {
-            return this.query;
-        }
-
-        @Override
-        public Suggest build() {
-            return new Suggest(this);
-        }
-
-    }
-
-}
diff --git a/jest-common/src/main/java/io/searchbox/core/SuggestResult.java b/jest-common/src/main/java/io/searchbox/core/SuggestResult.java
deleted file mode 100644
index 72a15eda..00000000
--- a/jest-common/src/main/java/io/searchbox/core/SuggestResult.java
+++ /dev/null
@@ -1,79 +0,0 @@
-package io.searchbox.core;
-
-import com.google.gson.Gson;
-import com.google.gson.JsonElement;
-import io.searchbox.client.JestResult;
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Map;
-import java.util.Objects;
-
-/**
- * @author cihat keser
- */
-public class SuggestResult extends JestResult {
-
-    public SuggestResult(SuggestResult suggestResult) {
-        super(suggestResult);
-    }
-
-    public SuggestResult(Gson gson) {
-        super(gson);
-    }
-
-    public List<Suggestion> getSuggestions(String suggestionName) {
-        List<Suggestion> suggestions = new ArrayList<Suggestion>();
-
-        if (jsonObject != null && jsonObject.has(suggestionName)) {
-            for (JsonElement suggestionElement : jsonObject.getAsJsonArray(suggestionName)) {
-                suggestions.add(gson.fromJson(suggestionElement, Suggestion.class));
-            }
-        }
-
-        return suggestions;
-    }
-
-    public class Suggestion {
-        public final String text;
-        public final Integer offset;
-        public final Integer length;
-        public final List<Map<String, Object>> options;
-
-        public Suggestion(String text, Integer offset, Integer length, List<Map<String, Object>> options) {
-            this.text = text;
-            this.offset = offset;
-            this.length = length;
-            this.options = options;
-        }
-
-        @Override
-        public int hashCode() {
-            return Objects.hash(
-                    text,
-                    offset,
-                    length,
-                    options);
-        }
-
-        @Override
-        public boolean equals(Object obj) {
-            if (obj == null) {
-                return false;
-            }
-            if (obj == this) {
-                return true;
-            }
-            if (obj.getClass() != getClass()) {
-                return false;
-            }
-
-            Suggestion rhs = (Suggestion) obj;
-            return Objects.equals(text, rhs.text)
-                    && Objects.equals(offset, rhs.offset)
-                    && Objects.equals(length, rhs.length)
-                    && Objects.equals(options, rhs.options);
-        }
-    }
-
-}
diff --git a/jest-common/src/main/java/io/searchbox/fields/FieldStats.java b/jest-common/src/main/java/io/searchbox/fields/FieldCapabilities.java
similarity index 71%
rename from jest-common/src/main/java/io/searchbox/fields/FieldStats.java
rename to jest-common/src/main/java/io/searchbox/fields/FieldCapabilities.java
index fc1de457..80526eb0 100644
--- a/jest-common/src/main/java/io/searchbox/fields/FieldStats.java
+++ b/jest-common/src/main/java/io/searchbox/fields/FieldCapabilities.java
@@ -8,8 +8,8 @@ import io.searchbox.params.Parameters;
 import java.util.HashMap;
 import java.util.Map;
 
-public class FieldStats extends GenericResultAbstractAction {
-    protected FieldStats(FieldStats.Builder builder) {
+public class FieldCapabilities extends GenericResultAbstractAction {
+    protected FieldCapabilities(FieldCapabilities.Builder builder) {
         super(builder);
 
         this.indexName = builder.index;
@@ -29,13 +29,13 @@ public class FieldStats extends GenericResultAbstractAction {
     protected String buildURI(ElasticsearchVersion elasticsearchVersion) {
         String buildURI = super.buildURI(elasticsearchVersion);
         if (buildURI.isEmpty())
-            return "_field_stats";
+            return "_field_caps";
 
-        return buildURI + "/_field_stats";
+        return buildURI + "/_field_caps";
     }
 
 
-    public static class Builder extends AbstractAction.Builder<FieldStats, FieldStats.Builder> {
+    public static class Builder extends AbstractAction.Builder<FieldCapabilities, FieldCapabilities.Builder> {
 
         private String index;
         private Object fields;
@@ -44,19 +44,19 @@ public class FieldStats extends GenericResultAbstractAction {
             this.fields = fields;
         }
 
-        public FieldStats.Builder setIndex(String index) {
+        public FieldCapabilities.Builder setIndex(String index) {
             this.index = index;
             return this;
         }
 
-        public FieldStats.Builder setLevel(String level) {
+        public FieldCapabilities.Builder setLevel(String level) {
             parameters.put(Parameters.LEVEL, level);
             return this;
         }
 
         @Override
-        public FieldStats build() {
-            return new FieldStats(this);
+        public FieldCapabilities build() {
+            return new FieldCapabilities(this);
         }
     }
 }
diff --git a/jest-common/src/main/java/io/searchbox/indices/Analyze.java b/jest-common/src/main/java/io/searchbox/indices/Analyze.java
index be6a44d1..876d6b4d 100644
--- a/jest-common/src/main/java/io/searchbox/indices/Analyze.java
+++ b/jest-common/src/main/java/io/searchbox/indices/Analyze.java
@@ -5,9 +5,7 @@ import io.searchbox.action.AbstractAction;
 import io.searchbox.action.GenericResultAbstractAction;
 import io.searchbox.client.config.ElasticsearchVersion;
 
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.List;
+import java.util.*;
 
 /**
  * Performs the analysis process on a text and return the tokens breakdown of the text.
@@ -19,9 +17,8 @@ public class Analyze extends GenericResultAbstractAction {
 
     protected Analyze(Builder builder) {
         super(builder);
-
         this.indexName = builder.index;
-        this.payload = "{\"text\": " + new Gson().toJson(builder.textToAnalyze) + "}";
+        this.payload = builder.body;
     }
 
     @Override
@@ -34,9 +31,19 @@ public class Analyze extends GenericResultAbstractAction {
         return "POST";
     }
 
+    @Override
+    public String getData(Gson gson) {
+        return gson.toJson(payload, Map.class);
+    }
+
     public static class Builder extends AbstractAction.Builder<Analyze, Builder> {
         private String index;
-        private List<String> textToAnalyze = new ArrayList<String>();
+        private List<String> textToAnalyze = new ArrayList<>();
+        private List<String> filters = new ArrayList<>();
+        private Map<String, Object> body = new HashMap<String, Object>() {{
+            put("text", textToAnalyze);
+            put("filter", filters);
+        }};
 
         public Builder index(String index) {
             this.index = index;
@@ -54,31 +61,40 @@ public class Analyze extends GenericResultAbstractAction {
         }
 
         public Builder analyzer(String analyzer) {
-            return setParameter("analyzer", analyzer);
+            body.put("analyzer", analyzer);
+            return this;
         }
 
         /**
          * The analyzer can be derived based on a field mapping.
          */
         public Builder field(String field) {
-            return setParameter("field", field);
+            body.put("field", field);
+            return this;
         }
 
         public Builder tokenizer(String tokenizer) {
-            return setParameter("tokenizer", tokenizer);
+            body.put("tokenizer", tokenizer);
+            return this;
         }
 
         public Builder filter(String filter) {
-            return setParameter("filter", filter);
+            this.filters.add(filter);
+            return this;
+        }
+
+        public Builder filter(Collection<? extends String> filters) {
+            this.filters.addAll(filters);
+            return this;
         }
 
         /**
          * By default, the format the tokens are returned in are in json and its called detailed.
          * The text format value provides the analyzed data in a text stream that is a bit more readable.
          */
-        public Builder format(String format) {
-            return setParameter("format", format);
-        }
+//        public Builder format(String format) {
+//            return setParameter("format", format);
+//        }
 
         @Override
         public Analyze build() {
diff --git a/jest-common/src/main/java/io/searchbox/indices/script/AbstractStoredScript.java b/jest-common/src/main/java/io/searchbox/indices/script/AbstractStoredScript.java
index 2abebb9c..680870f3 100644
--- a/jest-common/src/main/java/io/searchbox/indices/script/AbstractStoredScript.java
+++ b/jest-common/src/main/java/io/searchbox/indices/script/AbstractStoredScript.java
@@ -6,7 +6,7 @@ import io.searchbox.client.config.ElasticsearchVersion;
 
 import java.io.UnsupportedEncodingException;
 
-import static io.searchbox.indices.script.ScriptLanguage.GROOVY;
+import static io.searchbox.indices.script.ScriptLanguage.PAINLESS;
 import static java.net.URLEncoder.encode;
 
 /**
@@ -23,7 +23,7 @@ public abstract class AbstractStoredScript extends GenericResultAbstractAction {
     }
 
     protected String buildURI(ElasticsearchVersion elasticsearchVersion) {
-        String finalUri = super.buildURI(elasticsearchVersion) + "/_scripts/" + scriptLanguage.pathParameterName + "/";
+        String finalUri = super.buildURI(elasticsearchVersion) + "/_scripts/";
         try {
             finalUri += encode(scriptName, CHARSET);
         } catch (UnsupportedEncodingException e) {
@@ -46,7 +46,7 @@ public abstract class AbstractStoredScript extends GenericResultAbstractAction {
     public static abstract class Builder<T extends AbstractStoredScript, K> extends AbstractAction.Builder<T, K> {
 
         private String scriptName;
-        private ScriptLanguage scriptLanguage = GROOVY;
+        protected ScriptLanguage scriptLanguage = PAINLESS;
 
         public Builder(String scriptName) {
             this.scriptName = scriptName;
@@ -56,6 +56,5 @@ public abstract class AbstractStoredScript extends GenericResultAbstractAction {
             this.scriptLanguage = scriptLanguage;
             return (K) this;
         }
-
     }
 }
diff --git a/jest-common/src/main/java/io/searchbox/indices/script/ScriptLanguage.java b/jest-common/src/main/java/io/searchbox/indices/script/ScriptLanguage.java
index 29faaa79..16e25b65 100644
--- a/jest-common/src/main/java/io/searchbox/indices/script/ScriptLanguage.java
+++ b/jest-common/src/main/java/io/searchbox/indices/script/ScriptLanguage.java
@@ -10,7 +10,6 @@ public enum ScriptLanguage {
     GROOVY("groovy"),
     EXPRESSION("expression"),
     MUSTACHE("mustache"),
-    MVEL("mvel"),
     JAVASCRIPT("javascript"),
     PAINLESS("painless"),
     PYTHON("python");
diff --git a/jest-common/src/main/java/io/searchbox/indices/type/TypeExist.java b/jest-common/src/main/java/io/searchbox/indices/type/TypeExist.java
index 20e0bcb2..5d9706f4 100644
--- a/jest-common/src/main/java/io/searchbox/indices/type/TypeExist.java
+++ b/jest-common/src/main/java/io/searchbox/indices/type/TypeExist.java
@@ -10,12 +10,13 @@ import io.searchbox.client.config.ElasticsearchVersion;
 public class TypeExist extends GenericResultAbstractAction {
 
     TypeExist(Builder builder) {
+
         super(builder);
     }
 
     @Override
     protected String getURLCommandExtension(ElasticsearchVersion elasticsearchVersion) {
-        return elasticsearchVersion == ElasticsearchVersion.V55 ? "_mapping" : super.getURLCommandExtension(elasticsearchVersion);
+        return "_mapping";
     }
 
     @Override
@@ -26,7 +27,7 @@ public class TypeExist extends GenericResultAbstractAction {
     public static class Builder extends AbstractMultiTypeActionBuilder<TypeExist, Builder> {
 
         public Builder(String index) {
-            addIndex(index);
+            this.addIndex(index);
         }
 
         @Override
diff --git a/jest-droid/pom.xml b/jest-droid/pom.xml
index 1bd01dbc..65302ef7 100644
--- a/jest-droid/pom.xml
+++ b/jest-droid/pom.xml
@@ -45,7 +45,7 @@
     <parent>
         <groupId>io.searchbox</groupId>
         <artifactId>jest-parent</artifactId>
-        <version>5.3.4-SNAPSHOT</version>
+        <version>6.3.0-SNAPSHOT</version>
     </parent>
 
     <dependencies>
diff --git a/jest/pom.xml b/jest/pom.xml
index 430dbe7a..ff9e78da 100644
--- a/jest/pom.xml
+++ b/jest/pom.xml
@@ -45,7 +45,7 @@
     <parent>
         <groupId>io.searchbox</groupId>
         <artifactId>jest-parent</artifactId>
-        <version>5.3.4-SNAPSHOT</version>
+        <version>6.3.0-SNAPSHOT</version>
     </parent>
 
     <dependencies>
@@ -58,10 +58,6 @@
             <groupId>org.elasticsearch.test</groupId>
             <artifactId>framework</artifactId>
         </dependency>
-        <dependency>
-            <groupId>net.java.dev.jna</groupId>
-            <artifactId>jna</artifactId>
-        </dependency>
         <dependency>
             <groupId>org.hamcrest</groupId>
             <artifactId>hamcrest-all</artifactId>
diff --git a/pom.xml b/pom.xml
index 89246ab3..6a2626b6 100755
--- a/pom.xml
+++ b/pom.xml
@@ -6,7 +6,7 @@
     <groupId>io.searchbox</groupId>
     <artifactId>jest-parent</artifactId>
     <packaging>pom</packaging>
-    <version>5.3.4-SNAPSHOT</version>
+    <version>6.3.0-SNAPSHOT</version>
     <name>Jest Parent POM</name>
     <description>Parent POM for Jest - ElasticSearch Java rest client</description>
     <url>https://github.com/searchbox-io/Jest</url>
@@ -60,10 +60,9 @@
     <properties>
         <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
 
-        <elasticsearch.version>5.3.2</elasticsearch.version>
+        <elasticsearch.version>6.3.1</elasticsearch.version>
 
-        <lucene.version>6.4.2</lucene.version>
-        <jna.version>4.2.2</jna.version>
+        <lucene.version>7.3.1</lucene.version>
         <hamcrest.version>1.3</hamcrest.version>
         <randomizedtesting.version>2.4.0</randomizedtesting.version>
         <mustache.version>0.9.4</mustache.version>
@@ -250,7 +249,7 @@
             <dependency>
                 <groupId>io.searchbox</groupId>
                 <artifactId>jest-common</artifactId>
-                <version>5.3.4-SNAPSHOT</version>
+                <version>6.3.0-SNAPSHOT</version>
             </dependency>
 
             <!-- Testing Dependencies -->
@@ -418,16 +417,8 @@
                 <artifactId>compiler</artifactId>
                 <version>${mustache.version}</version>
                 <scope>test</scope>
-            </dependency>            
-
-            <dependency>
-                <groupId>net.java.dev.jna</groupId>
-                <artifactId>jna</artifactId>
-                <version>${jna.version}</version>
-                <scope>test</scope>
             </dependency>
 
-
         </dependencies>
     </dependencyManagement>
 
@@ -455,12 +446,17 @@
                                     <excludes>
                                         <exclude>none</exclude>
                                     </excludes>
-                                    <argLine>-Djava.net.preferIPv4Stack=true -Dtests.security.manager=false</argLine>
+                                    <argLine>-Djava.net.preferIPv4Stack=true -Dtests.security.manager=false
+                                        -Des.set.netty.runtime.available.processors=false
+                                        -Des.set.netty.runtime.available.processors=false
+                                    </argLine>
                                 </configuration>
                             </execution>
                         </executions>
                         <configuration>
-                            <argLine>-Dtests.security.manager=false</argLine>
+                            <argLine>-Dtests.security.manager=false -Des.set.netty.runtime.available.processors=false
+                                -Des.set.netty.runtime.available.processors=false
+                            </argLine>
                         </configuration>
                     </plugin>
                 </plugins>
@@ -514,13 +510,20 @@
                                     <excludes>
                                         <exclude>none</exclude>
                                     </excludes>
-                                    <argLine>-Xmx${tests.heap.size} -Xms${tests.heap.size} -Dtests.heap.size=${tests.heap.size} -Djava.net.preferIPv4Stack=true -Dtests.security.manager=false</argLine>
+                                    <argLine>-Xmx${tests.heap.size} -Xms${tests.heap.size}
+                                        -Dtests.heap.size=${tests.heap.size} -Djava.net.preferIPv4Stack=true
+                                        -Dtests.security.manager=false
+                                        -Des.set.netty.runtime.available.processors=false
+                                    </argLine>
                                     <reuseForks>false</reuseForks>
                                 </configuration>
                             </execution>
                         </executions>
                         <configuration>
-                            <argLine>-Xmx${tests.heap.size} -Xms${tests.heap.size} -Dtests.heap.size=${tests.heap.size} -Dtests.security.manager=false</argLine>
+                            <argLine>-Xmx${tests.heap.size} -Xms${tests.heap.size} -Dtests.heap.size=${tests.heap.size}
+                                -Dtests.security.manager=false
+                                -Des.set.netty.runtime.available.processors=false
+                            </argLine>
                             <reuseForks>false</reuseForks>
                         </configuration>
                     </plugin>


Test patch:
diff --git a/jest-common/src/main/java/io/searchbox/indices/script/CreateStoredScript.java b/jest-common/src/main/java/io/searchbox/indices/script/CreateStoredScript.java
index 6bf42fa3..f3969517 100644
--- a/jest-common/src/main/java/io/searchbox/indices/script/CreateStoredScript.java
+++ b/jest-common/src/main/java/io/searchbox/indices/script/CreateStoredScript.java
@@ -66,7 +66,12 @@ public class CreateStoredScript extends AbstractStoredScript {
 
         private void createPayload(String source) {
             JsonObject jsonObject = new JsonObject();
-            jsonObject.addProperty("script", source);
+
+            JsonObject innerObj = new JsonObject();
+            innerObj.addProperty("lang", String.valueOf(scriptLanguage).toLowerCase());
+            innerObj.addProperty("source", source);
+
+            jsonObject.add("script", innerObj);
             payload = jsonObject;
         }
 
diff --git a/jest-common/src/test/java/io/searchbox/core/PercolateTest.java b/jest-common/src/test/java/io/searchbox/core/PercolateTest.java
deleted file mode 100644
index 416eb01c..00000000
--- a/jest-common/src/test/java/io/searchbox/core/PercolateTest.java
+++ /dev/null
@@ -1,39 +0,0 @@
-package io.searchbox.core;
-
-import io.searchbox.client.config.ElasticsearchVersion;
-import org.junit.Test;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotEquals;
-
-/**
- * @author Dogukan Sonmez
- */
-
-
-public class PercolateTest {
-
-    @Test
-    public void percolateDocument() {
-        Percolate percolate = new Percolate.Builder("twitter", "percolateQuery", "{query}").build();
-        assertEquals("POST", percolate.getRestMethodName());
-        assertEquals("twitter/percolateQuery/_percolate", percolate.getURI(ElasticsearchVersion.UNKNOWN));
-    }
-
-    @Test
-    public void equals() {
-        Percolate percolate1 = new Percolate.Builder("twitter", "percolateQuery", "{query}").build();
-        Percolate percolate1Duplicate = new Percolate.Builder("twitter", "percolateQuery", "{query}").build();
-
-        assertEquals(percolate1, percolate1Duplicate);
-    }
-
-    @Test
-    public void equalsReturnsFalseForDifferentQueries() {
-        Percolate percolate1 = new Percolate.Builder("twitter", "percolateQuery", "{query}").build();
-        Percolate percolate2 = new Percolate.Builder("twitter", "percolateQuery", "{different_query}").build();
-
-        assertNotEquals(percolate1, percolate2);
-    }
-
-}
diff --git a/jest-common/src/test/java/io/searchbox/core/SuggestTest.java b/jest-common/src/test/java/io/searchbox/core/SuggestTest.java
deleted file mode 100644
index f2b45a90..00000000
--- a/jest-common/src/test/java/io/searchbox/core/SuggestTest.java
+++ /dev/null
@@ -1,67 +0,0 @@
-package io.searchbox.core;
-
-import io.searchbox.action.Action;
-import io.searchbox.client.config.ElasticsearchVersion;
-import org.junit.Test;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-
-public class SuggestTest {
-
-    @Test
-    public void getURIWithoutIndexAndType() {
-        Suggest suggest = new Suggest.Builder("").build();
-        assertEquals("_all/_suggest", suggest.getURI(ElasticsearchVersion.UNKNOWN));
-    }
-
-    @Test
-    public void getURIWithOnlyOneIndex() {
-        Suggest suggest = new Suggest.Builder("").addIndex("twitter").build();
-        assertEquals("twitter/_suggest", suggest.getURI(ElasticsearchVersion.UNKNOWN));
-    }
-
-    @Test
-    public void getURIWithOneIndexAndOneType() {
-        Suggest suggest = new Suggest.Builder("").addIndex("twitter").addType("tweet").build();
-        assertEquals("twitter/tweet/_suggest", suggest.getURI(ElasticsearchVersion.UNKNOWN));
-    }
-
-    @Test
-    public void getURIWithOnlyOneType() {
-        Suggest suggest = new Suggest.Builder("").addType("tweet").build();
-        assertEquals("_all/tweet/_suggest", suggest.getURI(ElasticsearchVersion.UNKNOWN));
-    }
-
-    @Test
-    public void getURIWithOnlyMultipleIndex() {
-        Suggest suggest = new Suggest.Builder("").addIndex("twitter").addIndex("suggestbox").build();
-        assertEquals("twitter%2Csuggestbox/_suggest", suggest.getURI(ElasticsearchVersion.UNKNOWN));
-    }
-
-    @Test
-    public void getURIWithOnlyMultipleType() {
-        Suggest suggest = new Suggest.Builder("").addType("tweet").addType("jest").build();
-        assertEquals("_all/tweet%2Cjest/_suggest", suggest.getURI(ElasticsearchVersion.UNKNOWN));
-    }
-
-    @Test
-    public void getURIWithMultipleIndexAndTypes() {
-        Suggest suggest = new Suggest.Builder("")
-            .addIndex("twitter")
-            .addIndex("suggestbox")
-            .addType("tweet")
-            .addType("jest")
-            .build();
-        assertEquals("twitter%2Csuggestbox/tweet%2Cjest/_suggest", suggest.getURI(ElasticsearchVersion.UNKNOWN));
-    }
-
-    @Test
-    public void getDataSimple() {
-        String query = "{\"elementSuggestion\":{\"text\":\"courgette\",\"completion\":{\"field\":\"element.completion\",\"size\":10,\"fuzzy\":{}}}}";
-        Action suggest = new Suggest.Builder(query).build();
-
-        assertNotNull("data", suggest.getData(null));
-        assertEquals(query, suggest.getData(null).toString());
-    }
-}
diff --git a/jest-common/src/test/java/io/searchbox/fields/FieldsStatsTest.java b/jest-common/src/test/java/io/searchbox/fields/FieldsStatsTest.java
index 8bfa1876..43467c8e 100644
--- a/jest-common/src/test/java/io/searchbox/fields/FieldsStatsTest.java
+++ b/jest-common/src/test/java/io/searchbox/fields/FieldsStatsTest.java
@@ -16,25 +16,25 @@ public class FieldsStatsTest {
 
     @Test
     public void testBasicUriGeneration() {
-        FieldStats fieldStats = new FieldStats.Builder(FIELDS).setIndex(INDEX).build();
-        assertEquals("POST", fieldStats.getRestMethodName());
-        assertEquals(INDEX + "/_field_stats", fieldStats.getURI(ElasticsearchVersion.UNKNOWN));
-        assertEquals("{\"fields\":[\"" + TEST_FIELD + "\"]}", fieldStats.getData(new Gson()));
+        FieldCapabilities fieldCapabilities = new FieldCapabilities.Builder(FIELDS).setIndex(INDEX).build();
+        assertEquals("POST", fieldCapabilities.getRestMethodName());
+        assertEquals(INDEX + "/_field_caps", fieldCapabilities.getURI(ElasticsearchVersion.UNKNOWN));
+        assertEquals("{\"fields\":[\"" + TEST_FIELD + "\"]}", fieldCapabilities.getData(new Gson()));
     }
 
     @Test
     public void testBasicUriGenerationNoIndex() {
-        FieldStats fieldStats = new FieldStats.Builder(FIELDS).build();
-        assertEquals("POST", fieldStats.getRestMethodName());
-        assertEquals("_field_stats", fieldStats.getURI(ElasticsearchVersion.UNKNOWN));
-        assertEquals("{\"fields\":[\"" + TEST_FIELD + "\"]}", fieldStats.getData(new Gson()));
+        FieldCapabilities fieldCapabilities = new FieldCapabilities.Builder(FIELDS).build();
+        assertEquals("POST", fieldCapabilities.getRestMethodName());
+        assertEquals("_field_caps", fieldCapabilities.getURI(ElasticsearchVersion.UNKNOWN));
+        assertEquals("{\"fields\":[\"" + TEST_FIELD + "\"]}", fieldCapabilities.getData(new Gson()));
     }
 
     @Test
     public void testBasicUriGenerationWithLevel() {
-        FieldStats fieldStats = new FieldStats.Builder(FIELDS).setIndex(INDEX).setLevel("indices").build();
-        assertEquals("POST", fieldStats.getRestMethodName());
-        assertEquals(INDEX + "/_field_stats?level=indices", fieldStats.getURI(ElasticsearchVersion.UNKNOWN));
-        assertEquals("{\"fields\":[\"" + TEST_FIELD + "\"]}", fieldStats.getData(new Gson()));
+        FieldCapabilities fieldCapabilities = new FieldCapabilities.Builder(FIELDS).setIndex(INDEX).setLevel("indices").build();
+        assertEquals("POST", fieldCapabilities.getRestMethodName());
+        assertEquals(INDEX + "/_field_caps?level=indices", fieldCapabilities.getURI(ElasticsearchVersion.UNKNOWN));
+        assertEquals("{\"fields\":[\"" + TEST_FIELD + "\"]}", fieldCapabilities.getData(new Gson()));
     }
 }
diff --git a/jest-common/src/test/java/io/searchbox/indices/AnalyzeTest.java b/jest-common/src/test/java/io/searchbox/indices/AnalyzeTest.java
index e62db488..7eab1a6c 100644
--- a/jest-common/src/test/java/io/searchbox/indices/AnalyzeTest.java
+++ b/jest-common/src/test/java/io/searchbox/indices/AnalyzeTest.java
@@ -4,6 +4,7 @@ import com.google.common.collect.ImmutableList;
 import com.google.gson.Gson;
 import io.searchbox.client.config.ElasticsearchVersion;
 import org.junit.Test;
+import org.skyscreamer.jsonassert.JSONAssert;
 
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNotEquals;
@@ -17,60 +18,11 @@ public class AnalyzeTest {
     public void testBasicUrlGeneration() {
         Analyze analyze = new Analyze.Builder()
                 .analyzer("standard")
-                .build();
-        assertEquals("/_analyze?analyzer=standard", analyze.getURI(ElasticsearchVersion.UNKNOWN));
-    }
-
-    @Test
-    public void testUrlGenerationWithCustomTransientAnalyzer() {
-        Analyze analyze = new Analyze.Builder()
                 .tokenizer("keyword")
                 .filter("lowercase")
+                .text("this is a test")
                 .build();
-        assertEquals("/_analyze?tokenizer=keyword&filter=lowercase", analyze.getURI(ElasticsearchVersion.UNKNOWN));
-    }
-
-    @Test
-    public void testUrlGenerationWithIndex() {
-        Analyze analyze = new Analyze.Builder()
-                .index("test")
-                .build();
-        assertEquals("test/_analyze", analyze.getURI(ElasticsearchVersion.UNKNOWN));
-    }
-
-    @Test
-    public void testUrlGenerationWithIndexAndAnalyzer() {
-        Analyze analyze = new Analyze.Builder()
-                .index("test")
-                .analyzer("whitespace")
-                .build();
-        assertEquals("test/_analyze?analyzer=whitespace", analyze.getURI(ElasticsearchVersion.UNKNOWN));
-    }
-
-    @Test
-    public void testUrlGenerationWithIndexAndFieldMapping() {
-        Analyze analyze = new Analyze.Builder()
-                .index("test")
-                .field("obj1.field1")
-                .build();
-        assertEquals("test/_analyze?field=obj1.field1", analyze.getURI(ElasticsearchVersion.UNKNOWN));
-    }
-
-    @Test
-    public void testPayloadWithASingleTextEntry() throws Exception {
-        Analyze analyze = new Analyze.Builder()
-                .text("foo")
-                .build();
-        assertEquals("{\"text\": [\"foo\"]}", analyze.getData(new Gson()));
-    }
-
-    @Test
-    public void testPayloadWithAMultipleTextEntry() throws Exception {
-        Analyze analyze = new Analyze.Builder()
-                .text("foo")
-                .text("bar")
-                .build();
-        assertEquals("{\"text\": [\"foo\",\"bar\"]}", analyze.getData(new Gson()));
+        assertEquals("/_analyze", analyze.getURI(ElasticsearchVersion.UNKNOWN));
     }
 
     @Test
@@ -79,7 +31,13 @@ public class AnalyzeTest {
                 .text(ImmutableList.of("foo", "bar"))
                 .text("baz")
                 .build();
-        assertEquals("{\"text\": [\"foo\",\"bar\",\"baz\"]}", analyze.getData(new Gson()));
+
+        String expectedJSON = "{\n" +
+                "\"filter\": [],\n" +
+                "\"text\": [\"foo\", \"bar\", \"baz\"]\n" +
+                "}";
+
+        JSONAssert.assertEquals(expectedJSON, analyze.getData(new Gson()), false);
     }
 
     @Test
diff --git a/jest-common/src/test/java/io/searchbox/indices/CreateIndexTest.java b/jest-common/src/test/java/io/searchbox/indices/CreateIndexTest.java
index 6401161b..eabb3da1 100644
--- a/jest-common/src/test/java/io/searchbox/indices/CreateIndexTest.java
+++ b/jest-common/src/test/java/io/searchbox/indices/CreateIndexTest.java
@@ -2,9 +2,11 @@ package io.searchbox.indices;
 
 import com.google.gson.Gson;
 import io.searchbox.client.config.ElasticsearchVersion;
-import org.elasticsearch.common.settings.Settings;
 import org.junit.Test;
 
+import java.util.HashMap;
+import java.util.Map;
+
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNotEquals;
 
@@ -25,24 +27,32 @@ public class CreateIndexTest {
 
     @Test
     public void equalsReturnsTrueForSameSettings() {
-        final Settings.Builder indexerSettings = Settings.builder();
+
+        Map<String, String> indexerSettings = new HashMap<>();
         indexerSettings.put("analysis.analyzer.events.type", "custom");
         indexerSettings.put("analysis.analyzer.events.tokenizer", "standard");
         indexerSettings.put("analysis.analyzer.events.filter", "snowball, standard, lowercase");
-        CreateIndex createIndex1 = new CreateIndex.Builder("tweet").settings(indexerSettings.build().getAsMap()).build();
-        CreateIndex createIndex1Duplicate = new CreateIndex.Builder("tweet").settings(indexerSettings.build().getAsMap()).build();
+
+        CreateIndex createIndex1 = new CreateIndex.Builder("tweet").settings(indexerSettings).build();
+        CreateIndex createIndex1Duplicate = new CreateIndex.Builder("tweet").settings(indexerSettings).build();
 
         assertEquals(createIndex1, createIndex1Duplicate);
     }
 
     @Test
     public void equalsReturnsFalseForDifferentSettings() {
-        final Settings.Builder indexerSettings = Settings.builder();
+
+        Map<String, String> indexerSettings = new HashMap<>();
         indexerSettings.put("analysis.analyzer.events.type", "custom");
         indexerSettings.put("analysis.analyzer.events.tokenizer", "standard");
-        CreateIndex createIndex1 = new CreateIndex.Builder("tweet").settings(indexerSettings.build().getAsMap()).build();
-        indexerSettings.put("analysis.analyzer.events.filter", "snowball, standard, lowercase");
-        CreateIndex createIndex2 = new CreateIndex.Builder("tweet").settings(indexerSettings.build().getAsMap()).build();
+
+        Map<String, String> indexerSettings2 = new HashMap<>();
+        indexerSettings.put("analysis.analyzer.events.type", "custom");
+        indexerSettings.put("analysis.analyzer.events.tokenizer", "standard");
+
+        CreateIndex createIndex1 = new CreateIndex.Builder("tweet").settings(indexerSettings).build();
+        indexerSettings2.put("analysis.analyzer.events.filter", "snowball, standard, lowercase");
+        CreateIndex createIndex2 = new CreateIndex.Builder("tweet").settings(indexerSettings2).build();
 
         assertNotEquals(createIndex1, createIndex2);
     }
diff --git a/jest-common/src/test/java/io/searchbox/indices/script/CreateIndexedScriptTest.java b/jest-common/src/test/java/io/searchbox/indices/script/CreateStoredScriptTest.java
similarity index 79%
rename from jest-common/src/test/java/io/searchbox/indices/script/CreateIndexedScriptTest.java
rename to jest-common/src/test/java/io/searchbox/indices/script/CreateStoredScriptTest.java
index 8f2db33a..31d25184 100644
--- a/jest-common/src/test/java/io/searchbox/indices/script/CreateIndexedScriptTest.java
+++ b/jest-common/src/test/java/io/searchbox/indices/script/CreateStoredScriptTest.java
@@ -11,12 +11,12 @@ import java.io.File;
 import java.io.FileWriter;
 import java.io.IOException;
 
-import static io.searchbox.indices.script.ScriptLanguage.GROOVY;
 import static io.searchbox.indices.script.ScriptLanguage.JAVASCRIPT;
+import static io.searchbox.indices.script.ScriptLanguage.PAINLESS;
 import static org.hamcrest.CoreMatchers.containsString;
 import static org.junit.Assert.*;
 
-public class CreateIndexedScriptTest {
+public class CreateStoredScriptTest {
 
     private static final String A_NAME = "a_name";
     private CreateStoredScript script;
@@ -32,11 +32,15 @@ public class CreateIndexedScriptTest {
     }
 
     @Test
-    public void defaultScriptingLanguageIsGroovy() {
+    public void defaultScriptingLanguageIsPainless() {
         CreateStoredScript script = new CreateStoredScript.Builder(A_NAME).build();
+        assertEquals(PAINLESS, script.getScriptLanguage());
+    }
 
-        assertEquals(GROOVY, script.getScriptLanguage());
-        assertThat(script.buildURI(ElasticsearchVersion.UNKNOWN), containsString(GROOVY.pathParameterName));
+    @Test
+    public void scriptingLanguageIsSetCorrectly() {
+        CreateStoredScript script = new CreateStoredScript.Builder(A_NAME).setLanguage(JAVASCRIPT).build();
+        assertEquals(JAVASCRIPT, script.getScriptLanguage());
     }
 
     @Test
@@ -46,12 +50,12 @@ public class CreateIndexedScriptTest {
 
     @Test
     public void scriptingLanguageIsSetIntoPath() {
-        assertThat(script.buildURI(ElasticsearchVersion.UNKNOWN), containsString("/_scripts/" + JAVASCRIPT.pathParameterName + "/"));
+        assertThat(script.buildURI(ElasticsearchVersion.UNKNOWN), containsString("/_scripts/"));
     }
 
     @Test
     public void nameOfTheScriptIsSetIntoPath() {
-        assertThat(script.buildURI(ElasticsearchVersion.UNKNOWN), containsString("/_scripts/" + JAVASCRIPT.pathParameterName + "/" + A_NAME));
+        assertThat(script.buildURI(ElasticsearchVersion.UNKNOWN), containsString("/_scripts/" + A_NAME));
     }
 
     @Test
@@ -62,7 +66,7 @@ public class CreateIndexedScriptTest {
 
         JsonObject jsonPayload = parseAsGson(script.getData(new Gson()));
         assertNotNull(jsonPayload.get("script"));
-        assertEquals(groovysnippet, jsonPayload.get("script").getAsString());
+        assertEquals(groovysnippet, jsonPayload.get("script").getAsJsonObject().get("source").getAsString());
     }
 
     @Test
@@ -73,7 +77,7 @@ public class CreateIndexedScriptTest {
 
         JsonObject jsonPayload = parseAsGson(script.getData(new Gson()));
         assertNotNull(jsonPayload.get("script"));
-        assertEquals(groovysnippet, jsonPayload.get("script").getAsString());
+        assertEquals(groovysnippet, jsonPayload.get("script").getAsJsonObject().get("source").getAsString());
     }
 
     private File createTempGroovySnippetFile() throws IOException {
diff --git a/jest-common/src/test/java/io/searchbox/indices/script/DeleteIndexedScriptTest.java b/jest-common/src/test/java/io/searchbox/indices/script/DeleteStoredScriptTest.java
similarity index 63%
rename from jest-common/src/test/java/io/searchbox/indices/script/DeleteIndexedScriptTest.java
rename to jest-common/src/test/java/io/searchbox/indices/script/DeleteStoredScriptTest.java
index 8ca2cd16..cec45d7a 100644
--- a/jest-common/src/test/java/io/searchbox/indices/script/DeleteIndexedScriptTest.java
+++ b/jest-common/src/test/java/io/searchbox/indices/script/DeleteStoredScriptTest.java
@@ -4,13 +4,12 @@ import io.searchbox.client.config.ElasticsearchVersion;
 import org.junit.Before;
 import org.junit.Test;
 
-import static io.searchbox.indices.script.ScriptLanguage.GROOVY;
 import static io.searchbox.indices.script.ScriptLanguage.JAVASCRIPT;
 import static org.hamcrest.CoreMatchers.containsString;
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertThat;
 
-public class DeleteIndexedScriptTest {
+public class DeleteStoredScriptTest {
 
     private static final String A_NAME = "a_name";
     private DeleteStoredScript script;
@@ -21,14 +20,6 @@ public class DeleteIndexedScriptTest {
         script = builder.build();
     }
 
-    @Test
-    public void defaultScriptingLanguageIsGroovy() {
-        DeleteStoredScript script = new DeleteStoredScript.Builder(A_NAME).build();
-
-        assertEquals(GROOVY, script.getScriptLanguage());
-        assertThat(script.buildURI(ElasticsearchVersion.UNKNOWN), containsString(GROOVY.pathParameterName));
-    }
-
     @Test
     public void methodIsDelete() {
         assertEquals("DELETE", script.getRestMethodName());
@@ -36,12 +27,12 @@ public class DeleteIndexedScriptTest {
 
     @Test
     public void scriptingLanguageIsSetIntoPath() {
-        assertThat(script.buildURI(ElasticsearchVersion.UNKNOWN), containsString("/_scripts/" + JAVASCRIPT.pathParameterName + "/"));
+        assertThat(script.buildURI(ElasticsearchVersion.UNKNOWN), containsString("/_scripts/"));
     }
 
     @Test
     public void nameOfTheScriptIsSetIntoPath() {
-        assertThat(script.buildURI(ElasticsearchVersion.UNKNOWN), containsString("/_scripts/" + JAVASCRIPT.pathParameterName + "/" + A_NAME));
+        assertThat(script.buildURI(ElasticsearchVersion.UNKNOWN), containsString("/_scripts/" + A_NAME));
     }
 
 }
\ No newline at end of file
diff --git a/jest-common/src/test/java/io/searchbox/indices/script/GetIndexedScriptTest.java b/jest-common/src/test/java/io/searchbox/indices/script/GetStoredScriptTest.java
similarity index 64%
rename from jest-common/src/test/java/io/searchbox/indices/script/GetIndexedScriptTest.java
rename to jest-common/src/test/java/io/searchbox/indices/script/GetStoredScriptTest.java
index 7252f7e1..a68bbd02 100644
--- a/jest-common/src/test/java/io/searchbox/indices/script/GetIndexedScriptTest.java
+++ b/jest-common/src/test/java/io/searchbox/indices/script/GetStoredScriptTest.java
@@ -4,7 +4,6 @@ import io.searchbox.client.config.ElasticsearchVersion;
 import org.junit.Before;
 import org.junit.Test;
 
-import static io.searchbox.indices.script.ScriptLanguage.GROOVY;
 import static io.searchbox.indices.script.ScriptLanguage.JAVASCRIPT;
 import static org.hamcrest.CoreMatchers.containsString;
 import static org.junit.Assert.assertEquals;
@@ -13,7 +12,7 @@ import static org.junit.Assert.assertThat;
 /**
  * @author cihat keser
  */
-public class GetIndexedScriptTest {
+public class GetStoredScriptTest {
 
     private static final String A_NAME = "a_name";
     private GetStoredScript script;
@@ -24,14 +23,6 @@ public class GetIndexedScriptTest {
         script = builder.build();
     }
 
-    @Test
-    public void defaultScriptingLanguageIsGroovy() {
-        GetStoredScript script = new GetStoredScript.Builder(A_NAME).build();
-
-        assertEquals(GROOVY, script.getScriptLanguage());
-        assertThat(script.buildURI(ElasticsearchVersion.UNKNOWN), containsString(GROOVY.pathParameterName));
-    }
-
     @Test
     public void methodIsGet() {
         assertEquals("GET", script.getRestMethodName());
@@ -39,12 +30,12 @@ public class GetIndexedScriptTest {
 
     @Test
     public void scriptingLanguageIsSetIntoPath() {
-        assertThat(script.buildURI(ElasticsearchVersion.UNKNOWN), containsString("/_scripts/" + JAVASCRIPT.pathParameterName + "/"));
+        assertThat(script.buildURI(ElasticsearchVersion.UNKNOWN), containsString("/_scripts/"));
     }
 
     @Test
     public void nameOfTheScriptIsSetIntoPath() {
-        assertThat(script.buildURI(ElasticsearchVersion.UNKNOWN), containsString("/_scripts/" + JAVASCRIPT.pathParameterName + "/" + A_NAME));
+        assertThat(script.buildURI(ElasticsearchVersion.UNKNOWN), containsString("/_scripts/" + A_NAME));
     }
 
 }
\ No newline at end of file
diff --git a/jest-common/src/test/java/io/searchbox/indices/type/TypeExistTest.java b/jest-common/src/test/java/io/searchbox/indices/type/TypeExistTest.java
index 8e8bb707..07eb24b4 100644
--- a/jest-common/src/test/java/io/searchbox/indices/type/TypeExistTest.java
+++ b/jest-common/src/test/java/io/searchbox/indices/type/TypeExistTest.java
@@ -11,14 +11,6 @@ import static org.junit.Assert.assertNotEquals;
  */
 public class TypeExistTest {
 
-	@Test
-	public void testBasicUriGeneration() {
-		TypeExist typeExist = new TypeExist.Builder("happyprg").addType("seohoo").build();
-
-		assertEquals("HEAD", typeExist.getRestMethodName());
-        assertEquals("happyprg/seohoo", typeExist.getURI(ElasticsearchVersion.UNKNOWN));
-	}
-
 	@Test
 	public void testBasicUriGeneration_compatibleForES55() {
 		TypeExist typeExist = new TypeExist.Builder("happyprg").addType("seohoo").build();
diff --git a/jest-common/src/test/java/io/searchbox/snapshot/CreateSnapshotRepositoryTest.java b/jest-common/src/test/java/io/searchbox/snapshot/CreateSnapshotRepositoryTest.java
index c0771ab2..018d4f25 100644
--- a/jest-common/src/test/java/io/searchbox/snapshot/CreateSnapshotRepositoryTest.java
+++ b/jest-common/src/test/java/io/searchbox/snapshot/CreateSnapshotRepositoryTest.java
@@ -2,8 +2,12 @@ package io.searchbox.snapshot;
 
 import com.google.gson.Gson;
 import io.searchbox.client.config.ElasticsearchVersion;
-import org.elasticsearch.common.settings.Settings;
+import org.json.JSONException;
 import org.junit.Test;
+import org.skyscreamer.jsonassert.JSONAssert;
+
+import java.util.HashMap;
+import java.util.Map;
 
 import static org.junit.Assert.assertEquals;
 
@@ -15,22 +19,34 @@ public class CreateSnapshotRepositoryTest {
     private String repository = "seohoo";
 
     @Test
-    public void testBasicUriGeneration() {
-        final Settings.Builder registerRepositorySettings = Settings.builder();
-        registerRepositorySettings.put("type", "fs");
-        registerRepositorySettings.put("settings.compress", "true");
-        registerRepositorySettings.put("settings.location", "/mount/backups/my_backup");
-        registerRepositorySettings.put("settings.chunk_size", "10m");
-        registerRepositorySettings.put("settings.max_restore_bytes_per_sec", "40mb");
-        registerRepositorySettings.put("settings.max_snapshot_bytes_per_sec", "40mb");
-        registerRepositorySettings.put("settings.readonly", "false");
-
-        CreateSnapshotRepository createSnapshotRepository = new CreateSnapshotRepository.Builder(repository).settings(registerRepositorySettings.build().getAsMap()).build();
+    public void testBasicUriGeneration() throws JSONException {
+
+        Map<String, String> repositorySettings = new HashMap<>();
+        repositorySettings.put("type", "fs");
+        repositorySettings.put("settings.compress", "true");
+        repositorySettings.put("settings.location", "/mount/backups/my_backup");
+        repositorySettings.put("settings.chunk_size", "10m");
+        repositorySettings.put("settings.max_restore_bytes_per_sec", "40mb");
+        repositorySettings.put("settings.max_snapshot_bytes_per_sec", "40mb");
+        repositorySettings.put("settings.readonly", "false");
+
+        CreateSnapshotRepository createSnapshotRepository = new CreateSnapshotRepository.Builder(repository).settings(repositorySettings).build();
 
         assertEquals("PUT", createSnapshotRepository.getRestMethodName());
         assertEquals("/_snapshot/" + repository, createSnapshotRepository.getURI(ElasticsearchVersion.UNKNOWN));
-        String settings = new Gson().toJson(createSnapshotRepository.getData(new Gson()));
-        assertEquals("\"{\\\"settings.chunk_size\\\":\\\"10m\\\",\\\"settings.compress\\\":\\\"true\\\",\\\"settings.location\\\":\\\"/mount/backups/my_backup\\\",\\\"settings.max_restore_bytes_per_sec\\\":\\\"40mb\\\",\\\"settings.max_snapshot_bytes_per_sec\\\":\\\"40mb\\\",\\\"settings.readonly\\\":\\\"false\\\",\\\"type\\\":\\\"fs\\\"}\"", settings);
+        String settings = createSnapshotRepository.getData(new Gson());
+
+        String expectedJSON = "{" +
+                "   \"settings.chunk_size\":\"10m\"," +
+                "   \"settings.compress\":\"true\"," +
+                "   \"settings.location\":\"/mount/backups/my_backup\"," +
+                "   \"settings.max_restore_bytes_per_sec\":\"40mb\"," +
+                "   \"settings.max_snapshot_bytes_per_sec\":\"40mb\"," +
+                "   \"settings.readonly\":\"false\"," +
+                "   \"type\":\"fs\"" +
+                "}";
+
+        JSONAssert.assertEquals(expectedJSON, settings, false);
     }
 
     @Test
diff --git a/jest-common/src/test/java/io/searchbox/snapshot/CreateSnapshotTest.java b/jest-common/src/test/java/io/searchbox/snapshot/CreateSnapshotTest.java
index 37dab655..e3fa05a9 100644
--- a/jest-common/src/test/java/io/searchbox/snapshot/CreateSnapshotTest.java
+++ b/jest-common/src/test/java/io/searchbox/snapshot/CreateSnapshotTest.java
@@ -2,8 +2,12 @@ package io.searchbox.snapshot;
 
 import com.google.gson.Gson;
 import io.searchbox.client.config.ElasticsearchVersion;
-import org.elasticsearch.common.settings.Settings;
+import org.json.JSONException;
 import org.junit.Test;
+import org.skyscreamer.jsonassert.JSONAssert;
+
+import java.util.HashMap;
+import java.util.Map;
 
 import static org.junit.Assert.assertEquals;
 
@@ -23,21 +27,29 @@ public class CreateSnapshotTest {
     }
 
     @Test
-    public void testSnapshotWithSettings() {
+    public void testSnapshotWithSettings() throws JSONException {
+
+        Map<String, String> repositorySettings = new HashMap<>();
+        repositorySettings.put("indices", "index_1,index_2");
+        repositorySettings.put("ignore_unavailable", "true");
+        repositorySettings.put("include_global_state", "false");
 
-        final Settings.Builder registerRepositorySettings = Settings.builder();
-        registerRepositorySettings.put("indices", "index_1,index_2");
-        registerRepositorySettings.put("ignore_unavailable", "true");
-        registerRepositorySettings.put("include_global_state", "false");
 
         CreateSnapshot createSnapshot = new CreateSnapshot.Builder(repository, snapshot)
-                .settings(registerRepositorySettings.build().getAsMap())
+                .settings(repositorySettings)
                 .waitForCompletion(true)
                 .build();
 
         assertEquals("PUT", createSnapshot.getRestMethodName());
         assertEquals("/_snapshot/leeseohoo/leeseola?wait_for_completion=true", createSnapshot.getURI(ElasticsearchVersion.UNKNOWN));
-        String settings = new Gson().toJson(createSnapshot.getData(new Gson()));
-        assertEquals("\"{\\\"ignore_unavailable\\\":\\\"true\\\",\\\"include_global_state\\\":\\\"false\\\",\\\"indices\\\":\\\"index_1,index_2\\\"}\"", settings);
+        String settings = createSnapshot.getData(new Gson());
+
+        String expectedJSON = "{\n" +
+                "\t\"ignore_unavailable\": \"true\",\n" +
+                "\t\"include_global_state\": \"false\",\n" +
+                "\t\"indices\": \"index_1,index_2\"\n" +
+                "}";
+
+        JSONAssert.assertEquals(expectedJSON, settings, false);
     }
 }
diff --git a/jest-common/src/test/java/io/searchbox/snapshot/RestoreSnapshotTest.java b/jest-common/src/test/java/io/searchbox/snapshot/RestoreSnapshotTest.java
index 59c8790d..c8775343 100644
--- a/jest-common/src/test/java/io/searchbox/snapshot/RestoreSnapshotTest.java
+++ b/jest-common/src/test/java/io/searchbox/snapshot/RestoreSnapshotTest.java
@@ -2,8 +2,12 @@ package io.searchbox.snapshot;
 
 import com.google.gson.Gson;
 import io.searchbox.client.config.ElasticsearchVersion;
-import org.elasticsearch.common.settings.Settings;
+import org.json.JSONException;
 import org.junit.Test;
+import org.skyscreamer.jsonassert.JSONAssert;
+
+import java.util.HashMap;
+import java.util.Map;
 
 import static org.junit.Assert.assertEquals;
 
@@ -16,19 +20,30 @@ public class RestoreSnapshotTest {
     private String snapshot = "leeseola";
 
     @Test
-    public void testSnapshot() {
-        final Settings.Builder registerRepositorySettings = Settings.builder();
-        registerRepositorySettings.put("indices", "index_1,index_2");
-        registerRepositorySettings.put("ignore_unavailable", "true");
-        registerRepositorySettings.put("include_global_state", "false");
-        registerRepositorySettings.put("rename_pattern", "index_(.+)");
-        registerRepositorySettings.put("rename_replacement", "restored_index_$1");
+    public void testSnapshot() throws JSONException {
+
+        Map<String, String> repositorySettings = new HashMap<>();
+        repositorySettings.put("indices", "index_1,index_2");
+        repositorySettings.put("ignore_unavailable", "true");
+        repositorySettings.put("include_global_state", "false");
+        repositorySettings.put("rename_pattern", "index_(.+)");
+        repositorySettings.put("rename_replacement", "restored_index_$1");
+
 
         RestoreSnapshot restoreSnapshot = new RestoreSnapshot.Builder(repository, snapshot)
-                .settings(registerRepositorySettings.build().getAsMap()).build();
+                .settings(repositorySettings).build();
         assertEquals("POST", restoreSnapshot.getRestMethodName());
         assertEquals("/_snapshot/leeseohoo/leeseola/_restore", restoreSnapshot.getURI(ElasticsearchVersion.UNKNOWN));
-        String settings = new Gson().toJson(restoreSnapshot.getData(new Gson()));
-        assertEquals("\"{\\\"ignore_unavailable\\\":\\\"true\\\",\\\"include_global_state\\\":\\\"false\\\",\\\"indices\\\":\\\"index_1,index_2\\\",\\\"rename_pattern\\\":\\\"index_(.+)\\\",\\\"rename_replacement\\\":\\\"restored_index_$1\\\"}\"", settings);
+        String settings = restoreSnapshot.getData(new Gson());
+
+        String expectedJSON = "{\n" +
+                "\"ignore_unavailable\": \"true\",\n" +
+                "\"include_global_state\": \"false\",\n" +
+                "\"indices\": \"index_1,index_2\",\n" +
+                "\"rename_pattern\": \"index_(.+)\",\n" +
+                "\"rename_replacement\": \"restored_index_$1\"\n" +
+                "}";
+
+        JSONAssert.assertEquals(expectedJSON, settings, false);
     }
 }
diff --git a/jest/src/test/java/io/searchbox/client/JestClientFactoryIntegrationTest.java b/jest/src/test/java/io/searchbox/client/JestClientFactoryIntegrationTest.java
index a6019e95..ea501e4e 100644
--- a/jest/src/test/java/io/searchbox/client/JestClientFactoryIntegrationTest.java
+++ b/jest/src/test/java/io/searchbox/client/JestClientFactoryIntegrationTest.java
@@ -28,6 +28,7 @@ public class JestClientFactoryIntegrationTest extends ESIntegTestCase {
 
     @Test
     public void testDiscovery() throws InterruptedException, IOException {
+
         // wait for 4 active nodes
         internalCluster().ensureAtLeastNumDataNodes(4);
         assertEquals("All nodes in cluster should have HTTP endpoint exposed", 4, cluster().httpAddresses().length);
diff --git a/jest/src/test/java/io/searchbox/client/JestClientFactoryTest.java b/jest/src/test/java/io/searchbox/client/JestClientFactoryTest.java
index 359f6c06..8249a3c7 100755
--- a/jest/src/test/java/io/searchbox/client/JestClientFactoryTest.java
+++ b/jest/src/test/java/io/searchbox/client/JestClientFactoryTest.java
@@ -1,7 +1,5 @@
 package io.searchbox.client;
 
-import java.util.HashSet;
-
 import io.searchbox.client.config.ClientConfig;
 import io.searchbox.client.config.HttpClientConfig;
 import io.searchbox.client.config.discovery.NodeChecker;
@@ -22,6 +20,8 @@ import org.apache.http.nio.conn.NHttpClientConnectionManager;
 import org.junit.Test;
 import org.mockito.Mockito;
 
+import java.util.HashSet;
+
 import static java.util.Arrays.asList;
 import static org.junit.Assert.*;
 
@@ -104,7 +104,7 @@ public class JestClientFactoryTest {
     @Test
     public void clientCreationWithDiscoveryAndOverriddenNodeChecker() {
         JestClientFactory factory = Mockito.spy(new ExtendedJestClientFactory());
-        HttpClientConfig httpClientConfig = Mockito.spy(new HttpClientConfig.Builder("http://localhost:9200")
+        HttpClientConfig httpClientConfig = Mockito.spy(new HttpClientConfig.Builder("http://somehost:9200")
                 .discoveryEnabled(true)
                 .build());
         factory.setHttpClientConfig(httpClientConfig);
@@ -113,7 +113,7 @@ public class JestClientFactoryTest {
         assertNotNull(jestClient.getAsyncClient());
         assertEquals(jestClient.getServerPoolSize(), 1);
         assertEquals("server list should contain localhost:9200",
-                "http://localhost:9200", jestClient.getNextServer());
+                "http://somehost:9200", jestClient.getNextServer());
         Mockito.verify(factory, Mockito.times(1)).createNodeChecker(Mockito.any(JestHttpClient.class),
                                                                     Mockito.same(httpClientConfig));
     }
diff --git a/jest/src/test/java/io/searchbox/client/http/JestHttpClientSystemWideProxyIntegrationTest.java b/jest/src/test/java/io/searchbox/client/http/JestHttpClientSystemWideProxyIntegrationTest.java
index 8c2a961e..8e67dedc 100644
--- a/jest/src/test/java/io/searchbox/client/http/JestHttpClientSystemWideProxyIntegrationTest.java
+++ b/jest/src/test/java/io/searchbox/client/http/JestHttpClientSystemWideProxyIntegrationTest.java
@@ -12,11 +12,7 @@ import org.elasticsearch.common.settings.Settings;
 import org.elasticsearch.plugins.Plugin;
 import org.elasticsearch.test.ESIntegTestCase;
 import org.elasticsearch.transport.Netty4Plugin;
-import org.junit.After;
-import org.junit.AfterClass;
-import org.junit.Before;
-import org.junit.BeforeClass;
-import org.junit.Test;
+import org.junit.*;
 import org.littleshoot.proxy.HttpFilters;
 import org.littleshoot.proxy.HttpFiltersAdapter;
 import org.littleshoot.proxy.HttpFiltersSourceAdapter;
@@ -38,6 +34,7 @@ import java.util.concurrent.atomic.AtomicInteger;
 @ESIntegTestCase.ClusterScope(scope = ESIntegTestCase.Scope.TEST, numDataNodes = 0)
 public class JestHttpClientSystemWideProxyIntegrationTest extends ESIntegTestCase {
 
+
     private static final int PROXY_PORT = 8790;
 
     private AtomicInteger numProxyRequests = new AtomicInteger(0);
diff --git a/jest/src/test/java/io/searchbox/cluster/UpdateSettingsIntegrationTest.java b/jest/src/test/java/io/searchbox/cluster/UpdateSettingsIntegrationTest.java
index 8eb3e6fb..cae03883 100644
--- a/jest/src/test/java/io/searchbox/cluster/UpdateSettingsIntegrationTest.java
+++ b/jest/src/test/java/io/searchbox/cluster/UpdateSettingsIntegrationTest.java
@@ -26,7 +26,7 @@ public class UpdateSettingsIntegrationTest extends AbstractIntegrationTest {
     public void transientSettingShouldBeUpdated() throws IOException {
         String source = "{\n" +
                 "    \"transient\" : {\n" +
-                "        \"indices.store.throttle.max_bytes_per_sec\" : \"50mb\"\n" +
+                "        \"indices.recovery.max_bytes_per_sec\" : \"20mb\"\n" +
                 "    }\n" +
                 "}";
 
diff --git a/jest/src/test/java/io/searchbox/core/BulkIntegrationTest.java b/jest/src/test/java/io/searchbox/core/BulkIntegrationTest.java
index 467695d0..035296a2 100644
--- a/jest/src/test/java/io/searchbox/core/BulkIntegrationTest.java
+++ b/jest/src/test/java/io/searchbox/core/BulkIntegrationTest.java
@@ -6,11 +6,15 @@ import io.searchbox.client.JestResult;
 import io.searchbox.client.config.HttpClientConfig;
 import io.searchbox.client.http.JestHttpClient;
 import io.searchbox.common.AbstractIntegrationTest;
+import io.searchbox.indices.CreateIndex;
+import io.searchbox.indices.DeleteIndex;
 import io.searchbox.params.Parameters;
 import org.elasticsearch.action.get.GetRequest;
 import org.elasticsearch.action.get.GetResponse;
 import org.elasticsearch.test.ESIntegTestCase;
 import org.json.JSONException;
+import org.junit.After;
+import org.junit.Before;
 import org.junit.Test;
 import org.skyscreamer.jsonassert.JSONAssert;
 
@@ -23,10 +27,22 @@ import java.util.*;
  */
 @ESIntegTestCase.ClusterScope(scope = ESIntegTestCase.Scope.TEST, numDataNodes = 1)
 public class BulkIntegrationTest extends AbstractIntegrationTest {
+
+    public static final String INDEX = "twitter";
+    public static final String TYPE = "tweet";
+
+    @Before
+    public void createIndex() throws IOException {
+        CreateIndex createIndex = new CreateIndex.Builder(INDEX).build();
+
+        JestResult result = client.execute(createIndex);
+        assertTrue(result.getErrorMessage(), result.isSucceeded());
+    }
+
     @Test
     public void bulkOperationWithCustomGson() throws Exception {
-        String index = "twitter";
-        String type = "tweet";
+        String index = INDEX;
+        String type = TYPE;
         String id = "1";
         Calendar calendar = GregorianCalendar.getInstance(TimeZone.getTimeZone("GMT"));
         calendar.set(2013, 0, 1, 0, 0, 0); // 2013-01-01 00:00:00 GMT
@@ -62,7 +78,7 @@ public class BulkIntegrationTest extends AbstractIntegrationTest {
         assertEquals(201, firstItem.status);
         assertNull(firstItem.error);
 
-        GetResponse getResponse = client().get(new GetRequest("twitter", "tweet", "1")).actionGet(5000);
+        GetResponse getResponse = client().get(new GetRequest(INDEX, TYPE, "1")).actionGet(5000);
         assertNotNull(getResponse);
         // use date formatter to avoid timezone issues when testing
         SimpleDateFormat df = new SimpleDateFormat(dateStyle, Locale.UK);
@@ -71,8 +87,8 @@ public class BulkIntegrationTest extends AbstractIntegrationTest {
 
     @Test
     public void bulkOperationWithIndex() throws IOException {
-        String index = "twitter";
-        String type = "tweet";
+        String index = INDEX;
+        String type = TYPE;
         String id = "1";
         Map<String, String> source = new HashMap<String, String>();
         source.put("user", "kimchy");
@@ -98,8 +114,8 @@ public class BulkIntegrationTest extends AbstractIntegrationTest {
 
     @Test
     public void bulkOperationWithDefaultIndexAndDefaultType() throws IOException {
-        String index = "twitter";
-        String type = "tweet";
+        String index = INDEX;
+        String type = TYPE;
         String id = "1";
         Map<String, String> source1 = new HashMap<String, String>();
         source1.put("user name", "kimchy olga john doe");
@@ -125,15 +141,15 @@ public class BulkIntegrationTest extends AbstractIntegrationTest {
         assertEquals(201, firstItem.status);
         assertNull(firstItem.error);
 
-        GetResponse getResponse = client().get(new GetRequest("twitter", "tweet", "1")).actionGet();
+        GetResponse getResponse = client().get(new GetRequest(INDEX, TYPE, "1")).actionGet();
         assertNotNull(getResponse);
         assertEquals(new Gson().toJson(source1), getResponse.getSourceAsString());
     }
 
     @Test
     public void bulkOperationWithIndexWithSourceIncludingWhitespace() throws IOException, JSONException {
-        String index = "twitter";
-        String type = "tweet";
+        String index = INDEX;
+        String type = TYPE;
         Map<String, String> source1 = new HashMap<String, String>();
         source1.put("user name", "kimchy olga john doe");
 
@@ -167,19 +183,19 @@ public class BulkIntegrationTest extends AbstractIntegrationTest {
         assertEquals(201, secondItem.status);
         assertNull(secondItem.error);
 
-        GetResponse getResponse = client().get(new GetRequest("twitter", "tweet", "1")).actionGet();
+        GetResponse getResponse = client().get(new GetRequest(INDEX, TYPE, "1")).actionGet();
         assertNotNull(getResponse);
         assertEquals(new Gson().toJson(source1), getResponse.getSourceAsString());
 
-        getResponse = client().get(new GetRequest("twitter", "tweet", "2")).actionGet();
+        getResponse = client().get(new GetRequest(INDEX, TYPE, "2")).actionGet();
         assertNotNull(getResponse);
         JSONAssert.assertEquals(source2, getResponse.getSourceAsString(), false);
     }
 
     @Test
     public void bulkOperationWithIndexWithSourceIncludingLineBreak() throws IOException {
-        String index = "twitter";
-        String type = "tweet";
+        String index = INDEX;
+        String type = TYPE;
         Map<String, String> source1 = new HashMap<String, String>();
         source1.put("user name", "kimchy\nolga\njohn doe");
 
@@ -200,8 +216,8 @@ public class BulkIntegrationTest extends AbstractIntegrationTest {
 
     @Test
     public void bulkOperationWithIndexWithParam() throws IOException {
-        String index = "twitter";
-        String type = "tweet";
+        String index = INDEX;
+        String type = TYPE;
         Map<String, String> source = new HashMap<String, String>();
         source.put("user", "kimchy");
         Bulk bulk = new Bulk.Builder()
@@ -219,8 +235,8 @@ public class BulkIntegrationTest extends AbstractIntegrationTest {
 
     @Test
     public void bulkOperationWithIndexAndUpdate() throws IOException {
-        String index = "twitter";
-        String type = "tweet";
+        String index = INDEX;
+        String type = TYPE;
         String id = "1";
         String script =  "{ \"script\" : { \"inline\": \"ctx._source.user += params.tag\", \"params\" : {\"tag\" : \"_rob\"}}}";
         Map<String, String> source = new HashMap<>();
@@ -253,15 +269,15 @@ public class BulkIntegrationTest extends AbstractIntegrationTest {
         assertEquals(200, secondItem.status);
         assertNull(secondItem.error);
 
-        GetResponse getResponse = client().get(new GetRequest("twitter", "tweet", "1")).actionGet();
+        GetResponse getResponse = client().get(new GetRequest(INDEX, TYPE, "1")).actionGet();
         assertNotNull(getResponse);
         assertEquals("{\"user\":\"kimchy_rob\"}", getResponse.getSourceAsString());
     }
 
     @Test
     public void bulkOperationWithIndexJsonSource() throws IOException {
-        String index = "twitter";
-        String type = "tweet";
+        String index = INDEX;
+        String type = TYPE;
         String id = "1";
         String source = "{\"user\":\"super\"}";
         Bulk bulk = new Bulk.Builder()
@@ -286,11 +302,11 @@ public class BulkIntegrationTest extends AbstractIntegrationTest {
 
     @Test
     public void bulkOperationWithSingleDelete() throws IOException {
-        String index = "twitter";
-        String type = "tweet";
+        String index = INDEX;
+        String type = TYPE;
         String id = "1";
         Bulk bulk = new Bulk.Builder()
-                .addAction(new Delete.Builder(id).index(index).type(type).build())
+                .addAction(new Delete.Builder(id).index(index).type(type).id(id).build())
                 .build();
 
         BulkResult result = client.execute(bulk);
@@ -311,8 +327,8 @@ public class BulkIntegrationTest extends AbstractIntegrationTest {
 
     @Test
     public void bulkOperationWithMultipleIndex() throws IOException {
-        String index1 = "twitter";
-        String type1 = "tweet";
+        String index1 = INDEX;
+        String type1 = TYPE;
         String id1 = "1";
         String index2 = "elasticsearch";
         String type2 = "jest";
@@ -351,8 +367,8 @@ public class BulkIntegrationTest extends AbstractIntegrationTest {
 
     @Test
     public void bulkOperationWithIndexCreateOpType() throws IOException {
-        String index = "twitter";
-        String type = "tweet";
+        String index = INDEX;
+        String type = TYPE;
         String id = "1";
         Map<String, String> source = new HashMap<String, String>();
         source.put("user", "kimcy");
@@ -395,8 +411,8 @@ public class BulkIntegrationTest extends AbstractIntegrationTest {
 
     @Test
     public void bulkOperationWithMultipleDelete() throws IOException {
-        String index = "twitter";
-        String type = "tweet";
+        String index = INDEX;
+        String type = TYPE;
         Bulk bulk = new Bulk.Builder()
                 .addAction(new Delete.Builder("1").index(index).type(type).build())
                 .addAction(new Delete.Builder("2").index(index).type(type).build())
@@ -428,8 +444,8 @@ public class BulkIntegrationTest extends AbstractIntegrationTest {
 
     @Test
     public void bulkOperationWithMultipleIndexAndDelete() throws IOException {
-        String index = "twitter";
-        String type = "tweet";
+        String index = INDEX;
+        String type = TYPE;
         Map<String, String> source = new HashMap<String, String>();
         source.put("field", "value");
         Bulk bulk = new Bulk.Builder()
@@ -458,8 +474,8 @@ public class BulkIntegrationTest extends AbstractIntegrationTest {
         );
 
         Bulk bulk = new Bulk.Builder()
-                .defaultIndex("twitter")
-                .defaultType("tweet")
+                .defaultIndex(INDEX)
+                .defaultType(TYPE)
                 .addAction(modelList)
                 .build();
 
@@ -472,4 +488,10 @@ public class BulkIntegrationTest extends AbstractIntegrationTest {
         assertEquals(0, failedItems.size());
     }
 
+    @After
+    public void deleteIndex() throws IOException {
+        DeleteIndex indicesExists = new DeleteIndex.Builder(INDEX).build();
+        JestResult result = client.execute(indicesExists);
+        assertTrue(result.getErrorMessage(), result.isSucceeded());
+    }
 }
diff --git a/jest/src/test/java/io/searchbox/core/DeleteIntegrationTest.java b/jest/src/test/java/io/searchbox/core/DeleteIntegrationTest.java
index 4693ef47..e09ac77c 100644
--- a/jest/src/test/java/io/searchbox/core/DeleteIntegrationTest.java
+++ b/jest/src/test/java/io/searchbox/core/DeleteIntegrationTest.java
@@ -1,12 +1,14 @@
 package io.searchbox.core;
 
+import io.searchbox.client.JestResult;
 import io.searchbox.client.JestResultHandler;
 import io.searchbox.common.AbstractIntegrationTest;
+import io.searchbox.indices.CreateIndex;
+import io.searchbox.indices.DeleteIndex;
 import org.elasticsearch.test.ESIntegTestCase;
-import org.junit.Ignore;
+import org.junit.After;
+import org.junit.Before;
 import org.junit.Test;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
 
 import java.io.IOException;
 import java.util.concurrent.ExecutionException;
@@ -17,24 +19,36 @@ import java.util.concurrent.ExecutionException;
 @ESIntegTestCase.ClusterScope(scope = ESIntegTestCase.Scope.SUITE, numDataNodes = 1)
 public class DeleteIntegrationTest extends AbstractIntegrationTest {
 
+    public static final String INDEX = "twitter";
+    public static final String TYPE = "tweet";
+    public static final String ID = "1";
+
+    @Before
+    public void createIndex() throws IOException {
+        CreateIndex createIndex = new CreateIndex.Builder(INDEX).build();
+
+        JestResult result = client.execute(createIndex);
+        assertTrue(result.getErrorMessage(), result.isSucceeded());
+    }
+
     @Test
     public void deleteNonExistingDocument() throws IOException {
-        DocumentResult result = client.execute(new Delete.Builder("1")
-                .index("twitter")
-                .type("tweet")
+        DocumentResult result = client.execute(new Delete.Builder(ID)
+                .index(INDEX)
+                .type(TYPE)
+                .id(ID)
                 .build());
         assertFalse(result.isSucceeded());
-        assertEquals("twitter", result.getIndex());
+        assertEquals(INDEX, result.getIndex());
         assertEquals("tweet", result.getType());
-        assertEquals("1", result.getId());
+        assertEquals(ID, result.getId());
     }
 
-    @Ignore // async execution disturbs flow of the test suite
     @Test
     public void deleteDocumentAsynchronously() throws InterruptedException, ExecutionException, IOException {
-        client.executeAsync(new Delete.Builder("1")
-                .index("twitter")
-                .type("tweet")
+        client.executeAsync(new Delete.Builder(ID)
+                .index(INDEX)
+                .type(TYPE)
                 .build(), new JestResultHandler<DocumentResult>() {
             @Override
             public void completed(DocumentResult result) {
@@ -46,13 +60,15 @@ public class DeleteIntegrationTest extends AbstractIntegrationTest {
                 fail("failed during the asynchronous calling");
             }
         });
+
+        Thread.sleep(500);
     }
 
     @Test
     public void deleteRealDocument() throws IOException {
-        Index index = new Index.Builder("{\"user\":\"kimchy\"}").index("cvbank").type("candidate").id("1").refresh(true).build();
+        Index index = new Index.Builder("{\"user\":\"kimchy\"}").index("cvbank").type("candidate").id(ID).refresh(true).build();
         client.execute(index);
-        DocumentResult result = client.execute(new Delete.Builder("1")
+        DocumentResult result = client.execute(new Delete.Builder(ID)
                 .index("cvbank")
                 .type("candidate")
                 .build());
@@ -60,7 +76,14 @@ public class DeleteIntegrationTest extends AbstractIntegrationTest {
         assertTrue(result.getErrorMessage(), result.isSucceeded());
         assertEquals("cvbank", result.getIndex());
         assertEquals("candidate", result.getType());
-        assertEquals("1", result.getId());
+        assertEquals(ID, result.getId());
+    }
+
+    @After
+    public void deleteIndex() throws IOException {
+        DeleteIndex indicesExists = new DeleteIndex.Builder(INDEX).build();
+        JestResult result = client.execute(indicesExists);
+        assertTrue(result.getErrorMessage(), result.isSucceeded());
     }
 
 }
diff --git a/jest/src/test/java/io/searchbox/core/ExplainIntegrationTest.java b/jest/src/test/java/io/searchbox/core/ExplainIntegrationTest.java
index 7e0517bb..1ed7eefb 100644
--- a/jest/src/test/java/io/searchbox/core/ExplainIntegrationTest.java
+++ b/jest/src/test/java/io/searchbox/core/ExplainIntegrationTest.java
@@ -4,6 +4,7 @@ import io.searchbox.common.AbstractIntegrationTest;
 import org.elasticsearch.action.index.IndexRequest;
 import org.elasticsearch.action.support.WriteRequest;
 import org.elasticsearch.test.ESIntegTestCase;
+import org.json.JSONException;
 import org.junit.Test;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -19,9 +20,9 @@ public class ExplainIntegrationTest extends AbstractIntegrationTest {
     final static Logger log = LoggerFactory.getLogger(ExplainIntegrationTest.class);
 
     @Test
-    public void explain() throws IOException {
-        client().index(new IndexRequest("twitter", "tweet", "1").source("{\"user\":\"tweety\"}").setRefreshPolicy(WriteRequest.RefreshPolicy.IMMEDIATE)).actionGet();
+    public void explain() throws IOException, JSONException {
 
+        client().index(new IndexRequest("twitter", "tweet", "1").source("user", "tweety").setRefreshPolicy(WriteRequest.RefreshPolicy.IMMEDIATE)).actionGet();
         String query = "{\n" +
                 "    \"query\": {\n" +
                 "                \"query_string\" : {\n" +
diff --git a/jest/src/test/java/io/searchbox/core/GetIntegrationTest.java b/jest/src/test/java/io/searchbox/core/GetIntegrationTest.java
index 5f44df2f..f2f21d35 100644
--- a/jest/src/test/java/io/searchbox/core/GetIntegrationTest.java
+++ b/jest/src/test/java/io/searchbox/core/GetIntegrationTest.java
@@ -1,10 +1,8 @@
 package io.searchbox.core;
 
-import java.io.IOException;
-import java.util.concurrent.CountDownLatch;
-import java.util.concurrent.ExecutionException;
-import java.util.concurrent.TimeUnit;
-
+import io.searchbox.annotations.JestId;
+import io.searchbox.client.JestResultHandler;
+import io.searchbox.common.AbstractIntegrationTest;
 import org.elasticsearch.action.DocWriteResponse;
 import org.elasticsearch.action.index.IndexRequest;
 import org.elasticsearch.action.index.IndexResponse;
@@ -14,9 +12,10 @@ import org.junit.Before;
 import org.junit.Test;
 import org.skyscreamer.jsonassert.JSONAssert;
 
-import io.searchbox.annotations.JestId;
-import io.searchbox.client.JestResultHandler;
-import io.searchbox.common.AbstractIntegrationTest;
+import java.io.IOException;
+import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.ExecutionException;
+import java.util.concurrent.TimeUnit;
 
 /**
  * @author Dogukan Sonmez
@@ -34,7 +33,7 @@ public class GetIntegrationTest extends AbstractIntegrationTest {
                 INDEX,
                 TYPE,
                 "1")
-                .source("{\"user\":\"tweety\"}"))
+                .source("user", "tweety"))
                 .actionGet();
         assertTrue(indexResponse.getResult().equals(DocWriteResponse.Result.CREATED));
     }
@@ -46,7 +45,7 @@ public class GetIntegrationTest extends AbstractIntegrationTest {
                 INDEX,
                 TYPE,
                 documentId)
-                .source("{\"user\":\"tweety\"}"))
+                .source("user", "tweety"))
                 .actionGet();
         assertNotNull(indexResponse);
 
diff --git a/jest/src/test/java/io/searchbox/core/IndexIntegrationTest.java b/jest/src/test/java/io/searchbox/core/IndexIntegrationTest.java
index b9d8e729..706ece5e 100644
--- a/jest/src/test/java/io/searchbox/core/IndexIntegrationTest.java
+++ b/jest/src/test/java/io/searchbox/core/IndexIntegrationTest.java
@@ -5,6 +5,7 @@ import io.searchbox.client.AbstractJestClient;
 import io.searchbox.common.AbstractIntegrationTest;
 import org.elasticsearch.action.admin.indices.mapping.put.PutMappingRequest;
 import org.elasticsearch.action.get.GetResponse;
+import org.elasticsearch.common.xcontent.XContentType;
 import org.elasticsearch.test.ESIntegTestCase;
 import org.junit.Test;
 
@@ -78,7 +79,7 @@ public class IndexIntegrationTest extends AbstractIntegrationTest {
 
         createIndex(INDEX);
         assertTrue(client().admin().indices().putMapping(new PutMappingRequest(INDEX)
-                .type(TYPE).source(mapping)).actionGet().isAcknowledged());
+                .type(TYPE).source(mapping, XContentType.JSON)).actionGet().isAcknowledged());
         assertConcreteMappingsOnAll(INDEX, TYPE, "creationDate");
 
         DocumentResult result = client.execute(new Index.Builder(source).index(INDEX).type(TYPE).id(id).build());
diff --git a/jest/src/test/java/io/searchbox/core/MultiGetIntegrationTest.java b/jest/src/test/java/io/searchbox/core/MultiGetIntegrationTest.java
index 85da6e67..cc827482 100644
--- a/jest/src/test/java/io/searchbox/core/MultiGetIntegrationTest.java
+++ b/jest/src/test/java/io/searchbox/core/MultiGetIntegrationTest.java
@@ -26,9 +26,9 @@ public class MultiGetIntegrationTest extends AbstractIntegrationTest {
 
     @Before
     public void setup() throws IOException {
-        client().index(new IndexRequest(TEST_INDEX, TEST_TYPE, "1").source("{\"text\":\"pumpkin\", \"author\":\"anon\"}")).actionGet();
-        client().index(new IndexRequest(TEST_INDEX, TEST_TYPE, "2").source("{\"text\":\"spice\"}")).actionGet();
-        client().index(new IndexRequest(TEST_INDEX, TEST_TYPE, "3").source("{\"text\":\"latte\"}")).actionGet();
+        client().index(new IndexRequest(TEST_INDEX, TEST_TYPE, "1").source("text", "pumpkin", "author", "anon")).actionGet();
+        client().index(new IndexRequest(TEST_INDEX, TEST_TYPE, "2").source("text", "spice")).actionGet();
+        client().index(new IndexRequest(TEST_INDEX, TEST_TYPE, "3").source("text", "latte")).actionGet();
     }
 
     @Test
diff --git a/jest/src/test/java/io/searchbox/core/MultiSearchIntegrationTest.java b/jest/src/test/java/io/searchbox/core/MultiSearchIntegrationTest.java
index 596d9c4c..12cc5162 100644
--- a/jest/src/test/java/io/searchbox/core/MultiSearchIntegrationTest.java
+++ b/jest/src/test/java/io/searchbox/core/MultiSearchIntegrationTest.java
@@ -14,7 +14,7 @@ import java.util.List;
 @ESIntegTestCase.ClusterScope(scope = ESIntegTestCase.Scope.SUITE, numDataNodes = 1)
 public class MultiSearchIntegrationTest extends AbstractIntegrationTest {
 
-    String query = "{ \"query\": { \"bool\": { \"should\": [ { \"query_string\": { \"query\": \"newman\" } } ], \"filter\": { \"term\": { \"user\": \"kramer\" } }, \"minimum_number_should_match\": 1 } } }";
+    String query = "{ \"query\": { \"bool\": { \"should\": [ { \"query_string\": { \"query\": \"newman\" } } ], \"filter\": { \"term\": { \"user\": \"kramer\" } }, \"minimum_should_match\": 1 } } }";
 
     @Test
     public void multipleSearchRequests() throws IOException {
diff --git a/jest/src/test/java/io/searchbox/core/PercolateIntegrationTest.java b/jest/src/test/java/io/searchbox/core/PercolateIntegrationTest.java
deleted file mode 100644
index ed577298..00000000
--- a/jest/src/test/java/io/searchbox/core/PercolateIntegrationTest.java
+++ /dev/null
@@ -1,55 +0,0 @@
-package io.searchbox.core;
-
-
-import io.searchbox.client.JestResult;
-import io.searchbox.common.AbstractIntegrationTest;
-import org.elasticsearch.action.admin.indices.mapping.put.PutMappingRequest;
-import org.elasticsearch.action.admin.indices.mapping.put.PutMappingResponse;
-import org.elasticsearch.test.ESIntegTestCase;
-import org.junit.Test;
-
-import java.io.IOException;
-
-import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertAcked;
-
-/**
- * @author Dogukan Sonmez
- */
-@ESIntegTestCase.ClusterScope(scope = ESIntegTestCase.Scope.SUITE, numDataNodes = 1)
-public class PercolateIntegrationTest extends AbstractIntegrationTest {
-
-    @Test
-    public void percolateWithValidParameters() throws IOException {
-        String index = "cvbank";
-        String type = "candidate";
-        createIndex(index);
-        ensureSearchable(index);
-
-        assertAcked(client().admin().indices().preparePutMapping(index)
-                .setType(type)
-                .setSource("{\"properties\":{\"language\":{\"type\":\"keyword\",\"store\":\"yes\"}}}")
-                .get());
-        assertAcked(client().admin().indices().preparePutMapping(index)
-                .setType("queries")
-                .setSource("{\"properties\":{\"query\":{\"type\":\"percolator\"}}}")
-                .get());
-
-        String query = "{\n" +
-                "    \"query\" : {\n" +
-                "        \"term\" : {\n" +
-                "            \"language\" : \"java\"\n" +
-                "        }\n" +
-                "    }\n" +
-                "}";
-
-        // register percolator query on our index
-        JestResult result = client.execute(new Index.Builder(query).index(index).type("queries").id("1").refresh(true).build());
-        assertTrue(result.getErrorMessage(), result.isSucceeded());
-
-        // try to match a document against the registered percolator
-        Percolate percolate = new Percolate.Builder(index, type, "{\"doc\" : {\"language\":\"java\"}}").build();
-        result = client.execute(percolate);
-        assertTrue(result.getErrorMessage(), result.isSucceeded());
-        assertEquals(1, result.getJsonObject().getAsJsonPrimitive("total").getAsInt());
-    }
-}
\ No newline at end of file
diff --git a/jest/src/test/java/io/searchbox/core/SearchIntegrationTest.java b/jest/src/test/java/io/searchbox/core/SearchIntegrationTest.java
index 46e063bf..47595daf 100644
--- a/jest/src/test/java/io/searchbox/core/SearchIntegrationTest.java
+++ b/jest/src/test/java/io/searchbox/core/SearchIntegrationTest.java
@@ -53,9 +53,114 @@ public class SearchIntegrationTest extends AbstractIntegrationTest {
         assertTrue(result.getErrorMessage(), result.isSucceeded());
     }
 
+    @Test
+    public void searchWithPercolator() throws IOException {
+        String index = "twitter";
+        String type = "tweet";
+
+        String mapping = "{\n" +
+                "            \"properties\": {\n" +
+                "                \"message\": {\n" +
+                "                    \"type\": \"text\"\n" +
+                "                },\n" +
+                "                \"query\": {\n" +
+                "                    \"type\": \"percolator\"\n" +
+                "                }\n" +
+                "            }\n" +
+                "        }";
+
+        assertAcked(prepareCreate(index).addMapping(type, mapping, XContentType.JSON));
+
+        String query = "{\n" +
+                "    \"query\" : {\n" +
+                "        \"match\" : {\n" +
+                "            \"message\" : \"bonsai tree\"\n" +
+                "        }\n" +
+                "    }\n" +
+                "}\n";
+
+
+        assertTrue(index(index, type, "1", query).getResult().equals(DocWriteResponse.Result.CREATED));
+        refresh();
+        ensureSearchable(index);
+
+        //SearchResult result = client.execute(new Search.Builder(query).addIndex(myIndex).addType(myType).build());
+        //assertTrue(result.getErrorMessage(), result.isSucceeded());
+
+        String matchQuery = "{\n" +
+                "    \"query\" : {\n" +
+                "        \"percolate\" : {\n" +
+                "            \"field\" : \"query\",\n" +
+                "            \"documents\" : [\n" +
+                "              {\n" +
+                "                \"message\" : \"A new bonsai tree in the office\"\n" +
+                "            }\n" +
+                "        ]\n" +
+                "        }\n" +
+                "    }\n" +
+                "}";
+
+        SearchResult myResult = client.execute(new Search.Builder(matchQuery).addIndex(index).build());
+        assertTrue(myResult.getErrorMessage(), myResult.isSucceeded());
+        assertEquals(1, myResult.getJsonObject().get("hits").getAsJsonObject().get("total").getAsInt());
+    }
+
+    @Test
+    public void suggestQuery() throws IOException {
+        String index = "twitter";
+        String type = "tweet";
+
+        String mapping = "{\n" +
+                "            \"properties\": {\n" +
+                "                \"message\": {\n" +
+                "                    \"type\": \"text\"\n" +
+                "                }\n" +
+                "            }\n" +
+                "        }";
+
+        assertAcked(prepareCreate(index).addMapping(type, mapping, XContentType.JSON));
+        assertTrue(index(index, type, "1", "{\"message\":\"istanbul\"}").getResult().equals(DocWriteResponse.Result.CREATED));
+        assertTrue(index(index, type, "2", "{\"message\":\"amsterdam\"}").getResult().equals(DocWriteResponse.Result.CREATED));
+        assertTrue(index(index, type, "3", "{\"message\":\"rotterdam\"}").getResult().equals(DocWriteResponse.Result.CREATED));
+        assertTrue(index(index, type, "4", "{\"message\":\"vienna\"}").getResult().equals(DocWriteResponse.Result.CREATED));
+        assertTrue(index(index, type, "5", "{\"message\":\"london\"}").getResult().equals(DocWriteResponse.Result.CREATED));
+
+        refresh();
+        ensureSearchable(INDEX);
+
+        String suggest = "{\n" +
+                "    \"my-suggestion\" : {\n" +
+                "      \"text\" : \"amsterdma\",\n" +
+                "      \"term\" : {\n" +
+                "        \"field\" : \"message\"\n" +
+                "      }\n" +
+                "    }\n" +
+                "  }";
+
+        String query = "{\n" +
+                "  \"query\" : {\n" +
+                "    \"match\": {\n" +
+                "      \"message\": \"amsterdam\"\n" +
+                "    }\n" +
+                "  },\n" +
+                "  \"suggest\" : {\n" +
+                "    \"my-suggestion\" : {\n" +
+                "      \"text\" : \"amsterdma\",\n" +
+                "      \"term\" : {\n" +
+                "        \"field\" : \"message\"\n" +
+                "      }\n" +
+                "    }\n" +
+                "  }\n" +
+                "}";
+
+        SearchResult result = client.execute(new Search.Builder(query).addIndex(index).build());
+        assertTrue(result.getErrorMessage(), result.isSucceeded());
+        assertEquals("amsterdma", result.getJsonObject().getAsJsonObject("suggest").getAsJsonArray("my-suggestion").get(0).getAsJsonObject().get("text").getAsString());
+    }
+
     @Test
     public void searchWithMultipleHits() throws Exception {
-        assertAcked(prepareCreate(INDEX).addMapping(TYPE, "{\"properties\":{\"user\":{\"type\":\"keyword\"}}}"));
+        assertAcked(prepareCreate(INDEX).addMapping(TYPE, "{\"properties\":{\"user\":{\"type\":\"keyword\"}}}", XContentType.JSON));
         assertTrue(index(INDEX, TYPE, "swmh1", "{\"user\":\"kimchy1\"}").getResult().equals(DocWriteResponse.Result.CREATED));
         assertTrue(index(INDEX, TYPE, "swmh2", "{\"user\":\"kimchy2\"}").getResult().equals(DocWriteResponse.Result.CREATED));
         assertTrue(index(INDEX, TYPE, "swmh3", "{\"user\":\"kimchy3\"}").getResult().equals(DocWriteResponse.Result.CREATED));
@@ -79,7 +184,7 @@ public class SearchIntegrationTest extends AbstractIntegrationTest {
 
     @Test
     public void searchWithSourceFilterByQuery() throws Exception {
-        assertAcked(prepareCreate(INDEX).addMapping(TYPE, "{\"properties\":{\"includeFieldName\":{\"type\":\"keyword\"}}}"));
+        assertAcked(prepareCreate(INDEX).addMapping(TYPE, "{\"properties\":{\"includeFieldName\":{\"type\":\"keyword\"}}}", XContentType.JSON));
         assertTrue(index(INDEX, TYPE, "Jeehong1", "{\"includeFieldName\":\"SeoHoo\",\"excludeFieldName\":\"SeongJeon\"}").getResult().equals(DocWriteResponse.Result.CREATED));
         assertTrue(index(INDEX, TYPE, "Jeehong2",  "{\"includeFieldName\":\"Seola\",\"excludeFieldName\":\"SeongJeon\"}").getResult().equals(DocWriteResponse.Result.CREATED));
         refresh();
@@ -97,7 +202,7 @@ public class SearchIntegrationTest extends AbstractIntegrationTest {
 
     @Test
     public void searchWithSourceFilterByParam() throws Exception {
-        assertAcked(prepareCreate(INDEX).addMapping(TYPE, "{\"properties\":{\"includeFieldName\":{\"type\":\"keyword\"}}}"));
+        assertAcked(prepareCreate(INDEX).addMapping(TYPE, "{\"properties\":{\"includeFieldName\":{\"type\":\"keyword\"}}}", XContentType.JSON));
         assertTrue(index(INDEX, TYPE, "Happyprg1", "{\"includeFieldName\":\"SeoHoo\",\"excludeFieldName\":\"SeongJeon\"}").getResult().equals(DocWriteResponse.Result.CREATED));
         assertTrue(index(INDEX, TYPE, "Happyprg2",  "{\"includeFieldName\":\"Seola\",\"excludeFieldName\":\"SeongJeon\"}").getResult().equals(DocWriteResponse.Result.CREATED));
         refresh();
diff --git a/jest/src/test/java/io/searchbox/core/SearchScrollIntegrationTest.java b/jest/src/test/java/io/searchbox/core/SearchScrollIntegrationTest.java
index 2c0fecd8..54828f76 100644
--- a/jest/src/test/java/io/searchbox/core/SearchScrollIntegrationTest.java
+++ b/jest/src/test/java/io/searchbox/core/SearchScrollIntegrationTest.java
@@ -1,8 +1,12 @@
 package io.searchbox.core;
 
 import com.google.gson.JsonArray;
-
+import io.searchbox.client.JestResult;
+import io.searchbox.common.AbstractIntegrationTest;
+import io.searchbox.core.search.sort.Sort;
+import io.searchbox.params.Parameters;
 import org.elasticsearch.action.DocWriteResponse;
+import org.elasticsearch.common.xcontent.XContentType;
 import org.elasticsearch.index.query.QueryBuilders;
 import org.elasticsearch.search.builder.SearchSourceBuilder;
 import org.elasticsearch.test.ESIntegTestCase;
@@ -12,11 +16,6 @@ import org.skyscreamer.jsonassert.JSONAssert;
 
 import java.io.IOException;
 
-import io.searchbox.client.JestResult;
-import io.searchbox.common.AbstractIntegrationTest;
-import io.searchbox.core.search.sort.Sort;
-import io.searchbox.params.Parameters;
-
 import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertAcked;
 
 
@@ -31,7 +30,7 @@ public class SearchScrollIntegrationTest extends AbstractIntegrationTest {
 
     @Test
     public void searchWithValidQuery() throws IOException, JSONException {
-        assertAcked(prepareCreate(INDEX).addMapping(TYPE, "{\"properties\":{\"code\":{\"type\":\"keyword\"}}}"));
+        assertAcked(prepareCreate(INDEX).addMapping(TYPE, "{\"properties\":{\"code\":{\"type\":\"keyword\"}}}", XContentType.JSON));
         assertTrue(index(INDEX, TYPE, "swvq1", "{\"code\":\"0\"}").getResult().equals(DocWriteResponse.Result.CREATED));
         assertTrue(index(INDEX, TYPE, "swvq2", "{\"code\":\"1\"}").getResult().equals(DocWriteResponse.Result.CREATED));
         assertTrue(index(INDEX, TYPE, "swvq3", "{\"code\":\"2\"}").getResult().equals(DocWriteResponse.Result.CREATED));
@@ -88,7 +87,7 @@ public class SearchScrollIntegrationTest extends AbstractIntegrationTest {
 
     @Test
     public void clearScrollAll() throws IOException, JSONException {
-        assertAcked(prepareCreate(INDEX).addMapping(TYPE, "{\"properties\":{\"code\":{\"type\":\"keyword\"}}}"));
+        assertAcked(prepareCreate(INDEX).addMapping(TYPE, "{\"properties\":{\"code\":{\"type\":\"keyword\"}}}", XContentType.JSON));
         assertTrue(index(INDEX, TYPE, "swvq1", "{\"code\":\"0\"}").getResult().equals(DocWriteResponse.Result.CREATED));
         assertTrue(index(INDEX, TYPE, "swvq2", "{\"code\":\"1\"}").getResult().equals(DocWriteResponse.Result.CREATED));
         assertTrue(index(INDEX, TYPE, "swvq3", "{\"code\":\"2\"}").getResult().equals(DocWriteResponse.Result.CREATED));
diff --git a/jest/src/test/java/io/searchbox/core/SearchShardsIntegrationTest.java b/jest/src/test/java/io/searchbox/core/SearchShardsIntegrationTest.java
index 5f27065b..23d3c9b3 100644
--- a/jest/src/test/java/io/searchbox/core/SearchShardsIntegrationTest.java
+++ b/jest/src/test/java/io/searchbox/core/SearchShardsIntegrationTest.java
@@ -20,7 +20,6 @@ public class SearchShardsIntegrationTest extends AbstractIntegrationTest {
     public void testBasicFlow() throws IOException {
         SearchShards searchShards = new SearchShards.Builder()
                 .addIndex(INDEX)
-                .addType(TYPE)
                 .build();
         JestResult result = client.execute(searchShards);
         assertTrue(result.getErrorMessage(), result.isSucceeded());
@@ -29,5 +28,4 @@ public class SearchShardsIntegrationTest extends AbstractIntegrationTest {
         assertTrue(source.containsKey("nodes"));
         assertTrue(source.containsKey("shards"));
     }
-
 }
diff --git a/jest/src/test/java/io/searchbox/core/SearchTemplateIntegrationTest.java b/jest/src/test/java/io/searchbox/core/SearchTemplateIntegrationTest.java
index 62e3bf58..f317ba51 100755
--- a/jest/src/test/java/io/searchbox/core/SearchTemplateIntegrationTest.java
+++ b/jest/src/test/java/io/searchbox/core/SearchTemplateIntegrationTest.java
@@ -48,19 +48,23 @@ public class SearchTemplateIntegrationTest extends AbstractIntegrationTest {
             "        \"user\" : \"kimchy1\"" +
             "    }" +
             "}";
-    
-    private static final String TEMPLATE = 
-    		"{" +
-    		"    \"template\": {" +
-            "    	\"query\": {" +
-            "    		\"term\": {" +
-            "       		\"user\" : \"{{user}}\"" +
-            "    		}" +
-            "    	}," +
-            "    	\"sort\": \"num\"" +
-            "	}" +	
+
+
+    private static final String SCRIPT =
+            "{" +
+                    "    \"script\": {" +
+                    "       \"lang\": \"mustache\"," +
+                    "       \"source\": {" +
+                    "           \"query\": {" +
+                    "               \"match\": {" +
+                    "                   \"user\": \"{{user}}\"" +
+                    "               }" +
+                    "           }," +
+                    "    	    \"sort\": \"num\"" +
+                    "       }" +
+                    "   }" +
             "}";
-    
+
 
     @Test
     public void searchWithValidQuery() throws IOException {
@@ -69,11 +73,11 @@ public class SearchTemplateIntegrationTest extends AbstractIntegrationTest {
     }
     
     @Test
-    public void searchTemplateInlineScript() throws Exception { 
-    	    	
-    	assertTrue(client().index(new IndexRequest(INDEX, TYPE).source("{\"user\":\"kimchy1\",\"num\":1}").setRefreshPolicy(WriteRequest.RefreshPolicy.IMMEDIATE)).actionGet().getResult().equals(DocWriteResponse.Result.CREATED));
-    	assertTrue(client().index(new IndexRequest(INDEX, TYPE).source("{\"user\":\"abcdef\",\"num\":2}").setRefreshPolicy(WriteRequest.RefreshPolicy.IMMEDIATE)).actionGet().getResult().equals(DocWriteResponse.Result.CREATED));
-    	assertTrue(client().index(new IndexRequest(INDEX, TYPE).source("{\"user\":\"abcdef\",\"num\":3}").setRefreshPolicy(WriteRequest.RefreshPolicy.IMMEDIATE)).actionGet().getResult().equals(DocWriteResponse.Result.CREATED));
+    public void searchTemplateInlineScript() throws Exception {
+
+        assertTrue(client().index(new IndexRequest(INDEX, TYPE).source("{\"user\":\"kimchy1\",\"num\":1}", XContentType.JSON).setRefreshPolicy(WriteRequest.RefreshPolicy.IMMEDIATE)).actionGet().getResult().equals(DocWriteResponse.Result.CREATED));
+        assertTrue(client().index(new IndexRequest(INDEX, TYPE).source("{\"user\":\"abcdef\",\"num\":2}", XContentType.JSON).setRefreshPolicy(WriteRequest.RefreshPolicy.IMMEDIATE)).actionGet().getResult().equals(DocWriteResponse.Result.CREATED));
+        assertTrue(client().index(new IndexRequest(INDEX, TYPE).source("{\"user\":\"abcdef\",\"num\":3}", XContentType.JSON).setRefreshPolicy(WriteRequest.RefreshPolicy.IMMEDIATE)).actionGet().getResult().equals(DocWriteResponse.Result.CREATED));
 
         //template includes sort
         SearchResult result = client.execute(new Search.TemplateBuilder(INLINE).build());
@@ -88,11 +92,11 @@ public class SearchTemplateIntegrationTest extends AbstractIntegrationTest {
     }
 
     @Test
-    public void searchTemplateInlineScriptWithSort() throws Exception { 
-    	    	
-    	assertTrue(client().index(new IndexRequest(INDEX, TYPE).source("{\"user\":\"kimchy1\",\"num\":1}").setRefreshPolicy(WriteRequest.RefreshPolicy.IMMEDIATE)).actionGet().getResult().equals(DocWriteResponse.Result.CREATED));
-    	assertTrue(client().index(new IndexRequest(INDEX, TYPE).source("{\"user\":\"kimchy1\",\"num\":0}").setRefreshPolicy(WriteRequest.RefreshPolicy.IMMEDIATE)).actionGet().getResult().equals(DocWriteResponse.Result.CREATED));
-        assertTrue(client().index(new IndexRequest(INDEX, TYPE).source("{\"user\":\"\"}").setRefreshPolicy(WriteRequest.RefreshPolicy.IMMEDIATE)).actionGet().getResult().equals(DocWriteResponse.Result.CREATED));
+    public void searchTemplateInlineScriptWithSort() throws Exception {
+
+        assertTrue(client().index(new IndexRequest(INDEX, TYPE).source("{\"user\":\"kimchy1\",\"num\":1}", XContentType.JSON).setRefreshPolicy(WriteRequest.RefreshPolicy.IMMEDIATE)).actionGet().getResult().equals(DocWriteResponse.Result.CREATED));
+        assertTrue(client().index(new IndexRequest(INDEX, TYPE).source("{\"user\":\"kimchy1\",\"num\":0}", XContentType.JSON).setRefreshPolicy(WriteRequest.RefreshPolicy.IMMEDIATE)).actionGet().getResult().equals(DocWriteResponse.Result.CREATED));
+        assertTrue(client().index(new IndexRequest(INDEX, TYPE).source("{\"user\":\"\"}", XContentType.JSON).setRefreshPolicy(WriteRequest.RefreshPolicy.IMMEDIATE)).actionGet().getResult().equals(DocWriteResponse.Result.CREATED));
 
         //template includes sort
         SearchResult result = client.execute(new Search.TemplateBuilder(INLINE).build());
@@ -117,13 +121,12 @@ public class SearchTemplateIntegrationTest extends AbstractIntegrationTest {
     @Test
     public void searchTemplateIdScriptWithSort() throws Exception {
         assertAcked(client().admin().cluster().preparePutStoredScript()
-                .setLang("mustache")
                 .setId("templateId")
-                .setContent(new BytesArray(TEMPLATE), XContentType.JSON)
+                .setContent(new BytesArray(SCRIPT), XContentType.JSON)
                 .get());
-    	assertTrue(client().index(new IndexRequest(INDEX, TYPE).source("{\"user\":\"kimchy1\",\"num\":1}").setRefreshPolicy(WriteRequest.RefreshPolicy.IMMEDIATE)).actionGet().getResult().equals(DocWriteResponse.Result.CREATED));
-    	assertTrue(client().index(new IndexRequest(INDEX, TYPE).source("{\"user\":\"kimchy1\",\"num\":0}").setRefreshPolicy(WriteRequest.RefreshPolicy.IMMEDIATE)).actionGet().getResult().equals(DocWriteResponse.Result.CREATED));
-        assertTrue(client().index(new IndexRequest(INDEX, TYPE).source("{\"user\":\"\"}").setRefreshPolicy(WriteRequest.RefreshPolicy.IMMEDIATE)).actionGet().getResult().equals(DocWriteResponse.Result.CREATED));
+        assertTrue(client().index(new IndexRequest(INDEX, TYPE).source("{\"user\":\"kimchy1\",\"num\":1}", XContentType.JSON).setRefreshPolicy(WriteRequest.RefreshPolicy.IMMEDIATE)).actionGet().getResult().equals(DocWriteResponse.Result.CREATED));
+        assertTrue(client().index(new IndexRequest(INDEX, TYPE).source("{\"user\":\"kimchy1\",\"num\":0}", XContentType.JSON).setRefreshPolicy(WriteRequest.RefreshPolicy.IMMEDIATE)).actionGet().getResult().equals(DocWriteResponse.Result.CREATED));
+        assertTrue(client().index(new IndexRequest(INDEX, TYPE).source("{\"user\":\"\"}", XContentType.JSON).setRefreshPolicy(WriteRequest.RefreshPolicy.IMMEDIATE)).actionGet().getResult().equals(DocWriteResponse.Result.CREATED));
 
         //template includes sort
         SearchResult result = client.execute(new Search.TemplateBuilder(QUERY).build());
diff --git a/jest/src/test/java/io/searchbox/core/SuggestIntegrationTest.java b/jest/src/test/java/io/searchbox/core/SuggestIntegrationTest.java
deleted file mode 100644
index aba758e8..00000000
--- a/jest/src/test/java/io/searchbox/core/SuggestIntegrationTest.java
+++ /dev/null
@@ -1,66 +0,0 @@
-package io.searchbox.core;
-
-import io.searchbox.common.AbstractIntegrationTest;
-import org.elasticsearch.action.DocWriteResponse;
-import org.elasticsearch.action.index.IndexRequest;
-import org.elasticsearch.action.support.WriteRequest;
-import org.elasticsearch.test.ESIntegTestCase;
-import org.junit.Test;
-
-import java.io.IOException;
-import java.util.List;
-
-/**
- * @author cihat keser
- */
-@ESIntegTestCase.ClusterScope(scope = ESIntegTestCase.Scope.SUITE, numDataNodes = 1)
-public class SuggestIntegrationTest extends AbstractIntegrationTest {
-
-    private static final String INDEX = "socializr";
-    private static final String TYPE = "meetings";
-
-    @Test
-    public void testWithSingleTermSuggester() throws IOException {
-        String suggestionName = "my-suggestion";
-
-        assertTrue(client().index(new IndexRequest(INDEX, TYPE).source("{\"body\":\"istanbul\"}").setRefreshPolicy(WriteRequest.RefreshPolicy.IMMEDIATE)).actionGet().getResult().equals(DocWriteResponse.Result.CREATED));
-        assertTrue(client().index(new IndexRequest(INDEX, TYPE).source("{\"body\":\"amsterdam\"}").setRefreshPolicy(WriteRequest.RefreshPolicy.IMMEDIATE)).actionGet().getResult().equals(DocWriteResponse.Result.CREATED));
-        assertTrue(client().index(new IndexRequest(INDEX, TYPE).source("{\"body\":\"rotterdam\"}").setRefreshPolicy(WriteRequest.RefreshPolicy.IMMEDIATE)).actionGet().getResult().equals(DocWriteResponse.Result.CREATED));
-        assertTrue(client().index(new IndexRequest(INDEX, TYPE).source("{\"body\":\"vienna\"}").setRefreshPolicy(WriteRequest.RefreshPolicy.IMMEDIATE)).actionGet().getResult().equals(DocWriteResponse.Result.CREATED));
-        assertTrue(client().index(new IndexRequest(INDEX, TYPE).source("{\"body\":\"london\"}").setRefreshPolicy(WriteRequest.RefreshPolicy.IMMEDIATE)).actionGet().getResult().equals(DocWriteResponse.Result.CREATED));
-
-        Suggest suggest = new Suggest.Builder("{\n" +
-                "  \"" + suggestionName + "\" : {\n" +
-                "    \"text\" : \"the amsterdma meetpu\",\n" +
-                "    \"term\" : {\n" +
-                "      \"field\" : \"body\"\n" +
-                "    }\n" +
-                "  }\n" +
-                "}").build();
-
-        SuggestResult result = client.execute(suggest);
-        assertTrue(result.getErrorMessage(), result.isSucceeded());
-
-        List<SuggestResult.Suggestion> suggestions = result.getSuggestions(suggestionName);
-        assertEquals(3, suggestions.size());
-
-        SuggestResult.Suggestion suggestion1 = suggestions.get(0);
-        assertEquals("the", suggestion1.text);
-        assertEquals(Integer.valueOf(0), suggestion1.offset);
-        assertEquals(Integer.valueOf(3), suggestion1.length);
-        assertEquals(0, suggestion1.options.size());
-
-        SuggestResult.Suggestion suggestion2 = suggestions.get(1);
-        assertEquals("amsterdma", suggestion2.text);
-        assertEquals(Integer.valueOf(4), suggestion2.offset);
-        assertEquals(Integer.valueOf(9), suggestion2.length);
-        assertEquals(1, suggestion2.options.size());
-
-        SuggestResult.Suggestion suggestion3 = suggestions.get(2);
-        assertEquals("meetpu", suggestion3.text);
-        assertEquals(Integer.valueOf(14), suggestion3.offset);
-        assertEquals(Integer.valueOf(6), suggestion3.length);
-        assertEquals(0, suggestion3.options.size());
-    }
-
-}
diff --git a/jest/src/test/java/io/searchbox/core/UpdateByQueryIntegrationTest.java b/jest/src/test/java/io/searchbox/core/UpdateByQueryIntegrationTest.java
index de46338e..0e5e82c4 100644
--- a/jest/src/test/java/io/searchbox/core/UpdateByQueryIntegrationTest.java
+++ b/jest/src/test/java/io/searchbox/core/UpdateByQueryIntegrationTest.java
@@ -1,26 +1,23 @@
 package io.searchbox.core;
 
-import com.google.gson.GsonBuilder;
-
 import io.searchbox.common.AbstractIntegrationTest;
-import io.searchbox.core.UpdateByQueryResult;
 import org.elasticsearch.action.DocWriteResponse;
 import org.elasticsearch.common.settings.Settings;
+import org.elasticsearch.common.xcontent.XContentBuilder;
 import org.elasticsearch.index.query.BoolQueryBuilder;
 import org.elasticsearch.index.query.QueryBuilders;
 import org.elasticsearch.index.reindex.ReindexPlugin;
 import org.elasticsearch.plugins.Plugin;
-import org.elasticsearch.rest.RestStatus;
 import org.elasticsearch.test.ESIntegTestCase;
 import org.junit.Test;
 
+import java.io.ByteArrayOutputStream;
 import java.io.IOException;
 import java.util.ArrayList;
 import java.util.Collection;
 
 import static org.elasticsearch.common.xcontent.XContentFactory.jsonBuilder;
 
-
 /**
  * @author Lior Knaany
  */
@@ -42,7 +39,7 @@ public class UpdateByQueryIntegrationTest extends AbstractIntegrationTest {
         final Settings.Builder builder = Settings.builder().put(super.nodeSettings(nodeOrdinal));
         return builder
                 .put(super.nodeSettings(nodeOrdinal))
-                .put("script.inline", "true")
+                .put("script.allowed_types", "inline")
                 .build();
     }
 
@@ -60,13 +57,19 @@ public class UpdateByQueryIntegrationTest extends AbstractIntegrationTest {
         final BoolQueryBuilder queryBuilder = QueryBuilders.boolQuery().must(QueryBuilders.termQuery("user", "lior"));
         final String script = "ctx._source.user = ctx._source.user + '_updated';";
 
-        final String payload = jsonBuilder()
+
+        final XContentBuilder xContentBuilder = jsonBuilder()
                 .startObject()
                 .field("query", queryBuilder)
                 .startObject("script")
                 .field("inline", script)
                 .endObject()
-                .endObject().string();
+                .endObject();
+
+        xContentBuilder.flush();
+
+        final String payload = ((ByteArrayOutputStream) xContentBuilder.getOutputStream()).toString("UTF-8");
+
 
         UpdateByQuery updateByQuery = new UpdateByQuery.Builder(payload)
                 .addIndex(INDEX)
diff --git a/jest/src/test/java/io/searchbox/core/UpdateIntegrationTest.java b/jest/src/test/java/io/searchbox/core/UpdateIntegrationTest.java
index 0dd08be1..16bce1b0 100644
--- a/jest/src/test/java/io/searchbox/core/UpdateIntegrationTest.java
+++ b/jest/src/test/java/io/searchbox/core/UpdateIntegrationTest.java
@@ -6,6 +6,7 @@ import org.elasticsearch.action.get.GetResponse;
 import org.elasticsearch.action.index.IndexRequest;
 import org.elasticsearch.action.index.IndexResponse;
 import org.elasticsearch.action.support.WriteRequest;
+import org.elasticsearch.common.xcontent.XContentType;
 import org.elasticsearch.rest.RestStatus;
 import org.elasticsearch.test.ESIntegTestCase;
 import org.junit.Test;
@@ -34,7 +35,7 @@ public class UpdateIntegrationTest extends AbstractIntegrationTest {
 
         client().index(
                 new IndexRequest(INDEX, TYPE, id)
-                        .source("{\"user\":\"kimchy\", \"tags\":\"That is test\"}")
+                        .source("{\"user\":\"kimchy\", \"tags\":\"That is test\"}", XContentType.JSON)
                         .setRefreshPolicy(WriteRequest.RefreshPolicy.IMMEDIATE)
         ).actionGet();
 
@@ -61,7 +62,7 @@ public class UpdateIntegrationTest extends AbstractIntegrationTest {
 
         client().index(
                 new IndexRequest(INDEX, TYPE, id)
-                        .source("{\"user\":\"kimchy\", \"tags\":\"That is test\"}")
+                        .source("{\"user\":\"kimchy\", \"tags\":\"That is test\"}", XContentType.JSON)
                         .setRefreshPolicy(WriteRequest.RefreshPolicy.IMMEDIATE)
         ).actionGet();
 
@@ -88,7 +89,7 @@ public class UpdateIntegrationTest extends AbstractIntegrationTest {
 
         IndexResponse response = client().index(
                 new IndexRequest(INDEX, TYPE, id)
-                        .source("{\"user\":\"kimchy\", \"tags\":\"That is test\"}")
+                        .source("{\"user\":\"kimchy\", \"tags\":\"That is test\"}", XContentType.JSON)
                         .setRefreshPolicy(WriteRequest.RefreshPolicy.IMMEDIATE)
         ).actionGet();
         long version = response.getVersion();
@@ -126,7 +127,7 @@ public class UpdateIntegrationTest extends AbstractIntegrationTest {
 
         IndexResponse response = client().index(
                 new IndexRequest(INDEX, TYPE, id)
-                        .source("{\"user\":\"kimchy\", \"tags\":\"That is test\"}")
+                        .source("{\"user\":\"kimchy\", \"tags\":\"That is test\"}", XContentType.JSON)
                         .setRefreshPolicy(WriteRequest.RefreshPolicy.IMMEDIATE)
         ).actionGet();
         long version = response.getVersion();
diff --git a/jest/src/test/java/io/searchbox/core/search/aggregation/AvgAggregationIntegrationTest.java b/jest/src/test/java/io/searchbox/core/search/aggregation/AvgAggregationIntegrationTest.java
index 4145cf20..6a361c87 100644
--- a/jest/src/test/java/io/searchbox/core/search/aggregation/AvgAggregationIntegrationTest.java
+++ b/jest/src/test/java/io/searchbox/core/search/aggregation/AvgAggregationIntegrationTest.java
@@ -5,6 +5,7 @@ import io.searchbox.core.Search;
 import io.searchbox.core.SearchResult;
 import org.elasticsearch.action.admin.indices.mapping.put.PutMappingRequest;
 import org.elasticsearch.action.admin.indices.mapping.put.PutMappingResponse;
+import org.elasticsearch.common.xcontent.XContentType;
 import org.elasticsearch.test.ESIntegTestCase;
 import org.junit.Test;
 
@@ -28,7 +29,7 @@ public class AvgAggregationIntegrationTest extends AbstractIntegrationTest {
         createIndex(INDEX);
         PutMappingResponse putMappingResponse = client().admin().indices().putMapping(new PutMappingRequest(INDEX)
                         .type(TYPE)
-                        .source("{\"document\":{\"properties\":{\"num\":{\"store\":true,\"type\":\"integer\"}}}}")
+                .source("{\"document\":{\"properties\":{\"num\":{\"store\":true,\"type\":\"integer\"}}}}", XContentType.JSON)
         ).actionGet();
 
         assertTrue(putMappingResponse.isAcknowledged());
@@ -81,7 +82,7 @@ public class AvgAggregationIntegrationTest extends AbstractIntegrationTest {
         createIndex(INDEX);
         PutMappingResponse putMappingResponse = client().admin().indices().putMapping(new PutMappingRequest(INDEX)
                         .type(TYPE)
-                        .source("{\"document\":{\"properties\":{\"num\":{\"store\":true,\"type\":\"integer\"}}}}")
+                .source("{\"document\":{\"properties\":{\"num\":{\"store\":true,\"type\":\"integer\"}}}}", XContentType.JSON)
         ).actionGet();
 
         assertTrue(putMappingResponse.isAcknowledged());
diff --git a/jest/src/test/java/io/searchbox/core/search/aggregation/CardinalityAggregationIntegrationTest.java b/jest/src/test/java/io/searchbox/core/search/aggregation/CardinalityAggregationIntegrationTest.java
index 4b5bcf54..d96c7e17 100644
--- a/jest/src/test/java/io/searchbox/core/search/aggregation/CardinalityAggregationIntegrationTest.java
+++ b/jest/src/test/java/io/searchbox/core/search/aggregation/CardinalityAggregationIntegrationTest.java
@@ -5,6 +5,7 @@ import io.searchbox.core.Search;
 import io.searchbox.core.SearchResult;
 import org.elasticsearch.action.admin.indices.mapping.put.PutMappingRequest;
 import org.elasticsearch.action.admin.indices.mapping.put.PutMappingResponse;
+import org.elasticsearch.common.xcontent.XContentType;
 import org.elasticsearch.test.ESIntegTestCase.ClusterScope;
 import org.elasticsearch.test.ESIntegTestCase.Scope;
 import org.junit.Test;
@@ -29,7 +30,7 @@ public class CardinalityAggregationIntegrationTest extends AbstractIntegrationTe
         createIndex(INDEX);
         PutMappingResponse putMappingResponse = client().admin().indices().putMapping(new PutMappingRequest(INDEX)
                         .type(TYPE)
-                        .source("{\"document\":{\"properties\":{\"doc_id\":{\"store\":true,\"type\":\"keyword\"}}}}")
+                .source("{\"document\":{\"properties\":{\"doc_id\":{\"store\":true,\"type\":\"keyword\"}}}}", XContentType.JSON)
         ).actionGet();
 
         assertTrue(putMappingResponse.isAcknowledged());
@@ -82,7 +83,7 @@ public class CardinalityAggregationIntegrationTest extends AbstractIntegrationTe
         createIndex(INDEX);
         PutMappingResponse putMappingResponse = client().admin().indices().putMapping(new PutMappingRequest(INDEX)
                         .type(TYPE)
-                        .source("{\"document\":{\"properties\":{\"doc_id\":{\"store\":true,\"type\":\"keyword\"}}}}")
+                .source("{\"document\":{\"properties\":{\"doc_id\":{\"store\":true,\"type\":\"keyword\"}}}}", XContentType.JSON)
         ).actionGet();
 
         assertTrue(putMappingResponse.isAcknowledged());
diff --git a/jest/src/test/java/io/searchbox/core/search/aggregation/DateHistogramAggregationIntegrationTest.java b/jest/src/test/java/io/searchbox/core/search/aggregation/DateHistogramAggregationIntegrationTest.java
index 70016bce..9dd1fd20 100644
--- a/jest/src/test/java/io/searchbox/core/search/aggregation/DateHistogramAggregationIntegrationTest.java
+++ b/jest/src/test/java/io/searchbox/core/search/aggregation/DateHistogramAggregationIntegrationTest.java
@@ -5,6 +5,7 @@ import io.searchbox.core.Search;
 import io.searchbox.core.SearchResult;
 import org.elasticsearch.action.admin.indices.mapping.put.PutMappingRequest;
 import org.elasticsearch.action.admin.indices.mapping.put.PutMappingResponse;
+import org.elasticsearch.common.xcontent.XContentType;
 import org.elasticsearch.test.ESIntegTestCase;
 import org.junit.Test;
 
@@ -28,7 +29,7 @@ public class DateHistogramAggregationIntegrationTest extends AbstractIntegration
         createIndex(INDEX);
         PutMappingResponse putMappingResponse = client().admin().indices().putMapping(new PutMappingRequest(INDEX)
                         .type(TYPE)
-                        .source("{\"document\":{\"properties\":{\"delivery\":{\"store\":true,\"type\":\"date\"}}}}")
+                .source("{\"document\":{\"properties\":{\"delivery\":{\"store\":true,\"type\":\"date\"}}}}", XContentType.JSON)
         ).actionGet();
 
         assertTrue(putMappingResponse.isAcknowledged());
@@ -91,7 +92,7 @@ public class DateHistogramAggregationIntegrationTest extends AbstractIntegration
         createIndex(INDEX);
         PutMappingResponse putMappingResponse = client().admin().indices().putMapping(new PutMappingRequest(INDEX)
                         .type(TYPE)
-                        .source("{\"document\":{\"properties\":{\"delivery\":{\"store\":true,\"type\":\"date\"}}}}")
+                .source("{\"document\":{\"properties\":{\"delivery\":{\"store\":true,\"type\":\"date\"}}}}", XContentType.JSON)
         ).actionGet();
 
         assertTrue(putMappingResponse.isAcknowledged());
diff --git a/jest/src/test/java/io/searchbox/core/search/aggregation/DateRangeAggregationIntegrationTest.java b/jest/src/test/java/io/searchbox/core/search/aggregation/DateRangeAggregationIntegrationTest.java
index 0fcd12df..e964be49 100644
--- a/jest/src/test/java/io/searchbox/core/search/aggregation/DateRangeAggregationIntegrationTest.java
+++ b/jest/src/test/java/io/searchbox/core/search/aggregation/DateRangeAggregationIntegrationTest.java
@@ -5,6 +5,7 @@ import io.searchbox.core.Search;
 import io.searchbox.core.SearchResult;
 import org.elasticsearch.action.admin.indices.mapping.put.PutMappingRequest;
 import org.elasticsearch.action.admin.indices.mapping.put.PutMappingResponse;
+import org.elasticsearch.common.xcontent.XContentType;
 import org.elasticsearch.test.ESIntegTestCase;
 import org.junit.Test;
 
@@ -28,7 +29,7 @@ public class DateRangeAggregationIntegrationTest extends AbstractIntegrationTest
         createIndex(INDEX);
         PutMappingResponse putMappingResponse = client().admin().indices().putMapping(new PutMappingRequest(INDEX)
                         .type(TYPE)
-                        .source("{\"document\":{\"properties\":{\"delivery\":{\"store\":true,\"type\":\"date\"}}}}")
+                .source("{\"document\":{\"properties\":{\"delivery\":{\"store\":true,\"type\":\"date\"}}}}", XContentType.JSON)
         ).actionGet();
 
         assertTrue(putMappingResponse.isAcknowledged());
@@ -100,7 +101,7 @@ public class DateRangeAggregationIntegrationTest extends AbstractIntegrationTest
         createIndex(INDEX);
         PutMappingResponse putMappingResponse = client().admin().indices().putMapping(new PutMappingRequest(INDEX)
                         .type(TYPE)
-                        .source("{\"document\":{\"properties\":{\"delivery\":{\"store\":true,\"type\":\"date\"}}}}")
+                .source("{\"document\":{\"properties\":{\"delivery\":{\"store\":true,\"type\":\"date\"}}}}", XContentType.JSON)
         ).actionGet();
 
         assertTrue(putMappingResponse.isAcknowledged());
diff --git a/jest/src/test/java/io/searchbox/core/search/aggregation/ExtendedStatsAggregationIntegrationTest.java b/jest/src/test/java/io/searchbox/core/search/aggregation/ExtendedStatsAggregationIntegrationTest.java
index 66626aec..69aa844b 100644
--- a/jest/src/test/java/io/searchbox/core/search/aggregation/ExtendedStatsAggregationIntegrationTest.java
+++ b/jest/src/test/java/io/searchbox/core/search/aggregation/ExtendedStatsAggregationIntegrationTest.java
@@ -5,6 +5,7 @@ import io.searchbox.core.Search;
 import io.searchbox.core.SearchResult;
 import org.elasticsearch.action.admin.indices.mapping.put.PutMappingRequest;
 import org.elasticsearch.action.admin.indices.mapping.put.PutMappingResponse;
+import org.elasticsearch.common.xcontent.XContentType;
 import org.elasticsearch.test.ESIntegTestCase;
 import org.junit.Test;
 
@@ -28,7 +29,7 @@ public class ExtendedStatsAggregationIntegrationTest extends AbstractIntegration
         createIndex(INDEX);
         PutMappingResponse putMappingResponse = client().admin().indices().putMapping(new PutMappingRequest(INDEX)
                         .type(TYPE)
-                        .source("{\"document\":{\"properties\":{\"num\":{\"store\":true,\"type\":\"integer\"}}}}")
+                .source("{\"document\":{\"properties\":{\"num\":{\"store\":true,\"type\":\"integer\"}}}}", XContentType.JSON)
         ).actionGet();
 
         assertTrue(putMappingResponse.isAcknowledged());
@@ -88,7 +89,7 @@ public class ExtendedStatsAggregationIntegrationTest extends AbstractIntegration
         createIndex(INDEX);
         PutMappingResponse putMappingResponse = client().admin().indices().putMapping(new PutMappingRequest(INDEX)
                         .type(TYPE)
-                        .source("{\"document\":{\"properties\":{\"num\":{\"store\":true,\"type\":\"integer\"}}}}")
+                .source("{\"document\":{\"properties\":{\"num\":{\"store\":true,\"type\":\"integer\"}}}}", XContentType.JSON)
         ).actionGet();
 
         assertTrue(putMappingResponse.isAcknowledged());
diff --git a/jest/src/test/java/io/searchbox/core/search/aggregation/FilterAggregationIntegrationTest.java b/jest/src/test/java/io/searchbox/core/search/aggregation/FilterAggregationIntegrationTest.java
index 883f2905..c04f7cfb 100644
--- a/jest/src/test/java/io/searchbox/core/search/aggregation/FilterAggregationIntegrationTest.java
+++ b/jest/src/test/java/io/searchbox/core/search/aggregation/FilterAggregationIntegrationTest.java
@@ -5,6 +5,7 @@ import io.searchbox.core.Search;
 import io.searchbox.core.SearchResult;
 import org.elasticsearch.action.admin.indices.mapping.put.PutMappingRequest;
 import org.elasticsearch.action.admin.indices.mapping.put.PutMappingResponse;
+import org.elasticsearch.common.xcontent.XContentType;
 import org.elasticsearch.test.ESIntegTestCase;
 import org.junit.Test;
 
@@ -29,7 +30,7 @@ public class FilterAggregationIntegrationTest extends AbstractIntegrationTest {
         createIndex(INDEX);
         PutMappingResponse putMappingResponse = client().admin().indices().putMapping(new PutMappingRequest(INDEX)
                         .type(TYPE)
-                        .source("{\"document\":{\"properties\":{\"num\":{\"store\":true,\"type\":\"integer\"}}}}")
+                .source("{\"document\":{\"properties\":{\"num\":{\"store\":true,\"type\":\"integer\"}}}}", XContentType.JSON)
         ).actionGet();
 
         assertTrue(putMappingResponse.isAcknowledged());
diff --git a/jest/src/test/java/io/searchbox/core/search/aggregation/FiltersAggregationIntegrationTest.java b/jest/src/test/java/io/searchbox/core/search/aggregation/FiltersAggregationIntegrationTest.java
index 8413c0e3..fe2919a1 100644
--- a/jest/src/test/java/io/searchbox/core/search/aggregation/FiltersAggregationIntegrationTest.java
+++ b/jest/src/test/java/io/searchbox/core/search/aggregation/FiltersAggregationIntegrationTest.java
@@ -5,6 +5,7 @@ import io.searchbox.core.Search;
 import io.searchbox.core.SearchResult;
 import org.elasticsearch.action.admin.indices.mapping.put.PutMappingRequest;
 import org.elasticsearch.action.admin.indices.mapping.put.PutMappingResponse;
+import org.elasticsearch.common.xcontent.XContentType;
 import org.elasticsearch.test.ESIntegTestCase;
 import org.junit.Test;
 
@@ -29,7 +30,7 @@ public class FiltersAggregationIntegrationTest extends AbstractIntegrationTest {
         createIndex(INDEX);
         PutMappingResponse putMappingResponse = client().admin().indices().putMapping(new PutMappingRequest(INDEX)
                         .type(TYPE)
-                        .source("{\"document\":{\"properties\":{\"msg\":{\"store\":true,\"type\":\"string\"}}}}")
+                .source("{\"document\":{\"properties\":{\"msg\":{\"store\":true,\"type\":\"text\"}}}}", XContentType.JSON)
         ).actionGet();
 
         assertTrue(putMappingResponse.isAcknowledged());
@@ -88,7 +89,7 @@ public class FiltersAggregationIntegrationTest extends AbstractIntegrationTest {
         createIndex(INDEX);
         PutMappingResponse putMappingResponse = client().admin().indices().putMapping(new PutMappingRequest(INDEX)
                         .type(TYPE)
-                        .source("{\"document\":{\"properties\":{\"msg\":{\"store\":true,\"type\":\"string\"}}}}")
+                .source("{\"document\":{\"properties\":{\"msg\":{\"store\":true,\"type\":\"text\"}}}}", XContentType.JSON)
         ).actionGet();
 
         assertTrue(putMappingResponse.isAcknowledged());
diff --git a/jest/src/test/java/io/searchbox/core/search/aggregation/GeoBoundsAggregationIntegrationTest.java b/jest/src/test/java/io/searchbox/core/search/aggregation/GeoBoundsAggregationIntegrationTest.java
index f80caff0..f2679d89 100644
--- a/jest/src/test/java/io/searchbox/core/search/aggregation/GeoBoundsAggregationIntegrationTest.java
+++ b/jest/src/test/java/io/searchbox/core/search/aggregation/GeoBoundsAggregationIntegrationTest.java
@@ -5,6 +5,7 @@ import io.searchbox.core.Search;
 import io.searchbox.core.SearchResult;
 import org.elasticsearch.action.admin.indices.mapping.put.PutMappingRequest;
 import org.elasticsearch.action.admin.indices.mapping.put.PutMappingResponse;
+import org.elasticsearch.common.xcontent.XContentType;
 import org.elasticsearch.test.ESIntegTestCase;
 import org.junit.Test;
 
@@ -28,7 +29,7 @@ public class GeoBoundsAggregationIntegrationTest extends AbstractIntegrationTest
         createIndex(INDEX);
         PutMappingResponse putMappingResponse = client().admin().indices().putMapping(new PutMappingRequest(INDEX)
                         .type(TYPE)
-                        .source("{\"document\":{\"properties\":{\"location\":{\"store\":true,\"type\":\"geo_point\"}}}}")
+                .source("{\"document\":{\"properties\":{\"location\":{\"store\":true,\"type\":\"geo_point\"}}}}", XContentType.JSON)
         ).actionGet();
 
         assertTrue(putMappingResponse.isAcknowledged());
@@ -86,7 +87,7 @@ public class GeoBoundsAggregationIntegrationTest extends AbstractIntegrationTest
         createIndex(INDEX);
         PutMappingResponse putMappingResponse = client().admin().indices().putMapping(new PutMappingRequest(INDEX)
                         .type(TYPE)
-                        .source("{\"document\":{\"properties\":{\"location\":{\"store\":true,\"type\":\"geo_point\"}}}}")
+                .source("{\"document\":{\"properties\":{\"location\":{\"store\":true,\"type\":\"geo_point\"}}}}", XContentType.JSON)
         ).actionGet();
 
         assertTrue(putMappingResponse.isAcknowledged());
diff --git a/jest/src/test/java/io/searchbox/core/search/aggregation/GeoDistanceAggregationTest.java b/jest/src/test/java/io/searchbox/core/search/aggregation/GeoDistanceAggregationTest.java
index 604bc251..e7568b92 100644
--- a/jest/src/test/java/io/searchbox/core/search/aggregation/GeoDistanceAggregationTest.java
+++ b/jest/src/test/java/io/searchbox/core/search/aggregation/GeoDistanceAggregationTest.java
@@ -5,6 +5,7 @@ import io.searchbox.core.Search;
 import io.searchbox.core.SearchResult;
 import org.elasticsearch.action.admin.indices.mapping.put.PutMappingRequest;
 import org.elasticsearch.action.admin.indices.mapping.put.PutMappingResponse;
+import org.elasticsearch.common.xcontent.XContentType;
 import org.elasticsearch.test.ESIntegTestCase;
 import org.junit.Test;
 
@@ -28,7 +29,7 @@ public class GeoDistanceAggregationTest extends AbstractIntegrationTest {
         createIndex(INDEX);
         PutMappingResponse putMappingResponse = client().admin().indices().putMapping(new PutMappingRequest(INDEX)
                         .type(TYPE)
-                        .source("{\"document\":{\"properties\":{\"location\":{\"store\":true,\"type\":\"geo_point\"}}}}")
+                .source("{\"document\":{\"properties\":{\"location\":{\"store\":true,\"type\":\"geo_point\"}}}}", XContentType.JSON)
         ).actionGet();
 
         assertTrue(putMappingResponse.isAcknowledged());
@@ -106,7 +107,7 @@ public class GeoDistanceAggregationTest extends AbstractIntegrationTest {
         createIndex(INDEX);
         PutMappingResponse putMappingResponse = client().admin().indices().putMapping(new PutMappingRequest(INDEX)
                         .type(TYPE)
-                        .source("{\"document\":{\"properties\":{\"location\":{\"store\":true,\"type\":\"geo_point\"}}}}")
+                .source("{\"document\":{\"properties\":{\"location\":{\"store\":true,\"type\":\"geo_point\"}}}}", XContentType.JSON)
         ).actionGet();
 
         assertTrue(putMappingResponse.isAcknowledged());
diff --git a/jest/src/test/java/io/searchbox/core/search/aggregation/GeoHashGridAggregationIntegrationTest.java b/jest/src/test/java/io/searchbox/core/search/aggregation/GeoHashGridAggregationIntegrationTest.java
index 5b6832b1..0775b00c 100644
--- a/jest/src/test/java/io/searchbox/core/search/aggregation/GeoHashGridAggregationIntegrationTest.java
+++ b/jest/src/test/java/io/searchbox/core/search/aggregation/GeoHashGridAggregationIntegrationTest.java
@@ -5,6 +5,7 @@ import io.searchbox.core.Search;
 import io.searchbox.core.SearchResult;
 import org.elasticsearch.action.admin.indices.mapping.put.PutMappingRequest;
 import org.elasticsearch.action.admin.indices.mapping.put.PutMappingResponse;
+import org.elasticsearch.common.xcontent.XContentType;
 import org.elasticsearch.test.ESIntegTestCase;
 import org.junit.Test;
 
@@ -28,7 +29,7 @@ public class GeoHashGridAggregationIntegrationTest extends AbstractIntegrationTe
         createIndex(INDEX);
         PutMappingResponse putMappingResponse = client().admin().indices().putMapping(new PutMappingRequest(INDEX)
                         .type(TYPE)
-                        .source("{\"document\":{\"properties\":{\"location\":{\"store\":true,\"type\":\"geo_point\"}}}}")
+                .source("{\"document\":{\"properties\":{\"location\":{\"store\":true,\"type\":\"geo_point\"}}}}", XContentType.JSON)
         ).actionGet();
 
         assertTrue(putMappingResponse.isAcknowledged());
@@ -94,7 +95,7 @@ public class GeoHashGridAggregationIntegrationTest extends AbstractIntegrationTe
         createIndex(INDEX);
         PutMappingResponse putMappingResponse = client().admin().indices().putMapping(new PutMappingRequest(INDEX)
                         .type(TYPE)
-                        .source("{\"document\":{\"properties\":{\"location\":{\"store\":true,\"type\":\"geo_point\"}}}}")
+                .source("{\"document\":{\"properties\":{\"location\":{\"store\":true,\"type\":\"geo_point\"}}}}", XContentType.JSON)
         ).actionGet();
 
         assertTrue(putMappingResponse.isAcknowledged());
diff --git a/jest/src/test/java/io/searchbox/core/search/aggregation/HistogramAggregationIntegrationTest.java b/jest/src/test/java/io/searchbox/core/search/aggregation/HistogramAggregationIntegrationTest.java
index d76778b3..10a9acde 100644
--- a/jest/src/test/java/io/searchbox/core/search/aggregation/HistogramAggregationIntegrationTest.java
+++ b/jest/src/test/java/io/searchbox/core/search/aggregation/HistogramAggregationIntegrationTest.java
@@ -5,6 +5,7 @@ import io.searchbox.core.Search;
 import io.searchbox.core.SearchResult;
 import org.elasticsearch.action.admin.indices.mapping.put.PutMappingRequest;
 import org.elasticsearch.action.admin.indices.mapping.put.PutMappingResponse;
+import org.elasticsearch.common.xcontent.XContentType;
 import org.elasticsearch.test.ESIntegTestCase;
 import org.junit.Test;
 
@@ -28,7 +29,7 @@ public class HistogramAggregationIntegrationTest extends AbstractIntegrationTest
         createIndex(INDEX);
         PutMappingResponse putMappingResponse = client().admin().indices().putMapping(new PutMappingRequest(INDEX)
                         .type(TYPE)
-                        .source("{\"document\":{\"properties\":{\"num\":{\"store\":true,\"type\":\"integer\"}}}}")
+                .source("{\"document\":{\"properties\":{\"num\":{\"store\":true,\"type\":\"integer\"}}}}", XContentType.JSON)
         ).actionGet();
 
         assertTrue(putMappingResponse.isAcknowledged());
@@ -93,7 +94,7 @@ public class HistogramAggregationIntegrationTest extends AbstractIntegrationTest
         createIndex(INDEX);
         PutMappingResponse putMappingResponse = client().admin().indices().putMapping(new PutMappingRequest(INDEX)
                         .type(TYPE)
-                        .source("{\"document\":{\"properties\":{\"num\":{\"store\":true,\"type\":\"integer\"}}}}")
+                .source("{\"document\":{\"properties\":{\"num\":{\"store\":true,\"type\":\"integer\"}}}}", XContentType.JSON)
         ).actionGet();
 
         assertTrue(putMappingResponse.isAcknowledged());
diff --git a/jest/src/test/java/io/searchbox/core/search/aggregation/Ipv4RangeAggregationIntegrationTest.java b/jest/src/test/java/io/searchbox/core/search/aggregation/Ipv4RangeAggregationIntegrationTest.java
index 723c0b8f..94fd191b 100644
--- a/jest/src/test/java/io/searchbox/core/search/aggregation/Ipv4RangeAggregationIntegrationTest.java
+++ b/jest/src/test/java/io/searchbox/core/search/aggregation/Ipv4RangeAggregationIntegrationTest.java
@@ -5,6 +5,7 @@ import io.searchbox.core.Search;
 import io.searchbox.core.SearchResult;
 import org.elasticsearch.action.admin.indices.mapping.put.PutMappingRequest;
 import org.elasticsearch.action.admin.indices.mapping.put.PutMappingResponse;
+import org.elasticsearch.common.xcontent.XContentType;
 import org.elasticsearch.test.ESIntegTestCase;
 import org.junit.Test;
 
@@ -28,7 +29,7 @@ public class Ipv4RangeAggregationIntegrationTest extends AbstractIntegrationTest
         createIndex(INDEX);
         PutMappingResponse putMappingResponse = client().admin().indices().putMapping(new PutMappingRequest(INDEX)
                         .type(TYPE)
-                        .source("{\"document\":{\"properties\":{\"address\":{\"store\":true,\"type\":\"ip\"}}}}")
+                .source("{\"document\":{\"properties\":{\"address\":{\"store\":true,\"type\":\"ip\"}}}}", XContentType.JSON)
         ).actionGet();
 
         assertTrue(putMappingResponse.isAcknowledged());
@@ -94,7 +95,7 @@ public class Ipv4RangeAggregationIntegrationTest extends AbstractIntegrationTest
         createIndex(INDEX);
         PutMappingResponse putMappingResponse = client().admin().indices().putMapping(new PutMappingRequest(INDEX)
                         .type(TYPE)
-                        .source("{\"document\":{\"properties\":{\"address\":{\"store\":true,\"type\":\"ip\"}}}}")
+                .source("{\"document\":{\"properties\":{\"address\":{\"store\":true,\"type\":\"ip\"}}}}", XContentType.JSON)
         ).actionGet();
 
         assertTrue(putMappingResponse.isAcknowledged());
@@ -157,7 +158,7 @@ public class Ipv4RangeAggregationIntegrationTest extends AbstractIntegrationTest
         createIndex(INDEX);
         PutMappingResponse putMappingResponse = client().admin().indices().putMapping(new PutMappingRequest(INDEX)
                         .type(TYPE)
-                        .source("{\"document\":{\"properties\":{\"address\":{\"store\":true,\"type\":\"ip\"}}}}")
+                .source("{\"document\":{\"properties\":{\"address\":{\"store\":true,\"type\":\"ip\"}}}}", XContentType.JSON)
         ).actionGet();
 
         assertTrue(putMappingResponse.isAcknowledged());
diff --git a/jest/src/test/java/io/searchbox/core/search/aggregation/MaxAggregationIntegrationTest.java b/jest/src/test/java/io/searchbox/core/search/aggregation/MaxAggregationIntegrationTest.java
index 4ae2b270..d25d7e0d 100644
--- a/jest/src/test/java/io/searchbox/core/search/aggregation/MaxAggregationIntegrationTest.java
+++ b/jest/src/test/java/io/searchbox/core/search/aggregation/MaxAggregationIntegrationTest.java
@@ -5,6 +5,7 @@ import io.searchbox.core.Search;
 import io.searchbox.core.SearchResult;
 import org.elasticsearch.action.admin.indices.mapping.put.PutMappingRequest;
 import org.elasticsearch.action.admin.indices.mapping.put.PutMappingResponse;
+import org.elasticsearch.common.xcontent.XContentType;
 import org.elasticsearch.test.ESIntegTestCase;
 import org.junit.Test;
 
@@ -28,7 +29,7 @@ public class MaxAggregationIntegrationTest extends AbstractIntegrationTest {
         createIndex(INDEX);
         PutMappingResponse putMappingResponse = client().admin().indices().putMapping(new PutMappingRequest(INDEX)
                         .type(TYPE)
-                        .source("{\"document\":{\"properties\":{\"num\":{\"store\":true,\"type\":\"integer\"}}}}")
+                .source("{\"document\":{\"properties\":{\"num\":{\"store\":true,\"type\":\"integer\"}}}}", XContentType.JSON)
         ).actionGet();
 
         assertTrue(putMappingResponse.isAcknowledged());
@@ -81,7 +82,7 @@ public class MaxAggregationIntegrationTest extends AbstractIntegrationTest {
         createIndex(INDEX);
         PutMappingResponse putMappingResponse = client().admin().indices().putMapping(new PutMappingRequest(INDEX)
                         .type(TYPE)
-                        .source("{\"document\":{\"properties\":{\"num\":{\"store\":true,\"type\":\"integer\"}}}}")
+                .source("{\"document\":{\"properties\":{\"num\":{\"store\":true,\"type\":\"integer\"}}}}", XContentType.JSON)
         ).actionGet();
 
         assertTrue(putMappingResponse.isAcknowledged());
diff --git a/jest/src/test/java/io/searchbox/core/search/aggregation/MinAggregationIntegrationTest.java b/jest/src/test/java/io/searchbox/core/search/aggregation/MinAggregationIntegrationTest.java
index 8c897412..d347fddc 100644
--- a/jest/src/test/java/io/searchbox/core/search/aggregation/MinAggregationIntegrationTest.java
+++ b/jest/src/test/java/io/searchbox/core/search/aggregation/MinAggregationIntegrationTest.java
@@ -5,6 +5,7 @@ import io.searchbox.core.Search;
 import io.searchbox.core.SearchResult;
 import org.elasticsearch.action.admin.indices.mapping.put.PutMappingRequest;
 import org.elasticsearch.action.admin.indices.mapping.put.PutMappingResponse;
+import org.elasticsearch.common.xcontent.XContentType;
 import org.elasticsearch.test.ESIntegTestCase;
 import org.junit.Test;
 
@@ -28,7 +29,7 @@ public class MinAggregationIntegrationTest extends AbstractIntegrationTest {
         createIndex(INDEX);
         PutMappingResponse putMappingResponse = client().admin().indices().putMapping(new PutMappingRequest(INDEX)
                         .type(TYPE)
-                        .source("{\"document\":{\"properties\":{\"num\":{\"store\":true,\"type\":\"integer\"}}}}")
+                .source("{\"document\":{\"properties\":{\"num\":{\"store\":true,\"type\":\"integer\"}}}}", XContentType.JSON)
         ).actionGet();
 
         assertTrue(putMappingResponse.isAcknowledged());
@@ -81,7 +82,7 @@ public class MinAggregationIntegrationTest extends AbstractIntegrationTest {
         createIndex(INDEX);
         PutMappingResponse putMappingResponse = client().admin().indices().putMapping(new PutMappingRequest(INDEX)
                         .type(TYPE)
-                        .source("{\"document\":{\"properties\":{\"num\":{\"store\":true,\"type\":\"integer\"}}}}")
+                .source("{\"document\":{\"properties\":{\"num\":{\"store\":true,\"type\":\"integer\"}}}}", XContentType.JSON)
         ).actionGet();
 
         assertTrue(putMappingResponse.isAcknowledged());
diff --git a/jest/src/test/java/io/searchbox/core/search/aggregation/MissingAggregationIntegrationTest.java b/jest/src/test/java/io/searchbox/core/search/aggregation/MissingAggregationIntegrationTest.java
index 585261de..87cf6f5d 100644
--- a/jest/src/test/java/io/searchbox/core/search/aggregation/MissingAggregationIntegrationTest.java
+++ b/jest/src/test/java/io/searchbox/core/search/aggregation/MissingAggregationIntegrationTest.java
@@ -5,6 +5,7 @@ import io.searchbox.core.Search;
 import io.searchbox.core.SearchResult;
 import org.elasticsearch.action.admin.indices.mapping.put.PutMappingRequest;
 import org.elasticsearch.action.admin.indices.mapping.put.PutMappingResponse;
+import org.elasticsearch.common.xcontent.XContentType;
 import org.elasticsearch.test.ESIntegTestCase;
 import org.junit.Test;
 
@@ -28,7 +29,7 @@ public class MissingAggregationIntegrationTest extends AbstractIntegrationTest {
         createIndex(INDEX);
         PutMappingResponse putMappingResponse = client().admin().indices().putMapping(new PutMappingRequest(INDEX)
                         .type(TYPE)
-                        .source("{\"document\":{\"properties\":{\"num\":{\"store\":true,\"type\":\"integer\"}}}}")
+                .source("{\"document\":{\"properties\":{\"num\":{\"store\":true,\"type\":\"integer\"}}}}", XContentType.JSON)
         ).actionGet();
 
         assertTrue(putMappingResponse.isAcknowledged());
@@ -82,7 +83,7 @@ public class MissingAggregationIntegrationTest extends AbstractIntegrationTest {
         createIndex(INDEX);
         PutMappingResponse putMappingResponse = client().admin().indices().putMapping(new PutMappingRequest(INDEX)
                         .type(TYPE)
-                        .source("{\"document\":{\"properties\":{\"num\":{\"store\":true,\"type\":\"integer\"}}}}")
+                .source("{\"document\":{\"properties\":{\"num\":{\"store\":true,\"type\":\"integer\"}}}}", XContentType.JSON)
         ).actionGet();
 
         assertTrue(putMappingResponse.isAcknowledged());
diff --git a/jest/src/test/java/io/searchbox/core/search/aggregation/PercentileRanksAggregationIntegrationTest.java b/jest/src/test/java/io/searchbox/core/search/aggregation/PercentileRanksAggregationIntegrationTest.java
index ac02918f..3d63d568 100644
--- a/jest/src/test/java/io/searchbox/core/search/aggregation/PercentileRanksAggregationIntegrationTest.java
+++ b/jest/src/test/java/io/searchbox/core/search/aggregation/PercentileRanksAggregationIntegrationTest.java
@@ -5,6 +5,7 @@ import io.searchbox.core.Search;
 import io.searchbox.core.SearchResult;
 import org.elasticsearch.action.admin.indices.mapping.put.PutMappingRequest;
 import org.elasticsearch.action.admin.indices.mapping.put.PutMappingResponse;
+import org.elasticsearch.common.xcontent.XContentType;
 import org.elasticsearch.test.ESIntegTestCase;
 import org.junit.Test;
 
@@ -28,7 +29,7 @@ public class PercentileRanksAggregationIntegrationTest extends AbstractIntegrati
         createIndex(INDEX);
         PutMappingResponse putMappingResponse = client().admin().indices().putMapping(new PutMappingRequest(INDEX)
                         .type(TYPE)
-                        .source("{\"document\":{\"properties\":{\"response_millis\":{\"store\":true,\"type\":\"double\"}}}}")
+                .source("{\"document\":{\"properties\":{\"response_millis\":{\"store\":true,\"type\":\"double\"}}}}", XContentType.JSON)
         ).actionGet();
 
         assertTrue(putMappingResponse.isAcknowledged());
@@ -65,8 +66,8 @@ public class PercentileRanksAggregationIntegrationTest extends AbstractIntegrati
         assertEquals("percent1", percentileRanks.getName());
         assertEquals(2, percentileRanks.getPercentileRanks().size());
 
-        assertEquals(new Double(52.5),percentileRanks.getPercentileRanks().get("80.0"));
-        assertEquals(new Double(62.5),percentileRanks.getPercentileRanks().get("100.0"));
+        assertEquals(new Double(65.0), percentileRanks.getPercentileRanks().get("80.0"));
+        assertEquals(new Double(100.0), percentileRanks.getPercentileRanks().get("100.0"));
 
         Aggregation aggregation = result.getAggregations().getAggregation("percent1", PercentileRanksAggregation.class);
         assertTrue(aggregation instanceof PercentileRanksAggregation);
@@ -88,7 +89,7 @@ public class PercentileRanksAggregationIntegrationTest extends AbstractIntegrati
         createIndex(INDEX);
         PutMappingResponse putMappingResponse = client().admin().indices().putMapping(new PutMappingRequest(INDEX)
                         .type(TYPE)
-                        .source("{\"document\":{\"properties\":{\"response_millis\":{\"store\":true,\"type\":\"double\"}}}}")
+                .source("{\"document\":{\"properties\":{\"response_millis\":{\"store\":true,\"type\":\"double\"}}}}", XContentType.JSON)
         ).actionGet();
 
         assertTrue(putMappingResponse.isAcknowledged());
diff --git a/jest/src/test/java/io/searchbox/core/search/aggregation/PercentilesAggregationIntegrationTest.java b/jest/src/test/java/io/searchbox/core/search/aggregation/PercentilesAggregationIntegrationTest.java
index fcd9632e..bbc4f9be 100644
--- a/jest/src/test/java/io/searchbox/core/search/aggregation/PercentilesAggregationIntegrationTest.java
+++ b/jest/src/test/java/io/searchbox/core/search/aggregation/PercentilesAggregationIntegrationTest.java
@@ -5,6 +5,7 @@ import io.searchbox.core.Search;
 import io.searchbox.core.SearchResult;
 import org.elasticsearch.action.admin.indices.mapping.put.PutMappingRequest;
 import org.elasticsearch.action.admin.indices.mapping.put.PutMappingResponse;
+import org.elasticsearch.common.xcontent.XContentType;
 import org.elasticsearch.test.ESIntegTestCase;
 import org.junit.Test;
 
@@ -28,7 +29,7 @@ public class PercentilesAggregationIntegrationTest extends AbstractIntegrationTe
         createIndex(INDEX);
         PutMappingResponse putMappingResponse = client().admin().indices().putMapping(new PutMappingRequest(INDEX)
                         .type(TYPE)
-                        .source("{\"document\":{\"properties\":{\"response_millis\":{\"store\":true,\"type\":\"double\"}}}}")
+                .source("{\"document\":{\"properties\":{\"response_millis\":{\"store\":true,\"type\":\"double\"}}}}", XContentType.JSON)
         ).actionGet();
 
         assertTrue(putMappingResponse.isAcknowledged());
@@ -68,9 +69,9 @@ public class PercentilesAggregationIntegrationTest extends AbstractIntegrationTe
         assertEquals(new Double(75.0),percentiles.getPercentiles().get("5.0"));
         assertEquals(new Double(75.0),percentiles.getPercentiles().get("25.0"));
         assertEquals(new Double(75.0),percentiles.getPercentiles().get("50.0"));
-        assertEquals(new Double(75.0),percentiles.getPercentiles().get("75.0"));
-        assertEquals(new Double(107.0),percentiles.getPercentiles().get("95.0"));
-        assertEquals(new Double(113.39999999999999),percentiles.getPercentiles().get("99.0"));
+        assertEquals(new Double(85.0), percentiles.getPercentiles().get("75.0"));
+        assertEquals(new Double(115.0), percentiles.getPercentiles().get("95.0"));
+        assertEquals(new Double(115.0), percentiles.getPercentiles().get("99.0"));
 
         Aggregation aggregation = result.getAggregations().getAggregation("percent1", PercentilesAggregation.class);
         assertTrue(aggregation instanceof PercentilesAggregation);
@@ -92,7 +93,7 @@ public class PercentilesAggregationIntegrationTest extends AbstractIntegrationTe
         createIndex(INDEX);
         PutMappingResponse putMappingResponse = client().admin().indices().putMapping(new PutMappingRequest(INDEX)
                         .type(TYPE)
-                        .source("{\"document\":{\"properties\":{\"response_millis\":{\"store\":true,\"type\":\"double\"}}}}")
+                .source("{\"document\":{\"properties\":{\"response_millis\":{\"store\":true,\"type\":\"double\"}}}}", XContentType.JSON)
         ).actionGet();
 
         assertTrue(putMappingResponse.isAcknowledged());
diff --git a/jest/src/test/java/io/searchbox/core/search/aggregation/RangeAggregationIntegrationTest.java b/jest/src/test/java/io/searchbox/core/search/aggregation/RangeAggregationIntegrationTest.java
index a9605d0d..1e291d83 100644
--- a/jest/src/test/java/io/searchbox/core/search/aggregation/RangeAggregationIntegrationTest.java
+++ b/jest/src/test/java/io/searchbox/core/search/aggregation/RangeAggregationIntegrationTest.java
@@ -5,6 +5,7 @@ import io.searchbox.core.Search;
 import io.searchbox.core.SearchResult;
 import org.elasticsearch.action.admin.indices.mapping.put.PutMappingRequest;
 import org.elasticsearch.action.admin.indices.mapping.put.PutMappingResponse;
+import org.elasticsearch.common.xcontent.XContentType;
 import org.elasticsearch.test.ESIntegTestCase;
 import org.junit.Test;
 
@@ -28,7 +29,7 @@ public class RangeAggregationIntegrationTest extends AbstractIntegrationTest {
         createIndex(INDEX);
         PutMappingResponse putMappingResponse = client().admin().indices().putMapping(new PutMappingRequest(INDEX)
                         .type(TYPE)
-                        .source("{\"document\":{\"properties\":{\"num\":{\"store\":true,\"type\":\"integer\"}}}}")
+                .source("{\"document\":{\"properties\":{\"num\":{\"store\":true,\"type\":\"integer\"}}}}", XContentType.JSON)
         ).actionGet();
 
         assertTrue(putMappingResponse.isAcknowledged());
@@ -100,7 +101,7 @@ public class RangeAggregationIntegrationTest extends AbstractIntegrationTest {
         createIndex(INDEX);
         PutMappingResponse putMappingResponse = client().admin().indices().putMapping(new PutMappingRequest(INDEX)
                         .type(TYPE)
-                        .source("{\"document\":{\"properties\":{\"num\":{\"store\":true,\"type\":\"integer\"}}}}")
+                .source("{\"document\":{\"properties\":{\"num\":{\"store\":true,\"type\":\"integer\"}}}}", XContentType.JSON)
         ).actionGet();
 
         assertTrue(putMappingResponse.isAcknowledged());
diff --git a/jest/src/test/java/io/searchbox/core/search/aggregation/ScriptedMetricAggregationIntegrationTest.java b/jest/src/test/java/io/searchbox/core/search/aggregation/ScriptedMetricAggregationIntegrationTest.java
index 3e75e6e3..455460aa 100644
--- a/jest/src/test/java/io/searchbox/core/search/aggregation/ScriptedMetricAggregationIntegrationTest.java
+++ b/jest/src/test/java/io/searchbox/core/search/aggregation/ScriptedMetricAggregationIntegrationTest.java
@@ -5,6 +5,7 @@ import io.searchbox.core.Search;
 import io.searchbox.core.SearchResult;
 import org.elasticsearch.action.admin.indices.mapping.put.PutMappingRequest;
 import org.elasticsearch.action.admin.indices.mapping.put.PutMappingResponse;
+import org.elasticsearch.common.xcontent.XContentType;
 import org.elasticsearch.test.ESIntegTestCase;
 import org.junit.Test;
 
@@ -28,7 +29,7 @@ public class ScriptedMetricAggregationIntegrationTest extends AbstractIntegratio
         createIndex(INDEX);
         PutMappingResponse putMappingResponse = client().admin().indices().putMapping(new PutMappingRequest(INDEX)
                         .type(TYPE)
-                        .source("{\"document\":{\"properties\":{\"amount\":{\"store\":true,\"type\":\"integer\"}}}}")
+                .source("{\"document\":{\"properties\":{\"amount\":{\"store\":true,\"type\":\"integer\"}}}}", XContentType.JSON)
         ).actionGet();
 
         assertTrue(putMappingResponse.isAcknowledged());
@@ -86,7 +87,7 @@ public class ScriptedMetricAggregationIntegrationTest extends AbstractIntegratio
         PutMappingResponse putMappingResponse = client().admin().indices().putMapping(new PutMappingRequest(INDEX)
                         .type(TYPE)
                         .source("{\"document\":{\"properties\":{\"amount\":{\"store\":true,\"type\":\"integer\"},"+
-                        "\"bad_field\":{\"store\":true,\"type\":\"integer\"}}}}")
+                                "\"bad_field\":{\"store\":true,\"type\":\"integer\"}}}}", XContentType.JSON)
         ).actionGet();
 
         assertTrue(putMappingResponse.isAcknowledged());
diff --git a/jest/src/test/java/io/searchbox/core/search/aggregation/SignificantTermsAggregationIntegrationTest.java b/jest/src/test/java/io/searchbox/core/search/aggregation/SignificantTermsAggregationIntegrationTest.java
index ee892525..cbab8f84 100644
--- a/jest/src/test/java/io/searchbox/core/search/aggregation/SignificantTermsAggregationIntegrationTest.java
+++ b/jest/src/test/java/io/searchbox/core/search/aggregation/SignificantTermsAggregationIntegrationTest.java
@@ -5,6 +5,7 @@ import io.searchbox.core.Search;
 import io.searchbox.core.SearchResult;
 import org.elasticsearch.action.admin.indices.mapping.put.PutMappingRequest;
 import org.elasticsearch.action.admin.indices.mapping.put.PutMappingResponse;
+import org.elasticsearch.common.xcontent.XContentType;
 import org.elasticsearch.test.ESIntegTestCase;
 import org.junit.Test;
 
@@ -27,7 +28,7 @@ public class SignificantTermsAggregationIntegrationTest extends AbstractIntegrat
         PutMappingResponse putMappingResponse = client().admin().indices().putMapping(new PutMappingRequest(INDEX)
                         .type(TYPE)
                         .source("{\"document\":{\"properties\":{\"gender\":{\"store\":true,\"type\":\"keyword\"},"+
-                         "\"favorite_movie\":{\"store\":true,\"type\":\"keyword\"}}}}")
+                                "\"favorite_movie\":{\"store\":true,\"type\":\"keyword\"}}}}", XContentType.JSON)
         ).actionGet();
 
         assertTrue(putMappingResponse.isAcknowledged());
@@ -96,8 +97,8 @@ public class SignificantTermsAggregationIntegrationTest extends AbstractIntegrat
         createIndex(INDEX);
         PutMappingResponse putMappingResponse = client().admin().indices().putMapping(new PutMappingRequest(INDEX)
                         .type(TYPE)
-                        .source("{\"document\":{\"properties\":{\"gender\":{\"store\":true,\"type\":\"string\"},"+
-                                "\"favorite_movie\":{\"store\":true,\"type\":\"string\"}}}}")
+                .source("{\"document\":{\"properties\":{\"gender\":{\"store\":true,\"type\":\"text\"}," +
+                        "\"favorite_movie\":{\"store\":true,\"type\":\"text\"}}}}", XContentType.JSON)
         ).actionGet();
 
         assertTrue(putMappingResponse.isAcknowledged());
diff --git a/jest/src/test/java/io/searchbox/core/search/aggregation/StatsAggregationIntegrationTest.java b/jest/src/test/java/io/searchbox/core/search/aggregation/StatsAggregationIntegrationTest.java
index 93b0b716..820aee90 100644
--- a/jest/src/test/java/io/searchbox/core/search/aggregation/StatsAggregationIntegrationTest.java
+++ b/jest/src/test/java/io/searchbox/core/search/aggregation/StatsAggregationIntegrationTest.java
@@ -5,6 +5,7 @@ import io.searchbox.core.Search;
 import io.searchbox.core.SearchResult;
 import org.elasticsearch.action.admin.indices.mapping.put.PutMappingRequest;
 import org.elasticsearch.action.admin.indices.mapping.put.PutMappingResponse;
+import org.elasticsearch.common.xcontent.XContentType;
 import org.elasticsearch.test.ESIntegTestCase;
 import org.junit.Test;
 
@@ -28,7 +29,7 @@ public class StatsAggregationIntegrationTest extends AbstractIntegrationTest {
         createIndex(INDEX);
         PutMappingResponse putMappingResponse = client().admin().indices().putMapping(new PutMappingRequest(INDEX)
                         .type(TYPE)
-                        .source("{\"document\":{\"properties\":{\"num\":{\"store\":true,\"type\":\"integer\"}}}}")
+                .source("{\"document\":{\"properties\":{\"num\":{\"store\":true,\"type\":\"integer\"}}}}", XContentType.JSON)
         ).actionGet();
 
         assertTrue(putMappingResponse.isAcknowledged());
@@ -85,7 +86,7 @@ public class StatsAggregationIntegrationTest extends AbstractIntegrationTest {
         createIndex(INDEX);
         PutMappingResponse putMappingResponse = client().admin().indices().putMapping(new PutMappingRequest(INDEX)
                         .type(TYPE)
-                        .source("{\"document\":{\"properties\":{\"num\":{\"store\":true,\"type\":\"integer\"}}}}")
+                .source("{\"document\":{\"properties\":{\"num\":{\"store\":true,\"type\":\"integer\"}}}}", XContentType.JSON)
         ).actionGet();
 
         assertTrue(putMappingResponse.isAcknowledged());
diff --git a/jest/src/test/java/io/searchbox/core/search/aggregation/SumAggregationIntegrationTest.java b/jest/src/test/java/io/searchbox/core/search/aggregation/SumAggregationIntegrationTest.java
index 4c3c3515..bcdecff0 100644
--- a/jest/src/test/java/io/searchbox/core/search/aggregation/SumAggregationIntegrationTest.java
+++ b/jest/src/test/java/io/searchbox/core/search/aggregation/SumAggregationIntegrationTest.java
@@ -5,6 +5,7 @@ import io.searchbox.core.Search;
 import io.searchbox.core.SearchResult;
 import org.elasticsearch.action.admin.indices.mapping.put.PutMappingRequest;
 import org.elasticsearch.action.admin.indices.mapping.put.PutMappingResponse;
+import org.elasticsearch.common.xcontent.XContentType;
 import org.elasticsearch.test.ESIntegTestCase;
 import org.junit.Test;
 
@@ -28,7 +29,7 @@ public class SumAggregationIntegrationTest extends AbstractIntegrationTest {
         createIndex(INDEX);
         PutMappingResponse putMappingResponse = client().admin().indices().putMapping(new PutMappingRequest(INDEX)
                         .type(TYPE)
-                        .source("{\"document\":{\"properties\":{\"num\":{\"store\":true,\"type\":\"integer\"}}}}")
+                .source("{\"document\":{\"properties\":{\"num\":{\"store\":true,\"type\":\"integer\"}}}}", XContentType.JSON)
         ).actionGet();
 
         assertTrue(putMappingResponse.isAcknowledged());
@@ -81,7 +82,7 @@ public class SumAggregationIntegrationTest extends AbstractIntegrationTest {
         createIndex(INDEX);
         PutMappingResponse putMappingResponse = client().admin().indices().putMapping(new PutMappingRequest(INDEX)
                         .type(TYPE)
-                        .source("{\"document\":{\"properties\":{\"num\":{\"store\":true,\"type\":\"integer\"}}}}")
+                .source("{\"document\":{\"properties\":{\"num\":{\"store\":true,\"type\":\"integer\"}}}}", XContentType.JSON)
         ).actionGet();
 
         assertTrue(putMappingResponse.isAcknowledged());
diff --git a/jest/src/test/java/io/searchbox/core/search/aggregation/TermsAggregationIntegrationTest.java b/jest/src/test/java/io/searchbox/core/search/aggregation/TermsAggregationIntegrationTest.java
index c04bede6..2c27c1fe 100644
--- a/jest/src/test/java/io/searchbox/core/search/aggregation/TermsAggregationIntegrationTest.java
+++ b/jest/src/test/java/io/searchbox/core/search/aggregation/TermsAggregationIntegrationTest.java
@@ -5,6 +5,7 @@ import io.searchbox.core.Search;
 import io.searchbox.core.SearchResult;
 import org.elasticsearch.action.admin.indices.mapping.put.PutMappingRequest;
 import org.elasticsearch.action.admin.indices.mapping.put.PutMappingResponse;
+import org.elasticsearch.common.xcontent.XContentType;
 import org.elasticsearch.test.ESIntegTestCase;
 import org.junit.Test;
 
@@ -28,7 +29,7 @@ public class TermsAggregationIntegrationTest extends AbstractIntegrationTest {
         createIndex(INDEX);
         PutMappingResponse putMappingResponse = client().admin().indices().putMapping(new PutMappingRequest(INDEX)
                         .type(TYPE)
-                        .source("{\"document\":{\"properties\":{\"gender\":{\"store\":true,\"type\":\"keyword\"}}}}")
+                .source("{\"document\":{\"properties\":{\"gender\":{\"store\":true,\"type\":\"keyword\"}}}}", XContentType.JSON)
         ).actionGet();
 
         assertTrue(putMappingResponse.isAcknowledged());
@@ -88,7 +89,7 @@ public class TermsAggregationIntegrationTest extends AbstractIntegrationTest {
         createIndex(INDEX);
         PutMappingResponse putMappingResponse = client().admin().indices().putMapping(new PutMappingRequest(INDEX)
                         .type(TYPE)
-                        .source("{\"document\":{\"properties\":{\"gender\":{\"store\":true,\"type\":\"string\"}}}}")
+                .source("{\"document\":{\"properties\":{\"gender\":{\"store\":true,\"type\":\"text\"}}}}", XContentType.JSON)
         ).actionGet();
 
         assertTrue(putMappingResponse.isAcknowledged());
diff --git a/jest/src/test/java/io/searchbox/core/search/aggregation/ValueCountAggregationIntegrationTest.java b/jest/src/test/java/io/searchbox/core/search/aggregation/ValueCountAggregationIntegrationTest.java
index 6a34045f..e065b1f6 100644
--- a/jest/src/test/java/io/searchbox/core/search/aggregation/ValueCountAggregationIntegrationTest.java
+++ b/jest/src/test/java/io/searchbox/core/search/aggregation/ValueCountAggregationIntegrationTest.java
@@ -5,6 +5,7 @@ import io.searchbox.core.Search;
 import io.searchbox.core.SearchResult;
 import org.elasticsearch.action.admin.indices.mapping.put.PutMappingRequest;
 import org.elasticsearch.action.admin.indices.mapping.put.PutMappingResponse;
+import org.elasticsearch.common.xcontent.XContentType;
 import org.elasticsearch.test.ESIntegTestCase;
 import org.junit.Test;
 
@@ -28,7 +29,7 @@ public class ValueCountAggregationIntegrationTest extends AbstractIntegrationTes
         createIndex(INDEX);
         PutMappingResponse putMappingResponse = client().admin().indices().putMapping(new PutMappingRequest(INDEX)
                         .type(TYPE)
-                        .source("{\"document\":{\"properties\":{\"num\":{\"store\":true,\"type\":\"integer\"}}}}")
+                .source("{\"document\":{\"properties\":{\"num\":{\"store\":true,\"type\":\"integer\"}}}}", XContentType.JSON)
         ).actionGet();
 
         assertTrue(putMappingResponse.isAcknowledged());
@@ -81,7 +82,7 @@ public class ValueCountAggregationIntegrationTest extends AbstractIntegrationTes
         createIndex(INDEX);
         PutMappingResponse putMappingResponse = client().admin().indices().putMapping(new PutMappingRequest(INDEX)
                         .type(TYPE)
-                        .source("{\"document\":{\"properties\":{\"num\":{\"store\":true,\"type\":\"integer\"}}}}")
+                .source("{\"document\":{\"properties\":{\"num\":{\"store\":true,\"type\":\"integer\"}}}}", XContentType.JSON)
         ).actionGet();
 
         assertTrue(putMappingResponse.isAcknowledged());
diff --git a/jest/src/test/java/io/searchbox/fields/FieldStatsIntegrationTest.java b/jest/src/test/java/io/searchbox/fields/FieldCapabilitiesIntegrationTest.java
similarity index 77%
rename from jest/src/test/java/io/searchbox/fields/FieldStatsIntegrationTest.java
rename to jest/src/test/java/io/searchbox/fields/FieldCapabilitiesIntegrationTest.java
index 4266355c..b0011bb4 100644
--- a/jest/src/test/java/io/searchbox/fields/FieldStatsIntegrationTest.java
+++ b/jest/src/test/java/io/searchbox/fields/FieldCapabilitiesIntegrationTest.java
@@ -14,7 +14,7 @@ import java.util.List;
 import java.util.Map;
 
 @ESIntegTestCase.ClusterScope(scope = ESIntegTestCase.Scope.SUITE, numDataNodes = 1)
-public class FieldStatsIntegrationTest  extends AbstractIntegrationTest {
+public class FieldCapabilitiesIntegrationTest extends AbstractIntegrationTest {
 
     private static final String INDEX = "twitter";
     private static final String TYPE = "tweet";
@@ -37,10 +37,10 @@ public class FieldStatsIntegrationTest  extends AbstractIntegrationTest {
 
         assertTrue(documentResult.getErrorMessage(), documentResult.isSucceeded());
 
-        FieldStats fieldStats = new FieldStats.Builder(FIELDS).setIndex(INDEX).build();
+        FieldCapabilities fieldCapabilities = new FieldCapabilities.Builder(FIELDS).build();
 
-        JestResult fieldStatsResult = client.execute(fieldStats);
+        JestResult fieldCapabilitiesResult = client.execute(fieldCapabilities);
 
-        assertTrue(fieldStatsResult.getErrorMessage(), fieldStatsResult.isSucceeded());
+        assertTrue(fieldCapabilitiesResult.getErrorMessage(), fieldCapabilitiesResult.isSucceeded());
     }
 }
diff --git a/jest/src/test/java/io/searchbox/indices/AnalyzeIntegrationTest.java b/jest/src/test/java/io/searchbox/indices/AnalyzeIntegrationTest.java
index 2bb73183..77b59aff 100644
--- a/jest/src/test/java/io/searchbox/indices/AnalyzeIntegrationTest.java
+++ b/jest/src/test/java/io/searchbox/indices/AnalyzeIntegrationTest.java
@@ -48,7 +48,7 @@ public class AnalyzeIntegrationTest extends AbstractIntegrationTest {
         Action action = new Analyze.Builder()
                 .analyzer("standard")
                 .text(sample_book)
-                .format("text")
+                //.format("text")
                 .build();
         JestResult result = client.execute(action);
         assertTrue(result.getErrorMessage(), result.isSucceeded());
diff --git a/jest/src/test/java/io/searchbox/indices/CreateIndexIntegrationTest.java b/jest/src/test/java/io/searchbox/indices/CreateIndexIntegrationTest.java
index 092c158f..18e36987 100644
--- a/jest/src/test/java/io/searchbox/indices/CreateIndexIntegrationTest.java
+++ b/jest/src/test/java/io/searchbox/indices/CreateIndexIntegrationTest.java
@@ -11,6 +11,7 @@ import org.elasticsearch.test.ESIntegTestCase;
 import org.junit.Test;
 
 import java.io.IOException;
+import java.util.HashMap;
 import java.util.Map;
 
 /**
@@ -30,11 +31,13 @@ public class CreateIndexIntegrationTest extends AbstractIntegrationTest {
     @Test
     public void createIndexWithMapSettings() throws IOException {
         String index = "anothernewindex";
-        final Settings.Builder indexerSettings = Settings.builder();
+
+        Map<String, String> indexerSettings = new HashMap<>();
         indexerSettings.put("analysis.analyzer.events.type", "custom");
         indexerSettings.put("analysis.analyzer.events.tokenizer", "standard");
-        indexerSettings.put("analysis.analyzer.events.filter", "snowball, standard, lowercase");
-        Map<String, String> expectedSettingsMap = indexerSettings.build().getAsMap();
+        indexerSettings.put("analysis.analyzer.events.filter", "standard, lowercase");
+
+        Map<String, String> expectedSettingsMap = indexerSettings;
         CreateIndex createIndex = new CreateIndex.Builder(index)
                 .settings(expectedSettingsMap)
                 .build();
diff --git a/jest/src/test/java/io/searchbox/indices/GetMappingIntegrationTest.java b/jest/src/test/java/io/searchbox/indices/GetMappingIntegrationTest.java
index 1f686802..7426b1dc 100644
--- a/jest/src/test/java/io/searchbox/indices/GetMappingIntegrationTest.java
+++ b/jest/src/test/java/io/searchbox/indices/GetMappingIntegrationTest.java
@@ -9,6 +9,7 @@ import org.elasticsearch.action.admin.indices.mapping.put.PutMappingRequest;
 import org.elasticsearch.action.admin.indices.mapping.put.PutMappingResponse;
 import org.elasticsearch.action.admin.indices.refresh.RefreshRequest;
 import org.elasticsearch.action.admin.indices.refresh.RefreshResponse;
+import org.elasticsearch.common.xcontent.XContentType;
 import org.elasticsearch.test.ESIntegTestCase;
 import org.junit.Test;
 
@@ -29,8 +30,8 @@ public class GetMappingIntegrationTest extends AbstractIntegrationTest {
         PutMappingResponse putMappingResponse = client().admin().indices().putMapping(
                 new PutMappingRequest(INDEX_1_NAME)
                         .type(CUSTOM_TYPE)
-                        .source("{\"science-fiction\":{\"properties\":{\"title\":{\"store\":true,\"type\":\"string\"}," +
-                                "\"author\":{\"store\":true,\"type\":\"string\"}}}}")
+                        .source("{\"science-fiction\":{\"properties\":{\"title\":{\"store\":true,\"type\":\"text\"}," +
+                                "\"author\":{\"store\":true,\"type\":\"text\"}}}}", XContentType.JSON)
         ).actionGet();
         assertTrue(putMappingResponse.isAcknowledged());
 
@@ -59,8 +60,8 @@ public class GetMappingIntegrationTest extends AbstractIntegrationTest {
         PutMappingResponse putMappingResponse = client().admin().indices().putMapping(
                 new PutMappingRequest(INDEX_1_NAME)
                         .type(CUSTOM_TYPE)
-                        .source("{\"science-fiction\":{\"properties\":{\"title\":{\"store\":true,\"type\":\"string\"}," +
-                                "\"author\":{\"store\":true,\"type\":\"string\"}}}}")
+                        .source("{\"science-fiction\":{\"properties\":{\"title\":{\"store\":true,\"type\":\"text\"}," +
+                                "\"author\":{\"store\":true,\"type\":\"text\"}}}}", XContentType.JSON)
         ).actionGet();
         assertTrue(putMappingResponse.isAcknowledged());
         assertConcreteMappingsOnAll(INDEX_1_NAME, CUSTOM_TYPE, "title", "author");
@@ -86,15 +87,15 @@ public class GetMappingIntegrationTest extends AbstractIntegrationTest {
         PutMappingResponse putMappingResponse = client().admin().indices().putMapping(
                 new PutMappingRequest(INDEX_1_NAME)
                         .type(CUSTOM_TYPE)
-                        .source("{\"science-fiction\":{\"properties\":{\"title\":{\"store\":true,\"type\":\"string\"}," +
-                                "\"author\":{\"store\":true,\"type\":\"string\"}}}}")
+                        .source("{\"science-fiction\":{\"properties\":{\"title\":{\"store\":true,\"type\":\"text\"}," +
+                                "\"author\":{\"store\":true,\"type\":\"text\"}}}}", XContentType.JSON)
         ).actionGet();
         assertTrue(putMappingResponse.isAcknowledged());
         putMappingResponse = client().admin().indices().putMapping(
                 new PutMappingRequest(INDEX_2_NAME)
                         .type(CUSTOM_TYPE)
-                        .source("{\"science-fiction\":{\"properties\":{\"title\":{\"store\":false,\"type\":\"string\"}," +
-                                "\"isbn\":{\"store\":true,\"type\":\"string\"}}}}")
+                        .source("{\"science-fiction\":{\"properties\":{\"title\":{\"store\":false,\"type\":\"text\"}," +
+                                "\"isbn\":{\"store\":true,\"type\":\"text\"}}}}", XContentType.JSON)
         ).actionGet();
         assertTrue(putMappingResponse.isAcknowledged());
         assertConcreteMappingsOnAll(INDEX_1_NAME, CUSTOM_TYPE, "title", "author");
diff --git a/jest/src/test/java/io/searchbox/indices/PutMappingIntegrationTest.java b/jest/src/test/java/io/searchbox/indices/PutMappingIntegrationTest.java
index 43ff5be3..42dc0e70 100644
--- a/jest/src/test/java/io/searchbox/indices/PutMappingIntegrationTest.java
+++ b/jest/src/test/java/io/searchbox/indices/PutMappingIntegrationTest.java
@@ -10,7 +10,6 @@ import org.elasticsearch.index.mapper.DocumentMapper;
 import org.elasticsearch.index.mapper.KeywordFieldMapper;
 import org.elasticsearch.index.mapper.MapperService;
 import org.elasticsearch.index.mapper.RootObjectMapper;
-import org.elasticsearch.index.mapper.StringFieldMapper;
 import org.elasticsearch.indices.IndicesService;
 import org.elasticsearch.test.ESIntegTestCase;
 import org.junit.Before;
@@ -39,7 +38,7 @@ public class PutMappingIntegrationTest extends AbstractIntegrationTest {
         PutMapping putMapping = new PutMapping.Builder(
                 INDEX_NAME,
                 INDEX_TYPE,
-                "{ \"document\" : { \"properties\" : { \"message_1\" : {\"type\" : \"string\", \"store\" : \"yes\"} } } }"
+                "{ \"document\" : { \"properties\" : { \"message_1\" : {\"type\" : \"text\", \"store\" : \"true\"} } } }"
         ).build();
 
         JestResult result = client.execute(putMapping);
diff --git a/jest/src/test/java/io/searchbox/indices/RefreshIntegrationTest.java b/jest/src/test/java/io/searchbox/indices/RefreshIntegrationTest.java
index 7971b7d1..1c25e009 100644
--- a/jest/src/test/java/io/searchbox/indices/RefreshIntegrationTest.java
+++ b/jest/src/test/java/io/searchbox/indices/RefreshIntegrationTest.java
@@ -2,70 +2,47 @@ package io.searchbox.indices;
 
 import io.searchbox.client.JestResult;
 import io.searchbox.common.AbstractIntegrationTest;
-import org.elasticsearch.action.ActionFuture;
-import org.elasticsearch.action.admin.indices.stats.IndexStats;
-import org.elasticsearch.action.admin.indices.stats.IndicesStatsRequest;
-import org.elasticsearch.action.admin.indices.stats.IndicesStatsResponse;
+import org.elasticsearch.common.settings.Settings;
 import org.elasticsearch.test.ESIntegTestCase;
 import org.junit.Test;
 
 import java.io.IOException;
 import java.util.concurrent.ExecutionException;
-import java.util.concurrent.TimeUnit;
 import java.util.concurrent.TimeoutException;
 
 /**
  * @author cihat keser
  */
-@ESIntegTestCase.ClusterScope(scope = ESIntegTestCase.Scope.SUITE, numDataNodes = 1)
+@ESIntegTestCase.ClusterScope(scope = ESIntegTestCase.Scope.TEST, numDataNodes = 1)
 public class RefreshIntegrationTest extends AbstractIntegrationTest {
 
     @Test
     public void testFlushAll() throws InterruptedException, ExecutionException, TimeoutException, IOException {
-        createIndex("i_flush_0", "i_flush_1", "i_flush_2");
+        createIndex("i_flush_0", Settings.builder().put("number_of_shards", 1).put("number_of_replicas", 0).build());
+        createIndex("i_flush_1", Settings.builder().put("number_of_shards", 5).put("number_of_replicas", 0).build());
+        createIndex("i_flush_2", Settings.builder().put("number_of_shards", 6).put("number_of_replicas", 0).build());
         ensureSearchable("i_flush_0", "i_flush_1", "i_flush_2");
 
+
         Refresh refresh = new Refresh.Builder().build();
         JestResult result = client.execute(refresh);
         assertTrue(result.getErrorMessage(), result.isSucceeded());
 
-        ActionFuture<IndicesStatsResponse> statsResponseFeature = client().admin().indices().stats(
-                new IndicesStatsRequest().clear().flush(true).refresh(true));
-        IndicesStatsResponse statsResponse = statsResponseFeature.get(10, TimeUnit.SECONDS);
-        assertNotNull(statsResponse);
-
-        IndexStats stats0 = statsResponse.getIndex("i_flush_0");
-        assertEquals(stats0.getShards().length, stats0.getTotal().getRefresh().getTotal());
+        assertEquals(12, result.getJsonObject().get("_shards").getAsJsonObject().get("total").getAsInt());
 
-        IndexStats stats1 = statsResponse.getIndex("i_flush_1");
-        assertEquals(stats1.getShards().length, stats1.getTotal().getRefresh().getTotal());
-
-        IndexStats stats2 = statsResponse.getIndex("i_flush_2");
-        assertEquals(stats2.getShards().length, stats2.getTotal().getRefresh().getTotal());
     }
 
     @Test
-    public void testFlushSpecificIndices() throws InterruptedException, ExecutionException, TimeoutException, IOException {
-        createIndex("i_flush_4", "i_flush_5", "i_flush_6");
+    public void testFlushSpecificIndices() throws IOException {
+        createIndex("i_flush_4", Settings.builder().put("number_of_shards", 1).put("number_of_replicas", 0).build());
+        createIndex("i_flush_5", Settings.builder().put("number_of_shards", 5).put("number_of_replicas", 0).build());
+        createIndex("i_flush_6", Settings.builder().put("number_of_shards", 6).put("number_of_replicas", 0).build());
         ensureSearchable("i_flush_4", "i_flush_5", "i_flush_6");
 
         Refresh refresh = new Refresh.Builder().addIndex("i_flush_4").addIndex("i_flush_6").build();
         JestResult result = client.execute(refresh);
         assertTrue(result.getErrorMessage(), result.isSucceeded());
-
-        ActionFuture<IndicesStatsResponse> statsResponseFeature = client().admin().indices().stats(
-                new IndicesStatsRequest().clear().flush(true).refresh(true));
-        IndicesStatsResponse statsResponse = statsResponseFeature.get(10, TimeUnit.SECONDS);
-        assertNotNull(statsResponse);
-
-        IndexStats stats4 = statsResponse.getIndex("i_flush_4");
-        assertEquals(stats4.getShards().length, stats4.getTotal().getRefresh().getTotal());
-
-        IndexStats stats5 = statsResponse.getIndex("i_flush_5");
-        assertEquals(0, stats5.getTotal().getRefresh().getTotal());
-
-        IndexStats stats6 = statsResponse.getIndex("i_flush_6");
-        assertEquals(stats6.getShards().length, stats6.getTotal().getRefresh().getTotal());
+        assertEquals(7, result.getJsonObject().get("_shards").getAsJsonObject().get("total").getAsInt());
     }
 
 }
diff --git a/jest/src/test/java/io/searchbox/indices/aliases/AliasExistsIntegrationTest.java b/jest/src/test/java/io/searchbox/indices/aliases/AliasExistsIntegrationTest.java
index 0a313bfb..77df23ff 100644
--- a/jest/src/test/java/io/searchbox/indices/aliases/AliasExistsIntegrationTest.java
+++ b/jest/src/test/java/io/searchbox/indices/aliases/AliasExistsIntegrationTest.java
@@ -36,7 +36,7 @@ public class AliasExistsIntegrationTest extends AbstractIntegrationTest {
 
     @Test
     public void testAliasDoesNotExist() throws IOException {
-        AliasExists aliasExists = new AliasExists.Builder().build();
+        AliasExists aliasExists = new AliasExists.Builder().alias("does_not_exist").build();
         JestResult result = client.execute(aliasExists);
         assertFalse(result.getErrorMessage(), result.isSucceeded());
     }
diff --git a/jest/src/test/java/io/searchbox/indices/script/CreateIndexedScriptIntegrationTest.java b/jest/src/test/java/io/searchbox/indices/script/CreateStoredScriptIntegrationTest.java
similarity index 61%
rename from jest/src/test/java/io/searchbox/indices/script/CreateIndexedScriptIntegrationTest.java
rename to jest/src/test/java/io/searchbox/indices/script/CreateStoredScriptIntegrationTest.java
index ce10751a..2f73530d 100644
--- a/jest/src/test/java/io/searchbox/indices/script/CreateIndexedScriptIntegrationTest.java
+++ b/jest/src/test/java/io/searchbox/indices/script/CreateStoredScriptIntegrationTest.java
@@ -11,26 +11,25 @@ import java.io.IOException;
 import static io.searchbox.indices.script.ScriptLanguage.PAINLESS;
 
 @ESIntegTestCase.ClusterScope(scope = ESIntegTestCase.Scope.TEST, numDataNodes = 1)
-public class CreateIndexedScriptIntegrationTest extends AbstractIntegrationTest {
+public class CreateStoredScriptIntegrationTest extends AbstractIntegrationTest {
 
     @Test
-    public void createAnIndexedScript() throws IOException {
+    public void createAStoredScript() throws IOException {
         String name = "script-test";
         String script = "int aVariable = 1; return aVariable";
 
-        CreateStoredScript createIndexedScript = new CreateStoredScript.Builder(name)
+        CreateStoredScript createStoredScript = new CreateStoredScript.Builder(name)
                 .setLanguage(PAINLESS)
                 .setSource(script)
                 .build();
-        JestResult result = client.execute(createIndexedScript);
+        JestResult result = client.execute(createStoredScript);
         assertTrue(result.getErrorMessage(), result.isSucceeded());
 
-        GetStoredScriptResponse getIndexedScriptResponse =
+        GetStoredScriptResponse getStoredScriptResponse =
                 client().admin().cluster().prepareGetStoredScript()
-                        .setLang("painless")
                         .setId(name).get();
-        assertNotNull(getIndexedScriptResponse.getSource());
-        assertEquals(script, getIndexedScriptResponse.getSource().getCode());
+        assertNotNull(getStoredScriptResponse.getSource());
+        assertEquals(script, getStoredScriptResponse.getSource().getSource());
     }
 }
 
diff --git a/jest/src/test/java/io/searchbox/indices/script/DeleteIndexedScriptIntegrationTest.java b/jest/src/test/java/io/searchbox/indices/script/DeleteStoredScriptIntegrationTest.java
similarity index 54%
rename from jest/src/test/java/io/searchbox/indices/script/DeleteIndexedScriptIntegrationTest.java
rename to jest/src/test/java/io/searchbox/indices/script/DeleteStoredScriptIntegrationTest.java
index 17f9d71e..c7649577 100644
--- a/jest/src/test/java/io/searchbox/indices/script/DeleteIndexedScriptIntegrationTest.java
+++ b/jest/src/test/java/io/searchbox/indices/script/DeleteStoredScriptIntegrationTest.java
@@ -10,29 +10,33 @@ import org.elasticsearch.test.ESIntegTestCase;
 import org.junit.Test;
 
 @ESIntegTestCase.ClusterScope(scope = ESIntegTestCase.Scope.TEST, numDataNodes = 1)
-public class DeleteIndexedScriptIntegrationTest extends AbstractIntegrationTest {
+public class DeleteStoredScriptIntegrationTest extends AbstractIntegrationTest {
 
     private static final String A_SCRIPT_NAME = "script-test";
 
+    String script = "{\n" +
+            "          \"script\": {\n" +
+            "              \"lang\" : \"painless\",\n" +
+            "              \"source\" : \"int aVariable = 1; return aVariable\"\n" +
+            "            }\n" +
+            "        }";
     @Test
-    public void delete_an_indexed_script_for_Groovy() throws Exception {
+    public void delete_a_stored_script_for_Painless() throws Exception {
         PutStoredScriptResponse response = client().admin().cluster().preparePutStoredScript()
-                .setLang("painless")
                 .setId(A_SCRIPT_NAME)
-                .setContent(new BytesArray("{\"script\":\"int aVariable = 1; return aVariable\"}"), XContentType.JSON).get();
-        assertTrue("could not create indexed script on server", response.isAcknowledged());
+                .setContent(new BytesArray(script), XContentType.JSON).get();
+        assertTrue("could not create stored script on server", response.isAcknowledged());
 
-        DeleteStoredScript deleteIndexedScript = new DeleteStoredScript.Builder(A_SCRIPT_NAME)
+        DeleteStoredScript deleteStoredScript = new DeleteStoredScript.Builder(A_SCRIPT_NAME)
                 .setLanguage(ScriptLanguage.PAINLESS)
                 .build();
-        JestResult result = client.execute(deleteIndexedScript);
+        JestResult result = client.execute(deleteStoredScript);
         assertTrue(result.getErrorMessage(), result.isSucceeded());
 
-        GetStoredScriptResponse getIndexedScriptResponse =
+        GetStoredScriptResponse getStoredScriptResponse =
                 client().admin().cluster().prepareGetStoredScript()
-                        .setLang("painless")
                         .setId(A_SCRIPT_NAME).get();
-        assertNull("Script should have been deleted", getIndexedScriptResponse.getSource());
+        assertNull("Script should have been deleted", getStoredScriptResponse.getSource());
     }
 }
 
diff --git a/jest/src/test/java/io/searchbox/indices/script/GetIndexedScriptIntegrationTest.java b/jest/src/test/java/io/searchbox/indices/script/GetIndexedScriptIntegrationTest.java
deleted file mode 100644
index 67bc5829..00000000
--- a/jest/src/test/java/io/searchbox/indices/script/GetIndexedScriptIntegrationTest.java
+++ /dev/null
@@ -1,30 +0,0 @@
-package io.searchbox.indices.script;
-
-import io.searchbox.client.JestResult;
-import io.searchbox.common.AbstractIntegrationTest;
-import org.elasticsearch.action.admin.cluster.storedscripts.PutStoredScriptResponse;
-import org.elasticsearch.common.bytes.BytesArray;
-import org.elasticsearch.common.xcontent.XContentType;
-import org.junit.Test;
-
-import java.io.IOException;
-
-public class GetIndexedScriptIntegrationTest extends AbstractIntegrationTest {
-
-    @Test
-    public void createIndexedScript() throws IOException {
-        String name = "mylilscript";
-
-        PutStoredScriptResponse response = client().admin().cluster().preparePutStoredScript().setId(name)
-                .setLang(ScriptLanguage.PAINLESS.pathParameterName)
-                .setContent(new BytesArray("{\"script\": \"return 42;\"}"), XContentType.JSON).get();
-        assertTrue("could not create indexed script on server", response.isAcknowledged());
-
-        GetStoredScript getIndexedScript = new GetStoredScript.Builder(name)
-                .setLanguage(ScriptLanguage.PAINLESS)
-                .build();
-        JestResult result = client.execute(getIndexedScript);
-        assertTrue(result.getErrorMessage(), result.isSucceeded());
-    }
-
-}
\ No newline at end of file
diff --git a/jest/src/test/java/io/searchbox/indices/script/GetStoredScriptIntegrationTest.java b/jest/src/test/java/io/searchbox/indices/script/GetStoredScriptIntegrationTest.java
new file mode 100644
index 00000000..bd780768
--- /dev/null
+++ b/jest/src/test/java/io/searchbox/indices/script/GetStoredScriptIntegrationTest.java
@@ -0,0 +1,36 @@
+package io.searchbox.indices.script;
+
+import io.searchbox.client.JestResult;
+import io.searchbox.common.AbstractIntegrationTest;
+import org.elasticsearch.action.admin.cluster.storedscripts.PutStoredScriptResponse;
+import org.elasticsearch.common.bytes.BytesArray;
+import org.elasticsearch.common.xcontent.XContentType;
+import org.junit.Test;
+
+import java.io.IOException;
+
+public class GetStoredScriptIntegrationTest extends AbstractIntegrationTest {
+
+    private static final String lang = ScriptLanguage.PAINLESS.pathParameterName;
+    private static final String SCRIPT =
+            "{" +
+                    "    \"script\": {" +
+                    "       \"lang\": \"" + lang + "\"," +
+                    "       \"source\": \"return 42;\"}" +
+                    "}";
+
+    @Test
+    public void createStoredScript() throws IOException {
+        String name = "mylilscript";
+
+        PutStoredScriptResponse response = client().admin().cluster().preparePutStoredScript().setId(name)
+                .setContent(new BytesArray(SCRIPT), XContentType.JSON).get();
+        assertTrue("could not create stored script on server", response.isAcknowledged());
+
+        GetStoredScript getStoredScript = new GetStoredScript.Builder(name)
+                .setLanguage(ScriptLanguage.PAINLESS)
+                .build();
+        JestResult result = client.execute(getStoredScript);
+        assertTrue(result.getErrorMessage(), result.isSucceeded());
+    }
+}
\ No newline at end of file
diff --git a/jest/src/test/java/io/searchbox/indices/type/TypeExistIntegrationTest.java b/jest/src/test/java/io/searchbox/indices/type/TypeExistIntegrationTest.java
index c2aeaf27..6f15278d 100644
--- a/jest/src/test/java/io/searchbox/indices/type/TypeExistIntegrationTest.java
+++ b/jest/src/test/java/io/searchbox/indices/type/TypeExistIntegrationTest.java
@@ -6,6 +6,7 @@ import io.searchbox.common.AbstractIntegrationTest;
 import org.elasticsearch.action.index.IndexRequest;
 import org.elasticsearch.action.index.IndexResponse;
 import org.elasticsearch.action.support.WriteRequest;
+import org.elasticsearch.common.xcontent.XContentType;
 import org.elasticsearch.test.ESIntegTestCase;
 import org.junit.Before;
 import org.junit.Test;
@@ -36,7 +37,7 @@ public class TypeExistIntegrationTest extends AbstractIntegrationTest {
     public void indexTypeExists() throws IOException, InterruptedException {
         IndexResponse indexResponse = client().index(
                 new IndexRequest(INDEX_NAME, EXISTING_INDEX_TYPE)
-                        .source("{\"user\":\"tweety\"}")
+                        .source("{\"user\":\"tweety\"}", XContentType.JSON)
                         .setRefreshPolicy(WriteRequest.RefreshPolicy.IMMEDIATE)
         ).actionGet();
         assertTrue(indexResponse.getResult().equals(CREATED));