From 85f4c39b69d5a1d0deedbc98e8e7ad1c719a2f5f Mon Sep 17 00:00:00 2001 From: Colin Goodheart-Smithe Date: Wed, 23 Sep 2015 18:58:16 +0100 Subject: [PATCH] more test fixes --- core/src/main/java/org/elasticsearch/search/SearchService.java | 1 + .../org/elasticsearch/search/builder/SearchSourceBuilder.java | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/core/src/main/java/org/elasticsearch/search/SearchService.java b/core/src/main/java/org/elasticsearch/search/SearchService.java index 0a54e09ac8d..63a72efef83 100644 --- a/core/src/main/java/org/elasticsearch/search/SearchService.java +++ b/core/src/main/java/org/elasticsearch/search/SearchService.java @@ -762,6 +762,7 @@ public class SearchService extends AbstractLifecycleComponent { 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_"; diff --git a/core/src/main/java/org/elasticsearch/search/builder/SearchSourceBuilder.java b/core/src/main/java/org/elasticsearch/search/builder/SearchSourceBuilder.java index 74891a086ab..23a2d89eccf 100644 --- a/core/src/main/java/org/elasticsearch/search/builder/SearchSourceBuilder.java +++ b/core/src/main/java/org/elasticsearch/search/builder/SearchSourceBuilder.java @@ -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 + "].",