|
@@ -652,7 +652,7 @@ public class VectorTileRestIT extends ESRestTestCase {
|
|
|
assertLayer(tile, META_LAYER, 4096, 1, 13);
|
|
|
}
|
|
|
|
|
|
- public void testMinAgg() throws Exception {
|
|
|
+ public void testSingleValueAgg() throws Exception {
|
|
|
final Request mvtRequest = new Request(getHttpMethod(), INDEX_POLYGON + "/_mvt/location/" + z + "/" + x + "/" + y);
|
|
|
mvtRequest.setJsonEntity(
|
|
|
"{\n"
|
|
@@ -676,6 +676,35 @@ public class VectorTileRestIT extends ESRestTestCase {
|
|
|
assertDoubleTag(metaLayer, metaLayer.getFeatures(0), "aggregations.minVal.max", 1.0);
|
|
|
}
|
|
|
|
|
|
+ public void testMultiValueAgg() throws Exception {
|
|
|
+ final Request mvtRequest = new Request(getHttpMethod(), INDEX_POLYGON + "/_mvt/location/" + z + "/" + x + "/" + y);
|
|
|
+ mvtRequest.setJsonEntity(
|
|
|
+ "{\n"
|
|
|
+ + " \"aggs\": {\n"
|
|
|
+ + " \"percentilesAgg\": {\n"
|
|
|
+ + " \"percentiles\": {\n"
|
|
|
+ + " \"field\": \"value1\",\n"
|
|
|
+ + " \"percents\": [95, 99, 99.9]\n"
|
|
|
+ + " }\n"
|
|
|
+ + " }\n"
|
|
|
+ + " }\n"
|
|
|
+ + "}"
|
|
|
+ );
|
|
|
+ final VectorTile.Tile tile = execute(mvtRequest);
|
|
|
+ assertThat(tile.getLayersCount(), Matchers.equalTo(3));
|
|
|
+ assertLayer(tile, HITS_LAYER, 4096, 1, 2);
|
|
|
+ assertLayer(tile, AGGS_LAYER, 4096, 256 * 256, 4);
|
|
|
+ assertLayer(tile, META_LAYER, 4096, 1, 28);
|
|
|
+ // check pipeline aggregation values
|
|
|
+ final VectorTile.Tile.Layer metaLayer = getLayer(tile, META_LAYER);
|
|
|
+ assertDoubleTag(metaLayer, metaLayer.getFeatures(0), "aggregations.percentilesAgg.95.0.min", 1.0);
|
|
|
+ assertDoubleTag(metaLayer, metaLayer.getFeatures(0), "aggregations.percentilesAgg.95.0.max", 1.0);
|
|
|
+ assertDoubleTag(metaLayer, metaLayer.getFeatures(0), "aggregations.percentilesAgg.99.0.min", 1.0);
|
|
|
+ assertDoubleTag(metaLayer, metaLayer.getFeatures(0), "aggregations.percentilesAgg.99.0.max", 1.0);
|
|
|
+ assertDoubleTag(metaLayer, metaLayer.getFeatures(0), "aggregations.percentilesAgg.99.9.min", 1.0);
|
|
|
+ assertDoubleTag(metaLayer, metaLayer.getFeatures(0), "aggregations.percentilesAgg.99.9.max", 1.0);
|
|
|
+ }
|
|
|
+
|
|
|
public void testOverlappingMultipolygon() throws Exception {
|
|
|
// Overlapping multipolygon are accepted by Elasticsearch but is invalid for JTS. This
|
|
|
// causes and error in the mvt library that gets logged using slf4j
|
|
@@ -720,7 +749,7 @@ public class VectorTileRestIT extends ESRestTestCase {
|
|
|
return;
|
|
|
}
|
|
|
}
|
|
|
- fail("Could not find tag [" + tag + " ]");
|
|
|
+ fail("Could not find tag [" + tag + "]");
|
|
|
}
|
|
|
|
|
|
private void assertDoubleTag(VectorTile.Tile.Layer layer, VectorTile.Tile.Feature feature, String tag, double value) {
|
|
@@ -732,7 +761,7 @@ public class VectorTileRestIT extends ESRestTestCase {
|
|
|
return;
|
|
|
}
|
|
|
}
|
|
|
- fail("Could not find tag [" + tag + " ]");
|
|
|
+ fail("Could not find tag [" + tag + "]");
|
|
|
}
|
|
|
|
|
|
private void assertStringTag(VectorTile.Tile.Layer layer, VectorTile.Tile.Feature feature, String tag, String value) {
|
|
@@ -744,7 +773,7 @@ public class VectorTileRestIT extends ESRestTestCase {
|
|
|
return;
|
|
|
}
|
|
|
}
|
|
|
- fail("Could not find tag [" + tag + " ]");
|
|
|
+ fail("Could not find tag [" + tag + "]");
|
|
|
}
|
|
|
|
|
|
private VectorTile.Tile execute(Request mvtRequest) throws IOException {
|