private static Set<CopyField> getCopyFields(SolrClient client, String collectionName) throws GenericException { SchemaRequest.CopyFields fields = new SchemaRequest.CopyFields(); CopyFieldsResponse response; try { response = fields.process(client, collectionName); return response.getCopyFields().stream().map(f -> new CopyField(f)).collect(Collectors.toSet()); } catch (SolrServerException | IOException e) { throw new GenericException("Could not get schema dynamic fields", e); } }