From 04d929ff53990dce7baf815a7f0609f890658186 Mon Sep 17 00:00:00 2001 From: javanna Date: Mon, 19 Dec 2016 19:26:32 +0100 Subject: [PATCH] add inline comments on GetField binary values parsing --- core/src/main/java/org/elasticsearch/index/get/GetField.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/core/src/main/java/org/elasticsearch/index/get/GetField.java b/core/src/main/java/org/elasticsearch/index/get/GetField.java index a4169ddfe51..3a0fa14acee 100644 --- a/core/src/main/java/org/elasticsearch/index/get/GetField.java +++ b/core/src/main/java/org/elasticsearch/index/get/GetField.java @@ -121,12 +121,14 @@ public class GetField implements Streamable, ToXContent, Iterable { while((token = parser.nextToken()) != XContentParser.Token.END_ARRAY) { Object value; if (token == XContentParser.Token.VALUE_STRING) { + //binary values will be parsed back and returned as base64 strings when reading from json and yaml value = parser.text(); } else if (token == XContentParser.Token.VALUE_NUMBER) { value = parser.numberValue(); } else if (token == XContentParser.Token.VALUE_BOOLEAN) { value = parser.booleanValue(); } else if (token == XContentParser.Token.VALUE_EMBEDDED_OBJECT) { + //binary values will be parsed back and returned as BytesArray when reading from cbor and smile value = new BytesArray(parser.binaryValue()); } else { throw new ParsingException(parser.getTokenLocation(), "Failed to parse object: unsupported token found [" + token + "]");