'Returns a sorted list of fields that match the type.
:param type the type of the field "string","integer" or a list of types
:param recursive recurse to sub object
:returns a sorted list of fields the match the type'

def get_properties_by_type(self, type, recursive=True, parent_path=''):

    if parent_path:
        parent_path += '.'
    if isinstance(type, str):
        if (type == '*'):
            type = (set(MAPPING_NAME_TYPE.keys()) - set(['nested', 'multi_field', 'multifield']))
        else:
            type = [type]
    properties = []
    for prop in list(self.properties.values()):
        if (prop.type in type):
            properties.append(((parent_path + prop.name), prop))
            continue
        elif ((prop.type == 'multi_field') and (prop.name in prop.fields) and (prop.fields[prop.name].type in type)):
            properties.append(((parent_path + prop.name), prop))
            continue
        if (not recursive):
            continue
        if (prop.type in ['nested', 'object']):
            properties.extend(prop.get_properties_by_type(type, recursive=recursive, parent_path=(parent_path + prop.name)))
    return sorted(properties)
