Best method for calculating text embedding for a KNN search?

Hello,
I am using Elastic Cloud and am using pre-trained ML models for text/semantic search and for image search. Currently, in order to do a text KNN search I have to make two API calls to ES, first to get the text embedding, and second to actually run the KNN search.

Is there no way to make a single call to ES (maybe using a script to get the text vector representation) to run a KNN search? I have searched through all the docs but haven't found an answer. ChatGPT had several suggestions that relied on runtime query scripts that would assign the vector value to a field used in the KNN query, but none of them worked for me.

Thanks in advance

Yes you can now do this in ES 8.7 in a single step by specifying your text embedding model in the KNN search.

I guess ChatGPT hasn't read the 8.7 docs yet.

1 Like

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.