diff --git a/core/src/test/java/org/elasticsearch/search/geo/GeoShapeIntegrationIT.java b/core/src/test/java/org/elasticsearch/search/geo/GeoShapeIntegrationIT.java index 6455120678d..5607266398b 100644 --- a/core/src/test/java/org/elasticsearch/search/geo/GeoShapeIntegrationIT.java +++ b/core/src/test/java/org/elasticsearch/search/geo/GeoShapeIntegrationIT.java @@ -31,6 +31,7 @@ import org.elasticsearch.common.xcontent.XContentBuilder; import org.elasticsearch.common.xcontent.XContentFactory; import org.elasticsearch.index.IndexService; import org.elasticsearch.index.mapper.MappedFieldType; +import org.elasticsearch.index.mapper.MapperParsingException; import org.elasticsearch.index.mapper.geo.GeoShapeFieldMapper; import org.elasticsearch.index.query.GeoShapeQueryBuilder; import org.elasticsearch.index.query.QueryBuilders; @@ -488,15 +489,14 @@ public class GeoShapeIntegrationIT extends ESIntegTestCase { ShapeBuilder shape = RandomShapeGenerator.createShape(random()); try { - indexRandom(true, client().prepareIndex("geo_points_only", "type1", "1").setSource(jsonBuilder().startObject() - .field("location", shape).endObject())); - } catch (Throwable e) { + index("geo_points_only", "type1", "1", jsonBuilder().startObject().field("location", shape).endObject()); + } catch (MapperParsingException e) { // RandomShapeGenerator created something other than a POINT type, verify the correct exception is thrown - assertThat(e.getMessage(), containsString("MapperParsingException")); - assertThat(e.getMessage(), containsString("is configured for points only")); + assertThat(e.getCause().getMessage(), containsString("is configured for points only")); return; } + refresh(); // test that point was inserted SearchResponse response = client().prepareSearch() .setQuery(geoIntersectionQuery("location", shape))