more test fixes

This commit is contained in:
Colin Goodheart-Smithe 2015-09-23 18:58:16 +01:00
parent 63da68e480
commit 85f4c39b69
2 changed files with 3 additions and 1 deletions

View File

@ -762,6 +762,7 @@ public class SearchService extends AbstractLifecycleComponent<SearchService> {
XContentParser suggestParser = null;
try {
suggestParser = XContentFactory.xContent(source.suggest()).createParser(source.suggest());
suggestParser.nextToken();
this.elementParsers.get("suggest").parse(suggestParser, context);
} catch (Exception e) {
String sSource = "_na_";

View File

@ -804,7 +804,8 @@ public final class SearchSourceBuilder extends ToXContentToBytes implements Writ
XContentBuilder xContentBuilder = XContentFactory.contentBuilder(parser.contentType()).copyCurrentStructure(parser);
builder.innerHitsBuilder = xContentBuilder.bytes();
} else if (context.parseFieldMatcher().match(currentFieldName, SUGGEST_FIELD)) {
XContentBuilder xContentBuilder = XContentFactory.contentBuilder(parser.contentType()).copyCurrentStructure(parser);
XContentBuilder xContentBuilder = XContentFactory.contentBuilder(parser.contentType());
xContentBuilder.copyCurrentStructure(parser);
builder.suggestBuilder = xContentBuilder.bytes();
} else {
throw new ParsingException(parser.getTokenLocation(), "Unknown key for a " + token + " in [" + currentFieldName + "].",