I’ve added K-NN plugin as dependency in my build.gradle:
But I still get unresolved reference error when trying to import anything from
How can I fix this and use the K-NN plugin for making queries from Java? I’m trying to import KNNQueryBuilder.
Is this for a plugin you are building? Or making a call to k-nn?
Just making calls to k-nn
In that case you don’t have to take dependency in K-NN plugin. The kNNQuerybuilder class is an internal class used for building the k-nn internal queries.
I would recommend checking the java client if Opensearch to see if it supports creating k-nn query. If thats not the case please create raw json query as per k-nn documentation.
Also, feel free to cut a github issue on opensearch java client if it doesn’t support building k-nn queries.
Thanks for the response.
I think this is the Java client repo and the one you mentioned is for building and running extensions.
And there seems to be a issue with knn already