Skip to content

Conversation

@l-trotta
Copy link
Contributor

@l-trotta l-trotta commented Sep 6, 2024

Fixes #1316 as discussed in the issue, also updates the documentation to better explain the various index initialization possibilities.

Added user-agent header to the elasticsearch client configuration. This is what we at Elastic will use to keep track of the usage of Spring AI, so that we can see statistics in the Elastic Cloud metrics, better understand the needs of Spring users and contribute more to the project.

@sobychacko sobychacko merged commit 4f62ac1 into spring-projects:main Sep 9, 2024
1 check passed
@sobychacko
Copy link
Contributor

Looks good. Squashed the commits and merged upstream. Thanks!

@l-trotta
Copy link
Contributor Author

l-trotta commented Sep 9, 2024

I forgot to add a unit test I wrote :') can I create another PR?

@sobychacko
Copy link
Contributor

@l-trotta, of course!

@l-trotta
Copy link
Contributor Author

here it is, thank you!

@sobychacko
Copy link
Contributor

@l-trotta When you added the user-agent header, is there a reason you didn't do it on the RestClient dIrectly? Also, we are considering adding this header across all the vector stores, and I was wondering how you tested this for Elasticsearch. Thanks!

@l-trotta
Copy link
Contributor Author

@sobychacko the RestClient would usually be the place where to put headers, but it this case its configuration is either:

  • up to the user when creating the bean
  • up to spring-boot when using autoconfigure

So the only way to add a header is to use the override that we have in the high level client.
I tested it by checking our internal monitoring tool where requests are saved and catalogued, so not with a simple Elasticsearch instance (and noticed that I actually set it wrong, here's the fix ^^").

About other vector stores, I'd probably check whether they use user-agent as a relevant header and if possible prepend spring-ai to the original value, or rebuilt it like I did in the new PR.

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.

Elasticsearch vector store - Wrong error reported when missing index

2 participants