MAPPINGs-->
{
"settings" : {
"posts" : {
"number_of_shards" : 1,
"number_of_replicas" : 1
},
"mappings": {
"properties": {
"title_vector": {
"type": "dense_vector",
"dims": 3
},
"comment": {
"type":"text"
}
}
}
}
}
INPUT QUERY -->
{
"query": {
"script_score": {
"query": {
"match_all": {}
},
"script": {
"source": "cosineSimilarity(params.queryVector, doc['title_vector'])",
"params": {
"queryVector": [0.6226563516985381,0.24777450998447703,0.16749395455557237]
}
}
}
}
}
OUTPUT ERROR-->
{
"error": {
"root_cause": [
{
"type": "script_exception",
"reason": "runtime error",
"script_stack": [
"cosineSimilarity(params.queryVector, doc['title_vector'])",
" ^---- HERE"
],
"script": "cosineSimilarity(params.queryVector, doc['title_vector'])",
"lang": "painless"
}
],
"type": "search_phase_execution_exception",
"reason": "all shards failed",
"phase": "query",
"grouped": true,
"failed_shards": [
{
"shard": 0,
"index": "posts",
"node": "IkCDVw5AR02qqOi0-EixKQ",
"reason": {
"type": "script_exception",
"reason": "runtime error",
"script_stack": [
"cosineSimilarity(params.queryVector, doc['title_vector'])",
" ^---- HERE"
],
"script": "cosineSimilarity(params.queryVector, doc['title_vector'])",
"lang": "painless",
"caused_by": {
"type": "class_cast_exception",
"reason": "class org.elasticsearch.index.fielddata.ScriptDocValues$Doubles cannot be cast to class org.elasticsearch.xpack.vectors.query.VectorScriptDocValues$DenseVectorScriptDocValues (org.elasticsearch.index.fielddata.ScriptDocValues$Doubles is in unnamed module of loader 'app'; org.elasticsearch.xpack.vectors.query.VectorScriptDocValues$DenseVectorScriptDocValues is in unnamed module of loader java.net.FactoryURLClassLoader @204e90f7)"
}
}
}
]
},
"status": 400
}