Elasticsearch: array_index_out_of_bounds_exception on multiple indexed_shape queries

Created on 16 Feb 2018  路  5Comments  路  Source: elastic/elasticsearch

Elasticsearch version: 6.2.1

Running in a docker image docker.elastic.co/elasticsearch/elasticsearch:6.2.1

Description of the problem including expected versus actual behavior:

When having multiple indexed_shape queries in a boolean should list, I get an error with the following

{
  "error" : {
    "root_cause" : [
      {
        "type" : "array_index_out_of_bounds_exception",
        "reason" : "1"
      }
    ],
    "type" : "array_index_out_of_bounds_exception",
    "reason" : "1"
  },
  "status" : 500
}

Steps to reproduce:

Index mappings

{
  "index": {
    "mappings": {
      "type": {
        "properties": {
          "geo_json": {
            "properties": {
              "coordinates": {
                "type": "float"
              },
              "type": {
                "type": "text",
                "fields": {
                  "keyword": {
                    "type": "keyword",
                    "ignore_above": 256
                  }
                }
              }
            }
          },
          "lat": {
            "type": "float"
          },
          "lng": {
            "type": "float"
          }
        }
      }
    }
  }
}

Search query

curl -X GET 'http://localhost:9200/other-index/_search?pretty' -H 'Content-Type: application/json' -d '{
  "from":0,
  "size":1,
  "query":{
    "bool":{
          "should":[
            {
              "geo_shape":{
                "geo_location":{
                  "relation":"within",
                  "indexed_shape":{
                    "type":"<type>",
                    "index":"<index>",
                    "id":"<id>",
                    "path":"geo_json"
                  }
                }
              }
            },
            {
              "geo_shape":{
                "geo_location":{
                  "relation":"within",
                  "indexed_shape":{
                    "type":"<type>",
                    "index":"<index>",
                    "id":"<id>",
                    "path":"geo_json"
                  }
                }
              }
            }
          ]

    }
  }
}
'

Logs

