Skip to content

[ES|QL] IN operator fails when used with array or query param pointing to array #136998

@jedrazb

Description

@jedrazb

Elasticsearch Version

9.2.0 (or latest)

Installed Plugins

No response

Java Version

bundled

OS Version

MacBook-Pro.local 23.6.0 Darwin Kernel Version 23.6.0: Mon Aug 11 21:20:40 PDT 2025; root:xnu-10063.141.1.706.13~1/RELEASE_ARM64_T6020 arm64

Problem Description

When using the IN operator in an ES|QL query with a list, either inline or passed via query parameters, Elasticsearch fails with a class_cast_exception (500 HTTP).

Steps to Reproduce

FROM search-movies
| WHERE id IN (["1", "2"])

Or with param

FROM search-movies
| WHERE id IN (?param)
{
  "param": ["1", "2"]
}

Logs (if relevant)

Full response from ES

#! No limit defined, adding default limit of [1000]
{
  "error": {
    "root_cause": [
      {
        "type": "class_cast_exception",
        "reason": "class java.util.ImmutableCollections$ListN cannot be cast to class org.apache.lucene.util.BytesRef (java.util.ImmutableCollections$ListN is in module java.base of loader 'bootstrap'; org.apache.lucene.util.BytesRef is in module org.apache.lucene.core@10.3.1 of loader 'app')"
      }
    ],
    "type": "class_cast_exception",
    "reason": "class java.util.ImmutableCollections$ListN cannot be cast to class org.apache.lucene.util.BytesRef (java.util.ImmutableCollections$ListN is in module java.base of loader 'bootstrap'; org.apache.lucene.util.BytesRef is in module org.apache.lucene.core@10.3.1 of loader 'app')"
  },
  "status": 500
}

Metadata

Metadata

Assignees

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions