[GEO] Fix points_only indexing failure for GeoShapeFieldMapper
This commit fixes a bug that was introduced in PR #27415 for 6.1 and 7.0 where a change to support MULTIPOINT shapes mucked up indexing of standalone points.
This commit is contained in:
parent
5bb79558e7
commit
3728c50d85
|
@ -30,6 +30,7 @@ import org.apache.lucene.spatial.prefix.tree.GeohashPrefixTree;
|
|||
import org.apache.lucene.spatial.prefix.tree.PackedQuadPrefixTree;
|
||||
import org.apache.lucene.spatial.prefix.tree.QuadPrefixTree;
|
||||
import org.apache.lucene.spatial.prefix.tree.SpatialPrefixTree;
|
||||
import org.elasticsearch.ElasticsearchException;
|
||||
import org.elasticsearch.Version;
|
||||
import org.elasticsearch.common.Explicit;
|
||||
import org.elasticsearch.common.geo.GeoUtils;
|
||||
|
@ -474,13 +475,13 @@ public class GeoShapeFieldMapper extends FieldMapper {
|
|||
for (Shape s : shapes) {
|
||||
indexShape(context, s);
|
||||
}
|
||||
return null;
|
||||
} else if (shape instanceof Point == false) {
|
||||
throw new MapperParsingException("[{" + fieldType().name() + "}] is configured for points only but a " +
|
||||
((shape instanceof JtsGeometry) ? ((JtsGeometry)shape).getGeom().getGeometryType() : shape.getClass()) + " was found");
|
||||
}
|
||||
} else {
|
||||
indexShape(context, shape);
|
||||
}
|
||||
indexShape(context, shape);
|
||||
} catch (Exception e) {
|
||||
if (ignoreMalformed.value() == false) {
|
||||
throw new MapperParsingException("failed to parse [" + fieldType().name() + "]", e);
|
||||
|
|
|
@ -464,7 +464,7 @@ public class GeoShapeQueryTests extends ESSingleNodeTestCase {
|
|||
|
||||
// test that point was inserted
|
||||
SearchResponse response = client().prepareSearch("geo_points_only").setTypes("type1")
|
||||
.setQuery(matchAllQuery())
|
||||
.setQuery(geoIntersectionQuery("location", shape))
|
||||
.execute().actionGet();
|
||||
|
||||
assertEquals(1, response.getHits().getTotalHits());
|
||||
|
|
Loading…
Reference in New Issue