@staticmethod
def preprocess_search_hit(pid, record_hit, links_factory=None, **kwargs):
    """Prepare a record hit from Elasticsearch for serialization."""
    links_factory = links_factory or (lambda x, **k: dict())
    record = dict(pid=pid, metadata=record_hit['_source'], links=
        links_factory(pid, record_hit=record_hit, **kwargs), revision=
        record_hit['_version'], created=None, updated=None)
    for key in ['_created', '_updated']:
        if key in record['metadata']:
            record[key[1:]] = record['metadata'][key]
            del record['metadata'][key]
    return record
