diff --git a/modules/benchmark/micro/src/main/java/org/elasticsearch/benchmark/stress/SingleThreadIndexingStress.java b/modules/benchmark/micro/src/main/java/org/elasticsearch/benchmark/stress/SingleThreadIndexingStress.java
index 9c184538c3847..13a10d7f22b73 100644
--- a/modules/benchmark/micro/src/main/java/org/elasticsearch/benchmark/stress/SingleThreadIndexingStress.java
+++ b/modules/benchmark/micro/src/main/java/org/elasticsearch/benchmark/stress/SingleThreadIndexingStress.java
@@ -23,7 +23,7 @@
import org.elasticsearch.client.Client;
import org.elasticsearch.common.StopWatch;
import org.elasticsearch.common.settings.Settings;
-import org.elasticsearch.common.xcontent.builder.XContentBuilder;
+import org.elasticsearch.common.xcontent.XContentBuilder;
import org.elasticsearch.node.Node;
import java.io.IOException;
diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/action/admin/indices/create/CreateIndexRequest.java b/modules/elasticsearch/src/main/java/org/elasticsearch/action/admin/indices/create/CreateIndexRequest.java
index 5c481b434472a..1a01564102a9b 100644
--- a/modules/elasticsearch/src/main/java/org/elasticsearch/action/admin/indices/create/CreateIndexRequest.java
+++ b/modules/elasticsearch/src/main/java/org/elasticsearch/action/admin/indices/create/CreateIndexRequest.java
@@ -28,10 +28,9 @@
import org.elasticsearch.common.settings.ImmutableSettings;
import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.common.unit.TimeValue;
+import org.elasticsearch.common.xcontent.XContentBuilder;
import org.elasticsearch.common.xcontent.XContentFactory;
import org.elasticsearch.common.xcontent.XContentType;
-import org.elasticsearch.common.xcontent.builder.TextXContentBuilder;
-import org.elasticsearch.common.xcontent.builder.XContentBuilder;
import java.io.IOException;
import java.util.Map;
@@ -141,7 +140,7 @@ public CreateIndexRequest settings(String source) {
*/
public CreateIndexRequest settings(Map source) {
try {
- TextXContentBuilder builder = XContentFactory.contentTextBuilder(XContentType.JSON);
+ XContentBuilder builder = XContentFactory.contentBuilder(XContentType.JSON);
builder.map(source);
settings(builder.string());
} catch (IOException e) {
@@ -192,7 +191,7 @@ public CreateIndexRequest mapping(String type, XContentBuilder source) {
*/
public CreateIndexRequest mapping(String type, Map source) {
try {
- TextXContentBuilder builder = XContentFactory.contentTextBuilder(XContentType.JSON);
+ XContentBuilder builder = XContentFactory.contentBuilder(XContentType.JSON);
builder.map(source);
return mapping(type, builder.string());
} catch (IOException e) {
diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/action/admin/indices/mapping/put/PutMappingRequest.java b/modules/elasticsearch/src/main/java/org/elasticsearch/action/admin/indices/mapping/put/PutMappingRequest.java
index 56f264bf03c06..2b0e2a808d8b1 100644
--- a/modules/elasticsearch/src/main/java/org/elasticsearch/action/admin/indices/mapping/put/PutMappingRequest.java
+++ b/modules/elasticsearch/src/main/java/org/elasticsearch/action/admin/indices/mapping/put/PutMappingRequest.java
@@ -27,10 +27,9 @@
import org.elasticsearch.common.io.stream.StreamInput;
import org.elasticsearch.common.io.stream.StreamOutput;
import org.elasticsearch.common.unit.TimeValue;
+import org.elasticsearch.common.xcontent.XContentBuilder;
import org.elasticsearch.common.xcontent.XContentFactory;
import org.elasticsearch.common.xcontent.XContentType;
-import org.elasticsearch.common.xcontent.builder.TextXContentBuilder;
-import org.elasticsearch.common.xcontent.builder.XContentBuilder;
import java.io.IOException;
import java.util.Map;
@@ -137,7 +136,7 @@ String source() {
*/
@Required public PutMappingRequest source(Map mappingSource) {
try {
- TextXContentBuilder builder = XContentFactory.contentTextBuilder(XContentType.JSON);
+ XContentBuilder builder = XContentFactory.contentBuilder(XContentType.JSON);
builder.map(mappingSource);
return source(builder.string());
} catch (IOException e) {
diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/action/admin/indices/settings/UpdateSettingsRequest.java b/modules/elasticsearch/src/main/java/org/elasticsearch/action/admin/indices/settings/UpdateSettingsRequest.java
index b9742323e3e81..e8c091d75acdc 100644
--- a/modules/elasticsearch/src/main/java/org/elasticsearch/action/admin/indices/settings/UpdateSettingsRequest.java
+++ b/modules/elasticsearch/src/main/java/org/elasticsearch/action/admin/indices/settings/UpdateSettingsRequest.java
@@ -26,9 +26,9 @@
import org.elasticsearch.common.io.stream.StreamOutput;
import org.elasticsearch.common.settings.ImmutableSettings;
import org.elasticsearch.common.settings.Settings;
+import org.elasticsearch.common.xcontent.XContentBuilder;
import org.elasticsearch.common.xcontent.XContentFactory;
import org.elasticsearch.common.xcontent.XContentType;
-import org.elasticsearch.common.xcontent.builder.TextXContentBuilder;
import java.io.IOException;
import java.util.Map;
@@ -114,7 +114,7 @@ public UpdateSettingsRequest settings(String source) {
*/
public UpdateSettingsRequest settings(Map source) {
try {
- TextXContentBuilder builder = XContentFactory.contentTextBuilder(XContentType.JSON);
+ XContentBuilder builder = XContentFactory.contentBuilder(XContentType.JSON);
builder.map(source);
settings(builder.string());
} catch (IOException e) {
diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/action/count/CountRequest.java b/modules/elasticsearch/src/main/java/org/elasticsearch/action/count/CountRequest.java
index 9e8592587a34e..338b074a87405 100644
--- a/modules/elasticsearch/src/main/java/org/elasticsearch/action/count/CountRequest.java
+++ b/modules/elasticsearch/src/main/java/org/elasticsearch/action/count/CountRequest.java
@@ -32,10 +32,9 @@
import org.elasticsearch.common.io.FastByteArrayOutputStream;
import org.elasticsearch.common.io.stream.StreamInput;
import org.elasticsearch.common.io.stream.StreamOutput;
+import org.elasticsearch.common.xcontent.XContentBuilder;
import org.elasticsearch.common.xcontent.XContentFactory;
import org.elasticsearch.common.xcontent.XContentType;
-import org.elasticsearch.common.xcontent.builder.BinaryXContentBuilder;
-import org.elasticsearch.common.xcontent.builder.XContentBuilder;
import org.elasticsearch.index.query.QueryBuilder;
import javax.annotation.Nullable;
@@ -184,7 +183,7 @@ int querySourceLength() {
*/
@Required public CountRequest query(Map querySource) {
try {
- BinaryXContentBuilder builder = XContentFactory.contentBinaryBuilder(contentType);
+ XContentBuilder builder = XContentFactory.contentBuilder(contentType);
builder.map(querySource);
return query(builder);
} catch (IOException e) {
diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/action/deletebyquery/DeleteByQueryRequest.java b/modules/elasticsearch/src/main/java/org/elasticsearch/action/deletebyquery/DeleteByQueryRequest.java
index b16f5342f5886..0176d657e9da3 100644
--- a/modules/elasticsearch/src/main/java/org/elasticsearch/action/deletebyquery/DeleteByQueryRequest.java
+++ b/modules/elasticsearch/src/main/java/org/elasticsearch/action/deletebyquery/DeleteByQueryRequest.java
@@ -32,10 +32,9 @@
import org.elasticsearch.common.io.stream.StreamInput;
import org.elasticsearch.common.io.stream.StreamOutput;
import org.elasticsearch.common.unit.TimeValue;
+import org.elasticsearch.common.xcontent.XContentBuilder;
import org.elasticsearch.common.xcontent.XContentFactory;
import org.elasticsearch.common.xcontent.XContentType;
-import org.elasticsearch.common.xcontent.builder.BinaryXContentBuilder;
-import org.elasticsearch.common.xcontent.builder.XContentBuilder;
import org.elasticsearch.index.query.QueryBuilder;
import java.io.IOException;
@@ -147,7 +146,7 @@ byte[] querySource() {
*/
@Required public DeleteByQueryRequest query(Map querySource) {
try {
- BinaryXContentBuilder builder = XContentFactory.contentBinaryBuilder(contentType);
+ XContentBuilder builder = XContentFactory.contentBuilder(contentType);
builder.map(querySource);
return query(builder);
} catch (IOException e) {
diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/action/get/GetResponse.java b/modules/elasticsearch/src/main/java/org/elasticsearch/action/get/GetResponse.java
index c83d17a8955c7..a1a14d56ecc2b 100644
--- a/modules/elasticsearch/src/main/java/org/elasticsearch/action/get/GetResponse.java
+++ b/modules/elasticsearch/src/main/java/org/elasticsearch/action/get/GetResponse.java
@@ -28,9 +28,9 @@
import org.elasticsearch.common.io.stream.StreamOutput;
import org.elasticsearch.common.io.stream.Streamable;
import org.elasticsearch.common.xcontent.ToXContent;
+import org.elasticsearch.common.xcontent.XContentBuilder;
import org.elasticsearch.common.xcontent.XContentFactory;
import org.elasticsearch.common.xcontent.XContentParser;
-import org.elasticsearch.common.xcontent.builder.XContentBuilder;
import org.elasticsearch.rest.action.support.RestXContentBuilder;
import java.io.IOException;
diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/action/index/IndexRequest.java b/modules/elasticsearch/src/main/java/org/elasticsearch/action/index/IndexRequest.java
index c4e07246cf232..3919cbe907ff5 100644
--- a/modules/elasticsearch/src/main/java/org/elasticsearch/action/index/IndexRequest.java
+++ b/modules/elasticsearch/src/main/java/org/elasticsearch/action/index/IndexRequest.java
@@ -30,10 +30,9 @@
import org.elasticsearch.common.io.stream.StreamInput;
import org.elasticsearch.common.io.stream.StreamOutput;
import org.elasticsearch.common.unit.TimeValue;
+import org.elasticsearch.common.xcontent.XContentBuilder;
import org.elasticsearch.common.xcontent.XContentFactory;
import org.elasticsearch.common.xcontent.XContentType;
-import org.elasticsearch.common.xcontent.builder.BinaryXContentBuilder;
-import org.elasticsearch.common.xcontent.builder.XContentBuilder;
import java.io.IOException;
import java.util.Arrays;
@@ -49,8 +48,8 @@
* {@link #source(byte[])} to be set.
*
*
The source (content to index) can be set in its bytes form using ({@link #source(byte[])}),
- * its string form ({@link #source(String)}) or using a {@link org.elasticsearch.common.xcontent.builder.XContentBuilder}
- * ({@link #source(org.elasticsearch.common.xcontent.builder.XContentBuilder)}).
+ * its string form ({@link #source(String)}) or using a {@link org.elasticsearch.common.xcontent.XContentBuilder}
+ * ({@link #source(org.elasticsearch.common.xcontent.XContentBuilder)}).
*
*
If the {@link #id(String)} is not set, it will be automatically generated.
*
@@ -238,7 +237,7 @@ byte[] source() {
*/
@Required public IndexRequest source(Map source, XContentType contentType) throws ElasticSearchGenerationException {
try {
- BinaryXContentBuilder builder = XContentFactory.contentBinaryBuilder(contentType);
+ XContentBuilder builder = XContentFactory.contentBuilder(contentType);
builder.map(source);
return source(builder);
} catch (IOException e) {
@@ -249,7 +248,7 @@ byte[] source() {
/**
* Sets the document source to index.
*
- *
Note, its preferable to either set it using {@link #source(org.elasticsearch.common.xcontent.builder.XContentBuilder)}
+ *
Note, its preferable to either set it using {@link #source(org.elasticsearch.common.xcontent.XContentBuilder)}
* or using the {@link #source(byte[])}.
*/
@Required public IndexRequest source(String source) {
diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/action/mlt/MoreLikeThisRequest.java b/modules/elasticsearch/src/main/java/org/elasticsearch/action/mlt/MoreLikeThisRequest.java
index 2760e4fe84756..e3bb532690dfe 100644
--- a/modules/elasticsearch/src/main/java/org/elasticsearch/action/mlt/MoreLikeThisRequest.java
+++ b/modules/elasticsearch/src/main/java/org/elasticsearch/action/mlt/MoreLikeThisRequest.java
@@ -34,10 +34,9 @@
import org.elasticsearch.common.io.FastByteArrayOutputStream;
import org.elasticsearch.common.io.stream.StreamInput;
import org.elasticsearch.common.io.stream.StreamOutput;
+import org.elasticsearch.common.xcontent.XContentBuilder;
import org.elasticsearch.common.xcontent.XContentFactory;
import org.elasticsearch.common.xcontent.XContentType;
-import org.elasticsearch.common.xcontent.builder.BinaryXContentBuilder;
-import org.elasticsearch.common.xcontent.builder.XContentBuilder;
import org.elasticsearch.search.Scroll;
import org.elasticsearch.search.builder.SearchSourceBuilder;
@@ -324,7 +323,7 @@ void beforeLocalFork() {
* more like this documents.
*/
public MoreLikeThisRequest searchSource(SearchSourceBuilder sourceBuilder) {
- FastByteArrayOutputStream bos = sourceBuilder.buildAsUnsafeBytes();
+ FastByteArrayOutputStream bos = sourceBuilder.buildAsUnsafeBytes(Requests.CONTENT_TYPE);
this.searchSource = bos.unsafeByteArray();
this.searchSourceOffset = 0;
this.searchSourceLength = bos.size();
@@ -347,7 +346,7 @@ public MoreLikeThisRequest searchSource(String searchSource) {
public MoreLikeThisRequest searchSource(Map searchSource) {
try {
- BinaryXContentBuilder builder = XContentFactory.contentBinaryBuilder(contentType);
+ XContentBuilder builder = XContentFactory.contentBuilder(contentType);
builder.map(searchSource);
return searchSource(builder);
} catch (IOException e) {
diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/action/search/SearchRequest.java b/modules/elasticsearch/src/main/java/org/elasticsearch/action/search/SearchRequest.java
index c241aa04807bd..d0b8b6ce3acb8 100644
--- a/modules/elasticsearch/src/main/java/org/elasticsearch/action/search/SearchRequest.java
+++ b/modules/elasticsearch/src/main/java/org/elasticsearch/action/search/SearchRequest.java
@@ -32,10 +32,9 @@
import org.elasticsearch.common.io.stream.StreamInput;
import org.elasticsearch.common.io.stream.StreamOutput;
import org.elasticsearch.common.unit.TimeValue;
+import org.elasticsearch.common.xcontent.XContentBuilder;
import org.elasticsearch.common.xcontent.XContentFactory;
import org.elasticsearch.common.xcontent.XContentType;
-import org.elasticsearch.common.xcontent.builder.BinaryXContentBuilder;
-import org.elasticsearch.common.xcontent.builder.XContentBuilder;
import org.elasticsearch.search.Scroll;
import org.elasticsearch.search.builder.SearchSourceBuilder;
@@ -217,7 +216,7 @@ public SearchRequest searchType(String searchType) throws ElasticSearchIllegalAr
* The source of the search request.
*/
public SearchRequest source(SearchSourceBuilder sourceBuilder) {
- FastByteArrayOutputStream bos = sourceBuilder.buildAsUnsafeBytes();
+ FastByteArrayOutputStream bos = sourceBuilder.buildAsUnsafeBytes(Requests.CONTENT_TYPE);
this.source = bos.unsafeByteArray();
this.sourceOffset = 0;
this.sourceLength = bos.size();
@@ -243,7 +242,7 @@ public SearchRequest source(String source) {
*/
public SearchRequest source(Map source) {
try {
- BinaryXContentBuilder builder = XContentFactory.contentBinaryBuilder(contentType);
+ XContentBuilder builder = XContentFactory.contentBuilder(contentType);
builder.map(source);
return source(builder);
} catch (IOException e) {
@@ -300,7 +299,7 @@ public int sourceLength() {
* Allows to provide additional source that will be used as well.
*/
public SearchRequest extraSource(SearchSourceBuilder sourceBuilder) {
- FastByteArrayOutputStream bos = sourceBuilder.buildAsUnsafeBytes();
+ FastByteArrayOutputStream bos = sourceBuilder.buildAsUnsafeBytes(Requests.CONTENT_TYPE);
this.extraSource = bos.unsafeByteArray();
this.extraSourceOffset = 0;
this.extraSourceLength = bos.size();
@@ -310,7 +309,7 @@ public SearchRequest extraSource(SearchSourceBuilder sourceBuilder) {
public SearchRequest extraSource(Map extraSource) {
try {
- BinaryXContentBuilder builder = XContentFactory.contentBinaryBuilder(contentType);
+ XContentBuilder builder = XContentFactory.contentBuilder(contentType);
builder.map(extraSource);
return extraSource(builder);
} catch (IOException e) {
diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/action/search/SearchResponse.java b/modules/elasticsearch/src/main/java/org/elasticsearch/action/search/SearchResponse.java
index 39eca55bedd86..8b32311ed9ca7 100644
--- a/modules/elasticsearch/src/main/java/org/elasticsearch/action/search/SearchResponse.java
+++ b/modules/elasticsearch/src/main/java/org/elasticsearch/action/search/SearchResponse.java
@@ -23,7 +23,7 @@
import org.elasticsearch.common.io.stream.StreamInput;
import org.elasticsearch.common.io.stream.StreamOutput;
import org.elasticsearch.common.xcontent.ToXContent;
-import org.elasticsearch.common.xcontent.builder.XContentBuilder;
+import org.elasticsearch.common.xcontent.XContentBuilder;
import org.elasticsearch.search.SearchHits;
import org.elasticsearch.search.facets.Facets;
import org.elasticsearch.search.internal.InternalSearchResponse;
diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/client/Requests.java b/modules/elasticsearch/src/main/java/org/elasticsearch/client/Requests.java
index b551e1e589a84..87eaf168bc538 100644
--- a/modules/elasticsearch/src/main/java/org/elasticsearch/client/Requests.java
+++ b/modules/elasticsearch/src/main/java/org/elasticsearch/client/Requests.java
@@ -59,7 +59,7 @@ public class Requests {
/**
* The content type used to generate request builders (query / search).
*/
- public static XContentType CONTENT_TYPE = XContentType.XSON;
+ public static XContentType CONTENT_TYPE = XContentType.SMILE;
public static IndexRequest indexRequest() {
return new IndexRequest();
diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/client/action/admin/indices/create/CreateIndexRequestBuilder.java b/modules/elasticsearch/src/main/java/org/elasticsearch/client/action/admin/indices/create/CreateIndexRequestBuilder.java
index 4035418923ff7..dc60ffc32db87 100644
--- a/modules/elasticsearch/src/main/java/org/elasticsearch/client/action/admin/indices/create/CreateIndexRequestBuilder.java
+++ b/modules/elasticsearch/src/main/java/org/elasticsearch/client/action/admin/indices/create/CreateIndexRequestBuilder.java
@@ -26,7 +26,7 @@
import org.elasticsearch.client.action.admin.indices.support.BaseIndicesRequestBuilder;
import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.common.unit.TimeValue;
-import org.elasticsearch.common.xcontent.builder.XContentBuilder;
+import org.elasticsearch.common.xcontent.XContentBuilder;
import java.util.Map;
diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/client/action/admin/indices/mapping/put/PutMappingRequestBuilder.java b/modules/elasticsearch/src/main/java/org/elasticsearch/client/action/admin/indices/mapping/put/PutMappingRequestBuilder.java
index f05ffa54bc686..76d1b07d0a240 100644
--- a/modules/elasticsearch/src/main/java/org/elasticsearch/client/action/admin/indices/mapping/put/PutMappingRequestBuilder.java
+++ b/modules/elasticsearch/src/main/java/org/elasticsearch/client/action/admin/indices/mapping/put/PutMappingRequestBuilder.java
@@ -25,7 +25,7 @@
import org.elasticsearch.client.IndicesAdminClient;
import org.elasticsearch.client.action.admin.indices.support.BaseIndicesRequestBuilder;
import org.elasticsearch.common.unit.TimeValue;
-import org.elasticsearch.common.xcontent.builder.XContentBuilder;
+import org.elasticsearch.common.xcontent.XContentBuilder;
import java.util.Map;
diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/client/action/deletebyquery/DeleteByQueryRequestBuilder.java b/modules/elasticsearch/src/main/java/org/elasticsearch/client/action/deletebyquery/DeleteByQueryRequestBuilder.java
index 08deeec3d401a..3ea71617ade74 100644
--- a/modules/elasticsearch/src/main/java/org/elasticsearch/client/action/deletebyquery/DeleteByQueryRequestBuilder.java
+++ b/modules/elasticsearch/src/main/java/org/elasticsearch/client/action/deletebyquery/DeleteByQueryRequestBuilder.java
@@ -26,7 +26,7 @@
import org.elasticsearch.client.Client;
import org.elasticsearch.client.action.support.BaseRequestBuilder;
import org.elasticsearch.common.unit.TimeValue;
-import org.elasticsearch.common.xcontent.builder.XContentBuilder;
+import org.elasticsearch.common.xcontent.XContentBuilder;
import org.elasticsearch.index.query.QueryBuilder;
import java.util.Map;
diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/client/action/index/IndexRequestBuilder.java b/modules/elasticsearch/src/main/java/org/elasticsearch/client/action/index/IndexRequestBuilder.java
index 4e5baf2089221..c617398db5671 100644
--- a/modules/elasticsearch/src/main/java/org/elasticsearch/client/action/index/IndexRequestBuilder.java
+++ b/modules/elasticsearch/src/main/java/org/elasticsearch/client/action/index/IndexRequestBuilder.java
@@ -26,8 +26,8 @@
import org.elasticsearch.client.Client;
import org.elasticsearch.client.action.support.BaseRequestBuilder;
import org.elasticsearch.common.unit.TimeValue;
+import org.elasticsearch.common.xcontent.XContentBuilder;
import org.elasticsearch.common.xcontent.XContentType;
-import org.elasticsearch.common.xcontent.builder.XContentBuilder;
import javax.annotation.Nullable;
import java.util.Map;
@@ -91,7 +91,7 @@ public IndexRequestBuilder setSource(Map source, XContentType co
/**
* Sets the document source to index.
*
- * Note, its preferable to either set it using {@link #setSource(org.elasticsearch.common.xcontent.builder.XContentBuilder)}
+ *
Note, its preferable to either set it using {@link #setSource(org.elasticsearch.common.xcontent.XContentBuilder)}
* or using the {@link #setSource(byte[])}.
*/
public IndexRequestBuilder setSource(String source) {
diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/cluster/block/ClusterBlock.java b/modules/elasticsearch/src/main/java/org/elasticsearch/cluster/block/ClusterBlock.java
index 46faeebcabd25..f43892a780576 100644
--- a/modules/elasticsearch/src/main/java/org/elasticsearch/cluster/block/ClusterBlock.java
+++ b/modules/elasticsearch/src/main/java/org/elasticsearch/cluster/block/ClusterBlock.java
@@ -23,7 +23,7 @@
import org.elasticsearch.common.io.stream.StreamOutput;
import org.elasticsearch.common.io.stream.Streamable;
import org.elasticsearch.common.xcontent.ToXContent;
-import org.elasticsearch.common.xcontent.builder.XContentBuilder;
+import org.elasticsearch.common.xcontent.XContentBuilder;
import java.io.IOException;
import java.io.Serializable;
diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/cluster/metadata/IndexMetaData.java b/modules/elasticsearch/src/main/java/org/elasticsearch/cluster/metadata/IndexMetaData.java
index 0ceeec3bddc81..9ea26d18f51ca 100644
--- a/modules/elasticsearch/src/main/java/org/elasticsearch/cluster/metadata/IndexMetaData.java
+++ b/modules/elasticsearch/src/main/java/org/elasticsearch/cluster/metadata/IndexMetaData.java
@@ -30,9 +30,9 @@
import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.common.util.concurrent.Immutable;
import org.elasticsearch.common.xcontent.ToXContent;
+import org.elasticsearch.common.xcontent.XContentBuilder;
import org.elasticsearch.common.xcontent.XContentFactory;
import org.elasticsearch.common.xcontent.XContentParser;
-import org.elasticsearch.common.xcontent.builder.XContentBuilder;
import javax.annotation.Nullable;
import java.io.IOException;
diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/cluster/metadata/IndexerMetaData.java b/modules/elasticsearch/src/main/java/org/elasticsearch/cluster/metadata/IndexerMetaData.java
new file mode 100644
index 0000000000000..5a252c75e6d08
--- /dev/null
+++ b/modules/elasticsearch/src/main/java/org/elasticsearch/cluster/metadata/IndexerMetaData.java
@@ -0,0 +1,140 @@
+/*
+ * Licensed to Elastic Search and Shay Banon under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. Elastic Search licenses this
+ * file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.elasticsearch.cluster.metadata;
+
+import org.elasticsearch.common.io.stream.StreamInput;
+import org.elasticsearch.common.io.stream.StreamOutput;
+import org.elasticsearch.common.settings.ImmutableSettings;
+import org.elasticsearch.common.settings.Settings;
+import org.elasticsearch.common.xcontent.ToXContent;
+import org.elasticsearch.common.xcontent.XContentBuilder;
+import org.elasticsearch.common.xcontent.XContentParser;
+import org.elasticsearch.indexer.IndexerName;
+
+import javax.annotation.Nullable;
+import java.io.IOException;
+import java.util.Map;
+
+/**
+ * @author kimchy (shay.banon)
+ */
+public class IndexerMetaData {
+
+ private final IndexerName indexerName;
+
+ private final Settings settings;
+
+ private IndexerMetaData(IndexerName indexerName, Settings settings) {
+ this.indexerName = indexerName;
+ this.settings = settings;
+ }
+
+ public IndexerName indexerName() {
+ return indexerName;
+ }
+
+ public Settings settings() {
+ return settings;
+ }
+
+ public static class Builder {
+
+ private IndexerName indexerName;
+
+ private Settings settings = ImmutableSettings.Builder.EMPTY_SETTINGS;
+
+ public Builder(IndexerName indexerName) {
+ this.indexerName = indexerName;
+ }
+
+ public Builder settings(Settings.Builder settings) {
+ this.settings = settings.build();
+ return this;
+ }
+
+ public Builder settings(Settings settings) {
+ this.settings = settings;
+ return this;
+ }
+
+ public IndexerMetaData build() {
+ return new IndexerMetaData(indexerName, settings);
+ }
+
+ public static void toXContent(IndexerMetaData indexerMetaData, XContentBuilder builder, ToXContent.Params params) throws IOException {
+ builder.startObject(indexerMetaData.indexerName().name());
+
+ builder.field("type", indexerMetaData.indexerName().type());
+
+ builder.startObject("settings");
+ for (Map.Entry entry : indexerMetaData.settings().getAsMap().entrySet()) {
+ builder.field(entry.getKey(), entry.getValue());
+ }
+ builder.endObject();
+
+ builder.endObject();
+ }
+
+ public static IndexerMetaData fromXContent(XContentParser parser, @Nullable Settings globalSettings) throws IOException {
+ String name = parser.currentName();
+ ImmutableSettings.Builder settingsBuilder = null;
+ String type = null;
+
+ String currentFieldName = null;
+ XContentParser.Token token = parser.nextToken();
+ while ((token = parser.nextToken()) != XContentParser.Token.END_OBJECT) {
+ if (token == XContentParser.Token.FIELD_NAME) {
+ currentFieldName = parser.currentName();
+ } else if (token == XContentParser.Token.START_OBJECT) {
+ if ("settings".equals(currentFieldName)) {
+ settingsBuilder = ImmutableSettings.settingsBuilder().globalSettings(globalSettings);
+ while ((token = parser.nextToken()) != XContentParser.Token.END_OBJECT) {
+ String key = parser.currentName();
+ token = parser.nextToken();
+ String value = parser.text();
+ settingsBuilder.put(key, value);
+ }
+ }
+ } else if (token.isValue()) {
+ if ("type".equals(currentFieldName)) {
+ type = parser.text();
+ }
+ }
+ }
+ Builder builder = new Builder(new IndexerName(name, type));
+ if (settingsBuilder != null) {
+ builder.settings(settingsBuilder);
+ }
+ return builder.build();
+ }
+
+ public static IndexerMetaData readFrom(StreamInput in, Settings globalSettings) throws IOException {
+ Builder builder = new Builder(new IndexerName(in.readUTF(), in.readUTF()));
+ builder.settings(ImmutableSettings.readSettingsFromStream(in, globalSettings));
+ return builder.build();
+ }
+
+ public static void writeTo(IndexerMetaData indexerMetaData, StreamOutput out) throws IOException {
+ out.writeUTF(indexerMetaData.indexerName().type());
+ out.writeUTF(indexerMetaData.indexerName().name());
+ ImmutableSettings.writeSettingsToStream(indexerMetaData.settings(), out);
+ }
+ }
+}
diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/cluster/metadata/MetaData.java b/modules/elasticsearch/src/main/java/org/elasticsearch/cluster/metadata/MetaData.java
index 669e5a4c57eec..b9f968734baeb 100644
--- a/modules/elasticsearch/src/main/java/org/elasticsearch/cluster/metadata/MetaData.java
+++ b/modules/elasticsearch/src/main/java/org/elasticsearch/cluster/metadata/MetaData.java
@@ -25,12 +25,7 @@
import org.elasticsearch.common.io.stream.StreamOutput;
import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.common.util.concurrent.Immutable;
-import org.elasticsearch.common.xcontent.ToXContent;
-import org.elasticsearch.common.xcontent.XContentFactory;
-import org.elasticsearch.common.xcontent.XContentParser;
-import org.elasticsearch.common.xcontent.XContentType;
-import org.elasticsearch.common.xcontent.builder.TextXContentBuilder;
-import org.elasticsearch.common.xcontent.builder.XContentBuilder;
+import org.elasticsearch.common.xcontent.*;
import org.elasticsearch.index.Index;
import org.elasticsearch.indices.IndexMissingException;
@@ -281,7 +276,7 @@ public MetaData build() {
}
public static String toXContent(MetaData metaData) throws IOException {
- TextXContentBuilder builder = XContentFactory.contentTextBuilder(XContentType.JSON);
+ XContentBuilder builder = XContentFactory.contentBuilder(XContentType.JSON);
builder.startObject();
toXContent(metaData, builder, ToXContent.EMPTY_PARAMS);
builder.endObject();
diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/common/Bytes.java b/modules/elasticsearch/src/main/java/org/elasticsearch/common/Bytes.java
index 0bfb08a5cf4d1..97324ad9e34f5 100644
--- a/modules/elasticsearch/src/main/java/org/elasticsearch/common/Bytes.java
+++ b/modules/elasticsearch/src/main/java/org/elasticsearch/common/Bytes.java
@@ -28,7 +28,7 @@ public class Bytes {
public static ThreadLocal> cachedBytes = new ThreadLocal>() {
@Override protected ThreadLocals.CleanableValue initialValue() {
- return new ThreadLocals.CleanableValue(new byte[256]);
+ return new ThreadLocals.CleanableValue(new byte[1024]);
}
};
diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/common/io/FastByteArrayOutputStream.java b/modules/elasticsearch/src/main/java/org/elasticsearch/common/io/FastByteArrayOutputStream.java
index eeb97fc88d2e4..fdf1fa96fd876 100644
--- a/modules/elasticsearch/src/main/java/org/elasticsearch/common/io/FastByteArrayOutputStream.java
+++ b/modules/elasticsearch/src/main/java/org/elasticsearch/common/io/FastByteArrayOutputStream.java
@@ -178,6 +178,13 @@ public int size() {
return count;
}
+ /**
+ * Seeks back to the given position. Size will become the seeked location.
+ */
+ public void seek(int position) {
+ this.count = position;
+ }
+
/**
* Converts the buffer's contents into a string decoding bytes using the
* platform's default character set. The length of the new String
diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/common/xcontent/ToXContent.java b/modules/elasticsearch/src/main/java/org/elasticsearch/common/xcontent/ToXContent.java
index 66deb4be35d88..9f745d5919ac5 100644
--- a/modules/elasticsearch/src/main/java/org/elasticsearch/common/xcontent/ToXContent.java
+++ b/modules/elasticsearch/src/main/java/org/elasticsearch/common/xcontent/ToXContent.java
@@ -20,13 +20,12 @@
package org.elasticsearch.common.xcontent;
import org.elasticsearch.common.Booleans;
-import org.elasticsearch.common.xcontent.builder.XContentBuilder;
import java.io.IOException;
import java.util.Map;
/**
- * An interface allowing to transfer an object to "XContent" using an {@link org.elasticsearch.common.xcontent.builder.XContentBuilder}.
+ * An interface allowing to transfer an object to "XContent" using an {@link XContentBuilder}.
*
* @author kimchy (shay.banon)
*/
diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/common/xcontent/builder/XContentBuilder.java b/modules/elasticsearch/src/main/java/org/elasticsearch/common/xcontent/XContentBuilder.java
similarity index 54%
rename from modules/elasticsearch/src/main/java/org/elasticsearch/common/xcontent/builder/XContentBuilder.java
rename to modules/elasticsearch/src/main/java/org/elasticsearch/common/xcontent/XContentBuilder.java
index 687f2b7dec5f3..5675f1f41b37b 100644
--- a/modules/elasticsearch/src/main/java/org/elasticsearch/common/xcontent/builder/XContentBuilder.java
+++ b/modules/elasticsearch/src/main/java/org/elasticsearch/common/xcontent/XContentBuilder.java
@@ -17,15 +17,15 @@
* under the License.
*/
-package org.elasticsearch.common.xcontent.builder;
+package org.elasticsearch.common.xcontent;
import org.elasticsearch.common.Strings;
+import org.elasticsearch.common.Unicode;
+import org.elasticsearch.common.io.FastByteArrayOutputStream;
import org.elasticsearch.common.joda.time.DateTimeZone;
import org.elasticsearch.common.joda.time.ReadableInstant;
import org.elasticsearch.common.joda.time.format.DateTimeFormatter;
import org.elasticsearch.common.joda.time.format.ISODateTimeFormat;
-import org.elasticsearch.common.xcontent.XContentGenerator;
-import org.elasticsearch.common.xcontent.XContentType;
import org.elasticsearch.common.xcontent.support.XContentMapConverter;
import java.io.IOException;
@@ -37,7 +37,7 @@
/**
* @author kimchy (shay.banon)
*/
-public abstract class XContentBuilder {
+public final class XContentBuilder {
public static enum FieldCaseConversion {
/**
@@ -62,168 +62,187 @@ public static void globalFieldCaseConversion(FieldCaseConversion globalFieldCase
XContentBuilder.globalFieldCaseConversion = globalFieldCaseConversion;
}
- protected XContentGenerator generator;
+ private XContentGenerator generator;
- protected T builder;
+ private final FastByteArrayOutputStream bos;
- protected FieldCaseConversion fieldCaseConversion = globalFieldCaseConversion;
+ private FieldCaseConversion fieldCaseConversion = globalFieldCaseConversion;
- protected StringBuilder cachedStringBuilder = new StringBuilder();
+ private StringBuilder cachedStringBuilder;
- public T fieldCaseConversion(FieldCaseConversion fieldCaseConversion) {
+ public static XContentBuilder cachedBuilder(XContent xContent) throws IOException {
+ return new XContentBuilder(FastByteArrayOutputStream.Cached.cached(), xContent);
+ }
+
+ public static XContentBuilder builder(XContent xContent) throws IOException {
+ return new XContentBuilder(new FastByteArrayOutputStream(), xContent);
+ }
+
+ public XContentBuilder(FastByteArrayOutputStream bos, XContent xContent) throws IOException {
+ this.bos = bos;
+ this.generator = xContent.createGenerator(bos);
+ }
+
+ public XContentBuilder fieldCaseConversion(FieldCaseConversion fieldCaseConversion) {
this.fieldCaseConversion = fieldCaseConversion;
- return builder;
+ return this;
}
public XContentType contentType() {
return generator.contentType();
}
- public T prettyPrint() {
+ public XContentBuilder prettyPrint() {
generator.usePrettyPrint();
- return builder;
+ return this;
}
- public T startObject(String name) throws IOException {
+ public XContentBuilder startObject(String name) throws IOException {
field(name);
startObject();
- return builder;
+ return this;
}
- public T startObject() throws IOException {
+ public XContentBuilder startObject() throws IOException {
generator.writeStartObject();
- return builder;
+ return this;
}
- public T endObject() throws IOException {
+ public XContentBuilder endObject() throws IOException {
generator.writeEndObject();
- return builder;
+ return this;
}
- public T array(String name, String... values) throws IOException {
+ public XContentBuilder array(String name, String... values) throws IOException {
startArray(name);
for (String value : values) {
value(value);
}
endArray();
- return builder;
+ return this;
}
- public T array(String name, Object... values) throws IOException {
+ public XContentBuilder array(String name, Object... values) throws IOException {
startArray(name);
for (Object value : values) {
value(value);
}
endArray();
- return builder;
+ return this;
}
- public T startArray(String name) throws IOException {
+ public XContentBuilder startArray(String name) throws IOException {
field(name);
startArray();
- return builder;
+ return this;
}
- public T startArray() throws IOException {
+ public XContentBuilder startArray() throws IOException {
generator.writeStartArray();
- return builder;
+ return this;
}
- public T endArray() throws IOException {
+ public XContentBuilder endArray() throws IOException {
generator.writeEndArray();
- return builder;
+ return this;
}
- public T field(String name) throws IOException {
+ public XContentBuilder field(String name) throws IOException {
if (fieldCaseConversion == FieldCaseConversion.UNDERSCORE) {
+ if (cachedStringBuilder == null) {
+ cachedStringBuilder = new StringBuilder();
+ }
name = Strings.toUnderscoreCase(name, cachedStringBuilder);
} else if (fieldCaseConversion == FieldCaseConversion.CAMELCASE) {
+ if (cachedStringBuilder == null) {
+ cachedStringBuilder = new StringBuilder();
+ }
name = Strings.toCamelCase(name, cachedStringBuilder);
}
generator.writeFieldName(name);
- return builder;
+ return this;
}
- public T field(String name, char[] value, int offset, int length) throws IOException {
+ public XContentBuilder field(String name, char[] value, int offset, int length) throws IOException {
field(name);
if (value == null) {
generator.writeNull();
} else {
generator.writeString(value, offset, length);
}
- return builder;
+ return this;
}
- public T field(String name, String value) throws IOException {
+ public XContentBuilder field(String name, String value) throws IOException {
field(name);
if (value == null) {
generator.writeNull();
} else {
generator.writeString(value);
}
- return builder;
+ return this;
}
- public T field(String name, Integer value) throws IOException {
+ public XContentBuilder field(String name, Integer value) throws IOException {
return field(name, value.intValue());
}
- public T field(String name, int value) throws IOException {
+ public XContentBuilder field(String name, int value) throws IOException {
field(name);
generator.writeNumber(value);
- return builder;
+ return this;
}
- public T field(String name, Long value) throws IOException {
+ public XContentBuilder field(String name, Long value) throws IOException {
return field(name, value.longValue());
}
- public T field(String name, long value) throws IOException {
+ public XContentBuilder field(String name, long value) throws IOException {
field(name);
generator.writeNumber(value);
- return builder;
+ return this;
}
- public T field(String name, Float value) throws IOException {
+ public XContentBuilder field(String name, Float value) throws IOException {
return field(name, value.floatValue());
}
- public T field(String name, float value) throws IOException {
+ public XContentBuilder field(String name, float value) throws IOException {
field(name);
generator.writeNumber(value);
- return builder;
+ return this;
}
- public T field(String name, Double value) throws IOException {
+ public XContentBuilder field(String name, Double value) throws IOException {
return field(name, value.doubleValue());
}
- public T field(String name, double value) throws IOException {
+ public XContentBuilder field(String name, double value) throws IOException {
field(name);
generator.writeNumber(value);
- return builder;
+ return this;
}
- public T field(String name, Map value) throws IOException {
+ public XContentBuilder field(String name, Map value) throws IOException {
field(name);
value(value);
- return builder;
+ return this;
}
- public T field(String name, List value) throws IOException {
+ public XContentBuilder field(String name, List value) throws IOException {
startArray(name);
for (Object o : value) {
value(o);
}
endArray();
- return builder;
+ return this;
}
- public T field(String name, Object value) throws IOException {
+ public XContentBuilder field(String name, Object value) throws IOException {
if (value == null) {
nullField(name);
- return builder;
+ return this;
}
Class type = value.getClass();
if (type == String.class) {
@@ -251,147 +270,143 @@ public T field(String name, Object value) throws IOException {
} else {
field(name, value.toString());
}
- return builder;
+ return this;
}
- public T field(String name, boolean value) throws IOException {
+ public XContentBuilder field(String name, boolean value) throws IOException {
field(name);
generator.writeBoolean(value);
- return builder;
+ return this;
}
- public T field(String name, byte[] value) throws IOException {
+ public XContentBuilder field(String name, byte[] value) throws IOException {
field(name);
generator.writeBinary(value);
- return builder;
+ return this;
}
- public T field(String name, ReadableInstant date) throws IOException {
+ public XContentBuilder field(String name, ReadableInstant date) throws IOException {
field(name);
return value(date);
}
- public T field(String name, ReadableInstant date, DateTimeFormatter formatter) throws IOException {
+ public XContentBuilder field(String name, ReadableInstant date, DateTimeFormatter formatter) throws IOException {
field(name);
return value(date, formatter);
}
- public T field(String name, Date date) throws IOException {
+ public XContentBuilder field(String name, Date date) throws IOException {
field(name);
return value(date);
}
- public T field(String name, Date date, DateTimeFormatter formatter) throws IOException {
+ public XContentBuilder field(String name, Date date, DateTimeFormatter formatter) throws IOException {
field(name);
return value(date, formatter);
}
- public T nullField(String name) throws IOException {
+ public XContentBuilder nullField(String name) throws IOException {
generator.writeNullField(name);
- return builder;
+ return this;
}
- public T nullValue() throws IOException {
+ public XContentBuilder nullValue() throws IOException {
generator.writeNull();
- return builder;
+ return this;
}
- public T rawField(String fieldName, byte[] content) throws IOException {
- generator.writeRawFieldStart(fieldName);
- return raw(content);
+ public XContentBuilder rawField(String fieldName, byte[] content) throws IOException {
+ generator.writeRawField(fieldName, content, bos);
+ return this;
}
- public T rawField(String fieldName, InputStream content) throws IOException {
- generator.writeRawFieldStart(fieldName);
- return raw(content);
+ public XContentBuilder rawField(String fieldName, InputStream content) throws IOException {
+ generator.writeRawField(fieldName, content, bos);
+ return this;
}
- public abstract T raw(byte[] content) throws IOException;
-
- public abstract T raw(InputStream content) throws IOException;
-
- public T value(Boolean value) throws IOException {
+ public XContentBuilder value(Boolean value) throws IOException {
return value(value.booleanValue());
}
- public T value(boolean value) throws IOException {
+ public XContentBuilder value(boolean value) throws IOException {
generator.writeBoolean(value);
- return builder;
+ return this;
}
- public T value(ReadableInstant date) throws IOException {
+ public XContentBuilder value(ReadableInstant date) throws IOException {
return value(date, defaultDatePrinter);
}
- public T value(ReadableInstant date, DateTimeFormatter dateTimeFormatter) throws IOException {
+ public XContentBuilder value(ReadableInstant date, DateTimeFormatter dateTimeFormatter) throws IOException {
return value(dateTimeFormatter.print(date));
}
- public T value(Date date) throws IOException {
+ public XContentBuilder value(Date date) throws IOException {
return value(date, defaultDatePrinter);
}
- public T value(Date date, DateTimeFormatter dateTimeFormatter) throws IOException {
+ public XContentBuilder value(Date date, DateTimeFormatter dateTimeFormatter) throws IOException {
return value(dateTimeFormatter.print(date.getTime()));
}
- public T value(Integer value) throws IOException {
+ public XContentBuilder value(Integer value) throws IOException {
return value(value.intValue());
}
- public T value(int value) throws IOException {
+ public XContentBuilder value(int value) throws IOException {
generator.writeNumber(value);
- return builder;
+ return this;
}
- public T value(Long value) throws IOException {
+ public XContentBuilder value(Long value) throws IOException {
return value(value.longValue());
}
- public T value(long value) throws IOException {
+ public XContentBuilder value(long value) throws IOException {
generator.writeNumber(value);
- return builder;
+ return this;
}
- public T value(Float value) throws IOException {
+ public XContentBuilder value(Float value) throws IOException {
return value(value.floatValue());
}
- public T value(float value) throws IOException {
+ public XContentBuilder value(float value) throws IOException {
generator.writeNumber(value);
- return builder;
+ return this;
}
- public T value(Double value) throws IOException {
+ public XContentBuilder value(Double value) throws IOException {
return value(value.doubleValue());
}
- public T value(double value) throws IOException {
+ public XContentBuilder value(double value) throws IOException {
generator.writeNumber(value);
- return builder;
+ return this;
}
- public T value(String value) throws IOException {
+ public XContentBuilder value(String value) throws IOException {
generator.writeString(value);
- return builder;
+ return this;
}
- public T value(byte[] value) throws IOException {
+ public XContentBuilder value(byte[] value) throws IOException {
generator.writeBinary(value);
- return builder;
+ return this;
}
- public T map(Map map) throws IOException {
+ public XContentBuilder map(Map map) throws IOException {
XContentMapConverter.writeMap(generator, map);
- return builder;
+ return this;
}
- public T value(Map map) throws IOException {
+ public XContentBuilder value(Map map) throws IOException {
XContentMapConverter.writeMap(generator, map);
- return builder;
+ return this;
}
- public T value(Object value) throws IOException {
+ public XContentBuilder value(Object value) throws IOException {
Class type = value.getClass();
if (type == String.class) {
value((String) value);
@@ -416,12 +431,12 @@ public T value(Object value) throws IOException {
} else {
throw new IOException("Type not allowed [" + type + "]");
}
- return builder;
+ return this;
}
- public T flush() throws IOException {
+ public XContentBuilder flush() throws IOException {
generator.flush();
- return builder;
+ return this;
}
public void close() {
@@ -432,13 +447,28 @@ public void close() {
}
}
- public abstract T reset() throws IOException;
+ public byte[] unsafeBytes() throws IOException {
+ close();
+ return bos.unsafeByteArray();
+ }
- public abstract byte[] unsafeBytes() throws IOException;
+ public int unsafeBytesLength() throws IOException {
+ close();
+ return bos.size();
+ }
- public abstract int unsafeBytesLength() throws IOException;
+ public FastByteArrayOutputStream unsafeStream() throws IOException {
+ close();
+ return bos;
+ }
- public abstract byte[] copiedBytes() throws IOException;
+ public byte[] copiedBytes() throws IOException {
+ close();
+ return bos.copiedByteArray();
+ }
- public abstract String string() throws IOException;
+ public String string() throws IOException {
+ close();
+ return Unicode.fromBytes(bos.unsafeByteArray(), 0, bos.size());
+ }
}
diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/common/xcontent/XContentFactory.java b/modules/elasticsearch/src/main/java/org/elasticsearch/common/xcontent/XContentFactory.java
index d92945a346921..292ca86281bf7 100644
--- a/modules/elasticsearch/src/main/java/org/elasticsearch/common/xcontent/XContentFactory.java
+++ b/modules/elasticsearch/src/main/java/org/elasticsearch/common/xcontent/XContentFactory.java
@@ -21,17 +21,16 @@
import org.elasticsearch.ElasticSearchIllegalArgumentException;
import org.elasticsearch.ElasticSearchParseException;
-import org.elasticsearch.common.xcontent.builder.BinaryXContentBuilder;
-import org.elasticsearch.common.xcontent.builder.TextXContentBuilder;
+import org.elasticsearch.common.jackson.smile.SmileConstants;
import org.elasticsearch.common.xcontent.json.JsonXContent;
-import org.elasticsearch.common.xcontent.xson.XsonXContent;
+import org.elasticsearch.common.xcontent.smile.SmileXContent;
import java.io.IOException;
import java.io.InputStream;
import java.util.Arrays;
/**
- * A one stop to use {@link org.elasticsearch.common.xcontent.XContent} and {@link org.elasticsearch.common.xcontent.builder.XContentBuilder}.
+ * A one stop to use {@link org.elasticsearch.common.xcontent.XContent} and {@link XContentBuilder}.
*
* @author kimchy (shay.banon)
*/
@@ -43,32 +42,32 @@ public class XContentFactory {
static {
contents = new XContent[2];
- contents[0] = new JsonXContent();
- contents[1] = new XsonXContent();
+ contents[0] = JsonXContent.jsonXContent;
+ contents[1] = SmileXContent.smileXContent;
}
/**
- * Returns a binary content builder using JSON format ({@link org.elasticsearch.common.xcontent.XContentType#JSON}.
+ * Returns a content builder using JSON format ({@link org.elasticsearch.common.xcontent.XContentType#JSON}.
*/
- public static BinaryXContentBuilder jsonBuilder() throws IOException {
- return contentBinaryBuilder(XContentType.JSON);
+ public static XContentBuilder jsonBuilder() throws IOException {
+ return contentBuilder(XContentType.JSON);
}
/**
- * Returns a binary content builder using XSON format ({@link org.elasticsearch.common.xcontent.XContentType#XSON}.
+ * Returns a content builder using SMILE format ({@link org.elasticsearch.common.xcontent.XContentType#SMILE}.
*/
- public static BinaryXContentBuilder xsonBuilder() throws IOException {
- return contentBinaryBuilder(XContentType.XSON);
+ public static XContentBuilder smileBuilder() throws IOException {
+ return contentBuilder(XContentType.SMILE);
}
/**
* Returns a binary content builder for the provided content type.
*/
- public static BinaryXContentBuilder contentBuilder(XContentType type) throws IOException {
+ public static XContentBuilder contentBuilder(XContentType type) throws IOException {
if (type == XContentType.JSON) {
- return JsonXContent.contentBinaryBuilder();
- } else if (type == XContentType.XSON) {
- return XsonXContent.contentBinaryBuilder();
+ return JsonXContent.contentBuilder();
+ } else if (type == XContentType.SMILE) {
+ return SmileXContent.contentBuilder();
}
throw new ElasticSearchIllegalArgumentException("No matching content type for " + type);
}
@@ -76,21 +75,11 @@ public static BinaryXContentBuilder contentBuilder(XContentType type) throws IOE
/**
* Returns a binary content builder for the provided content type.
*/
- public static BinaryXContentBuilder contentBinaryBuilder(XContentType type) throws IOException {
+ public static XContentBuilder unCachedContentBuilder(XContentType type) throws IOException {
if (type == XContentType.JSON) {
- return JsonXContent.contentBinaryBuilder();
- } else if (type == XContentType.XSON) {
- return XsonXContent.contentBinaryBuilder();
- }
- throw new ElasticSearchIllegalArgumentException("No matching content type for " + type);
- }
-
- /**
- * Returns a textual content builder for the provided content type. Note, XSON does not support this... .
- */
- public static TextXContentBuilder contentTextBuilder(XContentType type) throws IOException {
- if (type == XContentType.JSON) {
- return JsonXContent.contentTextBuilder();
+ return JsonXContent.unCachedContentBuilder();
+ } else if (type == XContentType.SMILE) {
+ return SmileXContent.unCachedContentBuilder();
}
throw new ElasticSearchIllegalArgumentException("No matching content type for " + type);
}
@@ -164,8 +153,11 @@ public static XContentType xContentType(InputStream si) throws IOException {
if (second == -1) {
return null;
}
- if (first == 0x00 && second == 0x00) {
- return XContentType.XSON;
+ if (first == SmileConstants.HEADER_BYTE_1 && second == SmileConstants.HEADER_BYTE_2) {
+ int third = si.read();
+ if (third == SmileConstants.HEADER_BYTE_3) {
+ return XContentType.SMILE;
+ }
}
if (first == '{' || second == '{') {
return XContentType.JSON;
@@ -187,8 +179,8 @@ public static XContentType xContentType(InputStream si) throws IOException {
*/
public static XContentType xContentType(byte[] data, int offset, int length) {
length = length < GUESS_HEADER_LENGTH ? length : GUESS_HEADER_LENGTH;
- if (length > 1 && data[offset] == 0x00 && data[offset + 1] == 0x00) {
- return XContentType.XSON;
+ if (length > 2 && data[offset] == SmileConstants.HEADER_BYTE_1 && data[offset + 1] == SmileConstants.HEADER_BYTE_2 && data[offset + 2] == SmileConstants.HEADER_BYTE_3) {
+ return XContentType.SMILE;
}
for (int i = offset; i < length; i++) {
if (data[i] == '{') {
diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/common/xcontent/XContentGenerator.java b/modules/elasticsearch/src/main/java/org/elasticsearch/common/xcontent/XContentGenerator.java
index 213c33ea58c2f..b59fb6803df3d 100644
--- a/modules/elasticsearch/src/main/java/org/elasticsearch/common/xcontent/XContentGenerator.java
+++ b/modules/elasticsearch/src/main/java/org/elasticsearch/common/xcontent/XContentGenerator.java
@@ -19,7 +19,10 @@
package org.elasticsearch.common.xcontent;
+import org.elasticsearch.common.io.FastByteArrayOutputStream;
+
import java.io.IOException;
+import java.io.InputStream;
/**
* @author kimchy (shay.banon)
@@ -81,7 +84,9 @@ public interface XContentGenerator {
void writeObjectFieldStart(String fieldName) throws IOException;
- void writeRawFieldStart(String fieldName) throws IOException;
+ void writeRawField(String fieldName, byte[] content, FastByteArrayOutputStream bos) throws IOException;
+
+ void writeRawField(String fieldName, InputStream content, FastByteArrayOutputStream bos) throws IOException;
void flush() throws IOException;
diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/common/xcontent/XContentType.java b/modules/elasticsearch/src/main/java/org/elasticsearch/common/xcontent/XContentType.java
index f5cd62b99f0aa..c33e370f48b51 100644
--- a/modules/elasticsearch/src/main/java/org/elasticsearch/common/xcontent/XContentType.java
+++ b/modules/elasticsearch/src/main/java/org/elasticsearch/common/xcontent/XContentType.java
@@ -31,9 +31,9 @@ public enum XContentType {
*/
JSON(0),
/**
- * An optimized binary form of JSON.
+ * The jackson based smile binary format. Fast and compact binary format.
*/
- XSON(1);
+ SMILE(1);
public static XContentType fromRestContentType(String contentType) {
if (contentType == null) {
@@ -43,8 +43,8 @@ public static XContentType fromRestContentType(String contentType) {
return JSON;
}
- if ("application/xson".equals(contentType) || "xson".equalsIgnoreCase(contentType)) {
- return XSON;
+ if ("application/smile".equals(contentType) || "smile".equalsIgnoreCase(contentType)) {
+ return SMILE;
}
return null;
diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/common/xcontent/builder/BinaryXContentBuilder.java b/modules/elasticsearch/src/main/java/org/elasticsearch/common/xcontent/builder/BinaryXContentBuilder.java
deleted file mode 100644
index b46d24e5ac738..0000000000000
--- a/modules/elasticsearch/src/main/java/org/elasticsearch/common/xcontent/builder/BinaryXContentBuilder.java
+++ /dev/null
@@ -1,94 +0,0 @@
-/*
- * Licensed to Elastic Search and Shay Banon under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. Elastic Search licenses this
- * file to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.elasticsearch.common.xcontent.builder;
-
-import org.elasticsearch.common.Unicode;
-import org.elasticsearch.common.io.FastByteArrayOutputStream;
-import org.elasticsearch.common.io.Streams;
-import org.elasticsearch.common.xcontent.XContent;
-
-import java.io.IOException;
-import java.io.InputStream;
-
-/**
- * @author kimchy (shay.banon)
- */
-public class BinaryXContentBuilder extends XContentBuilder {
-
- private final FastByteArrayOutputStream bos;
-
- private final XContent xContent;
-
- private byte[] bytes;
-
- public BinaryXContentBuilder(XContent xContent) throws IOException {
- this.bos = new FastByteArrayOutputStream();
- this.xContent = xContent;
- this.generator = xContent.createGenerator(bos);
- this.builder = this;
- }
-
- @Override public BinaryXContentBuilder raw(byte[] json) throws IOException {
- flush();
- bos.write(json);
- return this;
- }
-
- @Override public BinaryXContentBuilder raw(InputStream content) throws IOException {
- flush();
- if (bytes == null) {
- bytes = new byte[Streams.BUFFER_SIZE];
- }
- Streams.copy(content, bos, bytes);
- return this;
- }
-
- @Override public BinaryXContentBuilder reset() throws IOException {
- fieldCaseConversion = globalFieldCaseConversion;
- bos.reset();
- this.generator = xContent.createGenerator(bos);
- return this;
- }
-
- public FastByteArrayOutputStream unsafeStream() throws IOException {
- flush();
- return bos;
- }
-
- @Override public byte[] unsafeBytes() throws IOException {
- flush();
- return bos.unsafeByteArray();
- }
-
- @Override public int unsafeBytesLength() throws IOException {
- flush();
- return bos.size();
- }
-
- @Override public byte[] copiedBytes() throws IOException {
- flush();
- return bos.copiedByteArray();
- }
-
- @Override public String string() throws IOException {
- flush();
- return Unicode.fromBytes(bos.unsafeByteArray(), 0, bos.size());
- }
-}
diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/common/xcontent/builder/TextXContentBuilder.java b/modules/elasticsearch/src/main/java/org/elasticsearch/common/xcontent/builder/TextXContentBuilder.java
deleted file mode 100644
index c77f2b9b08bf7..0000000000000
--- a/modules/elasticsearch/src/main/java/org/elasticsearch/common/xcontent/builder/TextXContentBuilder.java
+++ /dev/null
@@ -1,137 +0,0 @@
-/*
- * Licensed to Elastic Search and Shay Banon under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. Elastic Search licenses this
- * file to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.elasticsearch.common.xcontent.builder;
-
-import org.apache.lucene.util.UnicodeUtil;
-import org.elasticsearch.common.Unicode;
-import org.elasticsearch.common.io.FastByteArrayOutputStream;
-import org.elasticsearch.common.io.FastCharArrayWriter;
-import org.elasticsearch.common.io.Streams;
-import org.elasticsearch.common.xcontent.XContent;
-
-import java.io.IOException;
-import java.io.InputStream;
-
-/**
- * @author kimchy (shay.banon)
- */
-public class TextXContentBuilder extends XContentBuilder {
-
- private final FastCharArrayWriter writer;
-
- private final XContent xContent;
-
- final UnicodeUtil.UTF8Result utf8Result = new UnicodeUtil.UTF8Result();
-
- public TextXContentBuilder(XContent xContent) throws IOException {
- this.writer = new FastCharArrayWriter();
- this.xContent = xContent;
- this.generator = xContent.createGenerator(writer);
- this.builder = this;
- }
-
- @Override public TextXContentBuilder raw(byte[] content) throws IOException {
- flush();
- Unicode.UTF16Result result = Unicode.unsafeFromBytesAsUtf16(content);
- writer.write(result.result, 0, result.length);
- return this;
- }
-
- @Override public TextXContentBuilder raw(InputStream content) throws IOException {
- FastByteArrayOutputStream os = new FastByteArrayOutputStream();
- Streams.copy(content, os);
- flush();
- Unicode.UTF16Result result = Unicode.unsafeFromBytesAsUtf16(os.unsafeByteArray(), 0, os.size());
- writer.write(result.result, 0, result.length);
- return this;
- }
-
- public TextXContentBuilder reset() throws IOException {
- fieldCaseConversion = globalFieldCaseConversion;
- writer.reset();
- generator = xContent.createGenerator(writer);
- return this;
- }
-
- public String string() throws IOException {
- flush();
- return writer.toStringTrim();
- }
-
- public FastCharArrayWriter unsafeChars() throws IOException {
- flush();
- return writer;
- }
-
- @Override public byte[] unsafeBytes() throws IOException {
- return utf8().result;
- }
-
- /**
- * Call this AFTER {@link #unsafeBytes()}.
- */
- @Override public int unsafeBytesLength() {
- return utf8Result.length;
- }
-
- @Override public byte[] copiedBytes() throws IOException {
- flush();
- byte[] ret = new byte[utf8Result.length];
- System.arraycopy(utf8Result.result, 0, ret, 0, ret.length);
- return ret;
- }
-
- /**
- * Returns the byte[] that represents the utf8 of the json written up until now.
- * Note, the result is shared within this instance, so copy the byte array if needed
- * or use {@link #utf8copied()}.
- */
- public UnicodeUtil.UTF8Result utf8() throws IOException {
- flush();
-
- // ignore whitepsaces
- int st = 0;
- int len = writer.size();
- char[] val = writer.unsafeCharArray();
-
- while ((st < len) && (val[st] <= ' ')) {
- st++;
- len--;
- }
- while ((st < len) && (val[len - 1] <= ' ')) {
- len--;
- }
-
- UnicodeUtil.UTF16toUTF8(val, st, len, utf8Result);
-
- return utf8Result;
- }
-
- /**
- * Returns a copied byte[] that represnts the utf8 o fthe json written up until now.
- */
- public byte[] utf8copied() throws IOException {
- utf8();
- byte[] result = new byte[utf8Result.length];
- System.arraycopy(utf8Result.result, 0, result, 0, utf8Result.length);
- return result;
- }
-
-}
diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/common/xcontent/json/JsonXContent.java b/modules/elasticsearch/src/main/java/org/elasticsearch/common/xcontent/json/JsonXContent.java
index 3d4ace20fa5f3..9adc8c7066666 100644
--- a/modules/elasticsearch/src/main/java/org/elasticsearch/common/xcontent/json/JsonXContent.java
+++ b/modules/elasticsearch/src/main/java/org/elasticsearch/common/xcontent/json/JsonXContent.java
@@ -19,19 +19,12 @@
package org.elasticsearch.common.xcontent.json;
-import org.elasticsearch.ElasticSearchException;
import org.elasticsearch.common.io.FastStringReader;
import org.elasticsearch.common.jackson.JsonEncoding;
import org.elasticsearch.common.jackson.JsonFactory;
import org.elasticsearch.common.jackson.JsonGenerator;
import org.elasticsearch.common.jackson.JsonParser;
-import org.elasticsearch.common.thread.ThreadLocals;
-import org.elasticsearch.common.xcontent.XContent;
-import org.elasticsearch.common.xcontent.XContentGenerator;
-import org.elasticsearch.common.xcontent.XContentParser;
-import org.elasticsearch.common.xcontent.XContentType;
-import org.elasticsearch.common.xcontent.builder.BinaryXContentBuilder;
-import org.elasticsearch.common.xcontent.builder.TextXContentBuilder;
+import org.elasticsearch.common.xcontent.*;
import java.io.*;
@@ -42,71 +35,25 @@
*/
public class JsonXContent implements XContent {
- public static class CachedBinaryBuilder {
-
- private static final ThreadLocal> cache = new ThreadLocal>() {
- @Override protected ThreadLocals.CleanableValue initialValue() {
- try {
- BinaryXContentBuilder builder = new BinaryXContentBuilder(new JsonXContent());
- return new ThreadLocals.CleanableValue(builder);
- } catch (IOException e) {
- throw new ElasticSearchException("Failed to create json generator", e);
- }
- }
- };
-
- /**
- * Returns the cached thread local generator, with its internal {@link StringBuilder} cleared.
- */
- static BinaryXContentBuilder cached() throws IOException {
- ThreadLocals.CleanableValue cached = cache.get();
- cached.get().reset();
- return cached.get();
- }
+ public static XContentBuilder contentBuilder() throws IOException {
+ return XContentBuilder.cachedBuilder(jsonXContent);
}
- public static class CachedTextBuilder {
-
- private static final ThreadLocal> cache = new ThreadLocal>() {
- @Override protected ThreadLocals.CleanableValue initialValue() {
- try {
- TextXContentBuilder builder = new TextXContentBuilder(new JsonXContent());
- return new ThreadLocals.CleanableValue(builder);
- } catch (IOException e) {
- throw new ElasticSearchException("Failed to create json generator", e);
- }
- }
- };
-
- /**
- * Returns the cached thread local generator, with its internal {@link StringBuilder} cleared.
- */
- static TextXContentBuilder cached() throws IOException {
- ThreadLocals.CleanableValue cached = cache.get();
- cached.get().reset();
- return cached.get();
- }
+ public static XContentBuilder unCachedContentBuilder() throws IOException {
+ return XContentBuilder.builder(jsonXContent);
}
- public static BinaryXContentBuilder contentBuilder() throws IOException {
- return contentBinaryBuilder();
- }
-
- public static BinaryXContentBuilder contentBinaryBuilder() throws IOException {
- return CachedBinaryBuilder.cached();
- }
-
- public static TextXContentBuilder contentTextBuilder() throws IOException {
- return CachedTextBuilder.cached();
- }
+ private final static JsonFactory jsonFactory;
+ public final static JsonXContent jsonXContent;
-
- private final JsonFactory jsonFactory;
-
- public JsonXContent() {
+ static {
jsonFactory = new JsonFactory();
jsonFactory.configure(JsonParser.Feature.ALLOW_UNQUOTED_FIELD_NAMES, true);
jsonFactory.configure(JsonGenerator.Feature.QUOTE_FIELD_NAMES, true);
+ jsonXContent = new JsonXContent();
+ }
+
+ private JsonXContent() {
}
@Override public XContentType type() {
diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/common/xcontent/json/JsonXContentGenerator.java b/modules/elasticsearch/src/main/java/org/elasticsearch/common/xcontent/json/JsonXContentGenerator.java
index f397a98527cf0..4d82f429ac44d 100644
--- a/modules/elasticsearch/src/main/java/org/elasticsearch/common/xcontent/json/JsonXContentGenerator.java
+++ b/modules/elasticsearch/src/main/java/org/elasticsearch/common/xcontent/json/JsonXContentGenerator.java
@@ -19,11 +19,15 @@
package org.elasticsearch.common.xcontent.json;
+import org.elasticsearch.common.Bytes;
+import org.elasticsearch.common.io.FastByteArrayOutputStream;
+import org.elasticsearch.common.io.Streams;
import org.elasticsearch.common.jackson.JsonGenerator;
import org.elasticsearch.common.xcontent.XContentGenerator;
import org.elasticsearch.common.xcontent.XContentType;
import java.io.IOException;
+import java.io.InputStream;
/**
* @author kimchy (shay.banon)
@@ -144,9 +148,17 @@ public JsonXContentGenerator(JsonGenerator generator) {
generator.writeObjectFieldStart(fieldName);
}
- @Override public void writeRawFieldStart(String fieldName) throws IOException {
+ @Override public void writeRawField(String fieldName, byte[] content, FastByteArrayOutputStream bos) throws IOException {
generator.writeRaw(", \"" + fieldName + "\" : ");
+ flush();
+ bos.write(content);
+ }
+ @Override public void writeRawField(String fieldName, InputStream content, FastByteArrayOutputStream bos) throws IOException {
+ generator.writeRaw(", \"" + fieldName + "\" : ");
+ flush();
+ byte[] bytes = Bytes.cachedBytes.get().get();
+ Streams.copy(content, bos, bytes);
}
@Override public void flush() throws IOException {
diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/common/xcontent/smile/SmileXContent.java b/modules/elasticsearch/src/main/java/org/elasticsearch/common/xcontent/smile/SmileXContent.java
new file mode 100644
index 0000000000000..5dabed162e903
--- /dev/null
+++ b/modules/elasticsearch/src/main/java/org/elasticsearch/common/xcontent/smile/SmileXContent.java
@@ -0,0 +1,89 @@
+/*
+ * Licensed to Elastic Search and Shay Banon under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. Elastic Search licenses this
+ * file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.elasticsearch.common.xcontent.smile;
+
+import org.elasticsearch.common.io.FastStringReader;
+import org.elasticsearch.common.jackson.JsonEncoding;
+import org.elasticsearch.common.jackson.smile.SmileFactory;
+import org.elasticsearch.common.jackson.smile.SmileGenerator;
+import org.elasticsearch.common.xcontent.*;
+import org.elasticsearch.common.xcontent.json.JsonXContentParser;
+
+import java.io.*;
+
+/**
+ * A JSON based content implementation using Jackson.
+ *
+ * @author kimchy (shay.banon)
+ */
+public class SmileXContent implements XContent {
+
+ public static XContentBuilder contentBuilder() throws IOException {
+ return XContentBuilder.cachedBuilder(smileXContent);
+ }
+
+ public static XContentBuilder unCachedContentBuilder() throws IOException {
+ return XContentBuilder.builder(smileXContent);
+ }
+
+ private final static SmileFactory smileFactory;
+ public final static SmileXContent smileXContent;
+
+ static {
+ smileFactory = new SmileFactory();
+ smileFactory.configure(SmileGenerator.Feature.ENCODE_BINARY_AS_7BIT, false); // for now, this is an overhead, might make sense for web sockets
+ smileXContent = new SmileXContent();
+ }
+
+ private SmileXContent() {
+ }
+
+ @Override public XContentType type() {
+ return XContentType.SMILE;
+ }
+
+ @Override public XContentGenerator createGenerator(OutputStream os) throws IOException {
+ return new SmileXContentGenerator(smileFactory.createJsonGenerator(os, JsonEncoding.UTF8));
+ }
+
+ @Override public XContentGenerator createGenerator(Writer writer) throws IOException {
+ return new SmileXContentGenerator(smileFactory.createJsonGenerator(writer));
+ }
+
+ @Override public XContentParser createParser(String content) throws IOException {
+ return new SmileXContentParser(smileFactory.createJsonParser(new FastStringReader(content)));
+ }
+
+ @Override public XContentParser createParser(InputStream is) throws IOException {
+ return new SmileXContentParser(smileFactory.createJsonParser(is));
+ }
+
+ @Override public XContentParser createParser(byte[] data) throws IOException {
+ return new SmileXContentParser(smileFactory.createJsonParser(data));
+ }
+
+ @Override public XContentParser createParser(byte[] data, int offset, int length) throws IOException {
+ return new SmileXContentParser(smileFactory.createJsonParser(data, offset, length));
+ }
+
+ @Override public XContentParser createParser(Reader reader) throws IOException {
+ return new JsonXContentParser(smileFactory.createJsonParser(reader));
+ }
+}
diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/common/xcontent/smile/SmileXContentGenerator.java b/modules/elasticsearch/src/main/java/org/elasticsearch/common/xcontent/smile/SmileXContentGenerator.java
new file mode 100644
index 0000000000000..b0637432adcf6
--- /dev/null
+++ b/modules/elasticsearch/src/main/java/org/elasticsearch/common/xcontent/smile/SmileXContentGenerator.java
@@ -0,0 +1,48 @@
+/*
+ * Licensed to Elastic Search and Shay Banon under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. Elastic Search licenses this
+ * file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.elasticsearch.common.xcontent.smile;
+
+import org.elasticsearch.common.io.FastByteArrayOutputStream;
+import org.elasticsearch.common.jackson.JsonGenerator;
+import org.elasticsearch.common.xcontent.XContentType;
+import org.elasticsearch.common.xcontent.json.JsonXContentGenerator;
+import org.elasticsearch.common.xcontent.support.XContentMapConverter;
+
+import java.io.IOException;
+
+/**
+ * @author kimchy (shay.banon)
+ */
+public class SmileXContentGenerator extends JsonXContentGenerator {
+
+ public SmileXContentGenerator(JsonGenerator generator) {
+ super(generator);
+ }
+
+ @Override public XContentType contentType() {
+ return XContentType.SMILE;
+ }
+
+ @Override public void writeRawField(String fieldName, byte[] content, FastByteArrayOutputStream bos) throws IOException {
+ writeFieldName(fieldName);
+ // crap here, need to find a better way... (at least don't create the map and direct parser to generator)
+ XContentMapConverter.writeMap(this, SmileXContent.smileXContent.createParser(content).map());
+ }
+}
diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/common/xcontent/xson/XsonType.java b/modules/elasticsearch/src/main/java/org/elasticsearch/common/xcontent/smile/SmileXContentParser.java
similarity index 57%
rename from modules/elasticsearch/src/main/java/org/elasticsearch/common/xcontent/xson/XsonType.java
rename to modules/elasticsearch/src/main/java/org/elasticsearch/common/xcontent/smile/SmileXContentParser.java
index d8b609d0a7449..6a894d65c39b7 100644
--- a/modules/elasticsearch/src/main/java/org/elasticsearch/common/xcontent/xson/XsonType.java
+++ b/modules/elasticsearch/src/main/java/org/elasticsearch/common/xcontent/smile/SmileXContentParser.java
@@ -17,36 +17,22 @@
* under the License.
*/
-package org.elasticsearch.common.xcontent.xson;
+package org.elasticsearch.common.xcontent.smile;
+
+import org.elasticsearch.common.jackson.JsonParser;
+import org.elasticsearch.common.xcontent.XContentType;
+import org.elasticsearch.common.xcontent.json.JsonXContentParser;
/**
* @author kimchy (shay.banon)
*/
-public enum XsonType {
-
- START_ARRAY((byte) 0x01),
- END_ARRAY((byte) 0x02),
- START_OBJECT((byte) 0x03),
- END_OBJECT((byte) 0x04),
- FIELD_NAME((byte) 0x05),
- VALUE_STRING((byte) 0x06),
- VALUE_BINARY((byte) 0x07),
- VALUE_INTEGER((byte) 0x08),
- VALUE_LONG((byte) 0x09),
- VALUE_FLOAT((byte) 0x0A),
- VALUE_DOUBLE((byte) 0x0B),
- VALUE_BOOLEAN((byte) 0x0C),
- VALUE_NULL((byte) 0x0D),;
-
- public static final int HEADER = 0x00;
-
- private final byte code;
+public class SmileXContentParser extends JsonXContentParser {
- XsonType(byte code) {
- this.code = code;
+ public SmileXContentParser(JsonParser parser) {
+ super(parser);
}
- public byte code() {
- return code;
+ @Override public XContentType contentType() {
+ return XContentType.SMILE;
}
}
diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/common/xcontent/support/XContentMapConverter.java b/modules/elasticsearch/src/main/java/org/elasticsearch/common/xcontent/support/XContentMapConverter.java
index 4b4d97857c20c..5024ec1e8a267 100644
--- a/modules/elasticsearch/src/main/java/org/elasticsearch/common/xcontent/support/XContentMapConverter.java
+++ b/modules/elasticsearch/src/main/java/org/elasticsearch/common/xcontent/support/XContentMapConverter.java
@@ -19,9 +19,9 @@
package org.elasticsearch.common.xcontent.support;
+import org.elasticsearch.common.xcontent.XContentBuilder;
import org.elasticsearch.common.xcontent.XContentGenerator;
import org.elasticsearch.common.xcontent.XContentParser;
-import org.elasticsearch.common.xcontent.builder.XContentBuilder;
import java.io.IOException;
import java.util.*;
diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/common/xcontent/xson/XsonXContent.java b/modules/elasticsearch/src/main/java/org/elasticsearch/common/xcontent/xson/XsonXContent.java
deleted file mode 100644
index a0c338c2e4ea8..0000000000000
--- a/modules/elasticsearch/src/main/java/org/elasticsearch/common/xcontent/xson/XsonXContent.java
+++ /dev/null
@@ -1,99 +0,0 @@
-/*
- * Licensed to Elastic Search and Shay Banon under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. Elastic Search licenses this
- * file to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.elasticsearch.common.xcontent.xson;
-
-import org.elasticsearch.ElasticSearchException;
-import org.elasticsearch.ElasticSearchIllegalStateException;
-import org.elasticsearch.common.io.FastByteArrayInputStream;
-import org.elasticsearch.common.thread.ThreadLocals;
-import org.elasticsearch.common.xcontent.XContent;
-import org.elasticsearch.common.xcontent.XContentGenerator;
-import org.elasticsearch.common.xcontent.XContentParser;
-import org.elasticsearch.common.xcontent.XContentType;
-import org.elasticsearch.common.xcontent.builder.BinaryXContentBuilder;
-
-import java.io.*;
-
-/**
- * A binary representation of content (basically, JSON encoded in optimized binary format).
- *
- * @author kimchy (shay.banon)
- */
-public class XsonXContent implements XContent {
-
- public static class CachedBinaryBuilder {
-
- private static final ThreadLocal> cache = new ThreadLocal>() {
- @Override protected ThreadLocals.CleanableValue initialValue() {
- try {
- BinaryXContentBuilder builder = new BinaryXContentBuilder(new XsonXContent());
- return new ThreadLocals.CleanableValue(builder);
- } catch (IOException e) {
- throw new ElasticSearchException("Failed to create xson generator", e);
- }
- }
- };
-
- /**
- * Returns the cached thread local generator, with its internal {@link StringBuilder} cleared.
- */
- static BinaryXContentBuilder cached() throws IOException {
- ThreadLocals.CleanableValue cached = cache.get();
- cached.get().reset();
- return cached.get();
- }
- }
-
- public static BinaryXContentBuilder contentBinaryBuilder() throws IOException {
- return CachedBinaryBuilder.cached();
- }
-
- @Override public XContentType type() {
- return XContentType.XSON;
- }
-
- @Override public XContentGenerator createGenerator(OutputStream os) throws IOException {
- return new XsonXContentGenerator(os);
- }
-
- @Override public XContentGenerator createGenerator(Writer writer) throws IOException {
- throw new ElasticSearchIllegalStateException("Can't create generator over xson with textual data");
- }
-
- @Override public XContentParser createParser(String content) throws IOException {
- throw new ElasticSearchIllegalStateException("Can't create parser over xson for textual data");
- }
-
- @Override public XContentParser createParser(InputStream is) throws IOException {
- return new XsonXContentParser(is);
- }
-
- @Override public XContentParser createParser(byte[] data) throws IOException {
- return new XsonXContentParser(new FastByteArrayInputStream(data));
- }
-
- @Override public XContentParser createParser(byte[] data, int offset, int length) throws IOException {
- return new XsonXContentParser(new FastByteArrayInputStream(data, offset, length));
- }
-
- @Override public XContentParser createParser(Reader reader) throws IOException {
- throw new ElasticSearchIllegalStateException("Can't create parser over xson for textual data");
- }
-}
diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/common/xcontent/xson/XsonXContentGenerator.java b/modules/elasticsearch/src/main/java/org/elasticsearch/common/xcontent/xson/XsonXContentGenerator.java
deleted file mode 100644
index c53b558c399dc..0000000000000
--- a/modules/elasticsearch/src/main/java/org/elasticsearch/common/xcontent/xson/XsonXContentGenerator.java
+++ /dev/null
@@ -1,211 +0,0 @@
-/*
- * Licensed to Elastic Search and Shay Banon under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. Elastic Search licenses this
- * file to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.elasticsearch.common.xcontent.xson;
-
-import org.apache.lucene.util.UnicodeUtil;
-import org.elasticsearch.common.Unicode;
-import org.elasticsearch.common.xcontent.XContentGenerator;
-import org.elasticsearch.common.xcontent.XContentType;
-import org.elasticsearch.common.xcontent.support.AbstractXContentGenerator;
-
-import java.io.IOException;
-import java.io.OutputStream;
-
-/**
- * @author kimchy (shay.banon)
- */
-public class XsonXContentGenerator extends AbstractXContentGenerator implements XContentGenerator {
-
- private final OutputStream out;
-
- public XsonXContentGenerator(OutputStream out) throws IOException {
- this.out = out;
- outInt(XsonType.HEADER);
- }
-
- @Override public XContentType contentType() {
- return XContentType.XSON;
- }
-
- @Override public void usePrettyPrint() {
- // irrelevant
- }
-
- @Override public void writeStartArray() throws IOException {
- out.write(XsonType.START_ARRAY.code());
- }
-
- @Override public void writeEndArray() throws IOException {
- out.write(XsonType.END_ARRAY.code());
- }
-
- @Override public void writeStartObject() throws IOException {
- out.write(XsonType.START_OBJECT.code());
- }
-
- @Override public void writeEndObject() throws IOException {
- out.write(XsonType.END_OBJECT.code());
- }
-
- @Override public void writeFieldName(String name) throws IOException {
- out.write(XsonType.FIELD_NAME.code());
- outUTF(name);
- }
-
- @Override public void writeString(String text) throws IOException {
- out.write(XsonType.VALUE_STRING.code());
- outUTF(text);
- }
-
- @Override public void writeString(char[] text, int offset, int len) throws IOException {
- writeString(new String(text, offset, len));
- }
-
- @Override public void writeBinary(byte[] data, int offset, int len) throws IOException {
- out.write(XsonType.VALUE_BINARY.code());
- outVInt(len);
- out.write(data, offset, len);
- }
-
- @Override public void writeBinary(byte[] data) throws IOException {
- out.write(XsonType.VALUE_BINARY.code());
- outVInt(data.length);
- out.write(data);
- }
-
- @Override public void writeNumber(int v) throws IOException {
- out.write(XsonType.VALUE_INTEGER.code());
- outInt(v);
- }
-
- @Override public void writeNumber(long v) throws IOException {
- out.write(XsonType.VALUE_LONG.code());
- outLong(v);
- }
-
- @Override public void writeNumber(double d) throws IOException {
- out.write(XsonType.VALUE_DOUBLE.code());
- outDouble(d);
- }
-
- @Override public void writeNumber(float f) throws IOException {
- out.write(XsonType.VALUE_FLOAT.code());
- outFloat(f);
- }
-
- @Override public void writeBoolean(boolean state) throws IOException {
- out.write(XsonType.VALUE_BOOLEAN.code());
- outBoolean(state);
- }
-
- @Override public void writeNull() throws IOException {
- out.write(XsonType.VALUE_NULL.code());
- }
-
- @Override public void writeRawFieldStart(String fieldName) throws IOException {
- writeFieldName(fieldName);
- }
-
- @Override public void flush() throws IOException {
- out.flush();
- }
-
- @Override public void close() throws IOException {
- out.close();
- }
-
-
- private void outShort(short v) throws IOException {
- out.write((byte) (v >> 8));
- out.write((byte) v);
- }
-
- /**
- * Writes an int as four bytes.
- */
- private void outInt(int i) throws IOException {
- out.write((byte) (i >> 24));
- out.write((byte) (i >> 16));
- out.write((byte) (i >> 8));
- out.write((byte) i);
- }
-
- /**
- * Writes an int in a variable-length format. Writes between one and
- * five bytes. Smaller values take fewer bytes. Negative numbers are not
- * supported.
- */
- private void outVInt(int i) throws IOException {
- while ((i & ~0x7F) != 0) {
- out.write((byte) ((i & 0x7f) | 0x80));
- i >>>= 7;
- }
- out.write((byte) i);
- }
-
- /**
- * Writes a long as eight bytes.
- */
- private void outLong(long i) throws IOException {
- outInt((int) (i >> 32));
- outInt((int) i);
- }
-
- /**
- * Writes an long in a variable-length format. Writes between one and five
- * bytes. Smaller values take fewer bytes. Negative numbers are not
- * supported.
- */
- private void outVLong(long i) throws IOException {
- while ((i & ~0x7F) != 0) {
- out.write((byte) ((i & 0x7f) | 0x80));
- i >>>= 7;
- }
- out.write((byte) i);
- }
-
- /**
- * Writes a string.
- */
- private void outUTF(String s) throws IOException {
- UnicodeUtil.UTF8Result utf8Result = Unicode.unsafeFromStringAsUtf8(s);
- outVInt(utf8Result.length);
- out.write(utf8Result.result, 0, utf8Result.length);
- }
-
- private void outFloat(float v) throws IOException {
- outInt(Float.floatToIntBits(v));
- }
-
- private void outDouble(double v) throws IOException {
- outLong(Double.doubleToLongBits(v));
- }
-
-
- private static byte ZERO = 0;
- private static byte ONE = 1;
-
- /**
- * Writes a boolean.
- */
- private void outBoolean(boolean b) throws IOException {
- out.write(b ? ONE : ZERO);
- }
-}
diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/common/xcontent/xson/XsonXContentParser.java b/modules/elasticsearch/src/main/java/org/elasticsearch/common/xcontent/xson/XsonXContentParser.java
deleted file mode 100644
index 0211b70a7ccd0..0000000000000
--- a/modules/elasticsearch/src/main/java/org/elasticsearch/common/xcontent/xson/XsonXContentParser.java
+++ /dev/null
@@ -1,383 +0,0 @@
-/*
- * Licensed to Elastic Search and Shay Banon under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. Elastic Search licenses this
- * file to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.elasticsearch.common.xcontent.xson;
-
-import org.elasticsearch.common.Bytes;
-import org.elasticsearch.common.Unicode;
-import org.elasticsearch.common.xcontent.XContentType;
-import org.elasticsearch.common.xcontent.support.AbstractXContentParser;
-
-import java.io.EOFException;
-import java.io.IOException;
-import java.io.InputStream;
-
-/**
- * @author kimchy (shay.banon)
- */
-public class XsonXContentParser extends AbstractXContentParser {
-
- private final InputStream is;
-
- private Token currentToken;
-
- private XsonType xsonType;
-
- private NumberType currentNumberType;
-
- private String currentName;
-
- private Unicode.UTF16Result utf16Result;
-
- private int valueInt;
- private long valueLong;
- private float valueFloat;
- private double valueDouble;
- private boolean valueBoolean;
- private byte[] valueBytes;
-
- public XsonXContentParser(InputStream is) throws IOException {
- this.is = is;
- int header = inInt();
- if (header != XsonType.HEADER) {
- throw new IOException("Not xson type header");
- }
- }
-
- @Override public XContentType contentType() {
- return XContentType.XSON;
- }
-
- @Override public Token nextToken() throws IOException {
- byte tokenType = (byte) is.read();
- if (tokenType == -1) {
- xsonType = null;
- currentToken = null;
- currentNumberType = null;
- return null;
- } else if (tokenType == XsonType.START_ARRAY.code()) {
- xsonType = XsonType.START_ARRAY;
- currentToken = Token.START_ARRAY;
- } else if (tokenType == XsonType.END_ARRAY.code()) {
- xsonType = XsonType.END_ARRAY;
- currentToken = Token.END_ARRAY;
- } else if (tokenType == XsonType.START_OBJECT.code()) {
- xsonType = XsonType.START_OBJECT;
- currentToken = Token.START_OBJECT;
- } else if (tokenType == XsonType.END_OBJECT.code()) {
- xsonType = XsonType.END_OBJECT;
- currentToken = Token.END_OBJECT;
- } else if (tokenType == XsonType.FIELD_NAME.code()) {
- xsonType = XsonType.FIELD_NAME;
- currentToken = Token.FIELD_NAME;
- // read the field name (interned)
- currentName = inUTF().intern();
- } else if (tokenType == XsonType.VALUE_STRING.code()) {
- xsonType = XsonType.VALUE_STRING;
- currentToken = Token.VALUE_STRING;
- inUtf16();
- } else if (tokenType == XsonType.VALUE_BINARY.code()) {
- xsonType = XsonType.VALUE_BINARY;
- currentToken = Token.VALUE_STRING;
- int length = inVInt();
- valueBytes = new byte[length];
- inBytes(valueBytes, 0, length);
- } else if (tokenType == XsonType.VALUE_INTEGER.code()) {
- xsonType = XsonType.VALUE_INTEGER;
- currentToken = Token.VALUE_NUMBER;
- currentNumberType = NumberType.INT;
- valueInt = inInt();
- } else if (tokenType == XsonType.VALUE_LONG.code()) {
- xsonType = XsonType.VALUE_LONG;
- currentToken = Token.VALUE_NUMBER;
- currentNumberType = NumberType.LONG;
- valueLong = inLong();
- } else if (tokenType == XsonType.VALUE_FLOAT.code()) {
- xsonType = XsonType.VALUE_FLOAT;
- currentToken = Token.VALUE_NUMBER;
- currentNumberType = NumberType.FLOAT;
- valueFloat = inFloat();
- } else if (tokenType == XsonType.VALUE_DOUBLE.code()) {
- xsonType = XsonType.VALUE_DOUBLE;
- currentToken = Token.VALUE_NUMBER;
- currentNumberType = NumberType.DOUBLE;
- valueDouble = inDouble();
- } else if (tokenType == XsonType.VALUE_BOOLEAN.code()) {
- xsonType = XsonType.VALUE_BOOLEAN;
- currentToken = Token.VALUE_BOOLEAN;
- valueBoolean = inBoolean();
- } else if (tokenType == XsonType.VALUE_NULL.code()) {
- xsonType = XsonType.VALUE_NULL;
- currentToken = Token.VALUE_NULL;
- }
- return currentToken;
- }
-
- @Override public void skipChildren() throws IOException {
- if (xsonType != XsonType.START_OBJECT && xsonType != XsonType.START_ARRAY) {
- return;
- }
- int open = 1;
-
- /* Since proper matching of start/end markers is handled
- * by nextToken(), we'll just count nesting levels here
- */
- while (true) {
- nextToken();
- if (xsonType == null) {
- return;
- }
- switch (xsonType) {
- case START_OBJECT:
- case START_ARRAY:
- ++open;
- break;
- case END_OBJECT:
- case END_ARRAY:
- if (--open == 0) {
- return;
- }
- break;
- }
- }
- }
-
- @Override public Token currentToken() {
- return currentToken;
- }
-
- @Override public String currentName() throws IOException {
- return currentName;
- }
-
- @Override public String text() throws IOException {
- return new String(utf16Result.result, 0, utf16Result.length);
- }
-
- @Override public char[] textCharacters() throws IOException {
- return utf16Result.result;
- }
-
- @Override public int textLength() throws IOException {
- return utf16Result.length;
- }
-
- @Override public int textOffset() throws IOException {
- return 0;
- }
-
- @Override public Number numberValue() throws IOException {
- if (currentNumberType == NumberType.INT) {
- return valueInt;
- } else if (currentNumberType == NumberType.LONG) {
- return valueLong;
- } else if (currentNumberType == NumberType.FLOAT) {
- return valueFloat;
- } else if (currentNumberType == NumberType.DOUBLE) {
- return valueDouble;
- }
- throw new IOException("No number type");
- }
-
- @Override public NumberType numberType() throws IOException {
- return currentNumberType;
- }
-
- @Override public boolean estimatedNumberType() {
- return false;
- }
-
- @Override public byte[] binaryValue() throws IOException {
- return valueBytes;
- }
-
- @Override protected boolean doBooleanValue() throws IOException {
- return valueBoolean;
- }
-
- @Override protected short doShortValue() throws IOException {
- if (currentNumberType == NumberType.INT) {
- return (short) valueInt;
- } else if (currentNumberType == NumberType.LONG) {
- return (short) valueLong;
- } else if (currentNumberType == NumberType.FLOAT) {
- return (short) valueFloat;
- } else if (currentNumberType == NumberType.DOUBLE) {
- return (short) valueDouble;
- }
- throw new IOException("No number type");
- }
-
- @Override protected int doIntValue() throws IOException {
- if (currentNumberType == NumberType.INT) {
- return valueInt;
- } else if (currentNumberType == NumberType.LONG) {
- return (int) valueLong;
- } else if (currentNumberType == NumberType.FLOAT) {
- return (int) valueFloat;
- } else if (currentNumberType == NumberType.DOUBLE) {
- return (int) valueDouble;
- }
- throw new IOException("No number type");
- }
-
- @Override protected long doLongValue() throws IOException {
- if (currentNumberType == NumberType.LONG) {
- return valueLong;
- } else if (currentNumberType == NumberType.INT) {
- return (long) valueInt;
- } else if (currentNumberType == NumberType.FLOAT) {
- return (long) valueFloat;
- } else if (currentNumberType == NumberType.DOUBLE) {
- return (long) valueDouble;
- }
- throw new IOException("No number type");
- }
-
- @Override protected float doFloatValue() throws IOException {
- if (currentNumberType == NumberType.FLOAT) {
- return valueFloat;
- } else if (currentNumberType == NumberType.INT) {
- return (float) valueInt;
- } else if (currentNumberType == NumberType.LONG) {
- return (float) valueLong;
- } else if (currentNumberType == NumberType.DOUBLE) {
- return (float) valueDouble;
- }
- throw new IOException("No number type");
- }
-
- @Override protected double doDoubleValue() throws IOException {
- if (currentNumberType == NumberType.DOUBLE) {
- return valueDouble;
- } else if (currentNumberType == NumberType.INT) {
- return (double) valueInt;
- } else if (currentNumberType == NumberType.FLOAT) {
- return (double) valueFloat;
- } else if (currentNumberType == NumberType.LONG) {
- return (double) valueLong;
- }
- throw new IOException("No number type");
- }
-
- @Override public void close() {
- try {
- is.close();
- } catch (IOException e) {
- // ignore
- }
- }
-
- private short inShort() throws IOException {
- return (short) (((is.read() & 0xFF) << 8) | (is.read() & 0xFF));
- }
-
- /**
- * Reads four bytes and returns an int.
- */
- private int inInt() throws IOException {
- return ((is.read() & 0xFF) << 24) | ((is.read() & 0xFF) << 16)
- | ((is.read() & 0xFF) << 8) | (is.read() & 0xFF);
- }
-
- /**
- * Reads an int stored in variable-length format. Reads between one and
- * five bytes. Smaller values take fewer bytes. Negative numbers are not
- * supported.
- */
- private int inVInt() throws IOException {
- int b = is.read();
- int i = b & 0x7F;
- for (int shift = 7; (b & 0x80) != 0; shift += 7) {
- b = is.read();
- i |= (b & 0x7F) << shift;
- }
- return i;
- }
-
- /**
- * Reads eight bytes and returns a long.
- */
- private long inLong() throws IOException {
- return (((long) inInt()) << 32) | (inInt() & 0xFFFFFFFFL);
- }
-
- /**
- * Reads a long stored in variable-length format. Reads between one and
- * nine bytes. Smaller values take fewer bytes. Negative numbers are not
- * supported.
- */
- private long readVLong() throws IOException {
- int b = is.read();
- long i = b & 0x7F;
- for (int shift = 7; (b & 0x80) != 0; shift += 7) {
- b = is.read();
- i |= (b & 0x7FL) << shift;
- }
- return i;
- }
-
- private String inUTF() throws IOException {
- inUtf16();
- return new String(utf16Result.result, 0, utf16Result.length);
- }
-
- /**
- * Reads a string.
- */
- private void inUtf16() throws IOException {
- int length = inVInt();
- byte[] bytes = Bytes.cachedBytes.get().get();
- if (bytes == null || length > bytes.length) {
- bytes = new byte[(int) (length * 1.25)];
- Bytes.cachedBytes.get().set(bytes);
- }
- inBytes(bytes, 0, length);
- utf16Result = Unicode.fromBytesAsUtf16(bytes, 0, length);
- }
-
- private float inFloat() throws IOException {
- return Float.intBitsToFloat(inInt());
- }
-
- private double inDouble() throws IOException {
- return Double.longBitsToDouble(inLong());
- }
-
- /**
- * Reads a boolean.
- */
- private boolean inBoolean() throws IOException {
- byte ch = (byte) is.read();
- if (ch < 0)
- throw new EOFException();
- return (ch != 0);
- }
-
- private void inBytes(byte[] b, int offset, int len) throws IOException {
- int n = 0;
- while (n < len) {
- int count = is.read(b, offset + n, len - n);
- if (count < 0)
- throw new EOFException();
- n += count;
- }
- }
-
-}
diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/gateway/blobstore/BlobStoreGateway.java b/modules/elasticsearch/src/main/java/org/elasticsearch/gateway/blobstore/BlobStoreGateway.java
index 13a7694e54ce0..60c406a17d24d 100644
--- a/modules/elasticsearch/src/main/java/org/elasticsearch/gateway/blobstore/BlobStoreGateway.java
+++ b/modules/elasticsearch/src/main/java/org/elasticsearch/gateway/blobstore/BlobStoreGateway.java
@@ -27,11 +27,7 @@
import org.elasticsearch.common.collect.ImmutableMap;
import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.common.unit.ByteSizeValue;
-import org.elasticsearch.common.xcontent.ToXContent;
-import org.elasticsearch.common.xcontent.XContentFactory;
-import org.elasticsearch.common.xcontent.XContentParser;
-import org.elasticsearch.common.xcontent.XContentType;
-import org.elasticsearch.common.xcontent.builder.BinaryXContentBuilder;
+import org.elasticsearch.common.xcontent.*;
import org.elasticsearch.gateway.GatewayException;
import org.elasticsearch.gateway.shared.SharedStorageGateway;
@@ -108,9 +104,9 @@ public ByteSizeValue chunkSize() {
@Override public void write(MetaData metaData) throws GatewayException {
final String newMetaData = "metadata-" + (currentIndex + 1);
- BinaryXContentBuilder builder;
+ XContentBuilder builder;
try {
- builder = XContentFactory.contentBinaryBuilder(XContentType.JSON);
+ builder = XContentFactory.contentBuilder(XContentType.JSON);
builder.prettyPrint();
builder.startObject();
MetaData.Builder.toXContent(metaData, builder, ToXContent.EMPTY_PARAMS);
diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/gateway/local/LocalGateway.java b/modules/elasticsearch/src/main/java/org/elasticsearch/gateway/local/LocalGateway.java
index 8b44e3b351200..bb4f8d154e8d4 100644
--- a/modules/elasticsearch/src/main/java/org/elasticsearch/gateway/local/LocalGateway.java
+++ b/modules/elasticsearch/src/main/java/org/elasticsearch/gateway/local/LocalGateway.java
@@ -40,11 +40,7 @@
import org.elasticsearch.common.io.FileSystemUtils;
import org.elasticsearch.common.io.Streams;
import org.elasticsearch.common.settings.Settings;
-import org.elasticsearch.common.xcontent.ToXContent;
-import org.elasticsearch.common.xcontent.XContentFactory;
-import org.elasticsearch.common.xcontent.XContentParser;
-import org.elasticsearch.common.xcontent.XContentType;
-import org.elasticsearch.common.xcontent.builder.BinaryXContentBuilder;
+import org.elasticsearch.common.xcontent.*;
import org.elasticsearch.env.NodeEnvironment;
import org.elasticsearch.gateway.Gateway;
import org.elasticsearch.gateway.GatewayException;
@@ -241,7 +237,7 @@ public LocalGatewayStartedShards currentStartedShards() {
try {
LocalGatewayMetaState stateToWrite = builder.build();
- BinaryXContentBuilder xContentBuilder = XContentFactory.contentBinaryBuilder(XContentType.JSON);
+ XContentBuilder xContentBuilder = XContentFactory.contentBuilder(XContentType.JSON);
xContentBuilder.prettyPrint();
xContentBuilder.startObject();
LocalGatewayMetaState.Builder.toXContent(stateToWrite, xContentBuilder, ToXContent.EMPTY_PARAMS);
@@ -298,7 +294,7 @@ public LocalGatewayStartedShards currentStartedShards() {
try {
LocalGatewayStartedShards stateToWrite = builder.build();
- BinaryXContentBuilder xContentBuilder = XContentFactory.contentBinaryBuilder(XContentType.JSON);
+ XContentBuilder xContentBuilder = XContentFactory.contentBuilder(XContentType.JSON);
xContentBuilder.prettyPrint();
xContentBuilder.startObject();
LocalGatewayStartedShards.Builder.toXContent(stateToWrite, xContentBuilder, ToXContent.EMPTY_PARAMS);
diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/gateway/local/LocalGatewayMetaState.java b/modules/elasticsearch/src/main/java/org/elasticsearch/gateway/local/LocalGatewayMetaState.java
index ba69943042011..27904c8caa8e0 100644
--- a/modules/elasticsearch/src/main/java/org/elasticsearch/gateway/local/LocalGatewayMetaState.java
+++ b/modules/elasticsearch/src/main/java/org/elasticsearch/gateway/local/LocalGatewayMetaState.java
@@ -24,8 +24,8 @@
import org.elasticsearch.common.io.stream.StreamOutput;
import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.common.xcontent.ToXContent;
+import org.elasticsearch.common.xcontent.XContentBuilder;
import org.elasticsearch.common.xcontent.XContentParser;
-import org.elasticsearch.common.xcontent.builder.XContentBuilder;
import javax.annotation.Nullable;
import java.io.IOException;
diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/gateway/local/LocalGatewayStartedShards.java b/modules/elasticsearch/src/main/java/org/elasticsearch/gateway/local/LocalGatewayStartedShards.java
index ece6a8b34f0ff..f2400bbcda99c 100644
--- a/modules/elasticsearch/src/main/java/org/elasticsearch/gateway/local/LocalGatewayStartedShards.java
+++ b/modules/elasticsearch/src/main/java/org/elasticsearch/gateway/local/LocalGatewayStartedShards.java
@@ -25,8 +25,8 @@
import org.elasticsearch.common.io.stream.StreamOutput;
import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.common.xcontent.ToXContent;
+import org.elasticsearch.common.xcontent.XContentBuilder;
import org.elasticsearch.common.xcontent.XContentParser;
-import org.elasticsearch.common.xcontent.builder.XContentBuilder;
import org.elasticsearch.index.shard.ShardId;
import javax.annotation.Nullable;
diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/index/field/function/script/ScriptFieldsFunction.java b/modules/elasticsearch/src/main/java/org/elasticsearch/index/field/function/script/ScriptFieldsFunction.java
index 649d4382052b9..80841dfaa77aa 100644
--- a/modules/elasticsearch/src/main/java/org/elasticsearch/index/field/function/script/ScriptFieldsFunction.java
+++ b/modules/elasticsearch/src/main/java/org/elasticsearch/index/field/function/script/ScriptFieldsFunction.java
@@ -31,6 +31,7 @@
import org.elasticsearch.common.io.stream.LZFStreamInput;
import org.elasticsearch.common.thread.ThreadLocals;
import org.elasticsearch.common.xcontent.XContentFactory;
+import org.elasticsearch.common.xcontent.XContentParser;
import org.elasticsearch.common.xcontent.XContentType;
import org.elasticsearch.index.cache.field.data.FieldDataCache;
import org.elasticsearch.index.field.data.FieldData;
@@ -129,6 +130,7 @@ private Map loadSourceIfNeeded() {
if (source != null) {
return source;
}
+ XContentParser parser = null;
try {
Document doc = reader.document(docId, SourceFieldSelector.INSTANCE);
Fieldable sourceField = doc.getFieldable(SourceFieldMapper.NAME);
@@ -138,12 +140,18 @@ private Map loadSourceIfNeeded() {
LZFStreamInput siLzf = CachedStreamInput.cachedLzf(siBytes);
XContentType contentType = XContentFactory.xContentType(siLzf);
siLzf.resetToBufferStart();
- this.source = XContentFactory.xContent(contentType).createParser(siLzf).map();
+ parser = XContentFactory.xContent(contentType).createParser(siLzf);
+ this.source = parser.map();
} else {
- this.source = XContentFactory.xContent(source).createParser(source).map();
+ parser = XContentFactory.xContent(source).createParser(source);
+ this.source = parser.map();
}
} catch (Exception e) {
throw new ElasticSearchParseException("failed to parse source", e);
+ } finally {
+ if (parser != null) {
+ parser.close();
+ }
}
return this.source;
}
diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/index/gateway/CommitPoints.java b/modules/elasticsearch/src/main/java/org/elasticsearch/index/gateway/CommitPoints.java
index 86e9a3ea51c1a..6b1c08890586e 100644
--- a/modules/elasticsearch/src/main/java/org/elasticsearch/index/gateway/CommitPoints.java
+++ b/modules/elasticsearch/src/main/java/org/elasticsearch/index/gateway/CommitPoints.java
@@ -21,10 +21,10 @@
import org.elasticsearch.common.collect.ImmutableList;
import org.elasticsearch.common.collect.Lists;
+import org.elasticsearch.common.xcontent.XContentBuilder;
import org.elasticsearch.common.xcontent.XContentFactory;
import org.elasticsearch.common.xcontent.XContentParser;
import org.elasticsearch.common.xcontent.XContentType;
-import org.elasticsearch.common.xcontent.builder.XContentBuilder;
import java.io.IOException;
import java.util.Collections;
@@ -86,7 +86,7 @@ public CommitPoint.FileInfo findNameFile(String name) {
}
public static byte[] toXContent(CommitPoint commitPoint) throws Exception {
- XContentBuilder builder = XContentFactory.contentBinaryBuilder(XContentType.JSON).prettyPrint();
+ XContentBuilder builder = XContentFactory.contentBuilder(XContentType.JSON).prettyPrint();
builder.startObject();
builder.field("version", commitPoint.version());
builder.field("name", commitPoint.name());
diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/index/mapper/xcontent/XContentAllFieldMapper.java b/modules/elasticsearch/src/main/java/org/elasticsearch/index/mapper/xcontent/XContentAllFieldMapper.java
index 7db7f5c62fe65..5008b920fc411 100644
--- a/modules/elasticsearch/src/main/java/org/elasticsearch/index/mapper/xcontent/XContentAllFieldMapper.java
+++ b/modules/elasticsearch/src/main/java/org/elasticsearch/index/mapper/xcontent/XContentAllFieldMapper.java
@@ -27,7 +27,7 @@
import org.elasticsearch.common.lucene.Lucene;
import org.elasticsearch.common.lucene.all.AllField;
import org.elasticsearch.common.lucene.all.AllTermQuery;
-import org.elasticsearch.common.xcontent.builder.XContentBuilder;
+import org.elasticsearch.common.xcontent.XContentBuilder;
import org.elasticsearch.index.analysis.NamedAnalyzer;
import org.elasticsearch.index.mapper.AllFieldMapper;
import org.elasticsearch.index.mapper.DocumentMapper;
diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/index/mapper/xcontent/XContentBinaryFieldMapper.java b/modules/elasticsearch/src/main/java/org/elasticsearch/index/mapper/xcontent/XContentBinaryFieldMapper.java
index 4c82c3f4dff5a..2b052f95d524a 100644
--- a/modules/elasticsearch/src/main/java/org/elasticsearch/index/mapper/xcontent/XContentBinaryFieldMapper.java
+++ b/modules/elasticsearch/src/main/java/org/elasticsearch/index/mapper/xcontent/XContentBinaryFieldMapper.java
@@ -21,8 +21,8 @@
import org.apache.lucene.document.Field;
import org.apache.lucene.document.Fieldable;
+import org.elasticsearch.common.xcontent.XContentBuilder;
import org.elasticsearch.common.xcontent.XContentParser;
-import org.elasticsearch.common.xcontent.builder.XContentBuilder;
import org.elasticsearch.index.mapper.MapperParsingException;
import java.io.IOException;
diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/index/mapper/xcontent/XContentBooleanFieldMapper.java b/modules/elasticsearch/src/main/java/org/elasticsearch/index/mapper/xcontent/XContentBooleanFieldMapper.java
index 4dc1a89176039..dab5f755bc5b7 100644
--- a/modules/elasticsearch/src/main/java/org/elasticsearch/index/mapper/xcontent/XContentBooleanFieldMapper.java
+++ b/modules/elasticsearch/src/main/java/org/elasticsearch/index/mapper/xcontent/XContentBooleanFieldMapper.java
@@ -24,8 +24,8 @@
import org.elasticsearch.common.Booleans;
import org.elasticsearch.common.Strings;
import org.elasticsearch.common.lucene.Lucene;
+import org.elasticsearch.common.xcontent.XContentBuilder;
import org.elasticsearch.common.xcontent.XContentParser;
-import org.elasticsearch.common.xcontent.builder.XContentBuilder;
import org.elasticsearch.index.mapper.MapperParsingException;
import java.io.IOException;
diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/index/mapper/xcontent/XContentBoostFieldMapper.java b/modules/elasticsearch/src/main/java/org/elasticsearch/index/mapper/xcontent/XContentBoostFieldMapper.java
index 52a572c472e71..e3976821d4ed5 100644
--- a/modules/elasticsearch/src/main/java/org/elasticsearch/index/mapper/xcontent/XContentBoostFieldMapper.java
+++ b/modules/elasticsearch/src/main/java/org/elasticsearch/index/mapper/xcontent/XContentBoostFieldMapper.java
@@ -27,8 +27,8 @@
import org.apache.lucene.search.Query;
import org.apache.lucene.util.NumericUtils;
import org.elasticsearch.common.Numbers;
+import org.elasticsearch.common.xcontent.XContentBuilder;
import org.elasticsearch.common.xcontent.XContentParser;
-import org.elasticsearch.common.xcontent.builder.XContentBuilder;
import org.elasticsearch.index.analysis.NamedAnalyzer;
import org.elasticsearch.index.analysis.NumericFloatAnalyzer;
import org.elasticsearch.index.field.data.FieldData;
diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/index/mapper/xcontent/XContentDateFieldMapper.java b/modules/elasticsearch/src/main/java/org/elasticsearch/index/mapper/xcontent/XContentDateFieldMapper.java
index 8a9fc22a9a3a3..62cb63b17cb1a 100644
--- a/modules/elasticsearch/src/main/java/org/elasticsearch/index/mapper/xcontent/XContentDateFieldMapper.java
+++ b/modules/elasticsearch/src/main/java/org/elasticsearch/index/mapper/xcontent/XContentDateFieldMapper.java
@@ -30,8 +30,8 @@
import org.elasticsearch.common.Strings;
import org.elasticsearch.common.joda.FormatDateTimeFormatter;
import org.elasticsearch.common.joda.Joda;
+import org.elasticsearch.common.xcontent.XContentBuilder;
import org.elasticsearch.common.xcontent.XContentParser;
-import org.elasticsearch.common.xcontent.builder.XContentBuilder;
import org.elasticsearch.index.analysis.NamedAnalyzer;
import org.elasticsearch.index.analysis.NumericDateAnalyzer;
import org.elasticsearch.index.field.data.FieldData;
diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/index/mapper/xcontent/XContentDocumentMapper.java b/modules/elasticsearch/src/main/java/org/elasticsearch/index/mapper/xcontent/XContentDocumentMapper.java
index 627e0a51da84a..66d6c33cac8b1 100644
--- a/modules/elasticsearch/src/main/java/org/elasticsearch/index/mapper/xcontent/XContentDocumentMapper.java
+++ b/modules/elasticsearch/src/main/java/org/elasticsearch/index/mapper/xcontent/XContentDocumentMapper.java
@@ -27,11 +27,7 @@
import org.elasticsearch.common.compress.CompressedString;
import org.elasticsearch.common.lucene.search.TermFilter;
import org.elasticsearch.common.thread.ThreadLocals;
-import org.elasticsearch.common.xcontent.ToXContent;
-import org.elasticsearch.common.xcontent.XContentFactory;
-import org.elasticsearch.common.xcontent.XContentParser;
-import org.elasticsearch.common.xcontent.XContentType;
-import org.elasticsearch.common.xcontent.builder.XContentBuilder;
+import org.elasticsearch.common.xcontent.*;
import org.elasticsearch.index.analysis.NamedAnalyzer;
import org.elasticsearch.index.mapper.*;
@@ -422,7 +418,7 @@ void addFieldMapper(FieldMapper fieldMapper) {
@Override public void refreshSource() throws FailedToGenerateSourceMapperException {
try {
- XContentBuilder builder = XContentFactory.contentTextBuilder(XContentType.JSON);
+ XContentBuilder builder = XContentFactory.contentBuilder(XContentType.JSON);
builder.startObject();
toXContent(builder, ToXContent.EMPTY_PARAMS);
builder.endObject();
diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/index/mapper/xcontent/XContentDoubleFieldMapper.java b/modules/elasticsearch/src/main/java/org/elasticsearch/index/mapper/xcontent/XContentDoubleFieldMapper.java
index 857637a2fab24..55b8b0a09f6fe 100644
--- a/modules/elasticsearch/src/main/java/org/elasticsearch/index/mapper/xcontent/XContentDoubleFieldMapper.java
+++ b/modules/elasticsearch/src/main/java/org/elasticsearch/index/mapper/xcontent/XContentDoubleFieldMapper.java
@@ -27,8 +27,8 @@
import org.apache.lucene.search.Query;
import org.apache.lucene.util.NumericUtils;
import org.elasticsearch.common.Numbers;
+import org.elasticsearch.common.xcontent.XContentBuilder;
import org.elasticsearch.common.xcontent.XContentParser;
-import org.elasticsearch.common.xcontent.builder.XContentBuilder;
import org.elasticsearch.index.analysis.NamedAnalyzer;
import org.elasticsearch.index.analysis.NumericDoubleAnalyzer;
import org.elasticsearch.index.field.data.FieldData;
diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/index/mapper/xcontent/XContentFieldMapper.java b/modules/elasticsearch/src/main/java/org/elasticsearch/index/mapper/xcontent/XContentFieldMapper.java
index 24dd386927538..56ece57677503 100644
--- a/modules/elasticsearch/src/main/java/org/elasticsearch/index/mapper/xcontent/XContentFieldMapper.java
+++ b/modules/elasticsearch/src/main/java/org/elasticsearch/index/mapper/xcontent/XContentFieldMapper.java
@@ -26,7 +26,7 @@
import org.apache.lucene.search.*;
import org.elasticsearch.common.lucene.Lucene;
import org.elasticsearch.common.lucene.search.TermFilter;
-import org.elasticsearch.common.xcontent.builder.XContentBuilder;
+import org.elasticsearch.common.xcontent.XContentBuilder;
import org.elasticsearch.index.analysis.NamedAnalyzer;
import org.elasticsearch.index.field.data.FieldData;
import org.elasticsearch.index.mapper.FieldMapper;
diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/index/mapper/xcontent/XContentFloatFieldMapper.java b/modules/elasticsearch/src/main/java/org/elasticsearch/index/mapper/xcontent/XContentFloatFieldMapper.java
index 724c4031e15c4..2ee6c8cda9554 100644
--- a/modules/elasticsearch/src/main/java/org/elasticsearch/index/mapper/xcontent/XContentFloatFieldMapper.java
+++ b/modules/elasticsearch/src/main/java/org/elasticsearch/index/mapper/xcontent/XContentFloatFieldMapper.java
@@ -28,8 +28,8 @@
import org.apache.lucene.util.NumericUtils;
import org.elasticsearch.common.Numbers;
import org.elasticsearch.common.Strings;
+import org.elasticsearch.common.xcontent.XContentBuilder;
import org.elasticsearch.common.xcontent.XContentParser;
-import org.elasticsearch.common.xcontent.builder.XContentBuilder;
import org.elasticsearch.index.analysis.NamedAnalyzer;
import org.elasticsearch.index.analysis.NumericFloatAnalyzer;
import org.elasticsearch.index.field.data.FieldData;
diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/index/mapper/xcontent/XContentGeoPointFieldMapper.java b/modules/elasticsearch/src/main/java/org/elasticsearch/index/mapper/xcontent/XContentGeoPointFieldMapper.java
index 19d575b0df315..ee643874b256a 100644
--- a/modules/elasticsearch/src/main/java/org/elasticsearch/index/mapper/xcontent/XContentGeoPointFieldMapper.java
+++ b/modules/elasticsearch/src/main/java/org/elasticsearch/index/mapper/xcontent/XContentGeoPointFieldMapper.java
@@ -23,8 +23,8 @@
import org.elasticsearch.ElasticSearchIllegalArgumentException;
import org.elasticsearch.common.Strings;
import org.elasticsearch.common.lucene.geo.GeoHashUtils;
+import org.elasticsearch.common.xcontent.XContentBuilder;
import org.elasticsearch.common.xcontent.XContentParser;
-import org.elasticsearch.common.xcontent.builder.XContentBuilder;
import org.elasticsearch.common.xcontent.support.XContentMapValues;
import org.elasticsearch.index.mapper.FieldMapperListener;
import org.elasticsearch.index.mapper.MapperParsingException;
diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/index/mapper/xcontent/XContentIdFieldMapper.java b/modules/elasticsearch/src/main/java/org/elasticsearch/index/mapper/xcontent/XContentIdFieldMapper.java
index e55a8841ad934..d0221bdc2df17 100644
--- a/modules/elasticsearch/src/main/java/org/elasticsearch/index/mapper/xcontent/XContentIdFieldMapper.java
+++ b/modules/elasticsearch/src/main/java/org/elasticsearch/index/mapper/xcontent/XContentIdFieldMapper.java
@@ -23,7 +23,7 @@
import org.apache.lucene.document.Field;
import org.apache.lucene.document.Fieldable;
import org.elasticsearch.common.lucene.Lucene;
-import org.elasticsearch.common.xcontent.builder.XContentBuilder;
+import org.elasticsearch.common.xcontent.XContentBuilder;
import org.elasticsearch.index.mapper.IdFieldMapper;
import org.elasticsearch.index.mapper.MapperParsingException;
import org.elasticsearch.index.mapper.MergeMappingException;
diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/index/mapper/xcontent/XContentIndexFieldMapper.java b/modules/elasticsearch/src/main/java/org/elasticsearch/index/mapper/xcontent/XContentIndexFieldMapper.java
index 5f4f3b945a1f5..42e2292d42ac8 100644
--- a/modules/elasticsearch/src/main/java/org/elasticsearch/index/mapper/xcontent/XContentIndexFieldMapper.java
+++ b/modules/elasticsearch/src/main/java/org/elasticsearch/index/mapper/xcontent/XContentIndexFieldMapper.java
@@ -24,7 +24,7 @@
import org.apache.lucene.document.Fieldable;
import org.apache.lucene.index.Term;
import org.elasticsearch.common.lucene.Lucene;
-import org.elasticsearch.common.xcontent.builder.XContentBuilder;
+import org.elasticsearch.common.xcontent.XContentBuilder;
import org.elasticsearch.index.mapper.IndexFieldMapper;
import org.elasticsearch.index.mapper.MergeMappingException;
diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/index/mapper/xcontent/XContentIntegerFieldMapper.java b/modules/elasticsearch/src/main/java/org/elasticsearch/index/mapper/xcontent/XContentIntegerFieldMapper.java
index 866591001ba22..5db93fd7c54b4 100644
--- a/modules/elasticsearch/src/main/java/org/elasticsearch/index/mapper/xcontent/XContentIntegerFieldMapper.java
+++ b/modules/elasticsearch/src/main/java/org/elasticsearch/index/mapper/xcontent/XContentIntegerFieldMapper.java
@@ -28,8 +28,8 @@
import org.apache.lucene.util.NumericUtils;
import org.elasticsearch.common.Numbers;
import org.elasticsearch.common.Strings;
+import org.elasticsearch.common.xcontent.XContentBuilder;
import org.elasticsearch.common.xcontent.XContentParser;
-import org.elasticsearch.common.xcontent.builder.XContentBuilder;
import org.elasticsearch.index.analysis.NamedAnalyzer;
import org.elasticsearch.index.analysis.NumericIntegerAnalyzer;
import org.elasticsearch.index.field.data.FieldData;
diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/index/mapper/xcontent/XContentLongFieldMapper.java b/modules/elasticsearch/src/main/java/org/elasticsearch/index/mapper/xcontent/XContentLongFieldMapper.java
index bc9120d54d469..ee943c7f3e946 100644
--- a/modules/elasticsearch/src/main/java/org/elasticsearch/index/mapper/xcontent/XContentLongFieldMapper.java
+++ b/modules/elasticsearch/src/main/java/org/elasticsearch/index/mapper/xcontent/XContentLongFieldMapper.java
@@ -28,8 +28,8 @@
import org.apache.lucene.util.NumericUtils;
import org.elasticsearch.common.Numbers;
import org.elasticsearch.common.Strings;
+import org.elasticsearch.common.xcontent.XContentBuilder;
import org.elasticsearch.common.xcontent.XContentParser;
-import org.elasticsearch.common.xcontent.builder.XContentBuilder;
import org.elasticsearch.index.analysis.NamedAnalyzer;
import org.elasticsearch.index.analysis.NumericLongAnalyzer;
import org.elasticsearch.index.field.data.FieldData;
diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/index/mapper/xcontent/XContentMultiFieldMapper.java b/modules/elasticsearch/src/main/java/org/elasticsearch/index/mapper/xcontent/XContentMultiFieldMapper.java
index 5cda902eea89f..217bfc892da2d 100644
--- a/modules/elasticsearch/src/main/java/org/elasticsearch/index/mapper/xcontent/XContentMultiFieldMapper.java
+++ b/modules/elasticsearch/src/main/java/org/elasticsearch/index/mapper/xcontent/XContentMultiFieldMapper.java
@@ -21,7 +21,7 @@
import org.elasticsearch.common.Strings;
import org.elasticsearch.common.collect.ImmutableMap;
-import org.elasticsearch.common.xcontent.builder.XContentBuilder;
+import org.elasticsearch.common.xcontent.XContentBuilder;
import org.elasticsearch.index.mapper.FieldMapper;
import org.elasticsearch.index.mapper.FieldMapperListener;
import org.elasticsearch.index.mapper.MapperParsingException;
diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/index/mapper/xcontent/XContentNumberFieldMapper.java b/modules/elasticsearch/src/main/java/org/elasticsearch/index/mapper/xcontent/XContentNumberFieldMapper.java
index 891be8c258cc4..d32b601e779bf 100644
--- a/modules/elasticsearch/src/main/java/org/elasticsearch/index/mapper/xcontent/XContentNumberFieldMapper.java
+++ b/modules/elasticsearch/src/main/java/org/elasticsearch/index/mapper/xcontent/XContentNumberFieldMapper.java
@@ -28,7 +28,7 @@
import org.apache.lucene.util.NumericUtils;
import org.elasticsearch.common.thread.ThreadLocals;
import org.elasticsearch.common.trove.TIntObjectHashMap;
-import org.elasticsearch.common.xcontent.builder.XContentBuilder;
+import org.elasticsearch.common.xcontent.XContentBuilder;
import org.elasticsearch.index.analysis.NamedAnalyzer;
import org.elasticsearch.index.field.data.FieldData;
import org.elasticsearch.index.mapper.MergeMappingException;
diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/index/mapper/xcontent/XContentObjectMapper.java b/modules/elasticsearch/src/main/java/org/elasticsearch/index/mapper/xcontent/XContentObjectMapper.java
index 326cf0e38e054..554fa6edba15d 100644
--- a/modules/elasticsearch/src/main/java/org/elasticsearch/index/mapper/xcontent/XContentObjectMapper.java
+++ b/modules/elasticsearch/src/main/java/org/elasticsearch/index/mapper/xcontent/XContentObjectMapper.java
@@ -25,8 +25,8 @@
import org.elasticsearch.common.joda.FormatDateTimeFormatter;
import org.elasticsearch.common.joda.Joda;
import org.elasticsearch.common.util.concurrent.ThreadSafe;
+import org.elasticsearch.common.xcontent.XContentBuilder;
import org.elasticsearch.common.xcontent.XContentParser;
-import org.elasticsearch.common.xcontent.builder.XContentBuilder;
import org.elasticsearch.index.mapper.*;
import java.io.IOException;
diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/index/mapper/xcontent/XContentShortFieldMapper.java b/modules/elasticsearch/src/main/java/org/elasticsearch/index/mapper/xcontent/XContentShortFieldMapper.java
index 7459bf563d215..26a490b1d5957 100644
--- a/modules/elasticsearch/src/main/java/org/elasticsearch/index/mapper/xcontent/XContentShortFieldMapper.java
+++ b/modules/elasticsearch/src/main/java/org/elasticsearch/index/mapper/xcontent/XContentShortFieldMapper.java
@@ -28,8 +28,8 @@
import org.apache.lucene.util.NumericUtils;
import org.elasticsearch.common.Numbers;
import org.elasticsearch.common.Strings;
+import org.elasticsearch.common.xcontent.XContentBuilder;
import org.elasticsearch.common.xcontent.XContentParser;
-import org.elasticsearch.common.xcontent.builder.XContentBuilder;
import org.elasticsearch.index.analysis.NamedAnalyzer;
import org.elasticsearch.index.analysis.NumericIntegerAnalyzer;
import org.elasticsearch.index.field.data.FieldData;
diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/index/mapper/xcontent/XContentSourceFieldMapper.java b/modules/elasticsearch/src/main/java/org/elasticsearch/index/mapper/xcontent/XContentSourceFieldMapper.java
index 995547de93f84..2b10f96738cf9 100644
--- a/modules/elasticsearch/src/main/java/org/elasticsearch/index/mapper/xcontent/XContentSourceFieldMapper.java
+++ b/modules/elasticsearch/src/main/java/org/elasticsearch/index/mapper/xcontent/XContentSourceFieldMapper.java
@@ -24,7 +24,7 @@
import org.elasticsearch.common.compress.lzf.LZFDecoder;
import org.elasticsearch.common.compress.lzf.LZFEncoder;
import org.elasticsearch.common.lucene.Lucene;
-import org.elasticsearch.common.xcontent.builder.XContentBuilder;
+import org.elasticsearch.common.xcontent.XContentBuilder;
import org.elasticsearch.index.mapper.MergeMappingException;
import org.elasticsearch.index.mapper.SourceFieldMapper;
diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/index/mapper/xcontent/XContentStringFieldMapper.java b/modules/elasticsearch/src/main/java/org/elasticsearch/index/mapper/xcontent/XContentStringFieldMapper.java
index 53818eeeddad6..13d58f76154c6 100644
--- a/modules/elasticsearch/src/main/java/org/elasticsearch/index/mapper/xcontent/XContentStringFieldMapper.java
+++ b/modules/elasticsearch/src/main/java/org/elasticsearch/index/mapper/xcontent/XContentStringFieldMapper.java
@@ -22,8 +22,8 @@
import org.apache.lucene.document.Field;
import org.apache.lucene.document.Fieldable;
import org.elasticsearch.common.Strings;
+import org.elasticsearch.common.xcontent.XContentBuilder;
import org.elasticsearch.common.xcontent.XContentParser;
-import org.elasticsearch.common.xcontent.builder.XContentBuilder;
import org.elasticsearch.index.analysis.NamedAnalyzer;
import org.elasticsearch.index.mapper.MapperParsingException;
import org.elasticsearch.index.mapper.MergeMappingException;
diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/index/mapper/xcontent/XContentTypeFieldMapper.java b/modules/elasticsearch/src/main/java/org/elasticsearch/index/mapper/xcontent/XContentTypeFieldMapper.java
index 7bfd07b3d25d5..e332310e4c43f 100644
--- a/modules/elasticsearch/src/main/java/org/elasticsearch/index/mapper/xcontent/XContentTypeFieldMapper.java
+++ b/modules/elasticsearch/src/main/java/org/elasticsearch/index/mapper/xcontent/XContentTypeFieldMapper.java
@@ -24,7 +24,7 @@
import org.apache.lucene.document.Fieldable;
import org.apache.lucene.index.Term;
import org.elasticsearch.common.lucene.Lucene;
-import org.elasticsearch.common.xcontent.builder.XContentBuilder;
+import org.elasticsearch.common.xcontent.XContentBuilder;
import org.elasticsearch.index.mapper.MergeMappingException;
import org.elasticsearch.index.mapper.TypeFieldMapper;
diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/index/mapper/xcontent/XContentUidFieldMapper.java b/modules/elasticsearch/src/main/java/org/elasticsearch/index/mapper/xcontent/XContentUidFieldMapper.java
index 36dcaeca64ce6..08c5bc31ba709 100644
--- a/modules/elasticsearch/src/main/java/org/elasticsearch/index/mapper/xcontent/XContentUidFieldMapper.java
+++ b/modules/elasticsearch/src/main/java/org/elasticsearch/index/mapper/xcontent/XContentUidFieldMapper.java
@@ -23,7 +23,7 @@
import org.apache.lucene.document.Fieldable;
import org.apache.lucene.index.Term;
import org.elasticsearch.common.lucene.Lucene;
-import org.elasticsearch.common.xcontent.builder.XContentBuilder;
+import org.elasticsearch.common.xcontent.XContentBuilder;
import org.elasticsearch.index.mapper.MapperParsingException;
import org.elasticsearch.index.mapper.MergeMappingException;
import org.elasticsearch.index.mapper.Uid;
diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/index/query/xcontent/AndFilterBuilder.java b/modules/elasticsearch/src/main/java/org/elasticsearch/index/query/xcontent/AndFilterBuilder.java
index 131f33c9836fa..f8a4fc90d4704 100644
--- a/modules/elasticsearch/src/main/java/org/elasticsearch/index/query/xcontent/AndFilterBuilder.java
+++ b/modules/elasticsearch/src/main/java/org/elasticsearch/index/query/xcontent/AndFilterBuilder.java
@@ -20,7 +20,7 @@
package org.elasticsearch.index.query.xcontent;
import org.elasticsearch.common.collect.Lists;
-import org.elasticsearch.common.xcontent.builder.XContentBuilder;
+import org.elasticsearch.common.xcontent.XContentBuilder;
import java.io.IOException;
import java.util.ArrayList;
diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/index/query/xcontent/BaseFilterBuilder.java b/modules/elasticsearch/src/main/java/org/elasticsearch/index/query/xcontent/BaseFilterBuilder.java
index 5d523b5217564..da80f0e9f42b4 100644
--- a/modules/elasticsearch/src/main/java/org/elasticsearch/index/query/xcontent/BaseFilterBuilder.java
+++ b/modules/elasticsearch/src/main/java/org/elasticsearch/index/query/xcontent/BaseFilterBuilder.java
@@ -19,7 +19,7 @@
package org.elasticsearch.index.query.xcontent;
-import org.elasticsearch.common.xcontent.builder.XContentBuilder;
+import org.elasticsearch.common.xcontent.XContentBuilder;
import java.io.IOException;
diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/index/query/xcontent/BaseQueryBuilder.java b/modules/elasticsearch/src/main/java/org/elasticsearch/index/query/xcontent/BaseQueryBuilder.java
index 776bdc0fdea58..e3960adf49703 100644
--- a/modules/elasticsearch/src/main/java/org/elasticsearch/index/query/xcontent/BaseQueryBuilder.java
+++ b/modules/elasticsearch/src/main/java/org/elasticsearch/index/query/xcontent/BaseQueryBuilder.java
@@ -20,10 +20,9 @@
package org.elasticsearch.index.query.xcontent;
import org.elasticsearch.common.io.FastByteArrayOutputStream;
+import org.elasticsearch.common.xcontent.XContentBuilder;
import org.elasticsearch.common.xcontent.XContentFactory;
import org.elasticsearch.common.xcontent.XContentType;
-import org.elasticsearch.common.xcontent.builder.BinaryXContentBuilder;
-import org.elasticsearch.common.xcontent.builder.XContentBuilder;
import org.elasticsearch.index.query.QueryBuilderException;
import java.io.IOException;
@@ -39,7 +38,7 @@ public abstract class BaseQueryBuilder implements XContentQueryBuilder {
@Override public FastByteArrayOutputStream buildAsUnsafeBytes(XContentType contentType) throws QueryBuilderException {
try {
- BinaryXContentBuilder builder = XContentFactory.contentBinaryBuilder(contentType);
+ XContentBuilder builder = XContentFactory.contentBuilder(contentType);
toXContent(builder, EMPTY_PARAMS);
return builder.unsafeStream();
} catch (Exception e) {
@@ -53,7 +52,7 @@ public abstract class BaseQueryBuilder implements XContentQueryBuilder {
@Override public byte[] buildAsBytes(XContentType contentType) throws QueryBuilderException {
try {
- XContentBuilder builder = XContentFactory.contentBinaryBuilder(contentType);
+ XContentBuilder builder = XContentFactory.contentBuilder(contentType);
toXContent(builder, EMPTY_PARAMS);
return builder.copiedBytes();
} catch (Exception e) {
diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/index/query/xcontent/BoolFilterBuilder.java b/modules/elasticsearch/src/main/java/org/elasticsearch/index/query/xcontent/BoolFilterBuilder.java
index 27c2613a356b6..3e05d5f5e5318 100644
--- a/modules/elasticsearch/src/main/java/org/elasticsearch/index/query/xcontent/BoolFilterBuilder.java
+++ b/modules/elasticsearch/src/main/java/org/elasticsearch/index/query/xcontent/BoolFilterBuilder.java
@@ -20,7 +20,7 @@
package org.elasticsearch.index.query.xcontent;
import org.apache.lucene.search.BooleanClause;
-import org.elasticsearch.common.xcontent.builder.XContentBuilder;
+import org.elasticsearch.common.xcontent.XContentBuilder;
import java.io.IOException;
import java.util.ArrayList;
diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/index/query/xcontent/BoolQueryBuilder.java b/modules/elasticsearch/src/main/java/org/elasticsearch/index/query/xcontent/BoolQueryBuilder.java
index 34cfe408411d1..7b53a2ed4ac58 100644
--- a/modules/elasticsearch/src/main/java/org/elasticsearch/index/query/xcontent/BoolQueryBuilder.java
+++ b/modules/elasticsearch/src/main/java/org/elasticsearch/index/query/xcontent/BoolQueryBuilder.java
@@ -20,7 +20,7 @@
package org.elasticsearch.index.query.xcontent;
import org.apache.lucene.search.BooleanClause;
-import org.elasticsearch.common.xcontent.builder.XContentBuilder;
+import org.elasticsearch.common.xcontent.XContentBuilder;
import java.io.IOException;
import java.util.ArrayList;
diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/index/query/xcontent/ConstantScoreQueryBuilder.java b/modules/elasticsearch/src/main/java/org/elasticsearch/index/query/xcontent/ConstantScoreQueryBuilder.java
index 3a29657b33752..0a9b1473ed7be 100644
--- a/modules/elasticsearch/src/main/java/org/elasticsearch/index/query/xcontent/ConstantScoreQueryBuilder.java
+++ b/modules/elasticsearch/src/main/java/org/elasticsearch/index/query/xcontent/ConstantScoreQueryBuilder.java
@@ -19,7 +19,7 @@
package org.elasticsearch.index.query.xcontent;
-import org.elasticsearch.common.xcontent.builder.XContentBuilder;
+import org.elasticsearch.common.xcontent.XContentBuilder;
import java.io.IOException;
diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/index/query/xcontent/CustomBoostFactorQueryBuilder.java b/modules/elasticsearch/src/main/java/org/elasticsearch/index/query/xcontent/CustomBoostFactorQueryBuilder.java
index 00e9c4fbc8ecc..7840c9ebcf4b4 100644
--- a/modules/elasticsearch/src/main/java/org/elasticsearch/index/query/xcontent/CustomBoostFactorQueryBuilder.java
+++ b/modules/elasticsearch/src/main/java/org/elasticsearch/index/query/xcontent/CustomBoostFactorQueryBuilder.java
@@ -19,7 +19,7 @@
package org.elasticsearch.index.query.xcontent;
-import org.elasticsearch.common.xcontent.builder.XContentBuilder;
+import org.elasticsearch.common.xcontent.XContentBuilder;
import java.io.IOException;
diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/index/query/xcontent/CustomScoreQueryBuilder.java b/modules/elasticsearch/src/main/java/org/elasticsearch/index/query/xcontent/CustomScoreQueryBuilder.java
index 9b99a235702a2..20b33721437b6 100644
--- a/modules/elasticsearch/src/main/java/org/elasticsearch/index/query/xcontent/CustomScoreQueryBuilder.java
+++ b/modules/elasticsearch/src/main/java/org/elasticsearch/index/query/xcontent/CustomScoreQueryBuilder.java
@@ -20,7 +20,7 @@
package org.elasticsearch.index.query.xcontent;
import org.elasticsearch.common.collect.Maps;
-import org.elasticsearch.common.xcontent.builder.XContentBuilder;
+import org.elasticsearch.common.xcontent.XContentBuilder;
import java.io.IOException;
import java.util.Map;
diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/index/query/xcontent/DisMaxQueryBuilder.java b/modules/elasticsearch/src/main/java/org/elasticsearch/index/query/xcontent/DisMaxQueryBuilder.java
index 778a5b5ad9663..c30b27a7a2367 100644
--- a/modules/elasticsearch/src/main/java/org/elasticsearch/index/query/xcontent/DisMaxQueryBuilder.java
+++ b/modules/elasticsearch/src/main/java/org/elasticsearch/index/query/xcontent/DisMaxQueryBuilder.java
@@ -19,7 +19,7 @@
package org.elasticsearch.index.query.xcontent;
-import org.elasticsearch.common.xcontent.builder.XContentBuilder;
+import org.elasticsearch.common.xcontent.XContentBuilder;
import java.io.IOException;
import java.util.ArrayList;
diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/index/query/xcontent/FieldQueryBuilder.java b/modules/elasticsearch/src/main/java/org/elasticsearch/index/query/xcontent/FieldQueryBuilder.java
index 4547feb104824..175d1833be1c6 100644
--- a/modules/elasticsearch/src/main/java/org/elasticsearch/index/query/xcontent/FieldQueryBuilder.java
+++ b/modules/elasticsearch/src/main/java/org/elasticsearch/index/query/xcontent/FieldQueryBuilder.java
@@ -19,7 +19,7 @@
package org.elasticsearch.index.query.xcontent;
-import org.elasticsearch.common.xcontent.builder.XContentBuilder;
+import org.elasticsearch.common.xcontent.XContentBuilder;
import java.io.IOException;
diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/index/query/xcontent/FilteredQueryBuilder.java b/modules/elasticsearch/src/main/java/org/elasticsearch/index/query/xcontent/FilteredQueryBuilder.java
index 536728ec53c35..2dff099dbd81f 100644
--- a/modules/elasticsearch/src/main/java/org/elasticsearch/index/query/xcontent/FilteredQueryBuilder.java
+++ b/modules/elasticsearch/src/main/java/org/elasticsearch/index/query/xcontent/FilteredQueryBuilder.java
@@ -19,7 +19,7 @@
package org.elasticsearch.index.query.xcontent;
-import org.elasticsearch.common.xcontent.builder.XContentBuilder;
+import org.elasticsearch.common.xcontent.XContentBuilder;
import java.io.IOException;
diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/index/query/xcontent/FuzzyLikeThisFieldQueryBuilder.java b/modules/elasticsearch/src/main/java/org/elasticsearch/index/query/xcontent/FuzzyLikeThisFieldQueryBuilder.java
index 7f79d8bc89b88..f053a3a288364 100644
--- a/modules/elasticsearch/src/main/java/org/elasticsearch/index/query/xcontent/FuzzyLikeThisFieldQueryBuilder.java
+++ b/modules/elasticsearch/src/main/java/org/elasticsearch/index/query/xcontent/FuzzyLikeThisFieldQueryBuilder.java
@@ -19,7 +19,7 @@
package org.elasticsearch.index.query.xcontent;
-import org.elasticsearch.common.xcontent.builder.XContentBuilder;
+import org.elasticsearch.common.xcontent.XContentBuilder;
import org.elasticsearch.index.query.QueryBuilderException;
import java.io.IOException;
diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/index/query/xcontent/FuzzyLikeThisQueryBuilder.java b/modules/elasticsearch/src/main/java/org/elasticsearch/index/query/xcontent/FuzzyLikeThisQueryBuilder.java
index ae2d52ed01612..f1683d219c39e 100644
--- a/modules/elasticsearch/src/main/java/org/elasticsearch/index/query/xcontent/FuzzyLikeThisQueryBuilder.java
+++ b/modules/elasticsearch/src/main/java/org/elasticsearch/index/query/xcontent/FuzzyLikeThisQueryBuilder.java
@@ -19,7 +19,7 @@
package org.elasticsearch.index.query.xcontent;
-import org.elasticsearch.common.xcontent.builder.XContentBuilder;
+import org.elasticsearch.common.xcontent.XContentBuilder;
import org.elasticsearch.index.query.QueryBuilderException;
import java.io.IOException;
diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/index/query/xcontent/FuzzyQueryBuilder.java b/modules/elasticsearch/src/main/java/org/elasticsearch/index/query/xcontent/FuzzyQueryBuilder.java
index 6477314fece82..d1469742fb52a 100644
--- a/modules/elasticsearch/src/main/java/org/elasticsearch/index/query/xcontent/FuzzyQueryBuilder.java
+++ b/modules/elasticsearch/src/main/java/org/elasticsearch/index/query/xcontent/FuzzyQueryBuilder.java
@@ -19,7 +19,7 @@
package org.elasticsearch.index.query.xcontent;
-import org.elasticsearch.common.xcontent.builder.XContentBuilder;
+import org.elasticsearch.common.xcontent.XContentBuilder;
import java.io.IOException;
diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/index/query/xcontent/GeoBoundingBoxFilterBuilder.java b/modules/elasticsearch/src/main/java/org/elasticsearch/index/query/xcontent/GeoBoundingBoxFilterBuilder.java
index 4301a6d7142f2..f2ac5c693ee32 100644
--- a/modules/elasticsearch/src/main/java/org/elasticsearch/index/query/xcontent/GeoBoundingBoxFilterBuilder.java
+++ b/modules/elasticsearch/src/main/java/org/elasticsearch/index/query/xcontent/GeoBoundingBoxFilterBuilder.java
@@ -20,7 +20,7 @@
package org.elasticsearch.index.query.xcontent;
import org.elasticsearch.common.lucene.geo.GeoBoundingBoxFilter;
-import org.elasticsearch.common.xcontent.builder.XContentBuilder;
+import org.elasticsearch.common.xcontent.XContentBuilder;
import org.elasticsearch.index.query.QueryBuilderException;
import java.io.IOException;
diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/index/query/xcontent/GeoDistanceFilterBuilder.java b/modules/elasticsearch/src/main/java/org/elasticsearch/index/query/xcontent/GeoDistanceFilterBuilder.java
index 5c0a3e884d983..5dc2e1bebd158 100644
--- a/modules/elasticsearch/src/main/java/org/elasticsearch/index/query/xcontent/GeoDistanceFilterBuilder.java
+++ b/modules/elasticsearch/src/main/java/org/elasticsearch/index/query/xcontent/GeoDistanceFilterBuilder.java
@@ -21,7 +21,7 @@
import org.elasticsearch.common.lucene.geo.GeoDistance;
import org.elasticsearch.common.unit.DistanceUnit;
-import org.elasticsearch.common.xcontent.builder.XContentBuilder;
+import org.elasticsearch.common.xcontent.XContentBuilder;
import java.io.IOException;
diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/index/query/xcontent/GeoPolygonFilterBuilder.java b/modules/elasticsearch/src/main/java/org/elasticsearch/index/query/xcontent/GeoPolygonFilterBuilder.java
index 2c8bcfbee4fa8..724a513d40f39 100644
--- a/modules/elasticsearch/src/main/java/org/elasticsearch/index/query/xcontent/GeoPolygonFilterBuilder.java
+++ b/modules/elasticsearch/src/main/java/org/elasticsearch/index/query/xcontent/GeoPolygonFilterBuilder.java
@@ -22,7 +22,7 @@
import org.elasticsearch.common.collect.Lists;
import org.elasticsearch.common.lucene.geo.GeoHashUtils;
import org.elasticsearch.common.lucene.geo.GeoPolygonFilter;
-import org.elasticsearch.common.xcontent.builder.XContentBuilder;
+import org.elasticsearch.common.xcontent.XContentBuilder;
import java.io.IOException;
import java.util.List;
diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/index/query/xcontent/MatchAllFilterBuilder.java b/modules/elasticsearch/src/main/java/org/elasticsearch/index/query/xcontent/MatchAllFilterBuilder.java
index ab4575de9c890..cd8517df037c9 100644
--- a/modules/elasticsearch/src/main/java/org/elasticsearch/index/query/xcontent/MatchAllFilterBuilder.java
+++ b/modules/elasticsearch/src/main/java/org/elasticsearch/index/query/xcontent/MatchAllFilterBuilder.java
@@ -19,7 +19,7 @@
package org.elasticsearch.index.query.xcontent;
-import org.elasticsearch.common.xcontent.builder.XContentBuilder;
+import org.elasticsearch.common.xcontent.XContentBuilder;
import java.io.IOException;
diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/index/query/xcontent/MatchAllQueryBuilder.java b/modules/elasticsearch/src/main/java/org/elasticsearch/index/query/xcontent/MatchAllQueryBuilder.java
index 2e68e569b3df4..2d2e07082bcbb 100644
--- a/modules/elasticsearch/src/main/java/org/elasticsearch/index/query/xcontent/MatchAllQueryBuilder.java
+++ b/modules/elasticsearch/src/main/java/org/elasticsearch/index/query/xcontent/MatchAllQueryBuilder.java
@@ -19,7 +19,7 @@
package org.elasticsearch.index.query.xcontent;
-import org.elasticsearch.common.xcontent.builder.XContentBuilder;
+import org.elasticsearch.common.xcontent.XContentBuilder;
import java.io.IOException;
diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/index/query/xcontent/MoreLikeThisFieldQueryBuilder.java b/modules/elasticsearch/src/main/java/org/elasticsearch/index/query/xcontent/MoreLikeThisFieldQueryBuilder.java
index c8969ea295813..037c2869ca0aa 100644
--- a/modules/elasticsearch/src/main/java/org/elasticsearch/index/query/xcontent/MoreLikeThisFieldQueryBuilder.java
+++ b/modules/elasticsearch/src/main/java/org/elasticsearch/index/query/xcontent/MoreLikeThisFieldQueryBuilder.java
@@ -19,7 +19,7 @@
package org.elasticsearch.index.query.xcontent;
-import org.elasticsearch.common.xcontent.builder.XContentBuilder;
+import org.elasticsearch.common.xcontent.XContentBuilder;
import org.elasticsearch.index.query.QueryBuilderException;
import java.io.IOException;
diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/index/query/xcontent/MoreLikeThisQueryBuilder.java b/modules/elasticsearch/src/main/java/org/elasticsearch/index/query/xcontent/MoreLikeThisQueryBuilder.java
index dfe69045610b1..a5b6a3a8c5c39 100644
--- a/modules/elasticsearch/src/main/java/org/elasticsearch/index/query/xcontent/MoreLikeThisQueryBuilder.java
+++ b/modules/elasticsearch/src/main/java/org/elasticsearch/index/query/xcontent/MoreLikeThisQueryBuilder.java
@@ -19,7 +19,7 @@
package org.elasticsearch.index.query.xcontent;
-import org.elasticsearch.common.xcontent.builder.XContentBuilder;
+import org.elasticsearch.common.xcontent.XContentBuilder;
import org.elasticsearch.index.query.QueryBuilderException;
import java.io.IOException;
diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/index/query/xcontent/NotFilterBuilder.java b/modules/elasticsearch/src/main/java/org/elasticsearch/index/query/xcontent/NotFilterBuilder.java
index fb0b66c7eddc4..71bd39f266d13 100644
--- a/modules/elasticsearch/src/main/java/org/elasticsearch/index/query/xcontent/NotFilterBuilder.java
+++ b/modules/elasticsearch/src/main/java/org/elasticsearch/index/query/xcontent/NotFilterBuilder.java
@@ -19,7 +19,7 @@
package org.elasticsearch.index.query.xcontent;
-import org.elasticsearch.common.xcontent.builder.XContentBuilder;
+import org.elasticsearch.common.xcontent.XContentBuilder;
import java.io.IOException;
diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/index/query/xcontent/OrFilterBuilder.java b/modules/elasticsearch/src/main/java/org/elasticsearch/index/query/xcontent/OrFilterBuilder.java
index 075f0f21486cc..d2b5a9c0e621d 100644
--- a/modules/elasticsearch/src/main/java/org/elasticsearch/index/query/xcontent/OrFilterBuilder.java
+++ b/modules/elasticsearch/src/main/java/org/elasticsearch/index/query/xcontent/OrFilterBuilder.java
@@ -20,7 +20,7 @@
package org.elasticsearch.index.query.xcontent;
import org.elasticsearch.common.collect.Lists;
-import org.elasticsearch.common.xcontent.builder.XContentBuilder;
+import org.elasticsearch.common.xcontent.XContentBuilder;
import java.io.IOException;
import java.util.ArrayList;
diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/index/query/xcontent/PrefixFilterBuilder.java b/modules/elasticsearch/src/main/java/org/elasticsearch/index/query/xcontent/PrefixFilterBuilder.java
index 766ba7dc2561b..33746cacf40af 100644
--- a/modules/elasticsearch/src/main/java/org/elasticsearch/index/query/xcontent/PrefixFilterBuilder.java
+++ b/modules/elasticsearch/src/main/java/org/elasticsearch/index/query/xcontent/PrefixFilterBuilder.java
@@ -19,7 +19,7 @@
package org.elasticsearch.index.query.xcontent;
-import org.elasticsearch.common.xcontent.builder.XContentBuilder;
+import org.elasticsearch.common.xcontent.XContentBuilder;
import java.io.IOException;
diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/index/query/xcontent/PrefixQueryBuilder.java b/modules/elasticsearch/src/main/java/org/elasticsearch/index/query/xcontent/PrefixQueryBuilder.java
index f9a8b85053100..718b0ca2a4ae1 100644
--- a/modules/elasticsearch/src/main/java/org/elasticsearch/index/query/xcontent/PrefixQueryBuilder.java
+++ b/modules/elasticsearch/src/main/java/org/elasticsearch/index/query/xcontent/PrefixQueryBuilder.java
@@ -19,7 +19,7 @@
package org.elasticsearch.index.query.xcontent;
-import org.elasticsearch.common.xcontent.builder.XContentBuilder;
+import org.elasticsearch.common.xcontent.XContentBuilder;
import java.io.IOException;
diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/index/query/xcontent/QueryFilterBuilder.java b/modules/elasticsearch/src/main/java/org/elasticsearch/index/query/xcontent/QueryFilterBuilder.java
index 97f87c5c71d3b..bfb0d2bba0988 100644
--- a/modules/elasticsearch/src/main/java/org/elasticsearch/index/query/xcontent/QueryFilterBuilder.java
+++ b/modules/elasticsearch/src/main/java/org/elasticsearch/index/query/xcontent/QueryFilterBuilder.java
@@ -19,7 +19,7 @@
package org.elasticsearch.index.query.xcontent;
-import org.elasticsearch.common.xcontent.builder.XContentBuilder;
+import org.elasticsearch.common.xcontent.XContentBuilder;
import java.io.IOException;
diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/index/query/xcontent/QueryStringQueryBuilder.java b/modules/elasticsearch/src/main/java/org/elasticsearch/index/query/xcontent/QueryStringQueryBuilder.java
index eea810f562821..2239dfbdcaea1 100644
--- a/modules/elasticsearch/src/main/java/org/elasticsearch/index/query/xcontent/QueryStringQueryBuilder.java
+++ b/modules/elasticsearch/src/main/java/org/elasticsearch/index/query/xcontent/QueryStringQueryBuilder.java
@@ -20,7 +20,7 @@
package org.elasticsearch.index.query.xcontent;
import org.elasticsearch.common.trove.ExtTObjectFloatHashMap;
-import org.elasticsearch.common.xcontent.builder.XContentBuilder;
+import org.elasticsearch.common.xcontent.XContentBuilder;
import java.io.IOException;
import java.util.List;
diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/index/query/xcontent/RangeFilterBuilder.java b/modules/elasticsearch/src/main/java/org/elasticsearch/index/query/xcontent/RangeFilterBuilder.java
index a5182c79ea7f1..c1c63951de593 100644
--- a/modules/elasticsearch/src/main/java/org/elasticsearch/index/query/xcontent/RangeFilterBuilder.java
+++ b/modules/elasticsearch/src/main/java/org/elasticsearch/index/query/xcontent/RangeFilterBuilder.java
@@ -19,7 +19,7 @@
package org.elasticsearch.index.query.xcontent;
-import org.elasticsearch.common.xcontent.builder.XContentBuilder;
+import org.elasticsearch.common.xcontent.XContentBuilder;
import java.io.IOException;
diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/index/query/xcontent/RangeQueryBuilder.java b/modules/elasticsearch/src/main/java/org/elasticsearch/index/query/xcontent/RangeQueryBuilder.java
index 9d65e37467afc..73b9feb9c72c2 100644
--- a/modules/elasticsearch/src/main/java/org/elasticsearch/index/query/xcontent/RangeQueryBuilder.java
+++ b/modules/elasticsearch/src/main/java/org/elasticsearch/index/query/xcontent/RangeQueryBuilder.java
@@ -19,7 +19,7 @@
package org.elasticsearch.index.query.xcontent;
-import org.elasticsearch.common.xcontent.builder.XContentBuilder;
+import org.elasticsearch.common.xcontent.XContentBuilder;
import java.io.IOException;
diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/index/query/xcontent/ScriptFilterBuilder.java b/modules/elasticsearch/src/main/java/org/elasticsearch/index/query/xcontent/ScriptFilterBuilder.java
index f69355a692fb1..647a4c7849998 100644
--- a/modules/elasticsearch/src/main/java/org/elasticsearch/index/query/xcontent/ScriptFilterBuilder.java
+++ b/modules/elasticsearch/src/main/java/org/elasticsearch/index/query/xcontent/ScriptFilterBuilder.java
@@ -19,7 +19,7 @@
package org.elasticsearch.index.query.xcontent;
-import org.elasticsearch.common.xcontent.builder.XContentBuilder;
+import org.elasticsearch.common.xcontent.XContentBuilder;
import java.io.IOException;
import java.util.Map;
diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/index/query/xcontent/SpanFirstQueryBuilder.java b/modules/elasticsearch/src/main/java/org/elasticsearch/index/query/xcontent/SpanFirstQueryBuilder.java
index 7efe2bb64173e..6735c514c8027 100644
--- a/modules/elasticsearch/src/main/java/org/elasticsearch/index/query/xcontent/SpanFirstQueryBuilder.java
+++ b/modules/elasticsearch/src/main/java/org/elasticsearch/index/query/xcontent/SpanFirstQueryBuilder.java
@@ -19,7 +19,7 @@
package org.elasticsearch.index.query.xcontent;
-import org.elasticsearch.common.xcontent.builder.XContentBuilder;
+import org.elasticsearch.common.xcontent.XContentBuilder;
import java.io.IOException;
diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/index/query/xcontent/SpanNearQueryBuilder.java b/modules/elasticsearch/src/main/java/org/elasticsearch/index/query/xcontent/SpanNearQueryBuilder.java
index 3a6aeb6566ccd..a99781f5359ee 100644
--- a/modules/elasticsearch/src/main/java/org/elasticsearch/index/query/xcontent/SpanNearQueryBuilder.java
+++ b/modules/elasticsearch/src/main/java/org/elasticsearch/index/query/xcontent/SpanNearQueryBuilder.java
@@ -19,7 +19,7 @@
package org.elasticsearch.index.query.xcontent;
-import org.elasticsearch.common.xcontent.builder.XContentBuilder;
+import org.elasticsearch.common.xcontent.XContentBuilder;
import org.elasticsearch.index.query.QueryBuilderException;
import java.io.IOException;
diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/index/query/xcontent/SpanNotQueryBuilder.java b/modules/elasticsearch/src/main/java/org/elasticsearch/index/query/xcontent/SpanNotQueryBuilder.java
index b41a38dd34417..d993ddd570ba9 100644
--- a/modules/elasticsearch/src/main/java/org/elasticsearch/index/query/xcontent/SpanNotQueryBuilder.java
+++ b/modules/elasticsearch/src/main/java/org/elasticsearch/index/query/xcontent/SpanNotQueryBuilder.java
@@ -19,7 +19,7 @@
package org.elasticsearch.index.query.xcontent;
-import org.elasticsearch.common.xcontent.builder.XContentBuilder;
+import org.elasticsearch.common.xcontent.XContentBuilder;
import org.elasticsearch.index.query.QueryBuilderException;
import java.io.IOException;
diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/index/query/xcontent/SpanOrQueryBuilder.java b/modules/elasticsearch/src/main/java/org/elasticsearch/index/query/xcontent/SpanOrQueryBuilder.java
index be2da37139961..421dd34b2ee45 100644
--- a/modules/elasticsearch/src/main/java/org/elasticsearch/index/query/xcontent/SpanOrQueryBuilder.java
+++ b/modules/elasticsearch/src/main/java/org/elasticsearch/index/query/xcontent/SpanOrQueryBuilder.java
@@ -19,7 +19,7 @@
package org.elasticsearch.index.query.xcontent;
-import org.elasticsearch.common.xcontent.builder.XContentBuilder;
+import org.elasticsearch.common.xcontent.XContentBuilder;
import org.elasticsearch.index.query.QueryBuilderException;
import java.io.IOException;
diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/index/query/xcontent/SpanTermQueryBuilder.java b/modules/elasticsearch/src/main/java/org/elasticsearch/index/query/xcontent/SpanTermQueryBuilder.java
index 483f09d6a1ca0..75a23e0958272 100644
--- a/modules/elasticsearch/src/main/java/org/elasticsearch/index/query/xcontent/SpanTermQueryBuilder.java
+++ b/modules/elasticsearch/src/main/java/org/elasticsearch/index/query/xcontent/SpanTermQueryBuilder.java
@@ -19,7 +19,7 @@
package org.elasticsearch.index.query.xcontent;
-import org.elasticsearch.common.xcontent.builder.XContentBuilder;
+import org.elasticsearch.common.xcontent.XContentBuilder;
import java.io.IOException;
diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/index/query/xcontent/TermFilterBuilder.java b/modules/elasticsearch/src/main/java/org/elasticsearch/index/query/xcontent/TermFilterBuilder.java
index 85f35299e6ef5..9443b56ab5044 100644
--- a/modules/elasticsearch/src/main/java/org/elasticsearch/index/query/xcontent/TermFilterBuilder.java
+++ b/modules/elasticsearch/src/main/java/org/elasticsearch/index/query/xcontent/TermFilterBuilder.java
@@ -19,7 +19,7 @@
package org.elasticsearch.index.query.xcontent;
-import org.elasticsearch.common.xcontent.builder.XContentBuilder;
+import org.elasticsearch.common.xcontent.XContentBuilder;
import java.io.IOException;
diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/index/query/xcontent/TermQueryBuilder.java b/modules/elasticsearch/src/main/java/org/elasticsearch/index/query/xcontent/TermQueryBuilder.java
index 927ebf6817b3b..628f68012e51f 100644
--- a/modules/elasticsearch/src/main/java/org/elasticsearch/index/query/xcontent/TermQueryBuilder.java
+++ b/modules/elasticsearch/src/main/java/org/elasticsearch/index/query/xcontent/TermQueryBuilder.java
@@ -19,7 +19,7 @@
package org.elasticsearch.index.query.xcontent;
-import org.elasticsearch.common.xcontent.builder.XContentBuilder;
+import org.elasticsearch.common.xcontent.XContentBuilder;
import java.io.IOException;
diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/index/query/xcontent/TermsFilterBuilder.java b/modules/elasticsearch/src/main/java/org/elasticsearch/index/query/xcontent/TermsFilterBuilder.java
index 4170bf6378150..300566d569848 100644
--- a/modules/elasticsearch/src/main/java/org/elasticsearch/index/query/xcontent/TermsFilterBuilder.java
+++ b/modules/elasticsearch/src/main/java/org/elasticsearch/index/query/xcontent/TermsFilterBuilder.java
@@ -19,7 +19,7 @@
package org.elasticsearch.index.query.xcontent;
-import org.elasticsearch.common.xcontent.builder.XContentBuilder;
+import org.elasticsearch.common.xcontent.XContentBuilder;
import java.io.IOException;
diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/index/query/xcontent/WildcardQueryBuilder.java b/modules/elasticsearch/src/main/java/org/elasticsearch/index/query/xcontent/WildcardQueryBuilder.java
index 4c00e4a4fd39c..3c3f022a3fe92 100644
--- a/modules/elasticsearch/src/main/java/org/elasticsearch/index/query/xcontent/WildcardQueryBuilder.java
+++ b/modules/elasticsearch/src/main/java/org/elasticsearch/index/query/xcontent/WildcardQueryBuilder.java
@@ -19,7 +19,7 @@
package org.elasticsearch.index.query.xcontent;
-import org.elasticsearch.common.xcontent.builder.XContentBuilder;
+import org.elasticsearch.common.xcontent.XContentBuilder;
import java.io.IOException;
diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/monitor/jvm/JvmInfo.java b/modules/elasticsearch/src/main/java/org/elasticsearch/monitor/jvm/JvmInfo.java
index a1f89745af1aa..25463f78e652b 100644
--- a/modules/elasticsearch/src/main/java/org/elasticsearch/monitor/jvm/JvmInfo.java
+++ b/modules/elasticsearch/src/main/java/org/elasticsearch/monitor/jvm/JvmInfo.java
@@ -24,7 +24,7 @@
import org.elasticsearch.common.io.stream.Streamable;
import org.elasticsearch.common.unit.ByteSizeValue;
import org.elasticsearch.common.xcontent.ToXContent;
-import org.elasticsearch.common.xcontent.builder.XContentBuilder;
+import org.elasticsearch.common.xcontent.XContentBuilder;
import java.io.IOException;
import java.io.Serializable;
diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/monitor/jvm/JvmStats.java b/modules/elasticsearch/src/main/java/org/elasticsearch/monitor/jvm/JvmStats.java
index 78a19f19a952b..0c68368582efa 100644
--- a/modules/elasticsearch/src/main/java/org/elasticsearch/monitor/jvm/JvmStats.java
+++ b/modules/elasticsearch/src/main/java/org/elasticsearch/monitor/jvm/JvmStats.java
@@ -26,7 +26,7 @@
import org.elasticsearch.common.unit.ByteSizeValue;
import org.elasticsearch.common.unit.TimeValue;
import org.elasticsearch.common.xcontent.ToXContent;
-import org.elasticsearch.common.xcontent.builder.XContentBuilder;
+import org.elasticsearch.common.xcontent.XContentBuilder;
import java.io.IOException;
import java.io.Serializable;
diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/monitor/network/NetworkInfo.java b/modules/elasticsearch/src/main/java/org/elasticsearch/monitor/network/NetworkInfo.java
index c5a294be0b3c6..e216b65ee94f8 100644
--- a/modules/elasticsearch/src/main/java/org/elasticsearch/monitor/network/NetworkInfo.java
+++ b/modules/elasticsearch/src/main/java/org/elasticsearch/monitor/network/NetworkInfo.java
@@ -23,7 +23,7 @@
import org.elasticsearch.common.io.stream.StreamOutput;
import org.elasticsearch.common.io.stream.Streamable;
import org.elasticsearch.common.xcontent.ToXContent;
-import org.elasticsearch.common.xcontent.builder.XContentBuilder;
+import org.elasticsearch.common.xcontent.XContentBuilder;
import java.io.IOException;
import java.io.Serializable;
diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/monitor/network/NetworkStats.java b/modules/elasticsearch/src/main/java/org/elasticsearch/monitor/network/NetworkStats.java
index ba5aa60915821..5da3a5229f370 100644
--- a/modules/elasticsearch/src/main/java/org/elasticsearch/monitor/network/NetworkStats.java
+++ b/modules/elasticsearch/src/main/java/org/elasticsearch/monitor/network/NetworkStats.java
@@ -23,7 +23,7 @@
import org.elasticsearch.common.io.stream.StreamOutput;
import org.elasticsearch.common.io.stream.Streamable;
import org.elasticsearch.common.xcontent.ToXContent;
-import org.elasticsearch.common.xcontent.builder.XContentBuilder;
+import org.elasticsearch.common.xcontent.XContentBuilder;
import java.io.IOException;
import java.io.Serializable;
diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/monitor/os/OsInfo.java b/modules/elasticsearch/src/main/java/org/elasticsearch/monitor/os/OsInfo.java
index c41891f7f4c90..e0391a413ee31 100644
--- a/modules/elasticsearch/src/main/java/org/elasticsearch/monitor/os/OsInfo.java
+++ b/modules/elasticsearch/src/main/java/org/elasticsearch/monitor/os/OsInfo.java
@@ -24,7 +24,7 @@
import org.elasticsearch.common.io.stream.Streamable;
import org.elasticsearch.common.unit.ByteSizeValue;
import org.elasticsearch.common.xcontent.ToXContent;
-import org.elasticsearch.common.xcontent.builder.XContentBuilder;
+import org.elasticsearch.common.xcontent.XContentBuilder;
import java.io.IOException;
import java.io.Serializable;
diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/monitor/os/OsStats.java b/modules/elasticsearch/src/main/java/org/elasticsearch/monitor/os/OsStats.java
index 648aea1cd8a84..3cd507d747b0e 100644
--- a/modules/elasticsearch/src/main/java/org/elasticsearch/monitor/os/OsStats.java
+++ b/modules/elasticsearch/src/main/java/org/elasticsearch/monitor/os/OsStats.java
@@ -25,7 +25,7 @@
import org.elasticsearch.common.unit.ByteSizeValue;
import org.elasticsearch.common.unit.TimeValue;
import org.elasticsearch.common.xcontent.ToXContent;
-import org.elasticsearch.common.xcontent.builder.XContentBuilder;
+import org.elasticsearch.common.xcontent.XContentBuilder;
import java.io.IOException;
import java.io.Serializable;
diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/monitor/process/ProcessInfo.java b/modules/elasticsearch/src/main/java/org/elasticsearch/monitor/process/ProcessInfo.java
index 171bef5c13090..8376ead279d54 100644
--- a/modules/elasticsearch/src/main/java/org/elasticsearch/monitor/process/ProcessInfo.java
+++ b/modules/elasticsearch/src/main/java/org/elasticsearch/monitor/process/ProcessInfo.java
@@ -23,7 +23,7 @@
import org.elasticsearch.common.io.stream.StreamOutput;
import org.elasticsearch.common.io.stream.Streamable;
import org.elasticsearch.common.xcontent.ToXContent;
-import org.elasticsearch.common.xcontent.builder.XContentBuilder;
+import org.elasticsearch.common.xcontent.XContentBuilder;
import java.io.IOException;
import java.io.Serializable;
diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/monitor/process/ProcessStats.java b/modules/elasticsearch/src/main/java/org/elasticsearch/monitor/process/ProcessStats.java
index 524c2da375543..1f1d4add4a67f 100644
--- a/modules/elasticsearch/src/main/java/org/elasticsearch/monitor/process/ProcessStats.java
+++ b/modules/elasticsearch/src/main/java/org/elasticsearch/monitor/process/ProcessStats.java
@@ -25,7 +25,7 @@
import org.elasticsearch.common.unit.ByteSizeValue;
import org.elasticsearch.common.unit.TimeValue;
import org.elasticsearch.common.xcontent.ToXContent;
-import org.elasticsearch.common.xcontent.builder.XContentBuilder;
+import org.elasticsearch.common.xcontent.XContentBuilder;
import java.io.IOException;
import java.io.Serializable;
diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/rest/XContentRestResponse.java b/modules/elasticsearch/src/main/java/org/elasticsearch/rest/XContentRestResponse.java
index 1baa065fc86c7..bf99fa8fcf8b2 100644
--- a/modules/elasticsearch/src/main/java/org/elasticsearch/rest/XContentRestResponse.java
+++ b/modules/elasticsearch/src/main/java/org/elasticsearch/rest/XContentRestResponse.java
@@ -21,7 +21,7 @@
import org.apache.lucene.util.UnicodeUtil;
import org.elasticsearch.common.thread.ThreadLocals;
-import org.elasticsearch.common.xcontent.builder.XContentBuilder;
+import org.elasticsearch.common.xcontent.XContentBuilder;
import java.io.IOException;
diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/rest/XContentThrowableRestResponse.java b/modules/elasticsearch/src/main/java/org/elasticsearch/rest/XContentThrowableRestResponse.java
index de089d8315285..e3fc96083157f 100644
--- a/modules/elasticsearch/src/main/java/org/elasticsearch/rest/XContentThrowableRestResponse.java
+++ b/modules/elasticsearch/src/main/java/org/elasticsearch/rest/XContentThrowableRestResponse.java
@@ -19,7 +19,7 @@
package org.elasticsearch.rest;
-import org.elasticsearch.common.xcontent.builder.XContentBuilder;
+import org.elasticsearch.common.xcontent.XContentBuilder;
import java.io.IOException;
diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/rest/action/admin/cluster/health/RestClusterHealthAction.java b/modules/elasticsearch/src/main/java/org/elasticsearch/rest/action/admin/cluster/health/RestClusterHealthAction.java
index c1735fc0117c3..cc761d80a27ba 100644
--- a/modules/elasticsearch/src/main/java/org/elasticsearch/rest/action/admin/cluster/health/RestClusterHealthAction.java
+++ b/modules/elasticsearch/src/main/java/org/elasticsearch/rest/action/admin/cluster/health/RestClusterHealthAction.java
@@ -24,7 +24,7 @@
import org.elasticsearch.client.Client;
import org.elasticsearch.common.inject.Inject;
import org.elasticsearch.common.settings.Settings;
-import org.elasticsearch.common.xcontent.builder.XContentBuilder;
+import org.elasticsearch.common.xcontent.XContentBuilder;
import org.elasticsearch.rest.*;
import org.elasticsearch.rest.action.support.RestActions;
import org.elasticsearch.rest.action.support.RestXContentBuilder;
diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/rest/action/admin/cluster/node/info/RestNodesInfoAction.java b/modules/elasticsearch/src/main/java/org/elasticsearch/rest/action/admin/cluster/node/info/RestNodesInfoAction.java
index 7c415c92345c9..2d8b8a048f208 100644
--- a/modules/elasticsearch/src/main/java/org/elasticsearch/rest/action/admin/cluster/node/info/RestNodesInfoAction.java
+++ b/modules/elasticsearch/src/main/java/org/elasticsearch/rest/action/admin/cluster/node/info/RestNodesInfoAction.java
@@ -27,7 +27,7 @@
import org.elasticsearch.common.inject.Inject;
import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.common.settings.SettingsFilter;
-import org.elasticsearch.common.xcontent.builder.XContentBuilder;
+import org.elasticsearch.common.xcontent.XContentBuilder;
import org.elasticsearch.rest.*;
import org.elasticsearch.rest.action.support.RestActions;
import org.elasticsearch.rest.action.support.RestXContentBuilder;
diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/rest/action/admin/cluster/node/restart/RestNodesRestartAction.java b/modules/elasticsearch/src/main/java/org/elasticsearch/rest/action/admin/cluster/node/restart/RestNodesRestartAction.java
index acaffd2902009..e23b1f1871f31 100644
--- a/modules/elasticsearch/src/main/java/org/elasticsearch/rest/action/admin/cluster/node/restart/RestNodesRestartAction.java
+++ b/modules/elasticsearch/src/main/java/org/elasticsearch/rest/action/admin/cluster/node/restart/RestNodesRestartAction.java
@@ -25,7 +25,7 @@
import org.elasticsearch.client.Client;
import org.elasticsearch.common.inject.Inject;
import org.elasticsearch.common.settings.Settings;
-import org.elasticsearch.common.xcontent.builder.XContentBuilder;
+import org.elasticsearch.common.xcontent.XContentBuilder;
import org.elasticsearch.rest.*;
import org.elasticsearch.rest.action.support.RestActions;
diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/rest/action/admin/cluster/node/shutdown/RestNodesShutdownAction.java b/modules/elasticsearch/src/main/java/org/elasticsearch/rest/action/admin/cluster/node/shutdown/RestNodesShutdownAction.java
index d7a9d9d2a23d5..57e2fea06ac2e 100644
--- a/modules/elasticsearch/src/main/java/org/elasticsearch/rest/action/admin/cluster/node/shutdown/RestNodesShutdownAction.java
+++ b/modules/elasticsearch/src/main/java/org/elasticsearch/rest/action/admin/cluster/node/shutdown/RestNodesShutdownAction.java
@@ -26,7 +26,7 @@
import org.elasticsearch.cluster.node.DiscoveryNode;
import org.elasticsearch.common.inject.Inject;
import org.elasticsearch.common.settings.Settings;
-import org.elasticsearch.common.xcontent.builder.XContentBuilder;
+import org.elasticsearch.common.xcontent.XContentBuilder;
import org.elasticsearch.rest.*;
import org.elasticsearch.rest.action.support.RestActions;
diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/rest/action/admin/cluster/node/stats/RestNodesStatsAction.java b/modules/elasticsearch/src/main/java/org/elasticsearch/rest/action/admin/cluster/node/stats/RestNodesStatsAction.java
index 6dc8ef80845cd..7b410be2f5576 100644
--- a/modules/elasticsearch/src/main/java/org/elasticsearch/rest/action/admin/cluster/node/stats/RestNodesStatsAction.java
+++ b/modules/elasticsearch/src/main/java/org/elasticsearch/rest/action/admin/cluster/node/stats/RestNodesStatsAction.java
@@ -26,7 +26,7 @@
import org.elasticsearch.client.Client;
import org.elasticsearch.common.inject.Inject;
import org.elasticsearch.common.settings.Settings;
-import org.elasticsearch.common.xcontent.builder.XContentBuilder;
+import org.elasticsearch.common.xcontent.XContentBuilder;
import org.elasticsearch.rest.*;
import org.elasticsearch.rest.action.support.RestActions;
import org.elasticsearch.rest.action.support.RestXContentBuilder;
diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/rest/action/admin/cluster/ping/broadcast/RestBroadcastPingAction.java b/modules/elasticsearch/src/main/java/org/elasticsearch/rest/action/admin/cluster/ping/broadcast/RestBroadcastPingAction.java
index 3007306e65ca5..76f7c83930f0f 100644
--- a/modules/elasticsearch/src/main/java/org/elasticsearch/rest/action/admin/cluster/ping/broadcast/RestBroadcastPingAction.java
+++ b/modules/elasticsearch/src/main/java/org/elasticsearch/rest/action/admin/cluster/ping/broadcast/RestBroadcastPingAction.java
@@ -26,7 +26,7 @@
import org.elasticsearch.client.Client;
import org.elasticsearch.common.inject.Inject;
import org.elasticsearch.common.settings.Settings;
-import org.elasticsearch.common.xcontent.builder.XContentBuilder;
+import org.elasticsearch.common.xcontent.XContentBuilder;
import org.elasticsearch.rest.*;
import org.elasticsearch.rest.action.support.RestActions;
import org.elasticsearch.rest.action.support.RestXContentBuilder;
diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/rest/action/admin/cluster/ping/replication/RestReplicationPingAction.java b/modules/elasticsearch/src/main/java/org/elasticsearch/rest/action/admin/cluster/ping/replication/RestReplicationPingAction.java
index 9d056d79f0fb8..ddbe63dd97409 100644
--- a/modules/elasticsearch/src/main/java/org/elasticsearch/rest/action/admin/cluster/ping/replication/RestReplicationPingAction.java
+++ b/modules/elasticsearch/src/main/java/org/elasticsearch/rest/action/admin/cluster/ping/replication/RestReplicationPingAction.java
@@ -28,7 +28,7 @@
import org.elasticsearch.client.Client;
import org.elasticsearch.common.inject.Inject;
import org.elasticsearch.common.settings.Settings;
-import org.elasticsearch.common.xcontent.builder.XContentBuilder;
+import org.elasticsearch.common.xcontent.XContentBuilder;
import org.elasticsearch.rest.*;
import org.elasticsearch.rest.action.support.RestActions;
import org.elasticsearch.rest.action.support.RestXContentBuilder;
diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/rest/action/admin/cluster/ping/single/RestSinglePingAction.java b/modules/elasticsearch/src/main/java/org/elasticsearch/rest/action/admin/cluster/ping/single/RestSinglePingAction.java
index c7ded93fd3207..099c0e3a669bc 100644
--- a/modules/elasticsearch/src/main/java/org/elasticsearch/rest/action/admin/cluster/ping/single/RestSinglePingAction.java
+++ b/modules/elasticsearch/src/main/java/org/elasticsearch/rest/action/admin/cluster/ping/single/RestSinglePingAction.java
@@ -25,7 +25,7 @@
import org.elasticsearch.client.Client;
import org.elasticsearch.common.inject.Inject;
import org.elasticsearch.common.settings.Settings;
-import org.elasticsearch.common.xcontent.builder.XContentBuilder;
+import org.elasticsearch.common.xcontent.XContentBuilder;
import org.elasticsearch.rest.*;
import org.elasticsearch.rest.action.support.RestXContentBuilder;
diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/rest/action/admin/cluster/state/RestClusterStateAction.java b/modules/elasticsearch/src/main/java/org/elasticsearch/rest/action/admin/cluster/state/RestClusterStateAction.java
index f6746b20df5c5..066716ad950ab 100644
--- a/modules/elasticsearch/src/main/java/org/elasticsearch/rest/action/admin/cluster/state/RestClusterStateAction.java
+++ b/modules/elasticsearch/src/main/java/org/elasticsearch/rest/action/admin/cluster/state/RestClusterStateAction.java
@@ -37,9 +37,9 @@
import org.elasticsearch.common.inject.Inject;
import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.common.settings.SettingsFilter;
+import org.elasticsearch.common.xcontent.XContentBuilder;
import org.elasticsearch.common.xcontent.XContentFactory;
import org.elasticsearch.common.xcontent.XContentParser;
-import org.elasticsearch.common.xcontent.builder.XContentBuilder;
import org.elasticsearch.rest.*;
import org.elasticsearch.rest.action.support.RestActions;
import org.elasticsearch.rest.action.support.RestXContentBuilder;
diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/rest/action/admin/indices/alias/RestIndicesAliasesAction.java b/modules/elasticsearch/src/main/java/org/elasticsearch/rest/action/admin/indices/alias/RestIndicesAliasesAction.java
index 9b8ada0107270..420c92bac8221 100644
--- a/modules/elasticsearch/src/main/java/org/elasticsearch/rest/action/admin/indices/alias/RestIndicesAliasesAction.java
+++ b/modules/elasticsearch/src/main/java/org/elasticsearch/rest/action/admin/indices/alias/RestIndicesAliasesAction.java
@@ -27,9 +27,9 @@
import org.elasticsearch.cluster.metadata.AliasAction;
import org.elasticsearch.common.inject.Inject;
import org.elasticsearch.common.settings.Settings;
+import org.elasticsearch.common.xcontent.XContentBuilder;
import org.elasticsearch.common.xcontent.XContentFactory;
import org.elasticsearch.common.xcontent.XContentParser;
-import org.elasticsearch.common.xcontent.builder.XContentBuilder;
import org.elasticsearch.rest.*;
import java.io.IOException;
diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/rest/action/admin/indices/cache/clear/RestClearIndicesCacheAction.java b/modules/elasticsearch/src/main/java/org/elasticsearch/rest/action/admin/indices/cache/clear/RestClearIndicesCacheAction.java
index 985df3f3d858b..7392d559de526 100644
--- a/modules/elasticsearch/src/main/java/org/elasticsearch/rest/action/admin/indices/cache/clear/RestClearIndicesCacheAction.java
+++ b/modules/elasticsearch/src/main/java/org/elasticsearch/rest/action/admin/indices/cache/clear/RestClearIndicesCacheAction.java
@@ -26,7 +26,7 @@
import org.elasticsearch.client.Client;
import org.elasticsearch.common.inject.Inject;
import org.elasticsearch.common.settings.Settings;
-import org.elasticsearch.common.xcontent.builder.XContentBuilder;
+import org.elasticsearch.common.xcontent.XContentBuilder;
import org.elasticsearch.rest.*;
import org.elasticsearch.rest.action.support.RestActions;
import org.elasticsearch.rest.action.support.RestXContentBuilder;
diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/rest/action/admin/indices/create/RestCreateIndexAction.java b/modules/elasticsearch/src/main/java/org/elasticsearch/rest/action/admin/indices/create/RestCreateIndexAction.java
index 3c741f4198e12..f612b3738cb68 100644
--- a/modules/elasticsearch/src/main/java/org/elasticsearch/rest/action/admin/indices/create/RestCreateIndexAction.java
+++ b/modules/elasticsearch/src/main/java/org/elasticsearch/rest/action/admin/indices/create/RestCreateIndexAction.java
@@ -28,7 +28,7 @@
import org.elasticsearch.common.settings.ImmutableSettings;
import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.common.settings.SettingsException;
-import org.elasticsearch.common.xcontent.builder.XContentBuilder;
+import org.elasticsearch.common.xcontent.XContentBuilder;
import org.elasticsearch.indices.IndexAlreadyExistsException;
import org.elasticsearch.indices.InvalidIndexNameException;
import org.elasticsearch.rest.*;
diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/rest/action/admin/indices/delete/RestDeleteIndexAction.java b/modules/elasticsearch/src/main/java/org/elasticsearch/rest/action/admin/indices/delete/RestDeleteIndexAction.java
index b0601cf53b44c..52bdb9ab814f0 100644
--- a/modules/elasticsearch/src/main/java/org/elasticsearch/rest/action/admin/indices/delete/RestDeleteIndexAction.java
+++ b/modules/elasticsearch/src/main/java/org/elasticsearch/rest/action/admin/indices/delete/RestDeleteIndexAction.java
@@ -25,7 +25,7 @@
import org.elasticsearch.client.Client;
import org.elasticsearch.common.inject.Inject;
import org.elasticsearch.common.settings.Settings;
-import org.elasticsearch.common.xcontent.builder.XContentBuilder;
+import org.elasticsearch.common.xcontent.XContentBuilder;
import org.elasticsearch.indices.IndexMissingException;
import org.elasticsearch.rest.*;
import org.elasticsearch.rest.action.support.RestXContentBuilder;
diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/rest/action/admin/indices/flush/RestFlushAction.java b/modules/elasticsearch/src/main/java/org/elasticsearch/rest/action/admin/indices/flush/RestFlushAction.java
index adc209ba8e115..e435b932b6dfc 100644
--- a/modules/elasticsearch/src/main/java/org/elasticsearch/rest/action/admin/indices/flush/RestFlushAction.java
+++ b/modules/elasticsearch/src/main/java/org/elasticsearch/rest/action/admin/indices/flush/RestFlushAction.java
@@ -26,7 +26,7 @@
import org.elasticsearch.client.Client;
import org.elasticsearch.common.inject.Inject;
import org.elasticsearch.common.settings.Settings;
-import org.elasticsearch.common.xcontent.builder.XContentBuilder;
+import org.elasticsearch.common.xcontent.XContentBuilder;
import org.elasticsearch.rest.*;
import org.elasticsearch.rest.action.support.RestActions;
import org.elasticsearch.rest.action.support.RestXContentBuilder;
diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/rest/action/admin/indices/gateway/snapshot/RestGatewaySnapshotAction.java b/modules/elasticsearch/src/main/java/org/elasticsearch/rest/action/admin/indices/gateway/snapshot/RestGatewaySnapshotAction.java
index e9345b949e902..f663ca220494b 100644
--- a/modules/elasticsearch/src/main/java/org/elasticsearch/rest/action/admin/indices/gateway/snapshot/RestGatewaySnapshotAction.java
+++ b/modules/elasticsearch/src/main/java/org/elasticsearch/rest/action/admin/indices/gateway/snapshot/RestGatewaySnapshotAction.java
@@ -25,7 +25,7 @@
import org.elasticsearch.client.Client;
import org.elasticsearch.common.inject.Inject;
import org.elasticsearch.common.settings.Settings;
-import org.elasticsearch.common.xcontent.builder.XContentBuilder;
+import org.elasticsearch.common.xcontent.XContentBuilder;
import org.elasticsearch.rest.*;
import org.elasticsearch.rest.action.support.RestActions;
import org.elasticsearch.rest.action.support.RestXContentBuilder;
diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/rest/action/admin/indices/mapping/get/RestGetMappingAction.java b/modules/elasticsearch/src/main/java/org/elasticsearch/rest/action/admin/indices/mapping/get/RestGetMappingAction.java
index 79601451fadee..25e29c2fd63b9 100644
--- a/modules/elasticsearch/src/main/java/org/elasticsearch/rest/action/admin/indices/mapping/get/RestGetMappingAction.java
+++ b/modules/elasticsearch/src/main/java/org/elasticsearch/rest/action/admin/indices/mapping/get/RestGetMappingAction.java
@@ -30,9 +30,9 @@
import org.elasticsearch.common.compress.CompressedString;
import org.elasticsearch.common.inject.Inject;
import org.elasticsearch.common.settings.Settings;
+import org.elasticsearch.common.xcontent.XContentBuilder;
import org.elasticsearch.common.xcontent.XContentFactory;
import org.elasticsearch.common.xcontent.XContentParser;
-import org.elasticsearch.common.xcontent.builder.XContentBuilder;
import org.elasticsearch.rest.*;
import org.elasticsearch.rest.action.support.RestXContentBuilder;
diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/rest/action/admin/indices/mapping/put/RestPutMappingAction.java b/modules/elasticsearch/src/main/java/org/elasticsearch/rest/action/admin/indices/mapping/put/RestPutMappingAction.java
index 912b13843562a..79db01d7bca8d 100644
--- a/modules/elasticsearch/src/main/java/org/elasticsearch/rest/action/admin/indices/mapping/put/RestPutMappingAction.java
+++ b/modules/elasticsearch/src/main/java/org/elasticsearch/rest/action/admin/indices/mapping/put/RestPutMappingAction.java
@@ -25,7 +25,7 @@
import org.elasticsearch.client.Client;
import org.elasticsearch.common.inject.Inject;
import org.elasticsearch.common.settings.Settings;
-import org.elasticsearch.common.xcontent.builder.XContentBuilder;
+import org.elasticsearch.common.xcontent.XContentBuilder;
import org.elasticsearch.index.mapper.InvalidTypeNameException;
import org.elasticsearch.index.mapper.MergeMappingException;
import org.elasticsearch.indices.IndexMissingException;
diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/rest/action/admin/indices/optimize/RestOptimizeAction.java b/modules/elasticsearch/src/main/java/org/elasticsearch/rest/action/admin/indices/optimize/RestOptimizeAction.java
index ca42609bbcaea..cdbee4c5b321f 100644
--- a/modules/elasticsearch/src/main/java/org/elasticsearch/rest/action/admin/indices/optimize/RestOptimizeAction.java
+++ b/modules/elasticsearch/src/main/java/org/elasticsearch/rest/action/admin/indices/optimize/RestOptimizeAction.java
@@ -26,7 +26,7 @@
import org.elasticsearch.client.Client;
import org.elasticsearch.common.inject.Inject;
import org.elasticsearch.common.settings.Settings;
-import org.elasticsearch.common.xcontent.builder.XContentBuilder;
+import org.elasticsearch.common.xcontent.XContentBuilder;
import org.elasticsearch.rest.*;
import org.elasticsearch.rest.action.support.RestActions;
import org.elasticsearch.rest.action.support.RestXContentBuilder;
diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/rest/action/admin/indices/refresh/RestRefreshAction.java b/modules/elasticsearch/src/main/java/org/elasticsearch/rest/action/admin/indices/refresh/RestRefreshAction.java
index 5cd1100f02ce7..4137c153cf0db 100644
--- a/modules/elasticsearch/src/main/java/org/elasticsearch/rest/action/admin/indices/refresh/RestRefreshAction.java
+++ b/modules/elasticsearch/src/main/java/org/elasticsearch/rest/action/admin/indices/refresh/RestRefreshAction.java
@@ -26,7 +26,7 @@
import org.elasticsearch.client.Client;
import org.elasticsearch.common.inject.Inject;
import org.elasticsearch.common.settings.Settings;
-import org.elasticsearch.common.xcontent.builder.XContentBuilder;
+import org.elasticsearch.common.xcontent.XContentBuilder;
import org.elasticsearch.rest.*;
import org.elasticsearch.rest.action.support.RestActions;
import org.elasticsearch.rest.action.support.RestXContentBuilder;
diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/rest/action/admin/indices/settings/RestUpdateSettingsAction.java b/modules/elasticsearch/src/main/java/org/elasticsearch/rest/action/admin/indices/settings/RestUpdateSettingsAction.java
index 5cfc92b06cdde..68096c3ca2c9f 100644
--- a/modules/elasticsearch/src/main/java/org/elasticsearch/rest/action/admin/indices/settings/RestUpdateSettingsAction.java
+++ b/modules/elasticsearch/src/main/java/org/elasticsearch/rest/action/admin/indices/settings/RestUpdateSettingsAction.java
@@ -28,7 +28,7 @@
import org.elasticsearch.common.settings.ImmutableSettings;
import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.common.settings.SettingsException;
-import org.elasticsearch.common.xcontent.builder.XContentBuilder;
+import org.elasticsearch.common.xcontent.XContentBuilder;
import org.elasticsearch.rest.*;
import org.elasticsearch.rest.action.support.RestXContentBuilder;
diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/rest/action/admin/indices/status/RestIndicesStatusAction.java b/modules/elasticsearch/src/main/java/org/elasticsearch/rest/action/admin/indices/status/RestIndicesStatusAction.java
index fe3130644e058..ec090ce3b8ed2 100644
--- a/modules/elasticsearch/src/main/java/org/elasticsearch/rest/action/admin/indices/status/RestIndicesStatusAction.java
+++ b/modules/elasticsearch/src/main/java/org/elasticsearch/rest/action/admin/indices/status/RestIndicesStatusAction.java
@@ -26,7 +26,7 @@
import org.elasticsearch.common.inject.Inject;
import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.common.settings.SettingsFilter;
-import org.elasticsearch.common.xcontent.builder.XContentBuilder;
+import org.elasticsearch.common.xcontent.XContentBuilder;
import org.elasticsearch.rest.*;
import org.elasticsearch.rest.action.support.RestXContentBuilder;
diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/rest/action/count/RestCountAction.java b/modules/elasticsearch/src/main/java/org/elasticsearch/rest/action/count/RestCountAction.java
index 7e37a9db6c2f7..d488901aaeb8d 100644
--- a/modules/elasticsearch/src/main/java/org/elasticsearch/rest/action/count/RestCountAction.java
+++ b/modules/elasticsearch/src/main/java/org/elasticsearch/rest/action/count/RestCountAction.java
@@ -26,7 +26,7 @@
import org.elasticsearch.client.Client;
import org.elasticsearch.common.inject.Inject;
import org.elasticsearch.common.settings.Settings;
-import org.elasticsearch.common.xcontent.builder.XContentBuilder;
+import org.elasticsearch.common.xcontent.XContentBuilder;
import org.elasticsearch.rest.*;
import org.elasticsearch.rest.action.support.RestActions;
import org.elasticsearch.rest.action.support.RestXContentBuilder;
diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/rest/action/delete/RestDeleteAction.java b/modules/elasticsearch/src/main/java/org/elasticsearch/rest/action/delete/RestDeleteAction.java
index 65f2c267214ce..4ab028d31034f 100644
--- a/modules/elasticsearch/src/main/java/org/elasticsearch/rest/action/delete/RestDeleteAction.java
+++ b/modules/elasticsearch/src/main/java/org/elasticsearch/rest/action/delete/RestDeleteAction.java
@@ -26,7 +26,7 @@
import org.elasticsearch.client.Client;
import org.elasticsearch.common.inject.Inject;
import org.elasticsearch.common.settings.Settings;
-import org.elasticsearch.common.xcontent.builder.XContentBuilder;
+import org.elasticsearch.common.xcontent.XContentBuilder;
import org.elasticsearch.rest.*;
import org.elasticsearch.rest.action.support.RestXContentBuilder;
diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/rest/action/deletebyquery/RestDeleteByQueryAction.java b/modules/elasticsearch/src/main/java/org/elasticsearch/rest/action/deletebyquery/RestDeleteByQueryAction.java
index 3466aaeb7a906..b92df1fbeb74d 100644
--- a/modules/elasticsearch/src/main/java/org/elasticsearch/rest/action/deletebyquery/RestDeleteByQueryAction.java
+++ b/modules/elasticsearch/src/main/java/org/elasticsearch/rest/action/deletebyquery/RestDeleteByQueryAction.java
@@ -28,7 +28,7 @@
import org.elasticsearch.client.Client;
import org.elasticsearch.common.inject.Inject;
import org.elasticsearch.common.settings.Settings;
-import org.elasticsearch.common.xcontent.builder.XContentBuilder;
+import org.elasticsearch.common.xcontent.XContentBuilder;
import org.elasticsearch.rest.*;
import org.elasticsearch.rest.action.support.RestActions;
import org.elasticsearch.rest.action.support.RestXContentBuilder;
diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/rest/action/get/RestGetAction.java b/modules/elasticsearch/src/main/java/org/elasticsearch/rest/action/get/RestGetAction.java
index 1a86b398d33fd..76295e043dbe0 100644
--- a/modules/elasticsearch/src/main/java/org/elasticsearch/rest/action/get/RestGetAction.java
+++ b/modules/elasticsearch/src/main/java/org/elasticsearch/rest/action/get/RestGetAction.java
@@ -25,7 +25,7 @@
import org.elasticsearch.client.Client;
import org.elasticsearch.common.inject.Inject;
import org.elasticsearch.common.settings.Settings;
-import org.elasticsearch.common.xcontent.builder.XContentBuilder;
+import org.elasticsearch.common.xcontent.XContentBuilder;
import org.elasticsearch.rest.*;
import java.io.IOException;
diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/rest/action/index/RestIndexAction.java b/modules/elasticsearch/src/main/java/org/elasticsearch/rest/action/index/RestIndexAction.java
index c24c2192b69b9..eb898ee8ecf11 100644
--- a/modules/elasticsearch/src/main/java/org/elasticsearch/rest/action/index/RestIndexAction.java
+++ b/modules/elasticsearch/src/main/java/org/elasticsearch/rest/action/index/RestIndexAction.java
@@ -26,7 +26,7 @@
import org.elasticsearch.client.Client;
import org.elasticsearch.common.inject.Inject;
import org.elasticsearch.common.settings.Settings;
-import org.elasticsearch.common.xcontent.builder.XContentBuilder;
+import org.elasticsearch.common.xcontent.XContentBuilder;
import org.elasticsearch.rest.*;
import org.elasticsearch.rest.action.support.RestXContentBuilder;
diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/rest/action/main/RestMainAction.java b/modules/elasticsearch/src/main/java/org/elasticsearch/rest/action/main/RestMainAction.java
index c3047c1ef4f62..ce699b82cb19e 100644
--- a/modules/elasticsearch/src/main/java/org/elasticsearch/rest/action/main/RestMainAction.java
+++ b/modules/elasticsearch/src/main/java/org/elasticsearch/rest/action/main/RestMainAction.java
@@ -25,10 +25,10 @@
import org.elasticsearch.common.inject.Inject;
import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.common.util.concurrent.jsr166y.ThreadLocalRandom;
+import org.elasticsearch.common.xcontent.XContentBuilder;
import org.elasticsearch.common.xcontent.XContentFactory;
import org.elasticsearch.common.xcontent.XContentParser;
import org.elasticsearch.common.xcontent.XContentType;
-import org.elasticsearch.common.xcontent.builder.XContentBuilder;
import org.elasticsearch.rest.*;
import org.elasticsearch.rest.action.support.RestXContentBuilder;
diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/rest/action/mlt/RestMoreLikeThisAction.java b/modules/elasticsearch/src/main/java/org/elasticsearch/rest/action/mlt/RestMoreLikeThisAction.java
index 1f92c149ec2e5..dfac0c5673604 100644
--- a/modules/elasticsearch/src/main/java/org/elasticsearch/rest/action/mlt/RestMoreLikeThisAction.java
+++ b/modules/elasticsearch/src/main/java/org/elasticsearch/rest/action/mlt/RestMoreLikeThisAction.java
@@ -26,7 +26,7 @@
import org.elasticsearch.client.Client;
import org.elasticsearch.common.inject.Inject;
import org.elasticsearch.common.settings.Settings;
-import org.elasticsearch.common.xcontent.builder.XContentBuilder;
+import org.elasticsearch.common.xcontent.XContentBuilder;
import org.elasticsearch.rest.*;
import org.elasticsearch.search.Scroll;
diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/rest/action/search/RestSearchAction.java b/modules/elasticsearch/src/main/java/org/elasticsearch/rest/action/search/RestSearchAction.java
index d151a5bbd5866..aaf088eb3e99b 100644
--- a/modules/elasticsearch/src/main/java/org/elasticsearch/rest/action/search/RestSearchAction.java
+++ b/modules/elasticsearch/src/main/java/org/elasticsearch/rest/action/search/RestSearchAction.java
@@ -27,7 +27,7 @@
import org.elasticsearch.client.Client;
import org.elasticsearch.common.inject.Inject;
import org.elasticsearch.common.settings.Settings;
-import org.elasticsearch.common.xcontent.builder.XContentBuilder;
+import org.elasticsearch.common.xcontent.XContentBuilder;
import org.elasticsearch.index.query.xcontent.QueryBuilders;
import org.elasticsearch.index.query.xcontent.QueryStringQueryBuilder;
import org.elasticsearch.rest.*;
diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/rest/action/search/RestSearchScrollAction.java b/modules/elasticsearch/src/main/java/org/elasticsearch/rest/action/search/RestSearchScrollAction.java
index de72707085ac2..621db6c3fae0b 100644
--- a/modules/elasticsearch/src/main/java/org/elasticsearch/rest/action/search/RestSearchScrollAction.java
+++ b/modules/elasticsearch/src/main/java/org/elasticsearch/rest/action/search/RestSearchScrollAction.java
@@ -26,7 +26,7 @@
import org.elasticsearch.client.Client;
import org.elasticsearch.common.inject.Inject;
import org.elasticsearch.common.settings.Settings;
-import org.elasticsearch.common.xcontent.builder.XContentBuilder;
+import org.elasticsearch.common.xcontent.XContentBuilder;
import org.elasticsearch.rest.*;
import org.elasticsearch.search.Scroll;
diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/rest/action/support/RestActions.java b/modules/elasticsearch/src/main/java/org/elasticsearch/rest/action/support/RestActions.java
index c28ac3e523086..a368c96016cc0 100644
--- a/modules/elasticsearch/src/main/java/org/elasticsearch/rest/action/support/RestActions.java
+++ b/modules/elasticsearch/src/main/java/org/elasticsearch/rest/action/support/RestActions.java
@@ -23,7 +23,7 @@
import org.elasticsearch.action.ShardOperationFailedException;
import org.elasticsearch.action.support.broadcast.BroadcastOperationResponse;
import org.elasticsearch.common.Strings;
-import org.elasticsearch.common.xcontent.builder.XContentBuilder;
+import org.elasticsearch.common.xcontent.XContentBuilder;
import org.elasticsearch.index.query.xcontent.QueryBuilders;
import org.elasticsearch.index.query.xcontent.QueryStringQueryBuilder;
import org.elasticsearch.rest.RestRequest;
diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/rest/action/support/RestXContentBuilder.java b/modules/elasticsearch/src/main/java/org/elasticsearch/rest/action/support/RestXContentBuilder.java
index f9089a7f2e2d5..8428b62e20124 100644
--- a/modules/elasticsearch/src/main/java/org/elasticsearch/rest/action/support/RestXContentBuilder.java
+++ b/modules/elasticsearch/src/main/java/org/elasticsearch/rest/action/support/RestXContentBuilder.java
@@ -24,10 +24,9 @@
import org.elasticsearch.common.io.stream.CachedStreamInput;
import org.elasticsearch.common.io.stream.LZFStreamInput;
import org.elasticsearch.common.xcontent.ToXContent;
+import org.elasticsearch.common.xcontent.XContentBuilder;
import org.elasticsearch.common.xcontent.XContentFactory;
import org.elasticsearch.common.xcontent.XContentType;
-import org.elasticsearch.common.xcontent.builder.BinaryXContentBuilder;
-import org.elasticsearch.common.xcontent.builder.XContentBuilder;
import org.elasticsearch.rest.RestRequest;
import java.io.IOException;
@@ -37,7 +36,7 @@
*/
public class RestXContentBuilder {
- public static BinaryXContentBuilder restContentBuilder(RestRequest request) throws IOException {
+ public static XContentBuilder restContentBuilder(RestRequest request) throws IOException {
XContentType contentType = XContentType.fromRestContentType(request.header("Content-Type"));
if (contentType == null) {
// try and guess it from the body, if exists
@@ -49,7 +48,7 @@ public static BinaryXContentBuilder restContentBuilder(RestRequest request) thro
// default to JSON
contentType = XContentType.JSON;
}
- BinaryXContentBuilder builder = XContentFactory.contentBinaryBuilder(contentType);
+ XContentBuilder builder = XContentFactory.contentBuilder(contentType);
if (request.paramAsBoolean("pretty", false)) {
builder.prettyPrint();
}
diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/search/SearchContextException.java b/modules/elasticsearch/src/main/java/org/elasticsearch/search/SearchContextException.java
index 47d1cf9286462..6299472d6afbe 100644
--- a/modules/elasticsearch/src/main/java/org/elasticsearch/search/SearchContextException.java
+++ b/modules/elasticsearch/src/main/java/org/elasticsearch/search/SearchContextException.java
@@ -37,7 +37,10 @@ public SearchContextException(SearchContext context, String msg, Throwable t) {
private static String buildMessage(SearchContext context, String msg) {
StringBuilder sb = new StringBuilder();
sb.append('[').append(context.shardTarget().index()).append("][").append(context.shardTarget().shardId()).append("]: ");
- sb.append("query[").append(context.parsedQuery().query()).append("],from[").append(context.from()).append("],size[").append(context.size()).append("]");
+ if (context.parsedQuery() != null) {
+ sb.append("query[").append(context.parsedQuery().query()).append("],");
+ }
+ sb.append("from[").append(context.from()).append("],size[").append(context.size()).append("]");
if (context.sort() != null) {
sb.append(",sort[").append(context.sort()).append("]");
}
diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/search/SearchService.java b/modules/elasticsearch/src/main/java/org/elasticsearch/search/SearchService.java
index 24966e2bdc7ec..af61be1798c46 100644
--- a/modules/elasticsearch/src/main/java/org/elasticsearch/search/SearchService.java
+++ b/modules/elasticsearch/src/main/java/org/elasticsearch/search/SearchService.java
@@ -355,6 +355,7 @@ private void parseSource(SearchContext context, byte[] source, int offset, int l
break;
}
}
+ parser.close();
} catch (Exception e) {
throw new SearchParseException(context, "Failed to parse [" + Unicode.fromBytes(source, offset, length) + "]", e);
}
diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/search/builder/SearchSourceBuilder.java b/modules/elasticsearch/src/main/java/org/elasticsearch/search/builder/SearchSourceBuilder.java
index 6b815c95124c9..8a79477c846ed 100644
--- a/modules/elasticsearch/src/main/java/org/elasticsearch/search/builder/SearchSourceBuilder.java
+++ b/modules/elasticsearch/src/main/java/org/elasticsearch/search/builder/SearchSourceBuilder.java
@@ -19,16 +19,16 @@
package org.elasticsearch.search.builder;
+import org.elasticsearch.client.Requests;
import org.elasticsearch.common.Unicode;
import org.elasticsearch.common.collect.Lists;
import org.elasticsearch.common.io.FastByteArrayOutputStream;
import org.elasticsearch.common.trove.TObjectFloatHashMap;
import org.elasticsearch.common.trove.TObjectFloatIterator;
import org.elasticsearch.common.xcontent.ToXContent;
+import org.elasticsearch.common.xcontent.XContentBuilder;
import org.elasticsearch.common.xcontent.XContentFactory;
import org.elasticsearch.common.xcontent.XContentType;
-import org.elasticsearch.common.xcontent.builder.BinaryXContentBuilder;
-import org.elasticsearch.common.xcontent.builder.XContentBuilder;
import org.elasticsearch.index.query.xcontent.XContentQueryBuilder;
import org.elasticsearch.search.facets.AbstractFacetBuilder;
import org.elasticsearch.search.highlight.HighlightBuilder;
@@ -264,13 +264,9 @@ public SearchSourceBuilder indexBoost(String index, float indexBoost) {
return this;
}
- public FastByteArrayOutputStream buildAsUnsafeBytes() throws SearchSourceBuilderException {
- return buildAsUnsafeBytes(XContentType.JSON);
- }
-
public FastByteArrayOutputStream buildAsUnsafeBytes(XContentType contentType) throws SearchSourceBuilderException {
try {
- BinaryXContentBuilder builder = XContentFactory.contentBinaryBuilder(contentType);
+ XContentBuilder builder = XContentFactory.contentBuilder(contentType);
toXContent(builder, ToXContent.EMPTY_PARAMS);
return builder.unsafeStream();
} catch (Exception e) {
@@ -279,12 +275,12 @@ public FastByteArrayOutputStream buildAsUnsafeBytes(XContentType contentType) th
}
public byte[] buildAsBytes() throws SearchSourceBuilderException {
- return buildAsBytes(XContentType.JSON);
+ return buildAsBytes(Requests.CONTENT_TYPE);
}
public byte[] buildAsBytes(XContentType contentType) throws SearchSourceBuilderException {
try {
- XContentBuilder builder = XContentFactory.contentBinaryBuilder(contentType);
+ XContentBuilder builder = XContentFactory.contentBuilder(contentType);
toXContent(builder, EMPTY_PARAMS);
return builder.copiedBytes();
} catch (Exception e) {
@@ -315,8 +311,7 @@ public byte[] buildAsBytes(XContentType contentType) throws SearchSourceBuilderE
if (XContentFactory.xContentType(queryBinary) == builder.contentType()) {
builder.rawField("query", queryBinary);
} else {
- builder.field("query_binary");
- builder.value(queryBinary);
+ builder.field("query_binary", queryBinary);
}
}
diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/search/facets/AbstractFacetBuilder.java b/modules/elasticsearch/src/main/java/org/elasticsearch/search/facets/AbstractFacetBuilder.java
index 7ccef55378f38..fe1a017567783 100644
--- a/modules/elasticsearch/src/main/java/org/elasticsearch/search/facets/AbstractFacetBuilder.java
+++ b/modules/elasticsearch/src/main/java/org/elasticsearch/search/facets/AbstractFacetBuilder.java
@@ -20,7 +20,7 @@
package org.elasticsearch.search.facets;
import org.elasticsearch.common.xcontent.ToXContent;
-import org.elasticsearch.common.xcontent.builder.XContentBuilder;
+import org.elasticsearch.common.xcontent.XContentBuilder;
import org.elasticsearch.index.query.xcontent.XContentFilterBuilder;
import java.io.IOException;
diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/search/facets/filter/FilterFacetBuilder.java b/modules/elasticsearch/src/main/java/org/elasticsearch/search/facets/filter/FilterFacetBuilder.java
index 1fc03b3c24b0f..40039f6581673 100644
--- a/modules/elasticsearch/src/main/java/org/elasticsearch/search/facets/filter/FilterFacetBuilder.java
+++ b/modules/elasticsearch/src/main/java/org/elasticsearch/search/facets/filter/FilterFacetBuilder.java
@@ -19,7 +19,7 @@
package org.elasticsearch.search.facets.filter;
-import org.elasticsearch.common.xcontent.builder.XContentBuilder;
+import org.elasticsearch.common.xcontent.XContentBuilder;
import org.elasticsearch.index.query.xcontent.XContentFilterBuilder;
import org.elasticsearch.search.builder.SearchSourceBuilderException;
import org.elasticsearch.search.facets.AbstractFacetBuilder;
diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/search/facets/filter/InternalFilterFacet.java b/modules/elasticsearch/src/main/java/org/elasticsearch/search/facets/filter/InternalFilterFacet.java
index ea7a525421fa1..34fc6921d5667 100644
--- a/modules/elasticsearch/src/main/java/org/elasticsearch/search/facets/filter/InternalFilterFacet.java
+++ b/modules/elasticsearch/src/main/java/org/elasticsearch/search/facets/filter/InternalFilterFacet.java
@@ -21,7 +21,7 @@
import org.elasticsearch.common.io.stream.StreamInput;
import org.elasticsearch.common.io.stream.StreamOutput;
-import org.elasticsearch.common.xcontent.builder.XContentBuilder;
+import org.elasticsearch.common.xcontent.XContentBuilder;
import org.elasticsearch.search.facets.Facet;
import org.elasticsearch.search.facets.internal.InternalFacet;
diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/search/facets/geodistance/GeoDistanceFacetBuilder.java b/modules/elasticsearch/src/main/java/org/elasticsearch/search/facets/geodistance/GeoDistanceFacetBuilder.java
index 5a4a1d6802c62..ae4d22ca16e63 100644
--- a/modules/elasticsearch/src/main/java/org/elasticsearch/search/facets/geodistance/GeoDistanceFacetBuilder.java
+++ b/modules/elasticsearch/src/main/java/org/elasticsearch/search/facets/geodistance/GeoDistanceFacetBuilder.java
@@ -23,7 +23,7 @@
import org.elasticsearch.common.collect.Maps;
import org.elasticsearch.common.lucene.geo.GeoDistance;
import org.elasticsearch.common.unit.DistanceUnit;
-import org.elasticsearch.common.xcontent.builder.XContentBuilder;
+import org.elasticsearch.common.xcontent.XContentBuilder;
import org.elasticsearch.index.query.xcontent.XContentFilterBuilder;
import org.elasticsearch.search.builder.SearchSourceBuilderException;
import org.elasticsearch.search.facets.AbstractFacetBuilder;
diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/search/facets/geodistance/InternalGeoDistanceFacet.java b/modules/elasticsearch/src/main/java/org/elasticsearch/search/facets/geodistance/InternalGeoDistanceFacet.java
index 34d5665211075..8ca6c005e4834 100644
--- a/modules/elasticsearch/src/main/java/org/elasticsearch/search/facets/geodistance/InternalGeoDistanceFacet.java
+++ b/modules/elasticsearch/src/main/java/org/elasticsearch/search/facets/geodistance/InternalGeoDistanceFacet.java
@@ -23,7 +23,7 @@
import org.elasticsearch.common.io.stream.StreamInput;
import org.elasticsearch.common.io.stream.StreamOutput;
import org.elasticsearch.common.unit.DistanceUnit;
-import org.elasticsearch.common.xcontent.builder.XContentBuilder;
+import org.elasticsearch.common.xcontent.XContentBuilder;
import org.elasticsearch.search.facets.Facet;
import org.elasticsearch.search.facets.internal.InternalFacet;
diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/search/facets/histogram/HistogramFacetBuilder.java b/modules/elasticsearch/src/main/java/org/elasticsearch/search/facets/histogram/HistogramFacetBuilder.java
index 8473734099b71..6709e6e90fbf0 100644
--- a/modules/elasticsearch/src/main/java/org/elasticsearch/search/facets/histogram/HistogramFacetBuilder.java
+++ b/modules/elasticsearch/src/main/java/org/elasticsearch/search/facets/histogram/HistogramFacetBuilder.java
@@ -19,7 +19,7 @@
package org.elasticsearch.search.facets.histogram;
-import org.elasticsearch.common.xcontent.builder.XContentBuilder;
+import org.elasticsearch.common.xcontent.XContentBuilder;
import org.elasticsearch.index.query.xcontent.XContentFilterBuilder;
import org.elasticsearch.search.builder.SearchSourceBuilderException;
import org.elasticsearch.search.facets.AbstractFacetBuilder;
diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/search/facets/histogram/HistogramScriptFacetBuilder.java b/modules/elasticsearch/src/main/java/org/elasticsearch/search/facets/histogram/HistogramScriptFacetBuilder.java
index f8484bb3c12fc..9be48a2fa57ea 100644
--- a/modules/elasticsearch/src/main/java/org/elasticsearch/search/facets/histogram/HistogramScriptFacetBuilder.java
+++ b/modules/elasticsearch/src/main/java/org/elasticsearch/search/facets/histogram/HistogramScriptFacetBuilder.java
@@ -20,7 +20,7 @@
package org.elasticsearch.search.facets.histogram;
import org.elasticsearch.common.collect.Maps;
-import org.elasticsearch.common.xcontent.builder.XContentBuilder;
+import org.elasticsearch.common.xcontent.XContentBuilder;
import org.elasticsearch.index.query.xcontent.XContentFilterBuilder;
import org.elasticsearch.search.builder.SearchSourceBuilderException;
import org.elasticsearch.search.facets.AbstractFacetBuilder;
diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/search/facets/histogram/InternalHistogramFacet.java b/modules/elasticsearch/src/main/java/org/elasticsearch/search/facets/histogram/InternalHistogramFacet.java
index ed0a4f3115d02..c282d308339eb 100644
--- a/modules/elasticsearch/src/main/java/org/elasticsearch/search/facets/histogram/InternalHistogramFacet.java
+++ b/modules/elasticsearch/src/main/java/org/elasticsearch/search/facets/histogram/InternalHistogramFacet.java
@@ -26,7 +26,7 @@
import org.elasticsearch.common.trove.TLongDoubleIterator;
import org.elasticsearch.common.trove.TLongLongHashMap;
import org.elasticsearch.common.trove.TLongLongIterator;
-import org.elasticsearch.common.xcontent.builder.XContentBuilder;
+import org.elasticsearch.common.xcontent.XContentBuilder;
import org.elasticsearch.search.facets.Facet;
import org.elasticsearch.search.facets.internal.InternalFacet;
diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/search/facets/internal/InternalFacets.java b/modules/elasticsearch/src/main/java/org/elasticsearch/search/facets/internal/InternalFacets.java
index 649b8212a6550..551efb454c803 100644
--- a/modules/elasticsearch/src/main/java/org/elasticsearch/search/facets/internal/InternalFacets.java
+++ b/modules/elasticsearch/src/main/java/org/elasticsearch/search/facets/internal/InternalFacets.java
@@ -26,7 +26,7 @@
import org.elasticsearch.common.io.stream.StreamOutput;
import org.elasticsearch.common.io.stream.Streamable;
import org.elasticsearch.common.xcontent.ToXContent;
-import org.elasticsearch.common.xcontent.builder.XContentBuilder;
+import org.elasticsearch.common.xcontent.XContentBuilder;
import org.elasticsearch.search.facets.Facet;
import org.elasticsearch.search.facets.Facets;
import org.elasticsearch.search.facets.filter.InternalFilterFacet;
diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/search/facets/query/InternalQueryFacet.java b/modules/elasticsearch/src/main/java/org/elasticsearch/search/facets/query/InternalQueryFacet.java
index fc8a66b118f73..8fd890acaa8c1 100644
--- a/modules/elasticsearch/src/main/java/org/elasticsearch/search/facets/query/InternalQueryFacet.java
+++ b/modules/elasticsearch/src/main/java/org/elasticsearch/search/facets/query/InternalQueryFacet.java
@@ -21,7 +21,7 @@
import org.elasticsearch.common.io.stream.StreamInput;
import org.elasticsearch.common.io.stream.StreamOutput;
-import org.elasticsearch.common.xcontent.builder.XContentBuilder;
+import org.elasticsearch.common.xcontent.XContentBuilder;
import org.elasticsearch.search.facets.Facet;
import org.elasticsearch.search.facets.internal.InternalFacet;
diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/search/facets/query/QueryFacetBuilder.java b/modules/elasticsearch/src/main/java/org/elasticsearch/search/facets/query/QueryFacetBuilder.java
index 854b5b21946a3..1ae9539b13840 100644
--- a/modules/elasticsearch/src/main/java/org/elasticsearch/search/facets/query/QueryFacetBuilder.java
+++ b/modules/elasticsearch/src/main/java/org/elasticsearch/search/facets/query/QueryFacetBuilder.java
@@ -19,7 +19,7 @@
package org.elasticsearch.search.facets.query;
-import org.elasticsearch.common.xcontent.builder.XContentBuilder;
+import org.elasticsearch.common.xcontent.XContentBuilder;
import org.elasticsearch.index.query.xcontent.XContentFilterBuilder;
import org.elasticsearch.index.query.xcontent.XContentQueryBuilder;
import org.elasticsearch.search.builder.SearchSourceBuilderException;
diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/search/facets/range/InternalRangeFacet.java b/modules/elasticsearch/src/main/java/org/elasticsearch/search/facets/range/InternalRangeFacet.java
index e6f5e5760faf8..8cb93001cb0ea 100644
--- a/modules/elasticsearch/src/main/java/org/elasticsearch/search/facets/range/InternalRangeFacet.java
+++ b/modules/elasticsearch/src/main/java/org/elasticsearch/search/facets/range/InternalRangeFacet.java
@@ -22,7 +22,7 @@
import org.elasticsearch.common.collect.ImmutableList;
import org.elasticsearch.common.io.stream.StreamInput;
import org.elasticsearch.common.io.stream.StreamOutput;
-import org.elasticsearch.common.xcontent.builder.XContentBuilder;
+import org.elasticsearch.common.xcontent.XContentBuilder;
import org.elasticsearch.search.facets.Facet;
import org.elasticsearch.search.facets.internal.InternalFacet;
diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/search/facets/range/RangeFacetBuilder.java b/modules/elasticsearch/src/main/java/org/elasticsearch/search/facets/range/RangeFacetBuilder.java
index a6b8d63926e18..053d2a9584a2d 100644
--- a/modules/elasticsearch/src/main/java/org/elasticsearch/search/facets/range/RangeFacetBuilder.java
+++ b/modules/elasticsearch/src/main/java/org/elasticsearch/search/facets/range/RangeFacetBuilder.java
@@ -20,7 +20,7 @@
package org.elasticsearch.search.facets.range;
import org.elasticsearch.common.collect.Lists;
-import org.elasticsearch.common.xcontent.builder.XContentBuilder;
+import org.elasticsearch.common.xcontent.XContentBuilder;
import org.elasticsearch.index.query.xcontent.XContentFilterBuilder;
import org.elasticsearch.search.builder.SearchSourceBuilderException;
import org.elasticsearch.search.facets.AbstractFacetBuilder;
diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/search/facets/range/RangeScriptFacetBuilder.java b/modules/elasticsearch/src/main/java/org/elasticsearch/search/facets/range/RangeScriptFacetBuilder.java
index 628a300095333..91c9052eb40f4 100644
--- a/modules/elasticsearch/src/main/java/org/elasticsearch/search/facets/range/RangeScriptFacetBuilder.java
+++ b/modules/elasticsearch/src/main/java/org/elasticsearch/search/facets/range/RangeScriptFacetBuilder.java
@@ -21,7 +21,7 @@
import org.elasticsearch.common.collect.Lists;
import org.elasticsearch.common.collect.Maps;
-import org.elasticsearch.common.xcontent.builder.XContentBuilder;
+import org.elasticsearch.common.xcontent.XContentBuilder;
import org.elasticsearch.index.query.xcontent.XContentFilterBuilder;
import org.elasticsearch.search.builder.SearchSourceBuilderException;
import org.elasticsearch.search.facets.AbstractFacetBuilder;
diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/search/facets/statistical/InternalStatisticalFacet.java b/modules/elasticsearch/src/main/java/org/elasticsearch/search/facets/statistical/InternalStatisticalFacet.java
index 4d47d6500c0d3..c31cf07146939 100644
--- a/modules/elasticsearch/src/main/java/org/elasticsearch/search/facets/statistical/InternalStatisticalFacet.java
+++ b/modules/elasticsearch/src/main/java/org/elasticsearch/search/facets/statistical/InternalStatisticalFacet.java
@@ -21,7 +21,7 @@
import org.elasticsearch.common.io.stream.StreamInput;
import org.elasticsearch.common.io.stream.StreamOutput;
-import org.elasticsearch.common.xcontent.builder.XContentBuilder;
+import org.elasticsearch.common.xcontent.XContentBuilder;
import org.elasticsearch.search.facets.Facet;
import org.elasticsearch.search.facets.internal.InternalFacet;
diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/search/facets/statistical/StatisticalFacetBuilder.java b/modules/elasticsearch/src/main/java/org/elasticsearch/search/facets/statistical/StatisticalFacetBuilder.java
index 779e7f8329162..947ea047f6143 100644
--- a/modules/elasticsearch/src/main/java/org/elasticsearch/search/facets/statistical/StatisticalFacetBuilder.java
+++ b/modules/elasticsearch/src/main/java/org/elasticsearch/search/facets/statistical/StatisticalFacetBuilder.java
@@ -19,7 +19,7 @@
package org.elasticsearch.search.facets.statistical;
-import org.elasticsearch.common.xcontent.builder.XContentBuilder;
+import org.elasticsearch.common.xcontent.XContentBuilder;
import org.elasticsearch.index.query.xcontent.XContentFilterBuilder;
import org.elasticsearch.search.builder.SearchSourceBuilderException;
import org.elasticsearch.search.facets.AbstractFacetBuilder;
diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/search/facets/statistical/StatisticalScriptFacetBuilder.java b/modules/elasticsearch/src/main/java/org/elasticsearch/search/facets/statistical/StatisticalScriptFacetBuilder.java
index df8f2cc6b49d0..10c9297e3fc77 100644
--- a/modules/elasticsearch/src/main/java/org/elasticsearch/search/facets/statistical/StatisticalScriptFacetBuilder.java
+++ b/modules/elasticsearch/src/main/java/org/elasticsearch/search/facets/statistical/StatisticalScriptFacetBuilder.java
@@ -20,7 +20,7 @@
package org.elasticsearch.search.facets.statistical;
import org.elasticsearch.common.collect.Maps;
-import org.elasticsearch.common.xcontent.builder.XContentBuilder;
+import org.elasticsearch.common.xcontent.XContentBuilder;
import org.elasticsearch.index.query.xcontent.XContentFilterBuilder;
import org.elasticsearch.search.builder.SearchSourceBuilderException;
import org.elasticsearch.search.facets.AbstractFacetBuilder;
diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/search/facets/terms/InternalTermsFacet.java b/modules/elasticsearch/src/main/java/org/elasticsearch/search/facets/terms/InternalTermsFacet.java
index e08e61af6f807..e60bf9078ce3c 100644
--- a/modules/elasticsearch/src/main/java/org/elasticsearch/search/facets/terms/InternalTermsFacet.java
+++ b/modules/elasticsearch/src/main/java/org/elasticsearch/search/facets/terms/InternalTermsFacet.java
@@ -26,7 +26,7 @@
import org.elasticsearch.common.thread.ThreadLocals;
import org.elasticsearch.common.trove.TObjectIntHashMap;
import org.elasticsearch.common.trove.TObjectIntIterator;
-import org.elasticsearch.common.xcontent.builder.XContentBuilder;
+import org.elasticsearch.common.xcontent.XContentBuilder;
import org.elasticsearch.search.facets.Facet;
import org.elasticsearch.search.facets.internal.InternalFacet;
diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/search/facets/terms/TermsFacetBuilder.java b/modules/elasticsearch/src/main/java/org/elasticsearch/search/facets/terms/TermsFacetBuilder.java
index 4c1ea888fdbf9..f890da81194cb 100644
--- a/modules/elasticsearch/src/main/java/org/elasticsearch/search/facets/terms/TermsFacetBuilder.java
+++ b/modules/elasticsearch/src/main/java/org/elasticsearch/search/facets/terms/TermsFacetBuilder.java
@@ -21,7 +21,7 @@
import org.elasticsearch.common.collect.Maps;
import org.elasticsearch.common.regex.Regex;
-import org.elasticsearch.common.xcontent.builder.XContentBuilder;
+import org.elasticsearch.common.xcontent.XContentBuilder;
import org.elasticsearch.index.query.xcontent.XContentFilterBuilder;
import org.elasticsearch.search.builder.SearchSourceBuilderException;
import org.elasticsearch.search.facets.AbstractFacetBuilder;
diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/search/highlight/HighlightBuilder.java b/modules/elasticsearch/src/main/java/org/elasticsearch/search/highlight/HighlightBuilder.java
index 98768f399657a..55cc1bd073394 100644
--- a/modules/elasticsearch/src/main/java/org/elasticsearch/search/highlight/HighlightBuilder.java
+++ b/modules/elasticsearch/src/main/java/org/elasticsearch/search/highlight/HighlightBuilder.java
@@ -20,7 +20,7 @@
package org.elasticsearch.search.highlight;
import org.elasticsearch.common.xcontent.ToXContent;
-import org.elasticsearch.common.xcontent.builder.XContentBuilder;
+import org.elasticsearch.common.xcontent.XContentBuilder;
import java.io.IOException;
import java.util.List;
diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/search/internal/InternalSearchHit.java b/modules/elasticsearch/src/main/java/org/elasticsearch/search/internal/InternalSearchHit.java
index 47ac84617a77e..7e33650bfe11e 100644
--- a/modules/elasticsearch/src/main/java/org/elasticsearch/search/internal/InternalSearchHit.java
+++ b/modules/elasticsearch/src/main/java/org/elasticsearch/search/internal/InternalSearchHit.java
@@ -28,9 +28,9 @@
import org.elasticsearch.common.io.stream.StreamInput;
import org.elasticsearch.common.io.stream.StreamOutput;
import org.elasticsearch.common.trove.TIntObjectHashMap;
+import org.elasticsearch.common.xcontent.XContentBuilder;
import org.elasticsearch.common.xcontent.XContentFactory;
import org.elasticsearch.common.xcontent.XContentParser;
-import org.elasticsearch.common.xcontent.builder.XContentBuilder;
import org.elasticsearch.rest.action.support.RestXContentBuilder;
import org.elasticsearch.search.SearchHit;
import org.elasticsearch.search.SearchHitField;
diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/search/internal/InternalSearchHits.java b/modules/elasticsearch/src/main/java/org/elasticsearch/search/internal/InternalSearchHits.java
index 886c61749e5c3..ad3e984a28564 100644
--- a/modules/elasticsearch/src/main/java/org/elasticsearch/search/internal/InternalSearchHits.java
+++ b/modules/elasticsearch/src/main/java/org/elasticsearch/search/internal/InternalSearchHits.java
@@ -23,7 +23,7 @@
import org.elasticsearch.common.io.stream.StreamInput;
import org.elasticsearch.common.io.stream.StreamOutput;
import org.elasticsearch.common.trove.TIntObjectHashMap;
-import org.elasticsearch.common.xcontent.builder.XContentBuilder;
+import org.elasticsearch.common.xcontent.XContentBuilder;
import org.elasticsearch.search.SearchHit;
import org.elasticsearch.search.SearchHits;
import org.elasticsearch.search.SearchShardTarget;
diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/search/internal/InternalSearchResponse.java b/modules/elasticsearch/src/main/java/org/elasticsearch/search/internal/InternalSearchResponse.java
index ed171cf524d22..b2ae57dbc4d69 100644
--- a/modules/elasticsearch/src/main/java/org/elasticsearch/search/internal/InternalSearchResponse.java
+++ b/modules/elasticsearch/src/main/java/org/elasticsearch/search/internal/InternalSearchResponse.java
@@ -23,7 +23,7 @@
import org.elasticsearch.common.io.stream.StreamOutput;
import org.elasticsearch.common.io.stream.Streamable;
import org.elasticsearch.common.xcontent.ToXContent;
-import org.elasticsearch.common.xcontent.builder.XContentBuilder;
+import org.elasticsearch.common.xcontent.XContentBuilder;
import org.elasticsearch.search.SearchHits;
import org.elasticsearch.search.facets.Facets;
import org.elasticsearch.search.facets.internal.InternalFacets;
diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/search/sort/FieldSortBuilder.java b/modules/elasticsearch/src/main/java/org/elasticsearch/search/sort/FieldSortBuilder.java
index a77a233f082a8..60b3470536fac 100644
--- a/modules/elasticsearch/src/main/java/org/elasticsearch/search/sort/FieldSortBuilder.java
+++ b/modules/elasticsearch/src/main/java/org/elasticsearch/search/sort/FieldSortBuilder.java
@@ -19,7 +19,7 @@
package org.elasticsearch.search.sort;
-import org.elasticsearch.common.xcontent.builder.XContentBuilder;
+import org.elasticsearch.common.xcontent.XContentBuilder;
import java.io.IOException;
diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/search/sort/GeoDistanceSortBuilder.java b/modules/elasticsearch/src/main/java/org/elasticsearch/search/sort/GeoDistanceSortBuilder.java
index 451f42a87489a..f9f5355a5fc66 100644
--- a/modules/elasticsearch/src/main/java/org/elasticsearch/search/sort/GeoDistanceSortBuilder.java
+++ b/modules/elasticsearch/src/main/java/org/elasticsearch/search/sort/GeoDistanceSortBuilder.java
@@ -21,7 +21,7 @@
import org.elasticsearch.common.lucene.geo.GeoDistance;
import org.elasticsearch.common.unit.DistanceUnit;
-import org.elasticsearch.common.xcontent.builder.XContentBuilder;
+import org.elasticsearch.common.xcontent.XContentBuilder;
import java.io.IOException;
diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/search/sort/ScoreSortBuilder.java b/modules/elasticsearch/src/main/java/org/elasticsearch/search/sort/ScoreSortBuilder.java
index 5b2e2e864912b..8cfeb5582b408 100644
--- a/modules/elasticsearch/src/main/java/org/elasticsearch/search/sort/ScoreSortBuilder.java
+++ b/modules/elasticsearch/src/main/java/org/elasticsearch/search/sort/ScoreSortBuilder.java
@@ -19,7 +19,7 @@
package org.elasticsearch.search.sort;
-import org.elasticsearch.common.xcontent.builder.XContentBuilder;
+import org.elasticsearch.common.xcontent.XContentBuilder;
import java.io.IOException;
diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/search/sort/ScriptSortBuilder.java b/modules/elasticsearch/src/main/java/org/elasticsearch/search/sort/ScriptSortBuilder.java
index af4de9d5a97bd..74afc0fae714d 100644
--- a/modules/elasticsearch/src/main/java/org/elasticsearch/search/sort/ScriptSortBuilder.java
+++ b/modules/elasticsearch/src/main/java/org/elasticsearch/search/sort/ScriptSortBuilder.java
@@ -20,7 +20,7 @@
package org.elasticsearch.search.sort;
import org.elasticsearch.common.collect.Maps;
-import org.elasticsearch.common.xcontent.builder.XContentBuilder;
+import org.elasticsearch.common.xcontent.XContentBuilder;
import java.io.IOException;
import java.util.Map;
diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/threadpool/ThreadPoolInfo.java b/modules/elasticsearch/src/main/java/org/elasticsearch/threadpool/ThreadPoolInfo.java
index 437149bac0222..d367f720c34d8 100644
--- a/modules/elasticsearch/src/main/java/org/elasticsearch/threadpool/ThreadPoolInfo.java
+++ b/modules/elasticsearch/src/main/java/org/elasticsearch/threadpool/ThreadPoolInfo.java
@@ -23,7 +23,7 @@
import org.elasticsearch.common.io.stream.StreamOutput;
import org.elasticsearch.common.io.stream.Streamable;
import org.elasticsearch.common.xcontent.ToXContent;
-import org.elasticsearch.common.xcontent.builder.XContentBuilder;
+import org.elasticsearch.common.xcontent.XContentBuilder;
import java.io.IOException;
import java.io.Serializable;
diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/threadpool/ThreadPoolStats.java b/modules/elasticsearch/src/main/java/org/elasticsearch/threadpool/ThreadPoolStats.java
index 24d58093a69a4..bef906a6ee4dc 100644
--- a/modules/elasticsearch/src/main/java/org/elasticsearch/threadpool/ThreadPoolStats.java
+++ b/modules/elasticsearch/src/main/java/org/elasticsearch/threadpool/ThreadPoolStats.java
@@ -23,7 +23,7 @@
import org.elasticsearch.common.io.stream.StreamOutput;
import org.elasticsearch.common.io.stream.Streamable;
import org.elasticsearch.common.xcontent.ToXContent;
-import org.elasticsearch.common.xcontent.builder.XContentBuilder;
+import org.elasticsearch.common.xcontent.XContentBuilder;
import java.io.IOException;
import java.io.Serializable;
diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/transport/TransportInfo.java b/modules/elasticsearch/src/main/java/org/elasticsearch/transport/TransportInfo.java
index 6112ee4046710..7322749af9f9f 100644
--- a/modules/elasticsearch/src/main/java/org/elasticsearch/transport/TransportInfo.java
+++ b/modules/elasticsearch/src/main/java/org/elasticsearch/transport/TransportInfo.java
@@ -24,7 +24,7 @@
import org.elasticsearch.common.io.stream.Streamable;
import org.elasticsearch.common.transport.BoundTransportAddress;
import org.elasticsearch.common.xcontent.ToXContent;
-import org.elasticsearch.common.xcontent.builder.XContentBuilder;
+import org.elasticsearch.common.xcontent.XContentBuilder;
import java.io.IOException;
import java.io.Serializable;
diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/transport/TransportStats.java b/modules/elasticsearch/src/main/java/org/elasticsearch/transport/TransportStats.java
index 729fedfcb6b39..e49cf0bb4ff1f 100644
--- a/modules/elasticsearch/src/main/java/org/elasticsearch/transport/TransportStats.java
+++ b/modules/elasticsearch/src/main/java/org/elasticsearch/transport/TransportStats.java
@@ -24,7 +24,7 @@
import org.elasticsearch.common.io.stream.Streamable;
import org.elasticsearch.common.unit.ByteSizeValue;
import org.elasticsearch.common.xcontent.ToXContent;
-import org.elasticsearch.common.xcontent.builder.XContentBuilder;
+import org.elasticsearch.common.xcontent.XContentBuilder;
import java.io.IOException;
import java.io.Serializable;
diff --git a/modules/elasticsearch/src/test/java/org/elasticsearch/common/xcontent/builder/BuilderRawFieldTests.java b/modules/elasticsearch/src/test/java/org/elasticsearch/common/xcontent/builder/BuilderRawFieldTests.java
new file mode 100644
index 0000000000000..a238d00e356e4
--- /dev/null
+++ b/modules/elasticsearch/src/test/java/org/elasticsearch/common/xcontent/builder/BuilderRawFieldTests.java
@@ -0,0 +1,76 @@
+/*
+ * Licensed to Elastic Search and Shay Banon under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. Elastic Search licenses this
+ * file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.elasticsearch.common.xcontent.builder;
+
+import org.elasticsearch.common.xcontent.XContentBuilder;
+import org.elasticsearch.common.xcontent.XContentFactory;
+import org.elasticsearch.common.xcontent.XContentParser;
+import org.elasticsearch.common.xcontent.XContentType;
+import org.testng.annotations.Test;
+
+import java.io.IOException;
+
+import static org.hamcrest.MatcherAssert.*;
+import static org.hamcrest.Matchers.*;
+
+/**
+ * @author kimchy (shay.banon)
+ */
+public class BuilderRawFieldTests {
+
+ @Test public void testJsonRawField() throws IOException {
+ testRawField(XContentType.JSON);
+ }
+
+ @Test public void testSmileRawField() throws IOException {
+ testRawField(XContentType.SMILE);
+ }
+
+ private void testRawField(XContentType type) throws IOException {
+ XContentBuilder builder = XContentFactory.contentBuilder(type);
+ builder.startObject();
+ builder.field("field1", "value1");
+ builder.rawField("_source", XContentFactory.unCachedContentBuilder(type).startObject().field("s_field", "s_value").endObject().copiedBytes());
+ builder.field("field2", "value2");
+ builder.endObject();
+
+ XContentParser parser = XContentFactory.xContent(type).createParser(builder.copiedBytes());
+ assertThat(parser.nextToken(), equalTo(XContentParser.Token.START_OBJECT));
+ assertThat(parser.nextToken(), equalTo(XContentParser.Token.FIELD_NAME));
+ assertThat(parser.currentName(), equalTo("field1"));
+ assertThat(parser.nextToken(), equalTo(XContentParser.Token.VALUE_STRING));
+ assertThat(parser.text(), equalTo("value1"));
+
+ assertThat(parser.nextToken(), equalTo(XContentParser.Token.FIELD_NAME));
+ assertThat(parser.currentName(), equalTo("_source"));
+ assertThat(parser.nextToken(), equalTo(XContentParser.Token.START_OBJECT));
+ assertThat(parser.nextToken(), equalTo(XContentParser.Token.FIELD_NAME));
+ assertThat(parser.currentName(), equalTo("s_field"));
+ assertThat(parser.nextToken(), equalTo(XContentParser.Token.VALUE_STRING));
+ assertThat(parser.text(), equalTo("s_value"));
+ assertThat(parser.nextToken(), equalTo(XContentParser.Token.END_OBJECT));
+
+ assertThat(parser.nextToken(), equalTo(XContentParser.Token.FIELD_NAME));
+ assertThat(parser.currentName(), equalTo("field2"));
+ assertThat(parser.nextToken(), equalTo(XContentParser.Token.VALUE_STRING));
+ assertThat(parser.text(), equalTo("value2"));
+ assertThat(parser.nextToken(), equalTo(XContentParser.Token.END_OBJECT));
+ }
+}
diff --git a/modules/elasticsearch/src/test/java/org/elasticsearch/common/xcontent/builder/XContentBuilderTests.java b/modules/elasticsearch/src/test/java/org/elasticsearch/common/xcontent/builder/XContentBuilderTests.java
index 3a5f3341c2178..3efd35b5d217c 100644
--- a/modules/elasticsearch/src/test/java/org/elasticsearch/common/xcontent/builder/XContentBuilderTests.java
+++ b/modules/elasticsearch/src/test/java/org/elasticsearch/common/xcontent/builder/XContentBuilderTests.java
@@ -21,12 +21,13 @@
import org.elasticsearch.common.io.FastByteArrayOutputStream;
import org.elasticsearch.common.io.FastCharArrayWriter;
+import org.elasticsearch.common.xcontent.XContentBuilder;
import org.elasticsearch.common.xcontent.XContentFactory;
import org.elasticsearch.common.xcontent.XContentGenerator;
import org.elasticsearch.common.xcontent.XContentType;
import org.testng.annotations.Test;
-import static org.elasticsearch.common.xcontent.builder.XContentBuilder.FieldCaseConversion.*;
+import static org.elasticsearch.common.xcontent.XContentBuilder.FieldCaseConversion.*;
import static org.hamcrest.MatcherAssert.*;
import static org.hamcrest.Matchers.*;
@@ -57,10 +58,11 @@ public class XContentBuilderTests {
}
@Test public void testSimpleGenerator() throws Exception {
- TextXContentBuilder builder = XContentFactory.contentTextBuilder(XContentType.JSON);
+ XContentBuilder builder = XContentFactory.contentBuilder(XContentType.JSON);
builder.startObject().field("test", "value").endObject();
assertThat(builder.string(), equalTo("{\"test\":\"value\"}"));
- builder.reset();
+
+ builder = XContentFactory.contentBuilder(XContentType.JSON);
builder.startObject().field("test", "value").endObject();
assertThat(builder.string(), equalTo("{\"test\":\"value\"}"));
}
@@ -83,11 +85,11 @@ public class XContentBuilderTests {
}
@Test public void testFieldCaseConversion() throws Exception {
- TextXContentBuilder builder = XContentFactory.contentTextBuilder(XContentType.JSON).fieldCaseConversion(CAMELCASE);
+ XContentBuilder builder = XContentFactory.contentBuilder(XContentType.JSON).fieldCaseConversion(CAMELCASE);
builder.startObject().field("test_name", "value").endObject();
assertThat(builder.string(), equalTo("{\"testName\":\"value\"}"));
- builder = XContentFactory.contentTextBuilder(XContentType.JSON).fieldCaseConversion(UNDERSCORE);
+ builder = XContentFactory.contentBuilder(XContentType.JSON).fieldCaseConversion(UNDERSCORE);
builder.startObject().field("testName", "value").endObject();
assertThat(builder.string(), equalTo("{\"test_name\":\"value\"}"));
}
diff --git a/modules/elasticsearch/src/test/java/org/elasticsearch/common/xcontent/xson/JsonVsXsonTests.java b/modules/elasticsearch/src/test/java/org/elasticsearch/common/xcontent/xson/JsonVsSmileTests.java
similarity index 96%
rename from modules/elasticsearch/src/test/java/org/elasticsearch/common/xcontent/xson/JsonVsXsonTests.java
rename to modules/elasticsearch/src/test/java/org/elasticsearch/common/xcontent/xson/JsonVsSmileTests.java
index ce8241fc6f7d4..cbaa2f2de6a0d 100644
--- a/modules/elasticsearch/src/test/java/org/elasticsearch/common/xcontent/xson/JsonVsXsonTests.java
+++ b/modules/elasticsearch/src/test/java/org/elasticsearch/common/xcontent/xson/JsonVsSmileTests.java
@@ -34,11 +34,11 @@
/**
* @author kimchy (shay.banon)
*/
-public class JsonVsXsonTests {
+public class JsonVsSmileTests {
@Test public void compareParsingTokens() throws IOException {
FastByteArrayOutputStream xsonOs = new FastByteArrayOutputStream();
- XContentGenerator xsonGen = XContentFactory.xContent(XContentType.XSON).createGenerator(xsonOs);
+ XContentGenerator xsonGen = XContentFactory.xContent(XContentType.SMILE).createGenerator(xsonOs);
FastByteArrayOutputStream jsonOs = new FastByteArrayOutputStream();
XContentGenerator jsonGen = XContentFactory.xContent(XContentType.JSON).createGenerator(jsonOs);
@@ -64,7 +64,7 @@ public class JsonVsXsonTests {
xsonGen.close();
jsonGen.close();
- verifySameTokens(XContentFactory.xContent(XContentType.JSON).createParser(jsonOs.copiedByteArray()), XContentFactory.xContent(XContentType.XSON).createParser(xsonOs.copiedByteArray()));
+ verifySameTokens(XContentFactory.xContent(XContentType.JSON).createParser(jsonOs.copiedByteArray()), XContentFactory.xContent(XContentType.SMILE).createParser(xsonOs.copiedByteArray()));
}
private void verifySameTokens(XContentParser parser1, XContentParser parser2) throws IOException {
diff --git a/modules/elasticsearch/src/test/java/org/elasticsearch/index/mapper/xcontent/defaultsource/DefaultSourceMappingTests.java b/modules/elasticsearch/src/test/java/org/elasticsearch/index/mapper/xcontent/defaultsource/DefaultSourceMappingTests.java
index 137a3369947a3..44a30693c0c9a 100644
--- a/modules/elasticsearch/src/test/java/org/elasticsearch/index/mapper/xcontent/defaultsource/DefaultSourceMappingTests.java
+++ b/modules/elasticsearch/src/test/java/org/elasticsearch/index/mapper/xcontent/defaultsource/DefaultSourceMappingTests.java
@@ -20,7 +20,6 @@
package org.elasticsearch.index.mapper.xcontent.defaultsource;
import org.elasticsearch.common.xcontent.XContentFactory;
-import org.elasticsearch.common.xcontent.XContentType;
import org.elasticsearch.index.mapper.MapperParsingException;
import org.elasticsearch.index.mapper.MapperService;
import org.elasticsearch.index.mapper.xcontent.XContentDocumentMapper;
@@ -36,7 +35,7 @@
public class DefaultSourceMappingTests {
@Test public void testDefaultMappingAndNoMapping() throws Exception {
- String defaultMapping = XContentFactory.contentTextBuilder(XContentType.JSON).startObject().startObject(MapperService.DEFAULT_MAPPING)
+ String defaultMapping = XContentFactory.jsonBuilder().startObject().startObject(MapperService.DEFAULT_MAPPING)
.startObject("_source").field("enabled", false).endObject()
.endObject().endObject().string();
@@ -55,11 +54,11 @@ public class DefaultSourceMappingTests {
}
@Test public void testDefaultMappingAndWithMappingOverride() throws Exception {
- String defaultMapping = XContentFactory.contentTextBuilder(XContentType.JSON).startObject().startObject(MapperService.DEFAULT_MAPPING)
+ String defaultMapping = XContentFactory.jsonBuilder().startObject().startObject(MapperService.DEFAULT_MAPPING)
.startObject("_source").field("enabled", false).endObject()
.endObject().endObject().string();
- String mapping = XContentFactory.contentTextBuilder(XContentType.JSON).startObject().startObject("type")
+ String mapping = XContentFactory.jsonBuilder().startObject().startObject("type")
.startObject("_source").field("enabled", true).endObject()
.endObject().endObject().string();
@@ -69,7 +68,7 @@ public class DefaultSourceMappingTests {
}
@Test public void testDefaultMappingAndNoMappingWithMapperService() throws Exception {
- String defaultMapping = XContentFactory.contentTextBuilder(XContentType.JSON).startObject().startObject(MapperService.DEFAULT_MAPPING)
+ String defaultMapping = XContentFactory.jsonBuilder().startObject().startObject(MapperService.DEFAULT_MAPPING)
.startObject("_source").field("enabled", false).endObject()
.endObject().endObject().string();
@@ -82,14 +81,14 @@ public class DefaultSourceMappingTests {
}
@Test public void testDefaultMappingAndWithMappingOverrideWithMapperService() throws Exception {
- String defaultMapping = XContentFactory.contentTextBuilder(XContentType.JSON).startObject().startObject(MapperService.DEFAULT_MAPPING)
+ String defaultMapping = XContentFactory.jsonBuilder().startObject().startObject(MapperService.DEFAULT_MAPPING)
.startObject("_source").field("enabled", false).endObject()
.endObject().endObject().string();
MapperService mapperService = XContentMapperTests.newMapperService();
mapperService.add(MapperService.DEFAULT_MAPPING, defaultMapping);
- String mapping = XContentFactory.contentTextBuilder(XContentType.JSON).startObject().startObject("type")
+ String mapping = XContentFactory.jsonBuilder().startObject().startObject("type")
.startObject("_source").field("enabled", true).endObject()
.endObject().endObject().string();
mapperService.add("my_type", mapping);
diff --git a/modules/elasticsearch/src/test/java/org/elasticsearch/index/mapper/xcontent/geopoint/GeohashMappingGeoPointTests.java b/modules/elasticsearch/src/test/java/org/elasticsearch/index/mapper/xcontent/geopoint/GeohashMappingGeoPointTests.java
index 61954fe6278aa..0bead7344ab44 100644
--- a/modules/elasticsearch/src/test/java/org/elasticsearch/index/mapper/xcontent/geopoint/GeohashMappingGeoPointTests.java
+++ b/modules/elasticsearch/src/test/java/org/elasticsearch/index/mapper/xcontent/geopoint/GeohashMappingGeoPointTests.java
@@ -21,7 +21,6 @@
import org.elasticsearch.common.lucene.geo.GeoHashUtils;
import org.elasticsearch.common.xcontent.XContentFactory;
-import org.elasticsearch.common.xcontent.XContentType;
import org.elasticsearch.index.mapper.ParsedDocument;
import org.elasticsearch.index.mapper.xcontent.XContentDocumentMapper;
import org.elasticsearch.index.mapper.xcontent.XContentMapperTests;
@@ -36,7 +35,7 @@
public class GeohashMappingGeoPointTests {
@Test public void testLatLonValues() throws Exception {
- String mapping = XContentFactory.contentTextBuilder(XContentType.JSON).startObject().startObject("type")
+ String mapping = XContentFactory.jsonBuilder().startObject().startObject("type")
.startObject("properties").startObject("point").field("type", "geo_point").field("geohash", true).field("lat_lon", false).endObject().endObject()
.endObject().endObject().string();
@@ -54,7 +53,7 @@ public class GeohashMappingGeoPointTests {
}
@Test public void testLatLonInOneValue() throws Exception {
- String mapping = XContentFactory.contentTextBuilder(XContentType.JSON).startObject().startObject("type")
+ String mapping = XContentFactory.jsonBuilder().startObject().startObject("type")
.startObject("properties").startObject("point").field("type", "geo_point").field("geohash", true).field("lat_lon", false).endObject().endObject()
.endObject().endObject().string();
@@ -72,7 +71,7 @@ public class GeohashMappingGeoPointTests {
}
@Test public void testGeoHashValue() throws Exception {
- String mapping = XContentFactory.contentTextBuilder(XContentType.JSON).startObject().startObject("type")
+ String mapping = XContentFactory.jsonBuilder().startObject().startObject("type")
.startObject("properties").startObject("point").field("type", "geo_point").field("geohash", true).field("lat_lon", false).endObject().endObject()
.endObject().endObject().string();
diff --git a/modules/elasticsearch/src/test/java/org/elasticsearch/index/mapper/xcontent/geopoint/LatLonAndGeohashMappingGeoPointTests.java b/modules/elasticsearch/src/test/java/org/elasticsearch/index/mapper/xcontent/geopoint/LatLonAndGeohashMappingGeoPointTests.java
index 2da0881db1fec..6209ae20892ee 100644
--- a/modules/elasticsearch/src/test/java/org/elasticsearch/index/mapper/xcontent/geopoint/LatLonAndGeohashMappingGeoPointTests.java
+++ b/modules/elasticsearch/src/test/java/org/elasticsearch/index/mapper/xcontent/geopoint/LatLonAndGeohashMappingGeoPointTests.java
@@ -21,7 +21,6 @@
import org.elasticsearch.common.lucene.geo.GeoHashUtils;
import org.elasticsearch.common.xcontent.XContentFactory;
-import org.elasticsearch.common.xcontent.XContentType;
import org.elasticsearch.index.mapper.ParsedDocument;
import org.elasticsearch.index.mapper.xcontent.XContentDocumentMapper;
import org.elasticsearch.index.mapper.xcontent.XContentMapperTests;
@@ -36,7 +35,7 @@
public class LatLonAndGeohashMappingGeoPointTests {
@Test public void testLatLonValues() throws Exception {
- String mapping = XContentFactory.contentTextBuilder(XContentType.JSON).startObject().startObject("type")
+ String mapping = XContentFactory.jsonBuilder().startObject().startObject("type")
.startObject("properties").startObject("point").field("type", "geo_point").field("geohash", true).endObject().endObject()
.endObject().endObject().string();
@@ -54,7 +53,7 @@ public class LatLonAndGeohashMappingGeoPointTests {
}
@Test public void testLatLonInOneValue() throws Exception {
- String mapping = XContentFactory.contentTextBuilder(XContentType.JSON).startObject().startObject("type")
+ String mapping = XContentFactory.jsonBuilder().startObject().startObject("type")
.startObject("properties").startObject("point").field("type", "geo_point").field("geohash", true).endObject().endObject()
.endObject().endObject().string();
@@ -72,7 +71,7 @@ public class LatLonAndGeohashMappingGeoPointTests {
}
@Test public void testGeoHashValue() throws Exception {
- String mapping = XContentFactory.contentTextBuilder(XContentType.JSON).startObject().startObject("type")
+ String mapping = XContentFactory.jsonBuilder().startObject().startObject("type")
.startObject("properties").startObject("point").field("type", "geo_point").field("geohash", true).endObject().endObject()
.endObject().endObject().string();
diff --git a/modules/elasticsearch/src/test/java/org/elasticsearch/index/mapper/xcontent/geopoint/LatLonMappingGeoPointTests.java b/modules/elasticsearch/src/test/java/org/elasticsearch/index/mapper/xcontent/geopoint/LatLonMappingGeoPointTests.java
index dd01d4ddbda48..9f96e5377f7c2 100644
--- a/modules/elasticsearch/src/test/java/org/elasticsearch/index/mapper/xcontent/geopoint/LatLonMappingGeoPointTests.java
+++ b/modules/elasticsearch/src/test/java/org/elasticsearch/index/mapper/xcontent/geopoint/LatLonMappingGeoPointTests.java
@@ -22,7 +22,6 @@
import org.elasticsearch.common.Numbers;
import org.elasticsearch.common.lucene.geo.GeoHashUtils;
import org.elasticsearch.common.xcontent.XContentFactory;
-import org.elasticsearch.common.xcontent.XContentType;
import org.elasticsearch.index.mapper.ParsedDocument;
import org.elasticsearch.index.mapper.xcontent.XContentDocumentMapper;
import org.elasticsearch.index.mapper.xcontent.XContentMapperTests;
@@ -37,7 +36,7 @@
public class LatLonMappingGeoPointTests {
@Test public void testLatLonValues() throws Exception {
- String mapping = XContentFactory.contentTextBuilder(XContentType.JSON).startObject().startObject("type")
+ String mapping = XContentFactory.jsonBuilder().startObject().startObject("type")
.startObject("properties").startObject("point").field("type", "geo_point").endObject().endObject()
.endObject().endObject().string();
@@ -57,7 +56,7 @@ public class LatLonMappingGeoPointTests {
}
@Test public void testLatLonValuesStored() throws Exception {
- String mapping = XContentFactory.contentTextBuilder(XContentType.JSON).startObject().startObject("type")
+ String mapping = XContentFactory.jsonBuilder().startObject().startObject("type")
.startObject("properties").startObject("point").field("type", "geo_point").field("store", "yes").endObject().endObject()
.endObject().endObject().string();
@@ -77,7 +76,7 @@ public class LatLonMappingGeoPointTests {
}
@Test public void testArrayLatLonValues() throws Exception {
- String mapping = XContentFactory.contentTextBuilder(XContentType.JSON).startObject().startObject("type")
+ String mapping = XContentFactory.jsonBuilder().startObject().startObject("type")
.startObject("properties").startObject("point").field("type", "geo_point").field("store", "yes").endObject().endObject()
.endObject().endObject().string();
@@ -103,7 +102,7 @@ public class LatLonMappingGeoPointTests {
}
@Test public void testLatLonInOneValue() throws Exception {
- String mapping = XContentFactory.contentTextBuilder(XContentType.JSON).startObject().startObject("type")
+ String mapping = XContentFactory.jsonBuilder().startObject().startObject("type")
.startObject("properties").startObject("point").field("type", "geo_point").endObject().endObject()
.endObject().endObject().string();
@@ -121,7 +120,7 @@ public class LatLonMappingGeoPointTests {
}
@Test public void testLatLonInOneValueStored() throws Exception {
- String mapping = XContentFactory.contentTextBuilder(XContentType.JSON).startObject().startObject("type")
+ String mapping = XContentFactory.jsonBuilder().startObject().startObject("type")
.startObject("properties").startObject("point").field("type", "geo_point").field("store", "yes").endObject().endObject()
.endObject().endObject().string();
@@ -141,7 +140,7 @@ public class LatLonMappingGeoPointTests {
}
@Test public void testLatLonInOneValueArray() throws Exception {
- String mapping = XContentFactory.contentTextBuilder(XContentType.JSON).startObject().startObject("type")
+ String mapping = XContentFactory.jsonBuilder().startObject().startObject("type")
.startObject("properties").startObject("point").field("type", "geo_point").field("store", "yes").endObject().endObject()
.endObject().endObject().string();
@@ -167,7 +166,7 @@ public class LatLonMappingGeoPointTests {
}
@Test public void testGeoHashValue() throws Exception {
- String mapping = XContentFactory.contentTextBuilder(XContentType.JSON).startObject().startObject("type")
+ String mapping = XContentFactory.jsonBuilder().startObject().startObject("type")
.startObject("properties").startObject("point").field("type", "geo_point").endObject().endObject()
.endObject().endObject().string();
@@ -185,7 +184,7 @@ public class LatLonMappingGeoPointTests {
}
@Test public void testLatLonArray() throws Exception {
- String mapping = XContentFactory.contentTextBuilder(XContentType.JSON).startObject().startObject("type")
+ String mapping = XContentFactory.jsonBuilder().startObject().startObject("type")
.startObject("properties").startObject("point").field("type", "geo_point").endObject().endObject()
.endObject().endObject().string();
@@ -205,7 +204,7 @@ public class LatLonMappingGeoPointTests {
}
@Test public void testLatLonArrayStored() throws Exception {
- String mapping = XContentFactory.contentTextBuilder(XContentType.JSON).startObject().startObject("type")
+ String mapping = XContentFactory.jsonBuilder().startObject().startObject("type")
.startObject("properties").startObject("point").field("type", "geo_point").field("store", "yes").endObject().endObject()
.endObject().endObject().string();
@@ -225,7 +224,7 @@ public class LatLonMappingGeoPointTests {
}
@Test public void testLatLonArrayArrayStored() throws Exception {
- String mapping = XContentFactory.contentTextBuilder(XContentType.JSON).startObject().startObject("type")
+ String mapping = XContentFactory.jsonBuilder().startObject().startObject("type")
.startObject("properties").startObject("point").field("type", "geo_point").field("store", "yes").endObject().endObject()
.endObject().endObject().string();
diff --git a/modules/elasticsearch/src/test/java/org/elasticsearch/index/mapper/xcontent/index/IndexTypeMapperTests.java b/modules/elasticsearch/src/test/java/org/elasticsearch/index/mapper/xcontent/index/IndexTypeMapperTests.java
index cf3ef8994b03f..99a0ca951fc7a 100644
--- a/modules/elasticsearch/src/test/java/org/elasticsearch/index/mapper/xcontent/index/IndexTypeMapperTests.java
+++ b/modules/elasticsearch/src/test/java/org/elasticsearch/index/mapper/xcontent/index/IndexTypeMapperTests.java
@@ -21,7 +21,6 @@
import org.apache.lucene.document.Field;
import org.elasticsearch.common.xcontent.XContentFactory;
-import org.elasticsearch.common.xcontent.XContentType;
import org.elasticsearch.index.mapper.IndexFieldMapper;
import org.elasticsearch.index.mapper.ParsedDocument;
import org.elasticsearch.index.mapper.xcontent.XContentDocumentMapper;
@@ -37,7 +36,7 @@
public class IndexTypeMapperTests {
@Test public void simpleIndexMapperTests() throws Exception {
- String mapping = XContentFactory.contentTextBuilder(XContentType.JSON).startObject().startObject("type")
+ String mapping = XContentFactory.jsonBuilder().startObject().startObject("type")
.startObject("_index").field("enabled", true).field("store", "yes").endObject()
.endObject().endObject().string();
XContentDocumentMapper docMapper = XContentMapperTests.newParser().parse(mapping);
@@ -56,7 +55,7 @@ public class IndexTypeMapperTests {
}
@Test public void explicitDisabledIndexMapperTests() throws Exception {
- String mapping = XContentFactory.contentTextBuilder(XContentType.JSON).startObject().startObject("type")
+ String mapping = XContentFactory.jsonBuilder().startObject().startObject("type")
.startObject("_index").field("enabled", false).field("store", "yes").endObject()
.endObject().endObject().string();
XContentDocumentMapper docMapper = XContentMapperTests.newParser().parse(mapping);
@@ -74,7 +73,7 @@ public class IndexTypeMapperTests {
}
@Test public void defaultDisabledIndexMapperTests() throws Exception {
- String mapping = XContentFactory.contentTextBuilder(XContentType.JSON).startObject().startObject("type")
+ String mapping = XContentFactory.jsonBuilder().startObject().startObject("type")
.endObject().endObject().string();
XContentDocumentMapper docMapper = XContentMapperTests.newParser().parse(mapping);
assertThat(docMapper.indexMapper().enabled(), equalTo(false));
diff --git a/modules/elasticsearch/src/test/java/org/elasticsearch/index/mapper/xcontent/object/XContentNullValueObjectMappingTests.java b/modules/elasticsearch/src/test/java/org/elasticsearch/index/mapper/xcontent/object/XContentNullValueObjectMappingTests.java
index 8b1952a09de85..c8193c82c7b0d 100644
--- a/modules/elasticsearch/src/test/java/org/elasticsearch/index/mapper/xcontent/object/XContentNullValueObjectMappingTests.java
+++ b/modules/elasticsearch/src/test/java/org/elasticsearch/index/mapper/xcontent/object/XContentNullValueObjectMappingTests.java
@@ -20,7 +20,6 @@
package org.elasticsearch.index.mapper.xcontent.object;
import org.elasticsearch.common.xcontent.XContentFactory;
-import org.elasticsearch.common.xcontent.XContentType;
import org.elasticsearch.index.mapper.ParsedDocument;
import org.elasticsearch.index.mapper.xcontent.XContentDocumentMapper;
import org.elasticsearch.index.mapper.xcontent.XContentMapperTests;
@@ -37,7 +36,7 @@
public class XContentNullValueObjectMappingTests {
@Test public void testNullValueObject() throws IOException {
- String mapping = XContentFactory.contentTextBuilder(XContentType.JSON).startObject().startObject("type")
+ String mapping = XContentFactory.jsonBuilder().startObject().startObject("type")
.startObject("properties").startObject("obj1").field("type", "object").endObject().endObject()
.endObject().endObject().string();
diff --git a/modules/elasticsearch/src/test/java/org/elasticsearch/index/mapper/xcontent/overridetype/OverrideTypeMappingTests.java b/modules/elasticsearch/src/test/java/org/elasticsearch/index/mapper/xcontent/overridetype/OverrideTypeMappingTests.java
index 4d04ffdee610d..dcbcc733f6e28 100644
--- a/modules/elasticsearch/src/test/java/org/elasticsearch/index/mapper/xcontent/overridetype/OverrideTypeMappingTests.java
+++ b/modules/elasticsearch/src/test/java/org/elasticsearch/index/mapper/xcontent/overridetype/OverrideTypeMappingTests.java
@@ -20,7 +20,6 @@
package org.elasticsearch.index.mapper.xcontent.overridetype;
import org.elasticsearch.common.xcontent.XContentFactory;
-import org.elasticsearch.common.xcontent.XContentType;
import org.elasticsearch.index.mapper.xcontent.XContentDocumentMapper;
import org.elasticsearch.index.mapper.xcontent.XContentMapperTests;
import org.testng.annotations.Test;
@@ -34,7 +33,7 @@
public class OverrideTypeMappingTests {
@Test public void testOverrideType() throws Exception {
- String mapping = XContentFactory.contentTextBuilder(XContentType.JSON).startObject().startObject("type")
+ String mapping = XContentFactory.jsonBuilder().startObject().startObject("type")
.startObject("_source").field("enabled", false).endObject()
.endObject().endObject().string();
diff --git a/modules/elasticsearch/src/test/java/org/elasticsearch/index/mapper/xcontent/typelevels/ParseDocumentTypeLevelsTests.java b/modules/elasticsearch/src/test/java/org/elasticsearch/index/mapper/xcontent/typelevels/ParseDocumentTypeLevelsTests.java
index 068b62ee0490f..ae024a7a82829 100644
--- a/modules/elasticsearch/src/test/java/org/elasticsearch/index/mapper/xcontent/typelevels/ParseDocumentTypeLevelsTests.java
+++ b/modules/elasticsearch/src/test/java/org/elasticsearch/index/mapper/xcontent/typelevels/ParseDocumentTypeLevelsTests.java
@@ -20,7 +20,6 @@
package org.elasticsearch.index.mapper.xcontent.typelevels;
import org.elasticsearch.common.xcontent.XContentFactory;
-import org.elasticsearch.common.xcontent.XContentType;
import org.elasticsearch.index.mapper.ParsedDocument;
import org.elasticsearch.index.mapper.xcontent.XContentDocumentMapper;
import org.elasticsearch.index.mapper.xcontent.XContentMapperTests;
@@ -35,7 +34,7 @@
public class ParseDocumentTypeLevelsTests {
@Test public void testNoLevel() throws Exception {
- String defaultMapping = XContentFactory.contentTextBuilder(XContentType.JSON).startObject().startObject("type").endObject().endObject().string();
+ String defaultMapping = XContentFactory.jsonBuilder().startObject().startObject("type").endObject().endObject().string();
XContentDocumentMapper defaultMapper = XContentMapperTests.newParser().parse(defaultMapping);
@@ -53,7 +52,7 @@ public class ParseDocumentTypeLevelsTests {
}
@Test public void testTypeLevel() throws Exception {
- String defaultMapping = XContentFactory.contentTextBuilder(XContentType.JSON).startObject().startObject("type").endObject().endObject().string();
+ String defaultMapping = XContentFactory.jsonBuilder().startObject().startObject("type").endObject().endObject().string();
XContentDocumentMapper defaultMapper = XContentMapperTests.newParser().parse(defaultMapping);
@@ -71,7 +70,7 @@ public class ParseDocumentTypeLevelsTests {
}
@Test public void testNoLevelWithFieldTypeAsValue() throws Exception {
- String defaultMapping = XContentFactory.contentTextBuilder(XContentType.JSON).startObject().startObject("type").endObject().endObject().string();
+ String defaultMapping = XContentFactory.jsonBuilder().startObject().startObject("type").endObject().endObject().string();
XContentDocumentMapper defaultMapper = XContentMapperTests.newParser().parse(defaultMapping);
@@ -91,7 +90,7 @@ public class ParseDocumentTypeLevelsTests {
}
@Test public void testTypeLevelWithFieldTypeAsValue() throws Exception {
- String defaultMapping = XContentFactory.contentTextBuilder(XContentType.JSON).startObject().startObject("type").endObject().endObject().string();
+ String defaultMapping = XContentFactory.jsonBuilder().startObject().startObject("type").endObject().endObject().string();
XContentDocumentMapper defaultMapper = XContentMapperTests.newParser().parse(defaultMapping);
@@ -111,7 +110,7 @@ public class ParseDocumentTypeLevelsTests {
}
@Test public void testNoLevelWithFieldTypeAsObject() throws Exception {
- String defaultMapping = XContentFactory.contentTextBuilder(XContentType.JSON).startObject().startObject("type").endObject().endObject().string();
+ String defaultMapping = XContentFactory.jsonBuilder().startObject().startObject("type").endObject().endObject().string();
XContentDocumentMapper defaultMapper = XContentMapperTests.newParser().parse(defaultMapping);
@@ -131,7 +130,7 @@ public class ParseDocumentTypeLevelsTests {
}
@Test public void testTypeLevelWithFieldTypeAsObject() throws Exception {
- String defaultMapping = XContentFactory.contentTextBuilder(XContentType.JSON).startObject().startObject("type").endObject().endObject().string();
+ String defaultMapping = XContentFactory.jsonBuilder().startObject().startObject("type").endObject().endObject().string();
XContentDocumentMapper defaultMapper = XContentMapperTests.newParser().parse(defaultMapping);
@@ -151,7 +150,7 @@ public class ParseDocumentTypeLevelsTests {
}
@Test public void testNoLevelWithFieldTypeAsValueNotFirst() throws Exception {
- String defaultMapping = XContentFactory.contentTextBuilder(XContentType.JSON).startObject().startObject("type").endObject().endObject().string();
+ String defaultMapping = XContentFactory.jsonBuilder().startObject().startObject("type").endObject().endObject().string();
XContentDocumentMapper defaultMapper = XContentMapperTests.newParser().parse(defaultMapping);
@@ -171,7 +170,7 @@ public class ParseDocumentTypeLevelsTests {
}
@Test public void testTypeLevelWithFieldTypeAsValueNotFirst() throws Exception {
- String defaultMapping = XContentFactory.contentTextBuilder(XContentType.JSON).startObject().startObject("type").endObject().endObject().string();
+ String defaultMapping = XContentFactory.jsonBuilder().startObject().startObject("type").endObject().endObject().string();
XContentDocumentMapper defaultMapper = XContentMapperTests.newParser().parse(defaultMapping);
@@ -191,7 +190,7 @@ public class ParseDocumentTypeLevelsTests {
}
@Test public void testNoLevelWithFieldTypeAsObjectNotFirst() throws Exception {
- String defaultMapping = XContentFactory.contentTextBuilder(XContentType.JSON).startObject().startObject("type").endObject().endObject().string();
+ String defaultMapping = XContentFactory.jsonBuilder().startObject().startObject("type").endObject().endObject().string();
XContentDocumentMapper defaultMapper = XContentMapperTests.newParser().parse(defaultMapping);
@@ -212,7 +211,7 @@ public class ParseDocumentTypeLevelsTests {
}
@Test public void testTypeLevelWithFieldTypeAsObjectNotFirst() throws Exception {
- String defaultMapping = XContentFactory.contentTextBuilder(XContentType.JSON).startObject().startObject("type").endObject().endObject().string();
+ String defaultMapping = XContentFactory.jsonBuilder().startObject().startObject("type").endObject().endObject().string();
XContentDocumentMapper defaultMapper = XContentMapperTests.newParser().parse(defaultMapping);
diff --git a/modules/elasticsearch/src/test/java/org/elasticsearch/index/mapper/xcontent/typelevels/ParseMappingTypeLevelTests.java b/modules/elasticsearch/src/test/java/org/elasticsearch/index/mapper/xcontent/typelevels/ParseMappingTypeLevelTests.java
index 941c420871132..c60e9ec4f1fca 100644
--- a/modules/elasticsearch/src/test/java/org/elasticsearch/index/mapper/xcontent/typelevels/ParseMappingTypeLevelTests.java
+++ b/modules/elasticsearch/src/test/java/org/elasticsearch/index/mapper/xcontent/typelevels/ParseMappingTypeLevelTests.java
@@ -20,7 +20,6 @@
package org.elasticsearch.index.mapper.xcontent.typelevels;
import org.elasticsearch.common.xcontent.XContentFactory;
-import org.elasticsearch.common.xcontent.XContentType;
import org.elasticsearch.index.mapper.xcontent.XContentDocumentMapper;
import org.elasticsearch.index.mapper.xcontent.XContentMapperTests;
import org.testng.annotations.Test;
@@ -34,7 +33,7 @@
public class ParseMappingTypeLevelTests {
@Test public void testTypeLevel() throws Exception {
- String mapping = XContentFactory.contentTextBuilder(XContentType.JSON).startObject().startObject("type")
+ String mapping = XContentFactory.jsonBuilder().startObject().startObject("type")
.startObject("_source").field("enabled", false).endObject()
.endObject().endObject().string();
diff --git a/modules/jarjar/build.gradle b/modules/jarjar/build.gradle
index c9f810fe93034..626b96c37fad3 100644
--- a/modules/jarjar/build.gradle
+++ b/modules/jarjar/build.gradle
@@ -16,6 +16,7 @@ dependencies {
runtime 'org.mvel:mvel2:2.0.17'
runtime 'org.codehaus.jackson:jackson-core-asl:1.6.0'
+ runtime 'org.codehaus.jackson:jackson-smile:1.6.0'
runtime 'org.yaml:snakeyaml:1.6'
runtime('org.jboss.netty:netty:3.2.2.Final') { transitive = false }
diff --git a/modules/test/integration/src/test/java/org/elasticsearch/test/integration/broadcast/BroadcastActionsTests.java b/modules/test/integration/src/test/java/org/elasticsearch/test/integration/broadcast/BroadcastActionsTests.java
index c07e645ea8e82..1642a023f147f 100644
--- a/modules/test/integration/src/test/java/org/elasticsearch/test/integration/broadcast/BroadcastActionsTests.java
+++ b/modules/test/integration/src/test/java/org/elasticsearch/test/integration/broadcast/BroadcastActionsTests.java
@@ -27,9 +27,8 @@
import org.elasticsearch.action.count.CountResponse;
import org.elasticsearch.action.support.broadcast.BroadcastOperationThreading;
import org.elasticsearch.common.Unicode;
+import org.elasticsearch.common.xcontent.XContentBuilder;
import org.elasticsearch.common.xcontent.XContentFactory;
-import org.elasticsearch.common.xcontent.XContentType;
-import org.elasticsearch.common.xcontent.builder.XContentBuilder;
import org.elasticsearch.test.integration.AbstractNodesTests;
import org.testng.annotations.AfterMethod;
import org.testng.annotations.Test;
@@ -115,6 +114,6 @@ public class BroadcastActionsTests extends AbstractNodesTests {
}
private XContentBuilder source(String id, String nameValue) throws IOException {
- return XContentFactory.contentBinaryBuilder(XContentType.JSON).startObject().field("id", id).field("name", nameValue).endObject();
+ return XContentFactory.jsonBuilder().startObject().field("id", id).field("name", nameValue).endObject();
}
}
diff --git a/modules/test/integration/src/test/java/org/elasticsearch/test/integration/search/TransportSearchFailuresTests.java b/modules/test/integration/src/test/java/org/elasticsearch/test/integration/search/TransportSearchFailuresTests.java
index 1098bb3d8d3bd..b9c2df4cf63de 100644
--- a/modules/test/integration/src/test/java/org/elasticsearch/test/integration/search/TransportSearchFailuresTests.java
+++ b/modules/test/integration/src/test/java/org/elasticsearch/test/integration/search/TransportSearchFailuresTests.java
@@ -28,7 +28,7 @@
import org.elasticsearch.client.Client;
import org.elasticsearch.client.Requests;
import org.elasticsearch.common.Unicode;
-import org.elasticsearch.common.xcontent.builder.XContentBuilder;
+import org.elasticsearch.common.xcontent.XContentBuilder;
import org.elasticsearch.test.integration.AbstractNodesTests;
import org.testng.annotations.AfterMethod;
import org.testng.annotations.Test;
diff --git a/modules/test/integration/src/test/java/org/elasticsearch/test/integration/search/TransportTwoServersSearchTests.java b/modules/test/integration/src/test/java/org/elasticsearch/test/integration/search/TransportTwoServersSearchTests.java
index 1451c80978686..a98c3f23b2a4b 100644
--- a/modules/test/integration/src/test/java/org/elasticsearch/test/integration/search/TransportTwoServersSearchTests.java
+++ b/modules/test/integration/src/test/java/org/elasticsearch/test/integration/search/TransportTwoServersSearchTests.java
@@ -26,7 +26,7 @@
import org.elasticsearch.client.Requests;
import org.elasticsearch.common.Unicode;
import org.elasticsearch.common.collect.Sets;
-import org.elasticsearch.common.xcontent.builder.XContentBuilder;
+import org.elasticsearch.common.xcontent.XContentBuilder;
import org.elasticsearch.search.Scroll;
import org.elasticsearch.search.SearchHit;
import org.elasticsearch.search.builder.SearchSourceBuilder;
diff --git a/modules/test/integration/src/test/java/org/elasticsearch/test/integration/search/compress/SearchSourceCompressTests.java b/modules/test/integration/src/test/java/org/elasticsearch/test/integration/search/compress/SearchSourceCompressTests.java
index 82df9f168437d..9c2cc4eebeaa3 100644
--- a/modules/test/integration/src/test/java/org/elasticsearch/test/integration/search/compress/SearchSourceCompressTests.java
+++ b/modules/test/integration/src/test/java/org/elasticsearch/test/integration/search/compress/SearchSourceCompressTests.java
@@ -22,9 +22,8 @@
import org.elasticsearch.action.get.GetResponse;
import org.elasticsearch.action.search.SearchResponse;
import org.elasticsearch.client.Client;
+import org.elasticsearch.common.xcontent.XContentBuilder;
import org.elasticsearch.common.xcontent.XContentFactory;
-import org.elasticsearch.common.xcontent.XContentType;
-import org.elasticsearch.common.xcontent.builder.XContentBuilder;
import org.elasticsearch.index.query.xcontent.QueryBuilders;
import org.elasticsearch.test.integration.AbstractNodesTests;
import org.testng.annotations.AfterClass;
@@ -79,7 +78,7 @@ private void verifySource(Boolean compress) throws IOException {
client.admin().indices().prepareCreate("test").execute().actionGet();
client.admin().cluster().prepareHealth().setWaitForGreenStatus().execute().actionGet();
- String mapping = XContentFactory.contentTextBuilder(XContentType.JSON).startObject().startObject("type1")
+ String mapping = XContentFactory.jsonBuilder().startObject().startObject("type1")
.startObject("_source").field("compress", compress).endObject()
.endObject().endObject().string();
diff --git a/modules/test/integration/src/test/java/org/elasticsearch/test/integration/search/fields/SearchFieldsTests.java b/modules/test/integration/src/test/java/org/elasticsearch/test/integration/search/fields/SearchFieldsTests.java
index 6d4628f10d67b..0adfe605a1ac9 100644
--- a/modules/test/integration/src/test/java/org/elasticsearch/test/integration/search/fields/SearchFieldsTests.java
+++ b/modules/test/integration/src/test/java/org/elasticsearch/test/integration/search/fields/SearchFieldsTests.java
@@ -22,7 +22,6 @@
import org.elasticsearch.action.search.SearchResponse;
import org.elasticsearch.client.Client;
import org.elasticsearch.common.xcontent.XContentFactory;
-import org.elasticsearch.common.xcontent.XContentType;
import org.elasticsearch.test.integration.AbstractNodesTests;
import org.testng.annotations.AfterClass;
import org.testng.annotations.BeforeClass;
@@ -59,7 +58,7 @@ protected Client getClient() {
client.admin().indices().prepareCreate("test").execute().actionGet();
client.admin().cluster().prepareHealth().setWaitForGreenStatus().execute().actionGet();
- String mapping = XContentFactory.contentTextBuilder(XContentType.JSON).startObject().startObject("type").startObject("properties")
+ String mapping = XContentFactory.jsonBuilder().startObject().startObject("type").startObject("properties")
.startObject("field1").field("type", "string").field("store", "yes").endObject()
.startObject("field2").field("type", "string").field("store", "no").endObject()
.startObject("field3").field("type", "string").field("store", "yes").endObject()
diff --git a/modules/test/integration/src/test/java/org/elasticsearch/test/integration/search/highlight/HighlightSearchTests.java b/modules/test/integration/src/test/java/org/elasticsearch/test/integration/search/highlight/HighlightSearchTests.java
index d7b584c8afd82..0e9dbe0697d0a 100644
--- a/modules/test/integration/src/test/java/org/elasticsearch/test/integration/search/highlight/HighlightSearchTests.java
+++ b/modules/test/integration/src/test/java/org/elasticsearch/test/integration/search/highlight/HighlightSearchTests.java
@@ -22,8 +22,8 @@
import org.elasticsearch.action.search.SearchResponse;
import org.elasticsearch.client.Client;
import org.elasticsearch.client.Requests;
+import org.elasticsearch.common.xcontent.XContentBuilder;
import org.elasticsearch.common.xcontent.XContentFactory;
-import org.elasticsearch.common.xcontent.builder.XContentBuilder;
import org.elasticsearch.search.SearchHit;
import org.elasticsearch.search.builder.SearchSourceBuilder;
import org.elasticsearch.test.integration.AbstractNodesTests;
diff --git a/plugins/client/groovy/src/main/groovy/org/elasticsearch/groovy/client/GClient.groovy b/plugins/client/groovy/src/main/groovy/org/elasticsearch/groovy/client/GClient.groovy
index 8637a5d0efaf0..45625e98788bf 100644
--- a/plugins/client/groovy/src/main/groovy/org/elasticsearch/groovy/client/GClient.groovy
+++ b/plugins/client/groovy/src/main/groovy/org/elasticsearch/groovy/client/GClient.groovy
@@ -136,7 +136,7 @@ class GClient {
}
}
- public static XContentType contentType = XContentType.XSON;
+ public static XContentType contentType = XContentType.SMILE;
public static XContentType indexContentType = XContentType.JSON;
diff --git a/plugins/client/groovy/src/main/groovy/org/elasticsearch/groovy/common/xcontent/GXContentBuilder.groovy b/plugins/client/groovy/src/main/groovy/org/elasticsearch/groovy/common/xcontent/GXContentBuilder.groovy
index ac30b1eb3d87c..b9c194d8e8134 100644
--- a/plugins/client/groovy/src/main/groovy/org/elasticsearch/groovy/common/xcontent/GXContentBuilder.groovy
+++ b/plugins/client/groovy/src/main/groovy/org/elasticsearch/groovy/common/xcontent/GXContentBuilder.groovy
@@ -19,10 +19,9 @@
package org.elasticsearch.groovy.common.xcontent
+import org.elasticsearch.common.xcontent.XContentBuilder
import org.elasticsearch.common.xcontent.XContentFactory
import org.elasticsearch.common.xcontent.XContentType
-import org.elasticsearch.common.xcontent.builder.BinaryXContentBuilder
-import org.elasticsearch.common.xcontent.builder.TextXContentBuilder
/**
* Used to build JSON data.
@@ -49,7 +48,7 @@ class GXContentBuilder {
}
String buildAsString(Closure c) {
- TextXContentBuilder builder = XContentFactory.contentTextBuilder(XContentType.JSON);
+ XContentBuilder builder = XContentFactory.contentBuilder(XContentType.JSON);
def json = build(c)
builder.map(json);
return builder.string();
@@ -60,7 +59,7 @@ class GXContentBuilder {
}
byte[] buildAsBytes(Closure c, XContentType contentType) {
- BinaryXContentBuilder builder = XContentFactory.contentBinaryBuilder(contentType);
+ XContentBuilder builder = XContentFactory.contentBuilder(contentType);
def json = build(c)
builder.map(json);
return builder.copiedBytes();
diff --git a/plugins/mapper/attachments/src/main/java/org/elasticsearch/index/mapper/xcontent/XContentAttachmentMapper.java b/plugins/mapper/attachments/src/main/java/org/elasticsearch/index/mapper/xcontent/XContentAttachmentMapper.java
index f0ad16d151a51..d0a8a942dfb2e 100644
--- a/plugins/mapper/attachments/src/main/java/org/elasticsearch/index/mapper/xcontent/XContentAttachmentMapper.java
+++ b/plugins/mapper/attachments/src/main/java/org/elasticsearch/index/mapper/xcontent/XContentAttachmentMapper.java
@@ -22,8 +22,8 @@
import org.apache.tika.exception.TikaException;
import org.apache.tika.metadata.Metadata;
import org.elasticsearch.common.io.FastByteArrayInputStream;
+import org.elasticsearch.common.xcontent.XContentBuilder;
import org.elasticsearch.common.xcontent.XContentParser;
-import org.elasticsearch.common.xcontent.builder.XContentBuilder;
import org.elasticsearch.index.mapper.FieldMapperListener;
import org.elasticsearch.index.mapper.MapperParsingException;
import org.elasticsearch.index.mapper.MergeMappingException;