Painless script throwing connection error in py-elasticsearch

时间:2018-07-25 05:28:20

标签: python elasticsearch elasticsearch-painless pyelasticsearch

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 个答案:

没有答案