def add_nested_field_to_es(nested_field, text, es_doc):
    """ Add a text to an appropriate field in
        a given elasticsearch-form document."""
    if nested_field not in es_doc:
        # create a new
        es_doc[nested_field] = text
    else:
        # append to existed one
        es_doc[nested_field] = "|".join([es_doc[nested_field], text])
    return es_doc