Forbid empty doc values on vector functions#43944
Forbid empty doc values on vector functions#43944mayya-sharipova merged 2 commits intoelastic:masterfrom
Conversation
Currently when a document misses a vector value, vector function returns 0 as a score for this document. We think this is incorrect behaviour. With this change, an error will be thrown if vector functions are used with docs that are missing vector doc values. Also VectorScriptDocValues is modified to allow size() function, which can be used to check if a document has a value for the vector field.
|
Pinging @elastic/es-search |
|
@jpountz I wanted to ask if you are fine if we expose Before we made a decision not to leak the internal representations of vectors. |
jpountz
left a comment
There was a problem hiding this comment.
To be clear, my comment in the other PR was about the fact that users could have access to the binary representation of the vector. Exposing size() as a way to know whether the document has a value or not sounds good to me. 👍
jtibshirani
left a comment
There was a problem hiding this comment.
This also looks good to me.
|
|
||
| @Override | ||
| public int size() { | ||
| throw new UnsupportedOperationException("vector fields may only be used via vector functions in scripts"); |
There was a problem hiding this comment.
Small comment: now that you can call size on a vector field, perhaps we could update the error message above to say "accessing a vector field's value through 'get' or 'value' is not supported".
Currently when a document misses a vector value, vector function returns 0 as a score for this document. We think this is incorrect behaviour. With this change, an error will be thrown if vector functions are used with docs that are missing vector doc values. Also VectorScriptDocValues is modified to allow size() function, which can be used to check if a document has a value for the vector field.
Currently when a document misses a vector value, vector function
returns 0 as a score for this document. We think this is incorrect
and unexpected behaviour.
With this change, an error will be thrown if vector functions are
used with docs that are missing vector doc values.
Also VectorScriptDocValues is modified to allow size() function,
which can be used to check if a document has a value for the
vector field.