Painless script throwing connection error in py-elasticsearch

441 views Asked by At

I have the following script search query:

bdy = {
 "query": {
   "function_score": {
     "script_score": {
       "script": {
         "lang": "painless",
         "inline": "def test = "+test1+"; float total = 0; for (int i = 0; i < doc['embedding_vector'].length; i++) { total += doc['embedding_vector'][i]*test[i]; } return total;"
       }
     }
   }
 }
}

Since the vectors are pre-normalized, I have written this to get the dot product. I have tested this on dummy data, it works but on the actual data it throws a connection time out error. 'test1' is the array with which I am taking dot product.

es.search(index="images", doc_type='image', body=bdy)
0

There are 0 answers