diff --git a/docs/reference/ingest/processors/circle.asciidoc b/docs/reference/ingest/processors/circle.asciidoc index 300d7763fe634..a8a6bda02f8e2 100644 --- a/docs/reference/ingest/processors/circle.asciidoc +++ b/docs/reference/ingest/processors/circle.asciidoc @@ -128,7 +128,7 @@ The response from the above index request: [30.000365257263184, 10.0] ] ], - "type": "polygon" + "type": "Polygon" } } } diff --git a/server/src/main/java/org/elasticsearch/common/geo/GeoJson.java b/server/src/main/java/org/elasticsearch/common/geo/GeoJson.java index 0a1454a868738..5eb327588fb80 100644 --- a/server/src/main/java/org/elasticsearch/common/geo/GeoJson.java +++ b/server/src/main/java/org/elasticsearch/common/geo/GeoJson.java @@ -382,17 +382,17 @@ public static String getGeoJsonName(Geometry geometry) { return geometry.visit(new GeometryVisitor<>() { @Override public String visit(Circle circle) { - return "circle"; + return "Circle"; } @Override public String visit(GeometryCollection collection) { - return "geometrycollection"; + return "GeometryCollection"; } @Override public String visit(Line line) { - return "linestring"; + return "LineString"; } @Override @@ -402,32 +402,32 @@ public String visit(LinearRing ring) { @Override public String visit(MultiLine multiLine) { - return "multilinestring"; + return "MultiLineString"; } @Override public String visit(MultiPoint multiPoint) { - return "multipoint"; + return "MultiPoint"; } @Override public String visit(MultiPolygon multiPolygon) { - return "multipolygon"; + return "MultiPolygon"; } @Override public String visit(Point point) { - return "point"; + return "Point"; } @Override public String visit(Polygon polygon) { - return "polygon"; + return "Polygon"; } @Override public String visit(Rectangle rectangle) { - return "envelope"; + return "Envelope"; } }); } diff --git a/server/src/test/java/org/elasticsearch/common/geo/GeometryParserTests.java b/server/src/test/java/org/elasticsearch/common/geo/GeometryParserTests.java index df4b47f23689f..4c53d40fb75db 100644 --- a/server/src/test/java/org/elasticsearch/common/geo/GeometryParserTests.java +++ b/server/src/test/java/org/elasticsearch/common/geo/GeometryParserTests.java @@ -51,7 +51,7 @@ public void testGeoJsonParsing() throws Exception { assertEquals(new Point(100, 0), format.fromXContent(parser)); XContentBuilder newGeoJson = XContentFactory.jsonBuilder(); format.toXContent(new Point(100, 10), newGeoJson, ToXContent.EMPTY_PARAMS); - assertEquals("{\"type\":\"point\",\"coordinates\":[100.0,10.0]}", Strings.toString(newGeoJson)); + assertEquals("{\"type\":\"Point\",\"coordinates\":[100.0,10.0]}", Strings.toString(newGeoJson)); } XContentBuilder pointGeoJsonWithZ = XContentFactory.jsonBuilder() @@ -148,7 +148,7 @@ public void testNullParsing() throws Exception { // if we serialize non-null value - it should be serialized as geojson format.toXContent(new Point(100, 10), newGeoJson, ToXContent.EMPTY_PARAMS); newGeoJson.endObject(); - assertEquals("{\"val\":{\"type\":\"point\",\"coordinates\":[100.0,10.0]}}", Strings.toString(newGeoJson)); + assertEquals("{\"val\":{\"type\":\"Point\",\"coordinates\":[100.0,10.0]}}", Strings.toString(newGeoJson)); newGeoJson = XContentFactory.jsonBuilder().startObject().field("val"); format.toXContent(null, newGeoJson, ToXContent.EMPTY_PARAMS); diff --git a/server/src/test/java/org/elasticsearch/index/query/GeoShapeQueryBuilderTests.java b/server/src/test/java/org/elasticsearch/index/query/GeoShapeQueryBuilderTests.java index 5eb89ccd4d454..8020083d106b6 100644 --- a/server/src/test/java/org/elasticsearch/index/query/GeoShapeQueryBuilderTests.java +++ b/server/src/test/java/org/elasticsearch/index/query/GeoShapeQueryBuilderTests.java @@ -204,7 +204,7 @@ public void testFromJson() throws IOException { " \"geo_shape\" : {\n" + " \"location\" : {\n" + " \"shape\" : {\n" + - " \"type\" : \"envelope\",\n" + + " \"type\" : \"Envelope\",\n" + " \"coordinates\" : [ [ 13.0, 53.0 ], [ 14.0, 52.0 ] ]\n" + " },\n" + " \"relation\" : \"intersects\"\n" + diff --git a/x-pack/plugin/spatial/src/test/java/org/elasticsearch/xpack/spatial/index/query/ShapeQueryBuilderTests.java b/x-pack/plugin/spatial/src/test/java/org/elasticsearch/xpack/spatial/index/query/ShapeQueryBuilderTests.java index 2e9cd2db3a55d..fb0d7fbbe7557 100644 --- a/x-pack/plugin/spatial/src/test/java/org/elasticsearch/xpack/spatial/index/query/ShapeQueryBuilderTests.java +++ b/x-pack/plugin/spatial/src/test/java/org/elasticsearch/xpack/spatial/index/query/ShapeQueryBuilderTests.java @@ -179,7 +179,7 @@ public void testFromJson() throws IOException { " }\n" + "}"; ShapeQueryBuilder parsed = (ShapeQueryBuilder) parseQuery(json); - checkGeneratedJson(json, parsed); + checkGeneratedJson(json.replaceAll("envelope", "Envelope"), parsed); assertEquals(json, 42.0, parsed.boost(), 0.0001); }