Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OpenSearchVectorSearch doesn't permit the user to specify a field name #2500

Closed
weaversam8 opened this issue Apr 6, 2023 · 6 comments · Fixed by #2509
Closed

OpenSearchVectorSearch doesn't permit the user to specify a field name #2500

weaversam8 opened this issue Apr 6, 2023 · 6 comments · Fixed by #2509

Comments

@weaversam8
Copy link
Contributor

Currently the OpenSearchVectorSearch class defaults to vector_field as the field name of the vector field in all vector similarity searches.

This works fine if you're populating your OpenSearch instance with data via LangChain, but doesn't work well if you're attempting to query a vector field with a different name that's been populated by some other process. For maximum utility, users should be able to customize which field is being queried.

@naveentatikonda
Copy link
Contributor

@weaversam8 Thank you for your feedback. Will work on it and raise the PR soon to provide customized field names.

@weaversam8
Copy link
Contributor Author

I'm actually working on a PR now, so I can give you a good starting point :)

I think the ability to specify the text field would also be helpful, so I'm planning on squeezing that into my PR as well.

@naveentatikonda
Copy link
Contributor

Sounds good. Thank you for your contributions to OpenSearch.

@weaversam8
Copy link
Contributor Author

Done, let me know what you think.

@naveentatikonda
Copy link
Contributor

Done, let me know what you think.

@weaversam8 I just reviewed your PR, everything looks good except a couple of things:

  1. We also need to update the script source function to use custom field name
  2. What is the reason behind changing the space_type to “cosinesimil” instead of “cosineSimilarity” for “painless_scripting” ? Please refer to this k-NN documentation https://opensearch.org/docs/latest/search-plugins/knn/painless-functions/#function-types

I have addressed these changes in my PR. Also, I have included the changes to add custom vector_field and text_field while indexing.

@naveentatikonda
Copy link
Contributor

@hwchase17 Could you please tag me and @vamshin if any new PRs or github issues are created that are related to OpenSearch. We would like to contribute by addressing those issues and reviewing those PRs.

hwchase17 pushed a commit that referenced this issue Apr 11, 2023
**Description**
Add custom vector field name and text field name while indexing and
querying for OpenSearch

**Issues**
#2500

Signed-off-by: Naveen Tatikonda <navtat@amazon.com>
wertycn pushed a commit to wertycn/langchain-zh that referenced this issue Apr 26, 2023
**Description**
Add custom vector field name and text field name while indexing and
querying for OpenSearch

**Issues**
langchain-ai/langchain#2500

Signed-off-by: Naveen Tatikonda <navtat@amazon.com>
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 a pull request may close this issue.

2 participants