Description
The UIs (both onprem and capells) when doing a query know the full syntax of the JSON index definition in particular for vector we have the following (assumes a vector definition on a field called "embedding":
|
"embedding": {
|
"enabled": true,
|
"dynamic": false,
|
"fields": [
|
{
|
"dims": 1536,
|
"index": true,
|
"name": "embedding",
|
"similarity": "l2_norm",
|
"type": "vector",
|
"vector_index_optimized_for": "recall"
|
}
|
]
|
},
|
as can be seen the "dims" value is 1536 now suppose that a query is about to be run from a UI as follows:
"knn": [
|
{
|
"k": 3,
|
"field": "embedding",
|
"vector": [
|
0,
|
0,
|
0
|
]
|
}
|
],
|
"fields": [
|
"*"
|
],
|
"query": {
|
"match_none": {}
|
},
|
"explain": true,
|
"size": 10,
|
"from": 0
|
}
|
The UI's JavaScript should check that a) a vector definition for the field "embedding" exists in the index definition and if it does compare the size of the query "vector" array to see if it matches the "dims" value in the definition if they don't match there is no point in running the misconfigured query.
In the example above 3 != 1536 so the query isn't legal from the start.