code: public List parseResponse(SearchResponse response, AbstractAggregationBuilder aggregation, String[] fieldsToSelect,
              MetamodelImpl metaModel, Class clazz, final EntityMetadata entityMetadata, KunderaQuery query)
      {
          logger.debug("Response of query: " + response);
  
          List results = new ArrayList();
          EntityType entityType = metaModel.entity(clazz);
  
          if (aggregation == null)
          {
              SearchHits hits = response.getHits();
              if (fieldsToSelect != null && fieldsToSelect.length > 1 && !(fieldsToSelect[1] == null))
              {
                  for (SearchHit hit : hits.getHits())
                  {
                      if (fieldsToSelect.length == 2)
                      {
                          results.add(hit
                                  .getFields()
                                  .get(((AbstractAttribute) metaModel.entity(clazz).getAttribute(fieldsToSelect[1]))
                                          .getJPAColumnName()).getValue());
                      }
                      else
                      {
                          List temp = new ArrayList();
  
                          for (int i = 1; i < fieldsToSelect.length; i++)
                          {
                              temp.add(hit
                                      .getFields()
                                      .get(((AbstractAttribute) metaModel.entity(clazz).getAttribute(fieldsToSelect[i]))
                                              .getJPAColumnName()).getValue());
                          }
                          results.add(temp);
                      }
                  }
              }
              else
              {
                  results = getEntityObjects(clazz, entityMetadata, entityType, hits);
              }
          }
          else
          {
              results = parseAggregatedResponse(response, query, metaModel, clazz, entityMetadata);
          }
          return results;
      }
docs: Parses the response.
  
  @param response
  the response
  @param aggregation
  the aggregation
  @param fieldsToSelect
  the fields to select
  @param metaModel
  the meta model
  @param clazz
  the clazz
  @param entityMetadata
  the entity metadata
  @param query
  the query
  @return the list