@Test
public void testPutIndexUsingQueryStoreIndex() throws IOException {

    List<Metric> metrics = new ArrayList<>();
    Metric myMetric = new Metric("scope1", "metric1");
    metrics.add(myMetric);
    ElasticSearchQueryStoreService spyService = _initializeSpyService(_esQueryStoreService, createSucessReply, createSucessReply);
    Set<QueryStoreRecord> records = new HashSet<>();
    for(Metric m : metrics) {
        QueryStoreRecord qsr = new QueryStoreRecord(m.getScope(),m.getMetric());
        records.add(qsr);
    }
    spyService.upsertQueryStoreRecords(records);
    ArgumentCaptor<Request> requestCaptor = ArgumentCaptor.forClass(Request.class);
    verify(restClient, times(1)).performRequest(requestCaptor.capture());
    Request capturedRequest = requestCaptor.getValue();
    String createJson = EntityUtils.toString(capturedRequest.getEntity());
    assertTrue(createJson.contains("index"));
    assertTrue(createJson.contains("mts"));
    assertTrue(createJson.contains("sourcehost"));
    assertTrue(createJson.contains("scope"));
    assertTrue(createJson.contains("metric"));
    String expectedURL = String.format("/%s/%s/_bulk", queryStoreIndexName, queryStoreTypeName);
    assertEquals(expectedURL, capturedRequest.getEndpoint());
}