vespa
vespa copied to clipboard
Is there Java Query API?
Required is something like Feed Client - https://docs.vespa.ai/en/vespa-feed-client.html, which works totally fine for me!
Until now I cannot find any Vespa API / Client which does operations described on https://docs.vespa.ai/en/query-api.html and https://docs.vespa.ai/en/nearest-neighbor-search.html.
Thanks in advance!
See #24534 for more details - thanks!
See #24534 for more details - thanks!
ok, thanks for reply. If I understood you correctly, you suggest to write own client, right?
If so, this is exactly what I wanted to avoid 😄 Since the common things like HTTP SSL client with PEM key & cert (at least!!) should be centralized as simple vespa client IMO. Actually the most of the code is already done and is inside of vespa-feed-client
.
What do you think guys?
Yes, you're right. We have not prioritized this because the query side is so simple, but key/cert handling complicates things a bit so this might be worth while now.
Publish sample java code using mTLS
I got this working by using library - https://github.com/Hakky54/sslcontext-kickstart#using-pem-files. Let me know if this is not taken - I can raise a PR
public SimpleHttpClient(String host, String certificate, String privateKey) {
logger.info(">>>>>>>>>>>>\t\tSimpleHttpClient Constructor certificate {} for {}", certificate, host);
X509ExtendedKeyManager keyManagerSTR = PemUtils.parseIdentityMaterial(certificate, privateKey, "secret".toCharArray());
SSLFactory sslFactory = SSLFactory.builder()
.withIdentityMaterial(keyManagerSTR)
.withDefaultTrustMaterial()
.build();
httpClient = HttpClientBuilder.create().setSSLContext(sslFactory.getSslContext()).build();
this.host = host;
}
@ketankhairnar We intend to create a new or extend an existing example in https://github.com/vespa-engine/sample-apps. Feel free to submit a contribution there.
@ketankhairnar FYI https://blog.vespa.ai/announce-tokens-and-anonymous-endpoints/#data-plane-token-authentication
Thanks @bjorncs