Retreive `knn_vector` value raising an error. What's the alternative?
igaloly opened this issue · comments
igal leikin commented
When I try to retrieve a value from a knn_vector
, I get this error: knn vector does not support this operation
.
I do not want to use _source
to get the vector, because it's slow.
What are my options to save vector with the ability to retrieve it values?
Mapping:
{
"test-1": {
"mappings": {
"properties": {
"vector": {
"type": "knn_vector",
"dimension": 768
}
}
}
}
}
Query:
{
"size": 0,
"aggs": {
"vector_iter": {
"scripted_metric": {
...
"map_script": "
for(int i = 0; i < doc['vector'].length; i++) {
state.sumVector[i] = state.sumVector[i] + doc['vector'][i]; <---- Here's the problem
}
",
...
"params": {
"vectorLength": 768
}
}
}
}
}
Vijayan Balasubramanian commented
@igaloly
Answered here: opensearch-project/k-NN#412