I am trying to host an Elasticsearch Application on an AWS Server. For this purpose I am using Elastic Enterprise Search. I configured the API connector as follows:
const connector = new AppSearchAPIConnector({
searchKey: "search-gs7t3micqu41z1dsou1ccz95",
engineName: "sentence-similarity",
endpointBase: "http://ec2-18-159-135-25.eu-central-1.compute.amazonaws.com:3002"
});
The application itself is running with npm under port 3000. I enabled both ports in the AWS Security Group.
After starting both Elastic Search and Enterprise Search, after npm start I can also connect to http://ec2-18-159-135-25.eu-central-1.compute.amazonaws.com:3000, so that works. However, once I make an API call over the application, I get the following error:
POST http://ec2-18-159-135-25.eu-central-1.compute.amazonaws.com:3002/api/as/v1/engines/sentence-similarity/search.json net::ERR_CONNECTION_REFUSED
Moreover, when I type curl http://localhost:3002/api/as/v1/engines/sentence-similarity/search.json in the console, I get the following error:
{"error":"You need to sign in or sign up before continuing."}
Therefore I assume, that there is a problem with the connection to Elasticsearch. When I was hosting the application on my local machine, I never encountered this problem.
My ideas, how to possibly fix the problem:
- I had to reinstall Elastic Search and Enterprise Search on the AWS Server. Possibly, something with the authentification went wrong, and I cannot connect to my Elasticsearch engine.
- There are two
.ymlfiles, one for Elastic Search and one for Enterprise Search, which I can configure. Possibly, I have to adjust these, when I host the application not on my local machine.
In any case, I am a beginner in deployment and I need some help for the details. Thank you very much in advance!
EDIT:
After some more research, I believe I identified the problem. It seems like on the AWS server, there is sort of a new Elastic Enterprise instance established. That means, that there is no engine configured yet, which is why the API call fails. How can I connect to my existing engine instead of having to create a new one?