Versions OS 3.1.0:
opensearch-py version: 3.0.0
Describe the issue :
Looking at this example from the official Opensearch-py repository: opensearch-py/samples/knn/knn_basics.py at main · opensearch-project/opensearch-py · GitHub
It looks as though os-py should support knn indices and queries. When I try to run that sample though, I get an error back:
opensearchpy.exceptions.RequestError: RequestError(400, 'settings_exception', 'unknown setting [index.knn] please check that any required plugins are installed, or check the breaking changes documentation for removed settings')
Is that expected behavior?
pablo
August 8, 2025, 12:30pm
2
@joshuajnoble I’ve tested that script with OpenSearch 3.1.0 and it worked.
root@docker1:/home/pablo/test# python3 -m venv venv
root@docker1:/home/pablo/test# source venv/bin/activate
(venv) root@docker1:/home/pablo/test# vi knn_basic.py
(venv) root@docker1:/home/pablo/test# python3 knn_basic.py
Traceback (most recent call last):
File "/home/pablo/test/knn_basic.py", line 16, in <module>
from opensearchpy import OpenSearch, helpers
ModuleNotFoundError: No module named 'opensearchpy'
(venv) root@docker1:/home/pablo/test# pip3 install opensearch-py
Collecting opensearch-py
Downloading opensearch_py-3.0.0-py3-none-any.whl.metadata (7.2 kB)
Collecting urllib3!=2.2.0,!=2.2.1,<3,>=1.26.19 (from opensearch-py)
Downloading urllib3-2.5.0-py3-none-any.whl.metadata (6.5 kB)
Collecting requests<3.0.0,>=2.32.0 (from opensearch-py)
Downloading requests-2.32.4-py3-none-any.whl.metadata (4.9 kB)
Collecting python-dateutil (from opensearch-py)
Downloading python_dateutil-2.9.0.post0-py2.py3-none-any.whl.metadata (8.4 kB)
Collecting certifi>=2024.07.04 (from opensearch-py)
Downloading certifi-2025.8.3-py3-none-any.whl.metadata (2.4 kB)
Collecting Events (from opensearch-py)
Downloading Events-0.5-py3-none-any.whl.metadata (3.9 kB)
Collecting charset_normalizer<4,>=2 (from requests<3.0.0,>=2.32.0->opensearch-py)
Downloading charset_normalizer-3.4.2-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata (35 kB)
Collecting idna<4,>=2.5 (from requests<3.0.0,>=2.32.0->opensearch-py)
Downloading idna-3.10-py3-none-any.whl.metadata (10 kB)
Collecting six>=1.5 (from python-dateutil->opensearch-py)
Downloading six-1.17.0-py2.py3-none-any.whl.metadata (1.7 kB)
Downloading opensearch_py-3.0.0-py3-none-any.whl (371 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 371.5/371.5 kB 20.8 MB/s eta 0:00:00
Downloading certifi-2025.8.3-py3-none-any.whl (161 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 161.2/161.2 kB 33.6 MB/s eta 0:00:00
Downloading requests-2.32.4-py3-none-any.whl (64 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 64.8/64.8 kB 8.3 MB/s eta 0:00:00
Downloading urllib3-2.5.0-py3-none-any.whl (129 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 129.8/129.8 kB 27.8 MB/s eta 0:00:00
Downloading Events-0.5-py3-none-any.whl (6.8 kB)
Downloading python_dateutil-2.9.0.post0-py2.py3-none-any.whl (229 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 229.9/229.9 kB 40.3 MB/s eta 0:00:00
Downloading charset_normalizer-3.4.2-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (148 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 148.6/148.6 kB 30.8 MB/s eta 0:00:00
Downloading idna-3.10-py3-none-any.whl (70 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 70.4/70.4 kB 18.7 MB/s eta 0:00:00
Downloading six-1.17.0-py2.py3-none-any.whl (11 kB)
Installing collected packages: Events, urllib3, six, idna, charset_normalizer, certifi, requests, python-dateutil, opensearch-py
Successfully installed Events-0.5 certifi-2025.8.3 charset_normalizer-3.4.2 idna-3.10 opensearch-py-3.0.0 python-dateutil-2.9.0.post0 requests-2.32.4 six-1.17.0 urllib3-2.5.0
(venv) root@docker1:/home/pablo/test#
(venv) root@docker1:/home/pablo/test# python3 knn_basic.py
Searching for [0.98, 0.95, 0.86, 0.76, 0.66] ...
Thanks for the response Pablo. I’ve reinstalled OS from Docker and it now works fine. The homebrew install (e.g. brew install opensearch
) doesn’t seem to be able to do KNN searches either via opensearch-py or GET requests. I’m not sure why that is.
pablo
August 11, 2025, 11:00am
4
@joshuajnoble OpeSearch in homebrew is delivered in a vanilla version with no plugins.
pawelw@MacBook-Pro ~ % opensearch-plugin list
warning: no-jdk distributions that do not bundle a JDK are deprecated and will be removed in a future release
pawelw@MacBook-Pro ~ %
This is the default list of plugins delivered with the OpenSearch Docker container version 3.1.0
docker exec -it opensearch-node1_3.1.0 bin/opensearch-plugin list
opensearch-alerting
opensearch-anomaly-detection
opensearch-asynchronous-search
opensearch-cross-cluster-replication
opensearch-custom-codecs
opensearch-flow-framework
opensearch-geospatial
opensearch-index-management
opensearch-job-scheduler
opensearch-knn
opensearch-ltr
opensearch-ml
opensearch-neural-search
opensearch-notifications
opensearch-notifications-core
opensearch-observability
opensearch-performance-analyzer
opensearch-reports-scheduler
opensearch-search-relevance
opensearch-security
opensearch-security-analytics
opensearch-skills
opensearch-sql
opensearch-system-templates
opensearch-ubi
query-insights
1 Like