@Override
    public void createDataStream(String dataStreamName, String timestampField, Map<String, Map<String, String>> mappings,
                                 Policy ismPolicy) {
        updateDataStreamTemplate(dataStreamName, timestampField, mappings);
        dataStreamAdapter.createDataStream(dataStreamName);
        dataStreamAdapter.applyIsmPolicy(dataStreamName, ismPolicy);
        dataStreamAdapter.setNumberOfReplicas(dataStreamName, replicas);
    }
@SuppressWarnings("unchecked")
    @Test
    public void fieldTypesCreated() {
        final Map<String, Map<String, String>> mappings = new HashMap<>();
        String customField = "field1";
        mappings.put(customField, Map.of("type", "keyword"));
        String streamName = "teststream";
        dataStreamService.createDataStream(streamName, "ts", mappings, mock(Policy.class));
        ArgumentCaptor<Template> templateCaptor = ArgumentCaptor.forClass(Template.class);
        verify(dataStreamAdapter).ensureDataStreamTemplate(anyString(), templateCaptor.capture(), anyString());
        Map<String, Object> fieldMappings = (Map<String, Object>) templateCaptor.getValue().mappings().get("properties");
        Map<String, String> timestampMapping = (Map<String, String>) fieldMappings.get(customField);
        assertThat(timestampMapping).isNotNull();
        assertThat(timestampMapping.get("type")).isEqualTo("keyword");
        ArgumentCaptor<IndexFieldTypesDTO> fieldTypes = ArgumentCaptor.forClass(IndexFieldTypesDTO.class);
        verify(indexFieldTypesService).upsert(fieldTypes.capture());
        IndexFieldTypesDTO fieldTypesDto = fieldTypes.getValue();
        assertThat(fieldTypesDto.indexName()).isEqualTo(streamName);
        assertThat(fieldTypesDto.indexSetId()).isEqualTo(Stream.DATASTREAM_PREFIX + streamName);
        assertThat(fieldTypesDto.fields()).hasSize(2);
    }