/** {@inheritDoc} */ @Override public NamedList<?> getStatsValues() { NamedList<Object> res = new SimpleOrderedMap<Object>(); res.add("min", min); res.add("max", max); res.add("count", count); res.add("missing", missing); if (calcDistinct) { res.add("distinctValues", distinctValues); res.add("countDistinct", countDistinct); } addTypeSpecificStats(res); // add the facet stats NamedList<NamedList<?>> nl = new SimpleOrderedMap<NamedList<?>>(); for (Map.Entry<String, Map<String, StatsValues>> entry : facets.entrySet()) { NamedList<NamedList<?>> nl2 = new SimpleOrderedMap<NamedList<?>>(); nl.add(entry.getKey(), nl2); for (Map.Entry<String, StatsValues> e2 : entry.getValue().entrySet()) { nl2.add(e2.getKey(), e2.getValue().getStatsValues()); } } res.add(FACETS, nl); return res; }
/** {@inheritDoc} */ @Override public NamedList<?> getStatsValues() { NamedList<Object> res = new SimpleOrderedMap<>(); if (statsField.includeInResponse(Stat.min)) { res.add("min", min); } if (statsField.includeInResponse(Stat.max)) { res.add("max", max); } if (statsField.includeInResponse(Stat.count)) { res.add("count", count); } if (statsField.includeInResponse(Stat.missing)) { res.add("missing", missing); } if (statsField.includeInResponse(Stat.distinctValues)) { res.add("distinctValues", distinctValues); } if (statsField.includeInResponse(Stat.countDistinct)) { res.add("countDistinct", countDistinct); } if (statsField.includeInResponse(Stat.cardinality)) { if (statsField.getIsShard()) { res.add("cardinality", hll.toBytes()); } else { res.add("cardinality", hll.cardinality()); } } addTypeSpecificStats(res); if (!facets.isEmpty()) { // add the facet stats NamedList<NamedList<?>> nl = new SimpleOrderedMap<>(); for (Map.Entry<String, Map<String, StatsValues>> entry : facets.entrySet()) { NamedList<NamedList<?>> nl2 = new SimpleOrderedMap<>(); nl.add(entry.getKey(), nl2); for (Map.Entry<String, StatsValues> e2 : entry.getValue().entrySet()) { nl2.add(e2.getKey(), e2.getValue().getStatsValues()); } } res.add(FACETS, nl); } return res; }