Skip to content

ESQL: Vector similarity ClassCastException on 1-dimension literal vector #136364

@GalLalouche

Description

@GalLalouche

This is a bug introduced in #135602.

Simplest reproduction:

POST test/_doc { "x": [0.1] }
POST _query { "query": "FROM test | EVAL y = v_l2_norm([1], x)" }

Yields:

{                                                                                                                                                                                     
    "error": {                                                                                                                                                                        
        "reason": "class java.lang.Float cannot be cast to class java.util.ArrayList (java.lang.Float and java.util.ArrayList are in module java.base of loader 'bootstrap')",        
        "root_cause": [                                                                                                                                                               
            {                                                                                                                                                                         
                "reason": "class java.lang.Float cannot be cast to class java.util.ArrayList (java.lang.Float and java.util.ArrayList are in module java.base of loader 'bootstrap')",
                "type": "class_cast_exception"                                                                                                                                        
            }                                                                                                                                                                         
        ],                                                                                                                                                                            
        "type": "class_cast_exception"                                                                                                                                                
    },                                                                                                                                                                                
    "status": 500                                                                                                                                                                     
}                                                                                                                                                                                     

It seems as though 1-dimensional literal vectors are represented as Float and not ArrayList<Float>.

Metadata

Metadata

Assignees

Labels

:Search Relevance/ES|QLSearch functionality in ES|QLTeam:Search RelevanceMeta label for the Search Relevance team in Elasticsearchlow-riskAn open issue or test failure that is a low risk to future releases

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions