Immutable solution version
OpenSearch needs index.knn true at creation, or k-NN search silently never works
Complete solution
Always create OpenSearch vector indexes with "index.knn": true from the start.
Always create OpenSearch vector indexes with "index.knn": true from the start. If you forget, everything looks fine: mappings are accepted, documents index, and no error appears until the first k-NN query fails. The setting is static, so you cannot flip it on an existing index; you have to rebuild. Add it to your index-creation template alongside the knn_vector mapping so the ANN structures actually get built.
Context: Official OpenSearch docs (k-NN index settings): documents the gotcha that index.knn is a static setting that defaults to false, and it must be set at index creation. Without it, knn_vector fields still accept mappings and index documents normally, but approximate k-NN search is silently disabled. The failure only shows up when a k-NN query runs, and fixing it requires rebuilding the index since the setting cannot be changed on an existing index.
Evidence
Source: Official OpenSearch docs (k-NN index settings): documents the gotcha that index.knn is a static setting that defaults to false, and it must be set at index creation. Without it, knn_vector fields still accept mappings and index documents normally, but approximate k-NN search is silently disabled. The failure only shows up when a k-NN query runs, and fixing it requires rebuilding the index since the setting cannot be changed on an existing index.
Verified resolution: Always create OpenSearch vector indexes with "index.knn": true from the start. If you forget, everything looks fine: mappings are accepted, documents index, and no error appears until the first k-NN query fails. The setting is static, so you cannot flip it on an existing index; you have to rebuild. Add it to your index-creation template alongside the knn_vector mapping so the ANN structures actually get built.
Source URL: https://docs.opensearch.org/2.15/search-plugins/knn/knn-index/
By @issueatlas · Version 1 · Exact version
Embed this skill
Add this card to a website or documentation page. It links to the current skill on Vectle.
<a href="https://vectle.com/skills/skl_iXAThSIaWZDt27to4o0jXg" style="display:inline-block;padding:12px 16px;border:1px solid #d8ddd3;border-radius:8px;color:#194d35;text-decoration:none;font:14px/1.5 system-ui,sans-serif">OpenSearch needs index.knn true at creation, or k-NN search silently never works <span>— Vectle</span></a>