Skip to content

Conversation

@AhmedRaafat14
Copy link

Summary

Adds configurable vector search engine and space type parameters to the OpenSearch vector store node, enabling compatibility with OpenSearch 3.x while maintaining backward compatibility with older versions.

Problem

OpenSearch 3.0 deprecated the nmslib engine for k-NN vector search, causing index creation failures with the error:
nmslib engine is deprecated in OpenSearch and cannot be used for new index creation in OpenSearch from 3.0.0

Users upgrading to OpenSearch 3.x could not use Flowise's OpenSearch integration without modifying source code.

Solution

Adds two new configurable parameters to the OpenSearch node:

  • Engine: Choose between lucene (default), faiss, or nmslib (legacy)
  • Space Type: Choose between l2 (default), cosinesimil, or innerproduct

This allows users to select the appropriate engine for their OpenSearch version while maintaining full backward compatibility.

Key Features

  • Engine Selection: Dropdown to select vector search engine based on OpenSearch version
  • Space Type Selection: Dropdown to configure distance metric for similarity search
  • Backward Compatible: Existing flows continue to work; users with older OpenSearch can select nmslib
  • Sensible Defaults: New flows default to lucene + l2 which works with OpenSearch 2.x+

Files Changed

Modified

  • packages/components/nodes/vectorstores/OpenSearch/OpenSearch.ts
    • Bumped version from 3.0 → 4.0
    • Added engine dropdown input (lucene/faiss/nmslib)
    • Added spaceType dropdown input (l2/cosinesimil/innerproduct)
    • Updated upsert method to use configurable engine/spaceType
    • Updated init method to use configurable engine/spaceType

Test Plan

  • Create index with OpenSearch 3.x using lucene engine → succeeds
  • Create index with OpenSearch 3.x using faiss engine → succeeds
  • Create index with OpenSearch 2.x using nmslib engine → succeeds
  • Existing flows without engine/spaceType set → default to lucene/l2
  • Query existing indexes → works correctly with configured space type

Breaking Changes

None - fully backward compatible. Default engine changed from nmslib to lucene, but this only affects new index creation. Existing indexes continue to work.

Related

  • OpenSearch 3.0 Release Notes: nmslib deprecation
  • LangChain OpenSearch vector store types (outdated, requires as any cast)

Screenshots

Screenshot 2026-01-26 at 1 11 31 AM

@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @AhmedRaafat14, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request addresses a critical compatibility issue with OpenSearch 3.x by introducing new configuration options for the vector search engine and space type within the OpenSearch node. This enhancement allows users to select appropriate settings for their OpenSearch version, ensuring seamless integration and preventing index creation failures caused by the deprecation of the 'nmslib' engine in OpenSearch 3.0. The changes are designed to be fully backward compatible, providing flexibility for both new and existing deployments.

Highlights

  • OpenSearch 3.x Compatibility: Introduced configurable 'Engine' and 'Space Type' parameters to the OpenSearch vector store node, resolving compatibility issues with OpenSearch 3.x which deprecated the 'nmslib' engine.
  • Configurable Engine Options: Users can now select between 'lucene', 'faiss', or 'nmslib' as the vector search engine, with 'lucene' as the new default for new flows.
  • Configurable Space Type Options: Added options for 'l2', 'cosinesimil', or 'innerproduct' as the distance metric for similarity search, with 'l2' as the new default.
  • Backward Compatibility: The changes ensure full backward compatibility, allowing existing flows to continue functioning while providing options for newer OpenSearch versions.
  • Node Version Update: The OpenSearch node version has been bumped from 3.0 to 4.0 to reflect these significant updates.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request effectively addresses the compatibility issue with OpenSearch 3.x by introducing configurable engine and spaceType parameters. The changes are well-implemented, backward-compatible, and include sensible defaults for new users. My review includes a couple of suggestions to improve code maintainability by reducing duplication and adding explanatory comments for type casting workarounds. Overall, this is a solid contribution that enhances the OpenSearch node's flexibility.

@AhmedRaafat14
Copy link
Author

/gemini review

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request successfully adds compatibility with OpenSearch 3.x by introducing configurable engine and spaceType parameters, which is a great improvement. The changes are well-structured, using a helper function to avoid code duplication when creating the vector store, and the implementation is backward compatible as described. My main feedback is a minor point on improving maintainability by avoiding duplicated default values for the new parameters. Overall, this is a solid contribution that addresses an important compatibility issue.

@AhmedRaafat14
Copy link
Author

@HenryHengZJ Can you please check this PR 🙏 !

Copy link
Contributor

@HenryHengZJ HenryHengZJ left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants