@Override
    public void onSerialize(Serializer target) {
        if (target instanceof FieldWriter) {
            serialize(null, (FieldWriter) target);
        } else if (target instanceof BufferSerializer) {
            serialize(null, DocumentSerializerFactory.createHead(((BufferSerializer) target).getBuf()));
        } else {
            DocumentSerializer fw = DocumentSerializerFactory.createHead(new GrowableByteBuffer());
            serialize(null, fw);
            target.put(null, fw.getBuf().getByteBuffer());
        }
    }
Using the given field path, digs through the document and returns the matching field value.
If the field path resolves to multiple values, returns an ArrayFieldValue containing the
values.
document/src/main/java/com/yahoo/document/datatypes/FieldValue.java