def last_blocks_that_logged(
    event_sig='0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef'
):
    """Query that returns blocks, that had `event_sig` log events.
    You can limit the number of responses by tweaking the `size` parameter of `es.search(...)`.

    Usage:
        es.search('ethereum', 'block', body=last_blocks_that_logged(), size=5)

    Params:
        event_sig (str): an event signature (topics[0])
    Returns:
        query (dict): elasticsearch query body dictionary.
    """
    return dict(
        query={
            'bool': {
                'filter': dict(
                    has_child=dict(
                        type='tx',
                        query=dict(
                            has_child=dict(
                                type='log',
                                query=dict(
                                    match=dict(
                                        signature=event_sig
                                    )
                                )
                            )
                        )
                    )
                )
            }
        },
        sort={
            'number.num': 'desc'
        }
    )