Issue with OpenSearch KNN


I’m encountering an issue with OpenSearch KNN plugin. I am getting an error:

java.lang.UnsatisfiedLinkError: no opensearchknn_nmslib in java.library.path: /usr/java/packages/lib

I added the path to this plugin libraries in the definition of my service:


But I am getting another error:

/opensearch/plugins/opensearch-knn/lib/ cannot open shared object: No such file or directory

The lib is already presents under: opensearch/plugins/opensearch-knn/lib/

Thanks for your help

Please provide the below details:

  1. Version of Opensearch
  2. How you started the OpenSearch Service?
  3. Operating System on which you are trying to run the service?
1 Like


  • OpenSearch version: 2.5.0
  • I started OpenSearch as a service by defining the JAVA_HOME, OPENSEARCH_HOME, OPENSEARCH_PATH_CONF and the WorkingDirectory.
  • Operating System: Ubuntu 20

So you also need to set 2 more variable for K-NN:

  1. KNN_LIB_DIR=$OPENSEARCH_HOME/plugins/opensearch-knn/lib
    for k-NN to work.

If you have downloaded the tar.gz file, you can also start the opensearch cluster using
/ file.

Documentation that can help: Tarball - OpenSearch documentation

I hope this helps.

1 Like

Thanks a lot. Working well now :slight_smile:

1 Like

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