code: private Map<String, Object> buildResultMap(SearchResponse response, KunderaQuery query, EntityMetadata m,
              MetamodelImpl metaModel)
      {
          Map<String, Object> map = new LinkedHashMap<>();
          ESResponseWrapper esResponseReader = new ESResponseWrapper();
  
          for (SearchHit hit : response.getHits())
          {
              Object id = PropertyAccessorHelper.fromSourceToTargetClass(
                      ((AbstractAttribute) m.getIdAttribute()).getBindableJavaType(), String.class, hit.getId());
              map.put(hit.getId(), id);
          }
  
          Map<String, Object> aggMap = esResponseReader.parseAggregations(response, query, metaModel, m.getEntityClazz(),
                  m);
          ListIterable<Expression> selectExpressionOrder = esResponseReader.getSelectExpressionOrder(query);
  
          Map<String, Object> resultMap = new HashMap<>();
          resultMap.put(Constants.AGGREGATIONS, aggMap);
          resultMap.put(Constants.PRIMARY_KEYS, map);
          resultMap.put(Constants.SELECT_EXPRESSION_ORDER, selectExpressionOrder);
  
          return resultMap;
      }
docs: Builds the result map.
  
  @param esResponseReader
  the es response reader
  @param response
  the response
  @param query
  the query
  @param m
  the m
  @param metaModel
  the meta model
  @return the map