elasticsearch    | java.lang.ArrayIndexOutOfBoundsException: 1
elasticsearch    |  at org.elasticsearch.index.query.GeoShapeQueryBuilder$1.onResponse(GeoShapeQueryBuilder.java:408) ~[elasticsearch-6.2.1.jar:6.2.1]
elasticsearch    |  at org.elasticsearch.index.query.GeoShapeQueryBuilder$1.onResponse(GeoShapeQueryBuilder.java:386) ~[elasticsearch-6.2.1.jar:6.2.1]
elasticsearch    |  at org.elasticsearch.action.support.TransportAction$1.onResponse(TransportAction.java:85) ~[elasticsearch-6.2.1.jar:6.2.1]
elasticsearch    |  at org.elasticsearch.action.support.TransportAction$1.onResponse(TransportAction.java:81) ~[elasticsearch-6.2.1.jar:6.2.1]
elasticsearch    |  at org.elasticsearch.action.support.ContextPreservingActionListener.onResponse(ContextPreservingActionListener.java:43) ~[elasticsearch-6.2.1.jar:6.2.1]
elasticsearch    |  at org.elasticsearch.action.support.single.shard.TransportSingleShardAction$AsyncSingleAction$2.handleResponse(TransportSingleShardAction.java:247) ~[elasticsearch-6.2.1.jar:6.2.1]
elasticsearch    |  at org.elasticsearch.action.support.single.shard.TransportSingleShardAction$AsyncSingleAction$2.handleResponse(TransportSingleShardAction.java:233) ~[elasticsearch-6.2.1.jar:6.2.1]
elasticsearch    |  at org.elasticsearch.transport.TransportService$ContextRestoreResponseHandler.handleResponse(TransportService.java:1091) ~[elasticsearch-6.2.1.jar:6.2.1]
elasticsearch    |  at org.elasticsearch.transport.TransportService$DirectResponseChannel.processResponse(TransportService.java:1160) ~[elasticsearch-6.2.1.jar:6.2.1]
elasticsearch    |  at org.elasticsearch.transport.TransportService$DirectResponseChannel.sendResponse(TransportService.java:1150) ~[elasticsearch-6.2.1.jar:6.2.1]
elasticsearch    |  at org.elasticsearch.transport.TransportService$DirectResponseChannel.sendResponse(TransportService.java:1139) ~[elasticsearch-6.2.1.jar:6.2.1]
elasticsearch    |  at org.elasticsearch.transport.TaskTransportChannel.sendResponse(TaskTransportChannel.java:54) ~[elasticsearch-6.2.1.jar:6.2.1]
elasticsearch    |  at org.elasticsearch.action.support.single.shard.TransportSingleShardAction$ShardTransportHandler.messageReceived(TransportSingleShardAction.java:294) ~[elasticsearch-6.2.1.jar:6.2.1]
elasticsearch    |  at org.elasticsearch.action.support.single.shard.TransportSingleShardAction$ShardTransportHandler.messageReceived(TransportSingleShardAction.java:286) ~[elasticsearch-6.2.1.jar:6.2.1]
elasticsearch    |  at org.elasticsearch.transport.TransportRequestHandler.messageReceived(TransportRequestHandler.java:30) ~[elasticsearch-6.2.1.jar:6.2.1]
elasticsearch    |  at org.elasticsearch.xpack.security.transport.SecurityServerTransportInterceptor$ProfileSecuredRequestHandler$1.doRun(SecurityServerTransportInterceptor.java:258) ~[?:?]
elasticsearch    |  at org.elasticsearch.common.util.concurrent.AbstractRunnable.run(AbstractRunnable.java:37) ~[elasticsearch-6.2.1.jar:6.2.1]
elasticsearch    |  at org.elasticsearch.common.util.concurrent.EsExecutors$1.execute(EsExecutors.java:135) ~[elasticsearch-6.2.1.jar:6.2.1]
elasticsearch    |  at org.elasticsearch.xpack.security.transport.SecurityServerTransportInterceptor$ProfileSecuredRequestHandler.lambda$messageReceived$0(SecurityServerTransportInterceptor.java:307) ~[?:?]
elasticsearch    |  at org.elasticsearch.action.ActionListener$1.onResponse(ActionListener.java:60) ~[elasticsearch-6.2.1.jar:6.2.1]
elasticsearch    |  at org.elasticsearch.xpack.security.transport.ServerTransportFilter$NodeProfile.lambda$inbound$2(ServerTransportFilter.java:166) ~[?:?]
elasticsearch    |  at org.elasticsearch.xpack.security.authz.AuthorizationUtils$AsyncAuthorizer.maybeRun(AuthorizationUtils.java:183) ~[?:?]
elasticsearch    |  at org.elasticsearch.xpack.security.authz.AuthorizationUtils$AsyncAuthorizer.setRunAsRoles(AuthorizationUtils.java:177) ~[?:?]
elasticsearch    |  at org.elasticsearch.xpack.security.authz.AuthorizationUtils$AsyncAuthorizer.authorize(AuthorizationUtils.java:165) ~[?:?]
elasticsearch    |  at org.elasticsearch.xpack.security.transport.ServerTransportFilter$NodeProfile.lambda$inbound$3(ServerTransportFilter.java:168) ~[?:?]
elasticsearch    |  at org.elasticsearch.action.ActionListener$1.onResponse(ActionListener.java:60) ~[elasticsearch-6.2.1.jar:6.2.1]
elasticsearch    |  at org.elasticsearch.xpack.security.authc.AuthenticationService$Authenticator.lambda$authenticateAsync$2(AuthenticationService.java:184) ~[x-pack-security-6.2.1.jar:6.2.1]
elasticsearch    |  at org.elasticsearch.xpack.security.authc.AuthenticationService$Authenticator.lambda$lookForExistingAuthentication$4(AuthenticationService.java:217) ~[x-pack-security-6.2.1.jar:6.2.1]
elasticsearch    |  at org.elasticsearch.xpack.security.authc.AuthenticationService$Authenticator.lookForExistingAuthentication(AuthenticationService.java:228) [x-pack-security-6.2.1.jar:6.2.1]
elasticsearch    |  at org.elasticsearch.xpack.security.authc.AuthenticationService$Authenticator.authenticateAsync(AuthenticationService.java:182) [x-pack-security-6.2.1.jar:6.2.1]
elasticsearch    |  at org.elasticsearch.xpack.security.authc.AuthenticationService$Authenticator.access$000(AuthenticationService.java:143) [x-pack-security-6.2.1.jar:6.2.1]
elasticsearch    |  at org.elasticsearch.xpack.security.authc.AuthenticationService.authenticate(AuthenticationService.java:113) [x-pack-security-6.2.1.jar:6.2.1]
elasticsearch    |  at org.elasticsearch.xpack.security.transport.ServerTransportFilter$NodeProfile.inbound(ServerTransportFilter.java:142) [x-pack-security-6.2.1.jar:6.2.1]
elasticsearch    |  at org.elasticsearch.xpack.security.transport.SecurityServerTransportInterceptor$ProfileSecuredRequestHandler.messageReceived(SecurityServerTransportInterceptor.java:314) [x-pack-security-6.2.1.jar:6.2.1]
elasticsearch    |  at org.elasticsearch.transport.RequestHandlerRegistry.processMessageReceived(RequestHandlerRegistry.java:66) [elasticsearch-6.2.1.jar:6.2.1]
elasticsearch    |  at org.elasticsearch.transport.TransportService$7.doRun(TransportService.java:656) [elasticsearch-6.2.1.jar:6.2.1]
elasticsearch    |  at org.elasticsearch.common.util.concurrent.ThreadContext$ContextPreservingAbstractRunnable.doRun(ThreadContext.java:635) [elasticsearch-6.2.1.jar:6.2.1]
elasticsearch    |  at org.elasticsearch.common.util.concurrent.AbstractRunnable.run(AbstractRunnable.java:37) [elasticsearch-6.2.1.jar:6.2.1]
elasticsearch    |  at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [?:1.8.0_161]
elasticsearch    |  at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [?:1.8.0_161]
elasticsearch    |  at java.lang.Thread.run(Thread.java:748) [?:1.8.0_161]

To make this query work without error, simply remove one of the indexed shape queries.

Let me know if any more context or information would help.

:AnalyticGeo

Most helpful comment

FWIW, I was able to build and use a 6.3.0 snapshot and verify that the same error does not happen and thus seems to be fixed in master.

All 5 comments

@elastic/es-search-aggs Please take a look.

@nknize Could you take a look at this one?

Similar-looking problems are fixed by #28458, to be released in 6.3. There's not enough detail in the OP to reproduce what @ncavig is seeing exactly, but it seems likely that it's this. Closing this as a duplicate of #28456, but please reopen if the problem persists in 6.3.

FWIW, I was able to build and use a 6.3.0 snapshot and verify that the same error does not happen and thus seems to be fixed in master.

Good to know, thanks for checking @ncavig !

Was this page helpful?
0 / 5 - 0 ratings

Related issues

clintongormley picture clintongormley  路  3Comments

malpani picture malpani  路  3Comments

jasontedor picture jasontedor  路  3Comments

dawi picture dawi  路  3Comments

clintongormley picture clintongormley  路  3Comments