@Override
 protected void innerParseCreateField(ParseContext context, List<Field> fields)
     throws IOException {
   short value;
   float boost = fieldType().boost();
   if (context.externalValueSet()) {
     Object externalValue = context.externalValue();
     if (externalValue == null) {
       if (fieldType().nullValue() == null) {
         return;
       }
       value = fieldType().nullValue();
     } else if (externalValue instanceof String) {
       String sExternalValue = (String) externalValue;
       if (sExternalValue.length() == 0) {
         if (fieldType().nullValue() == null) {
           return;
         }
         value = fieldType().nullValue();
       } else {
         value = Short.parseShort(sExternalValue);
       }
     } else {
       value = ((Number) externalValue).shortValue();
     }
     if (context.includeInAll(includeInAll, this)) {
       context.allEntries().addText(fieldType().name(), Short.toString(value), boost);
     }
   } else {
     XContentParser parser = context.parser();
     if (parser.currentToken() == XContentParser.Token.VALUE_NULL
         || (parser.currentToken() == XContentParser.Token.VALUE_STRING
             && parser.textLength() == 0)) {
       if (fieldType().nullValue() == null) {
         return;
       }
       value = fieldType().nullValue();
       if (fieldType().nullValueAsString() != null && (context.includeInAll(includeInAll, this))) {
         context.allEntries().addText(fieldType().name(), fieldType().nullValueAsString(), boost);
       }
     } else if (parser.currentToken() == XContentParser.Token.START_OBJECT
         && Version.indexCreated(context.indexSettings()).before(Version.V_5_0_0_alpha1)) {
       XContentParser.Token token;
       String currentFieldName = null;
       Short objValue = fieldType().nullValue();
       while ((token = parser.nextToken()) != XContentParser.Token.END_OBJECT) {
         if (token == XContentParser.Token.FIELD_NAME) {
           currentFieldName = parser.currentName();
         } else {
           if ("value".equals(currentFieldName) || "_value".equals(currentFieldName)) {
             if (parser.currentToken() != XContentParser.Token.VALUE_NULL) {
               objValue = parser.shortValue(coerce.value());
             }
           } else if ("boost".equals(currentFieldName) || "_boost".equals(currentFieldName)) {
             boost = parser.floatValue();
           } else {
             throw new IllegalArgumentException("unknown property [" + currentFieldName + "]");
           }
         }
       }
       if (objValue == null) {
         // no value
         return;
       }
       value = objValue;
     } else {
       value = parser.shortValue(coerce.value());
       if (context.includeInAll(includeInAll, this)) {
         context.allEntries().addText(fieldType().name(), parser.text(), boost);
       }
     }
   }
   if (fieldType().indexOptions() != IndexOptions.NONE || fieldType().stored()) {
     CustomShortNumericField field = new CustomShortNumericField(value, fieldType());
     if (boost != 1f
         && Version.indexCreated(context.indexSettings()).before(Version.V_5_0_0_alpha1)) {
       field.setBoost(boost);
     }
     fields.add(field);
   }
   if (fieldType().hasDocValues()) {
     addDocValue(context, fields, value);
   }
 }
 @Override
 protected Fieldable innerParseCreateField(ParseContext context) throws IOException {
   short value;
   float boost = this.boost;
   if (context.externalValueSet()) {
     Object externalValue = context.externalValue();
     if (externalValue == null) {
       if (nullValue == null) {
         return null;
       }
       value = nullValue;
     } else if (externalValue instanceof String) {
       String sExternalValue = (String) externalValue;
       if (sExternalValue.length() == 0) {
         if (nullValue == null) {
           return null;
         }
         value = nullValue;
       } else {
         value = Short.parseShort(sExternalValue);
       }
     } else {
       value = ((Number) externalValue).shortValue();
     }
     if (context.includeInAll(includeInAll, this)) {
       context.allEntries().addText(names.fullName(), Short.toString(value), boost);
     }
   } else {
     XContentParser parser = context.parser();
     if (parser.currentToken() == XContentParser.Token.VALUE_NULL
         || (parser.currentToken() == XContentParser.Token.VALUE_STRING
             && parser.textLength() == 0)) {
       if (nullValue == null) {
         return null;
       }
       value = nullValue;
       if (nullValueAsString != null && (context.includeInAll(includeInAll, this))) {
         context.allEntries().addText(names.fullName(), nullValueAsString, boost);
       }
     } else if (parser.currentToken() == XContentParser.Token.START_OBJECT) {
       XContentParser.Token token;
       String currentFieldName = null;
       Short objValue = nullValue;
       while ((token = parser.nextToken()) != XContentParser.Token.END_OBJECT) {
         if (token == XContentParser.Token.FIELD_NAME) {
           currentFieldName = parser.currentName();
         } else {
           if ("value".equals(currentFieldName) || "_value".equals(currentFieldName)) {
             if (parser.currentToken() != XContentParser.Token.VALUE_NULL) {
               objValue = parser.shortValue();
             }
           } else if ("boost".equals(currentFieldName) || "_boost".equals(currentFieldName)) {
             boost = parser.floatValue();
           }
         }
       }
       if (objValue == null) {
         // no value
         return null;
       }
       value = objValue;
     } else {
       value = parser.shortValue();
       if (context.includeInAll(includeInAll, this)) {
         context.allEntries().addText(names.fullName(), parser.text(), boost);
       }
     }
   }
   CustomShortNumericField field = new CustomShortNumericField(this, value);
   field.setBoost(boost);
   return field;
 }