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

ElasticsearchVectorStore #2082

Open
gikeihi opened this issue Jan 17, 2025 · 3 comments · May be fixed by #2175
Open

ElasticsearchVectorStore #2082

gikeihi opened this issue Jan 17, 2025 · 3 comments · May be fixed by #2175

Comments

@gikeihi
Copy link

gikeihi commented Jan 17, 2025

Why is the query field "embedding" hardcoded in the ElasticsearchVectorStore class?

			SearchResponse<Document> res = this.elasticsearchClient.search(sr -> sr.index(this.options.getIndexName())
				.knn(knn -> knn.queryVector(EmbeddingUtils.toList(vectors))
					.similarity(finalThreshold)
					.k((long) searchRequest.getTopK())
					.field("embedding")
					.numCandidates((long) (1.5 * searchRequest.getTopK()))
					.filter(fl -> fl
						.queryString(qs -> qs.query(getElasticsearchQueryString(searchRequest.getFilterExpression())))))
				.size(searchRequest.getTopK()), Document.class);
@ilayaperumalg
Copy link
Member

Hi @gikeihi , This is because the ElasticSearchVectorStore's document object has the embeddings field mapped to "embedding" and by default the index mapping is also configured to use the same field name "embedding" as in here.

@gikeihi
Copy link
Author

gikeihi commented Jan 20, 2025

@ilayaperumalg
Thank you for your reply. I’d like to know why. Why can’t this field be configured? I already have an index whose vector field is “vector.” What should I do?

@ilayaperumalg
Copy link
Member

@gikeihi I agree this should be configurable. I will keep this issue open to track this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants