@Test
public void testGetUniqueUsingMetricTagvRegexSchemaIndex() throws IOException {

    MetricSchemaRecordQuery queryForMetric = new MetricSchemaRecordQuery.MetricSchemaRecordQueryBuilder().scope("system")
            .metric("argus")
            .tagKey("device")
            .tagValue("abc*")
            .namespace("*")
            .limit(2)
            .build();
    SchemaService.RecordType scopeType = SchemaService.RecordType.TAGV;
    ElasticSearchSchemaService spyService = _initializeSpyService(_esSchemaService, getReply, getReply);
    spyService.getUnique(queryForMetric, scopeType);
    ArgumentCaptor<Request> captor = ArgumentCaptor.forClass(Request.class);
    verify(restClient, times(1)).performRequest(captor.capture());
    String requestUrl = captor.getValue().getEndpoint();
    String queryJson = convertToPrettyJson(EntityUtils.toString(captor.getValue().getEntity()));
    assertEquals(metricQueryTagvRegex, queryJson);
    assertEquals("/metadata_index/metadata_type/_search", requestUrl);
    assertFalse(queryForMetric.isQueryOnlyOnScope());
    assertFalse(queryForMetric.isQueryOnlyOnScopeAndMetric());
}