fix auto conversion from source content type to rest content type
This commit is contained in:
parent
f01f5ab323
commit
86e17eae2c
|
@ -69,8 +69,7 @@ public class RestXContentBuilder {
|
||||||
if (contentType == builder.contentType()) {
|
if (contentType == builder.contentType()) {
|
||||||
builder.rawField("_source", siLzf);
|
builder.rawField("_source", siLzf);
|
||||||
} else {
|
} else {
|
||||||
// TODO, should we just return it as binary and not auto convert it?
|
XContentParser parser = XContentFactory.xContent(contentType).createParser(siLzf);
|
||||||
XContentParser parser = XContentFactory.xContent(builder.contentType()).createParser(siLzf);
|
|
||||||
try {
|
try {
|
||||||
parser.nextToken();
|
parser.nextToken();
|
||||||
builder.field("_source");
|
builder.field("_source");
|
||||||
|
@ -80,11 +79,11 @@ public class RestXContentBuilder {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (XContentFactory.xContentType(source) == builder.contentType()) {
|
XContentType contentType = XContentFactory.xContentType(source);
|
||||||
|
if (contentType == builder.contentType()) {
|
||||||
builder.rawField("_source", source);
|
builder.rawField("_source", source);
|
||||||
} else {
|
} else {
|
||||||
// TODO, should we just return it as binary and not auto convert it?
|
XContentParser parser = XContentFactory.xContent(contentType).createParser(source);
|
||||||
XContentParser parser = XContentFactory.xContent(builder.contentType()).createParser(source);
|
|
||||||
try {
|
try {
|
||||||
parser.nextToken();
|
parser.nextToken();
|
||||||
builder.field("_source");
|
builder.field("_source");
|
||||||
|
|
Loading…
Reference in New Issue