class LegacyDetectorRepositoryImpl implements LegacyDetectorRepository {

    @Override
    public DetectorDocument findByUuid(String uuid) {
        MDC.put("DetectorUuid", uuid);
        val queryBuilder = QueryBuilders.termQuery("uuid", uuid);
        val searchSourceBuilder = elasticsearchUtil.getSourceBuilder(queryBuilder).size(DEFAULT_ES_RESULTS_SIZE);
        val searchRequest = elasticsearchUtil.getSearchRequest(searchSourceBuilder, DETECTOR_INDEX, DETECTOR_DOC_TYPE);
        val detectors = getDetectorsFromElasticSearch(searchRequest);
        MDC.remove("DetectorUuid");
        return detectors.isEmpty() ? null : detectors.get(0);
    }

}