code: @POST
      @Produces(MediaType.APPLICATION_JSON)
      @Path("/metrics/search")
      @Description("Discover metric schema records. If type is specified, then records of that particular type are returned.")
      public MetricDiscoveryResultDto searchRecords(@Context HttpServletRequest req,
          MetricDiscoveryQueryDto metricDiscoveryQueryDto) {
  
          KeywordQuery query = new KeywordQueryBuilder().query(metricDiscoveryQueryDto.getKeywordQuery())
                                                        .limit(metricDiscoveryQueryDto.getLimit())
                                                        .page(metricDiscoveryQueryDto.getPage())
                                                        .scope(metricDiscoveryQueryDto.getScope())
                                                        .metric(metricDiscoveryQueryDto.getMetric())
                                                        .tagKey(metricDiscoveryQueryDto.getTagk())
                                                        .tagValue(metricDiscoveryQueryDto.getTagv())
                                                        .namespace(metricDiscoveryQueryDto.getNamespace())
                                                        .type(metricDiscoveryQueryDto.getType())
                                                        .build();
  
          List<MetricSchemaRecord> schemaRecords = _discoveryService.filterRecords(query);
  
          if(query.getType() == null) {
              if(_isFormat(req)) {
                  List<String> records = new ArrayList<>(schemaRecords.size());
                  _formatToString(schemaRecords, records);
                  return new MetricDiscoveryResultDto(records, records.isEmpty() ? null : schemaRecords.get(schemaRecords.size()-1));
              }
  
              return new MetricDiscoveryResultDto(schemaRecords, schemaRecords.isEmpty() ? null : schemaRecords.get(schemaRecords.size()-1));
          } else {
              return new MetricDiscoveryResultDto(_getValueForType(schemaRecords, query.getType()),
                      schemaRecords.isEmpty() ? null : schemaRecords.get(schemaRecords.size()-1));
          }
          
      }
docs: Discover metric schema records. If type is specified, then records of that particular type are returned.
  
  @param   req             The HTTP request.
  @param   metricDiscoveryQueryDto This contains metric query parameters along with scanner starting schema record
  
  @return  The filtered set of schema records or unique values if a specific field is requested.