def find_conflicts(self, index_name):

        existing_mappings = get_existing_mapping(index_name=index_name)
        new_mappings = get_current_mapping(index_name=index_name)

        conflicts = tuple(find_conflicts(existing_mappings, new_mappings))

        if conflicts:
            print

        for field_name in conflicts:
            print_bad("'%s.%s' has changed!" % (index_name, field_name))
            print
            print "Before:"
            print_dict(existing_mappings["modelresult"]["properties"][field_name])
            print "After:"
            print_dict(new_mappings["modelresult"]["properties"][field_name])
            print
    def find_conflicts(self, index_name):

        existing_mappings = get_existing_mapping(index_name=index_name)
        new_mappings = get_current_mapping(index_name=index_name)

        conflicts = tuple(find_conflicts(existing_mappings, new_mappings))

        if conflicts:
            print

        for field_name in conflicts:
            print_bad("'%s.%s' has changed!" % (index_name, field_name))
            print
            print 'Before:'
            print_dict(
                existing_mappings['modelresult']['properties'][field_name])
            print 'After:'
            print_dict(new_mappings['modelresult']['properties'][field_name])
            print
    def show_fields(self, index_name, *fields):

        existing_mappings = get_existing_mapping(index_name=index_name)
        new_mappings = get_current_mapping(index_name=index_name)

        conflicts = tuple(find_conflicts(existing_mappings, new_mappings))

        for field_name in fields:

            try:
                before = existing_mappings['modelresult']['properties'][
                    field_name]
            except KeyError:
                before = None

            try:
                after = new_mappings['modelresult']['properties'][field_name]
            except KeyError:
                after = None

            if before or after:

                if field_name in conflicts:
                    print_method = print_bad
                else:
                    print_method = print_good

                print_method('Mappings for %s.%s:' % (index_name, field_name))
                print
                if before:
                    print 'Before:'
                    print_dict(before)
                    print
                if after and after != before:
                    print 'After:'
                    print_dict(after)
                    print
    def show_fields(self, index_name, *fields):

        existing_mappings = get_existing_mapping(index_name=index_name)
        new_mappings = get_current_mapping(index_name=index_name)

        conflicts = tuple(find_conflicts(existing_mappings, new_mappings))

        for field_name in fields:

            try:
                before = existing_mappings["modelresult"]["properties"][field_name]
            except KeyError:
                before = None

            try:
                after = new_mappings["modelresult"]["properties"][field_name]
            except KeyError:
                after = None

            if before or after:

                if field_name in conflicts:
                    print_method = print_bad
                else:
                    print_method = print_good

                print_method("Mappings for %s.%s:" % (index_name, field_name))
                print
                if before:
                    print "Before:"
                    print_dict(before)
                    print
                if after and after != before:
                    print "After:"
                    print_dict(after)
                    print