I'm trying to return documents that contain a geoshape point which is in any of a given set of pre-indexed areas. To do this, I'm adding 2 geo span queries as should clauses to a bool query. However, I'm receiving a 500 error as the response. Please see the example below:
Removing either of the should clauses and re-running the query returns results as expected. My first question is if anyone can see anything obviously wrong with the query?
Failing that, is this a known behaviour or does anyone know a better way I can approach this task?
Some further info I should have added! Here is the stack trace that is getting thrown in the ES logs:
[2018-01-04T11:39:43,852][WARN ][r.suppressed ] path: /docs/doc/_search, params: {index=docs, type=doc}
java.lang.ArrayIndexOutOfBoundsException: 1
at org.elasticsearch.index.query.GeoShapeQueryBuilder$1.onResponse(GeoShapeQueryBuilder.java:410) [elasticsearch-6.0.0.jar:6.0.0]
at org.elasticsearch.index.query.GeoShapeQueryBuilder$1.onResponse(GeoShapeQueryBuilder.java:388) [elasticsearch-6.0.0.jar:6.0.0]
at org.elasticsearch.action.support.TransportAction$1.onResponse(TransportAction.java:85) [elasticsearch-6.0.0.jar:6.0.0]
at org.elasticsearch.action.support.TransportAction$1.onResponse(TransportAction.java:81) [elasticsearch-6.0.0.jar:6.0.0]
at org.elasticsearch.action.support.single.shard.TransportSingleShardAction$AsyncSingleAction$2.handleResponse(TransportSingleShardAction.java:247) [elasticsearch-6.0.0.jar:6.0.0]
at org.elasticsearch.action.support.single.shard.TransportSingleShardAction$AsyncSingleAction$2.handleResponse(TransportSingleShardAction.java:233) [elasticsearch-6.0.0.jar:6.0.0]
at org.elasticsearch.transport.TransportService$ContextRestoreResponseHandler.handleResponse(TransportService.java:1062) [elasticsearch-6.0.0.jar:6.0.0]
at org.elasticsearch.transport.TransportService$DirectResponseChannel.processResponse(TransportService.java:1136) [elasticsearch-6.0.0.jar:6.0.0]
at org.elasticsearch.transport.TransportService$DirectResponseChannel.sendResponse(TransportService.java:1126) [elasticsearch-6.0.0.jar:6.0.0]
at org.elasticsearch.transport.TransportService$DirectResponseChannel.sendResponse(TransportService.java:1115) [elasticsearch-6.0.0.jar:6.0.0]
at org.elasticsearch.transport.DelegatingTransportChannel.sendResponse(DelegatingTransportChannel.java:60) [elasticsearch-6.0.0.jar:6.0.0]
at org.elasticsearch.transport.RequestHandlerRegistry$TransportChannelWrapper.sendResponse(RequestHandlerRegistry.java:108) [elasticsearch-6.0.0.jar:6.0.0]
at org.elasticsearch.action.support.single.shard.TransportSingleShardAction$ShardTransportHandler.messageReceived(TransportSingleShardAction.java:295) [elasticsearch-6.0.0.jar:6.0.0]
at org.elasticsearch.action.support.single.shard.TransportSingleShardAction$ShardTransportHandler.messageReceived(TransportSingleShardAction.java:287) [elasticsearch-6.0.0.jar:6.0.0]
at org.elasticsearch.transport.TransportRequestHandler.messageReceived(TransportRequestHandler.java:30) [elasticsearch-6.0.0.jar:6.0.0]
at org.elasticsearch.transport.RequestHandlerRegistry.processMessageReceived(RequestHandlerRegistry.java:66) [elasticsearch-6.0.0.jar:6.0.0]
at org.elasticsearch.transport.TransportService$7.doRun(TransportService.java:659) [elasticsearch-6.0.0.jar:6.0.0]
at org.elasticsearch.common.util.concurrent.ThreadContext$ContextPreservingAbstractRunnable.doRun(ThreadContext.java:638) [elasticsearch-6.0.0.jar:6.0.0]
at org.elasticsearch.common.util.concurrent.AbstractRunnable.run(AbstractRunnable.java:37) [elasticsearch-6.0.0.jar:6.0.0]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) [?:1.8.0_131]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) [?:1.8.0_131]
at java.lang.Thread.run(Thread.java:748) [?:1.8.0_131]
I implemented a workaround of creating a single MultiPolygon that combined all the MultiPolygons i was interested in so that I only had one geo_shape query within my bool query.
This works but means I can unfortunately no longer used stored shapes as I'm building the shape at query time.
We are running into the same issue with ES 6.0. We use indexed shapes to perform geospatial queries and cannot combine them into a single multipolygon without a significant rewrite. Could someone from the ES team comment?
Thanks,
Trang
Apache, Apache Lucene, Apache Hadoop, Hadoop, HDFS and the yellow elephant
logo are trademarks of the
Apache Software Foundation
in the United States and/or other countries.