Hello, in our team we use painless scripting quite heavily and have come across some very weird behaviour from time to time, the latest having to do with the following piece of code:
try {
double test = dotProduct(k_vector, vector_name);
} catch(Exception e) {
double test = dotProduct(k_vector, vector_name);
}
Where "k_vector" is a dense_vector of size 50 and "vector_name" is the name of the field containing the other dense_vector inside the document.
On some documents, the first execution of the function throws the exception "java.lang.IllegalArgumentException: A document doesn't have a value for a vector field!" however the second execution (inside the catch statement) works fine and returns the correct value for the dotProduct of the vectors.
We took a thorough look at the documents and couldn't find any difference between those that work and those that don't, so we're at a loss here.
Can anyone explain this behaviour? Is it a bug or are we missing something?