I'm trying to connect my Magento to AWS elasticsearch service but I can't get a successfull connection.
Magento is running on an AWS EC2 instance which the IP address is allowed on Elasticsearch access policy. ES is version 6.8, and Magento 2.3.1.
In
stores configuration> Catalog> Catalog> Catalog Search
I've tryed to configure it with the given endpoint in ES service admin panel on AWS, with ports 9200, 9300, 443, 80 and could not connect
My Elasticsearch doesn't have an user and pass to set HTTP auth.
Does anyone have made this integration and can help me out?
Thanks!
-
Id suggest you take a look at this cloudways.com/blog/configuring-elasticsearch-magento explains the process in detailDava Gordon– Dava Gordon2019年08月19日 14:21:13 +00:00Commented Aug 19, 2019 at 14:21
-
did you figure out a solution? i'm interested in setting that up as wellMage Explorer– Mage Explorer2019年10月03日 00:52:58 +00:00Commented Oct 3, 2019 at 0:52
-
@Kris Wen, not yet. I stoped working on this but now I'm back, if I find something useful I'll let you know, please do the same!Igor– Igor2019年10月03日 13:01:31 +00:00Commented Oct 3, 2019 at 13:01
-
@igor Thank you,Upon my researches yesterday. Seems like AWS Elasticsearch is not the best fit. github.com/Smile-SA/elasticsuite/issues/379Mage Explorer– Mage Explorer2019年10月03日 18:45:01 +00:00Commented Oct 3, 2019 at 18:45
-
@igor by the way, i found it online that you can probably hosted elasticsearch engine using free plan from here. openshift.com/products/onlineMage Explorer– Mage Explorer2019年10月03日 18:53:26 +00:00Commented Oct 3, 2019 at 18:53
5 Answers 5
I was able to make the connection by making Nginx changes. I created a configuration file for nginx to proxy messages to my AWS ES.
So in my /etc/nginx/conf.d/ a .conf file with the following content:
server {
listen 8080;
location / {
proxy_pass https://myAwsElasticsearchServiceEndpoint.com;
}
}
Then in
"stores configuration> Catalog> Catalog> Catalog Search"
I configured:
- Search Engine: Elasticsearch 6.0+
- Elasticsearch Server Hostname: https://myAwsElasticsearchServiceEndpoint.com
- Elasticsearch Server Port: 8080
A successfull connection was made, and running reindex I could comprove that data was sent to AWS ES.
If someone knows a better way or why this way is not good please let me know!
Thanks!
-
not sure why you need to proxy external connection...MagenX– MagenX2019年10月08日 20:06:29 +00:00Commented Oct 8, 2019 at 20:06
My AWS Elasticsearch Cluster is in AWS VPC and so is my AWS EC2 Magento Instance.
The AWS Security Group has HTTP (80) and HTTPS (443) ports allowed as Inbound Rules associated with the AWS Elasticsearch Cluster.
I used the following configurations:
- Search Engine: Elasticsearch 6.0+
- Elasticsearch Server Hostname: https://MyAWSElasticsearchServiceEndpoint.com
- Elasticsearch Server Port: 80
-
I can confirm using 2.3 and AWS elastic search 6.0 and deployed in the same VPC as the ec2 instance was successful with no need for a reverse proxyasherrard– asherrard2020年07月24日 21:56:40 +00:00Commented Jul 24, 2020 at 21:56
I also wasn't able to connect to AWS Elasticsearch when Magento 2 runs at another hoster.
Using the described solution from above worked, although the configuratio in Magento 2 backend is like this:
- Elasticsearch Server Hostname:
127.0.0.1- it connects to your local server, do not put the AWS ES endpoint here - ...
P.S. For those asking why using a proxy is a good thing, check Magento dev docs.
If you are using AWS Elasticseach service then try 443 port in Magento Elasticsearch service settings.
Use port 443 and make sure you don't have a trailing slash on the hostname.
This fails:
https://vpc-domain-name-identifier.region.es.amazonaws.com/
This succeeds:
https://vpc-domain-name-identifier.region.es.amazonaws.com