class ElasticSearchAlarmHistoryService implements AlarmHistoryService {


    public final static String ALARM_HISTORY_INDEX = "alarm_history";

    private final ElasticSearchIndexManager indexManager;

    private final ElasticSearchService elasticSearchService;


    public Mono<PagerResult<AlarmHistoryInfo>> queryPager(QueryParam queryParam) {
        return elasticSearchService.queryPager(ALARM_HISTORY_INDEX, queryParam, AlarmHistoryInfo.class);
    }

    public Mono<Void> save(AlarmHistoryInfo historyInfo) {
        return elasticSearchService.commit(ALARM_HISTORY_INDEX, createData(historyInfo));
    }

    public Mono<Void> save(Flux<AlarmHistoryInfo> historyInfo) {
        return elasticSearchService.save(ALARM_HISTORY_INDEX, historyInfo.map(this::createData));
    }

    public Mono<Void> save(Mono<AlarmHistoryInfo> historyInfo) {
        return elasticSearchService.save(ALARM_HISTORY_INDEX, historyInfo.map(this::createData));
    }

    private Map<String, Object> createData(AlarmHistoryInfo info) {
        return FastBeanCopier.copy(info, new HashMap<>(16));

    }

    public void init() {<FILL_FUNCTION_BODY>}
}

        indexManager.putIndex(
            new DefaultElasticSearchIndexMetadata(ALARM_HISTORY_INDEX)
                .addProperty("id", StringType.GLOBAL)
                .addProperty("alarmConfigId", StringType.GLOBAL)
                .addProperty("alarmConfigName", StringType.GLOBAL)
                .addProperty("alarmRecordId", StringType.GLOBAL)
                .addProperty("level", IntType.GLOBAL)
                .addProperty("description", StringType.GLOBAL)
                .addProperty("alarmTime", DateTimeType.GLOBAL)
                .addProperty("targetType", StringType.GLOBAL)
                .addProperty("targetName", StringType.GLOBAL)
                .addProperty("targetId", StringType.GLOBAL)

                .addProperty("sourceType", StringType.GLOBAL)
                .addProperty("sourceName", StringType.GLOBAL)
                .addProperty("sourceId", StringType.GLOBAL)

                .addProperty("alarmInfo", StringType.GLOBAL)
                .addProperty("creatorId", StringType.GLOBAL)
                .addProperty("bindings", new ArrayType().elementType(StringType.GLOBAL))
        ).block(Duration.ofSeconds(10));
    
<no_super_class>