@Test public void updatePrecision() { final Map<String, Object> geohashGridAgg = new HashMap<>(ImmutableMap.of("field", "name", "precision", 0)); final Map<String, Map<String, Map<String, Object>>> aggregations; aggregations = ImmutableMap.of("first", ImmutableMap.of("geohash_grid", geohashGridAgg)); final Map<String, Object> expected = ImmutableMap.of( "first", ImmutableMap.of( "geohash_grid", ImmutableMap.of("field", "name", "precision", 2))); GeohashUtil.updateGridAggregationPrecision(aggregations, 2); assertEquals(expected, aggregations); }
public static void updateGridAggregationPrecision( Map<String, Map<String, Map<String, Object>>> aggregations, int precision) { aggregations .values() .stream() .filter(a -> a.containsKey("geohash_grid")) .forEach(a -> a.get("geohash_grid").put("precision", precision)); }
GeohashUtil { public static void updateGridAggregationPrecision( Map<String, Map<String, Map<String, Object>>> aggregations, int precision) { aggregations .values() .stream() .filter(a -> a.containsKey("geohash_grid")) .forEach(a -> a.get("geohash_grid").put("precision", precision)); } }
GeohashUtil { public static void updateGridAggregationPrecision( Map<String, Map<String, Map<String, Object>>> aggregations, int precision) { aggregations .values() .stream() .filter(a -> a.containsKey("geohash_grid")) .forEach(a -> a.get("geohash_grid").put("precision", precision)); }  }
GeohashUtil { public static void updateGridAggregationPrecision( Map<String, Map<String, Map<String, Object>>> aggregations, int precision) { aggregations .values() .stream() .filter(a -> a.containsKey("geohash_grid")) .forEach(a -> a.get("geohash_grid").put("precision", precision)); }  static int computePrecision(Envelope envelope, long size, double threshold); static void updateGridAggregationPrecision(
            Map<String, Map<String, Map<String, Object>>> aggregations, int precision); }
GeohashUtil { public static void updateGridAggregationPrecision( Map<String, Map<String, Map<String, Object>>> aggregations, int precision) { aggregations .values() .stream() .filter(a -> a.containsKey("geohash_grid")) .forEach(a -> a.get("geohash_grid").put("precision", precision)); }  static int computePrecision(Envelope envelope, long size, double threshold); static void updateGridAggregationPrecision(
            Map<String, Map<String, Map<String, Object>>> aggregations, int precision);  }