public void testFromJson() throws IOException { String json = "{\n" + " \"geo_bounding_box\" : {\n" + " \"pin.location\" : {\n" + " \"top_left\" : [ -74.1, 40.73 ],\n" + " \"bottom_right\" : [ -71.12, 40.01 ]\n" + " },\n" + " \"validation_method\" : \"STRICT\",\n" + " \"type\" : \"MEMORY\",\n" + " \"ignore_unmapped\" : false,\n" + " \"boost\" : 1.0\n" + " }\n" + "}"; GeoBoundingBoxQueryBuilder parsed = (GeoBoundingBoxQueryBuilder) parseQuery(json); checkGeneratedJson(json, parsed); assertEquals(json, "pin.location", parsed.fieldName()); assertEquals(json, -74.1, parsed.topLeft().getLon(), 0.0001); assertEquals(json, 40.73, parsed.topLeft().getLat(), 0.0001); assertEquals(json, -71.12, parsed.bottomRight().getLon(), 0.0001); assertEquals(json, 40.01, parsed.bottomRight().getLat(), 0.0001); assertEquals(json, 1.0, parsed.boost(), 0.0001); assertEquals(json, GeoExecType.MEMORY, parsed.type()); }