diff --git a/elasticsearch/src/main/java/org/elasticsearch/xpack/common/xcontent/XContentUtils.java b/elasticsearch/src/main/java/org/elasticsearch/xpack/common/xcontent/XContentUtils.java index 25d7ecc01aa..6762b1a3c12 100644 --- a/elasticsearch/src/main/java/org/elasticsearch/xpack/common/xcontent/XContentUtils.java +++ b/elasticsearch/src/main/java/org/elasticsearch/xpack/common/xcontent/XContentUtils.java @@ -37,16 +37,6 @@ public class XContentUtils { } } - public static Tuple convertToObject(BytesReference bytes) throws ElasticsearchParseException { - try { - // EMPTY is safe here because we never call namedObject - XContentParser parser = XContentHelper.createParser(NamedXContentRegistry.EMPTY, bytes); - return Tuple.tuple(parser.contentType(), readValue(parser, parser.nextToken())); - } catch (IOException e) { - throw new ElasticsearchParseException("Failed to parse content to map", e); - } - } - public static String[] readStringArray(XContentParser parser, boolean allowNull) throws IOException { if (parser.currentToken() == XContentParser.Token.VALUE_NULL) { if (allowNull) { diff --git a/elasticsearch/src/main/java/org/elasticsearch/xpack/watcher/input/search/ExecutableSearchInput.java b/elasticsearch/src/main/java/org/elasticsearch/xpack/watcher/input/search/ExecutableSearchInput.java index 4adcfec196a..86721490215 100644 --- a/elasticsearch/src/main/java/org/elasticsearch/xpack/watcher/input/search/ExecutableSearchInput.java +++ b/elasticsearch/src/main/java/org/elasticsearch/xpack/watcher/input/search/ExecutableSearchInput.java @@ -81,9 +81,10 @@ public class ExecutableSearchInput extends ExecutableInput filteredKeys = XContentFilterKeysUtils.filterMapOrdered(input.getExtractKeys(), parser); - payload = new Payload.Simple(filteredKeys); + try (XContentParser parser = XContentHelper.createParser(NamedXContentRegistry.EMPTY, bytes)) { + Map filteredKeys = XContentFilterKeysUtils.filterMapOrdered(input.getExtractKeys(), parser); + payload = new Payload.Simple(filteredKeys); + } } else { payload = new Payload.XContent(response); }