Guides on getting Elastic 8 working with a Java backend?

Hello. Been working in Java to try getting Elasticsearch up and working in a Java backend and not having good luck with finding examples of how to have it working.

A lot of the materials I've seen use RestHighLevelClient which is deprecated. And when looking at the newer examples from here I'm having a hard time understanding which files those snippets are meant to be in.

Plus the api key portion of that example is also something I'm having difficulty with. I tried using Postman to send a request to localhost:9200/_security/api_key but got back and error due ot missing credentials for REST request. Are there additional parameters I need to include there to get the key?

My overall goal here is to create a Java backend with a RESTful API that can get called from a frontend application. The frontend will take care of user interface and creating new documents. The backend will then take care of getting information from Elasticsearch and then sending it back.

So what are some good resources to further help in figuring this out? Or am I going down a wrong path? (And apologies if I have the forum/tag wrong.)

Edit: One thing to add, I'm specifically using the Springboot framework.

Hi @DenverCoder9,

Sounds like you're trying to run before you've learned to walk. :slight_smile:

I suggest you focus first on understanding Elasticearch, how it works, and how to interact with it just through a pure REST interface (cURL or Postman) and then worry about the Java language client and how to integrate with Spring Boot.

If you've got Elasticsearch running but can't authenticate yet, check out: Built-in users | Elasticsearch Guide [8.11] | Elastic

Most folks make their first Elasticsearch requests using the elastic built-in user, and basic authentication. With cURL, that'll look like:

curl -XGET -u elastic:<password> localhost:9200

I strongly recommend you also set up Kibana, which will give you a UI, so that you can log in through your browser with that same username/password and explore creating API keys, indices, using Kibana dev tools, etc. At that point, you could follow this getting started guide: Quick start | Elasticsearch Guide [8.11] | Elastic

1 Like

Hi @DenverCoder9 Welcome to the community...

Also did you see the basic examples here?

There are samples for

Definitely feels like it. :slight_smile: Overall goal in the end is a fullstack app searching .docx, .pdf, .txt etc. So tried going a bit ahead.

I do have Kibana already so at least I've got that. But definitely looks like I'll have to read through that guide and stephen's resource to get back to basics before trying next steps. Thank you very much for the help.

In general, would it be better to open another thread if I have more questions soon or to keep on with this one? (Not sure on all the etiquette of this forum.)

You know you do not need to build a full java app for this ... this is exactly What The Enterprise Search / App Search does OOTB for you :slight_smile:

Unless you are doing this for a learning exercise...

What version are on?

Where would I read more about that? Is this the correct link? https://www.elastic.co/guide/en/enterprise-search/current/index.html

I'll need to see if that fulfills the requirements doc. It's been a small team of us, mostly new to the field, working on it so we've been having some difficulties figuring out which direction to go.

Edit: For Elasticsearch we're using version 8.1

8.1 or 8.11?

Make sure you are looking at the right docs .. .but Yes, under Enterprise Search.

Technically Workplace Search has the .pdf / word connectors etc..

This is all going under a bit of change right now so just want to be sure which version you are on... and what you have installed?

Enterprise Search

This is a casual place. BUT, if you think you're going to have a lot of questions and need some more rapid back-and-forth, might I suggest you check out our community slack? Specifically if you end up trying out App Search or one of our document store connectors, you can find the relevant team (my team) in the #search-enterprise channel.

Looking at the full name, 8.10.4 would be the one and then Kibana is 8.10.2

@Sean, thanks for the Slack link. I'll keep it in mind.

So look at the links I provided above and there is a little Version Selector and make sure you look at the correct docs...

You might as well upgrade to 8.11.2 soon ... anyways :slight_smile:

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.