Hello everyone,
Overview: I am creating a search engine using the Open Ai embeddings .I am using the dividing the documents in chunks and then converting the chunks to embedding and storing in Elastic Search(7.10).Now when i am sending a prompt i again convert to the same and do a script base cosine similarity search.
here is an example of elastic search query.
{
"script_score": {
"script": {
"source": "doc['associated_questions_vector_field'].size() == 0 ? 0 : (1 + cosineSimilarity(params.prompt_vector, doc['associated_questions_vector_field']) + (1 + cosineSimilarity(params.prompt_vector, doc['vector_field']))) / 2,
"params": {
"prompt_vector": query_vector
}
}
}
}
Problem : Earlier it seemed to be working fine but now as the documents have increased i am getting wrong documents results any idea why that is happening and has anyone faced similar issue.