Magento 2 and ElasticSearch errors. Connection Failed. Test again?












2















i need some help with configuring my elastic search on magento 2.2.3 and i'm using ES 2.3.



I login and configure here: Click Stores > Settings > Configuration > Catalog > Catalog > Catalog Search.



It's on a remote aws server and i know it's configured on port 443 so i changed the port to 443 rather than 9200 and i've changed the Elasticsearch Server Hostname to the correct endpoint.




  • telnet from admin to ES works


as does curl




  • so not a network / firewall iss

  • Elasticsearch Index Prefix is correct

  • cluster name is correct


After that i followed these instructions here: https://docs.aws.amazon.com/elasticsearch-service/latest/developerguide/es-gsg-upload-data.html




  • I was able to upload a new search document and then I was able to retrieve it as well. So once again the networking between the two is good.


Is there a php dependency that i'm missing or a third party magento plugin that needs to be installed to assist? Please help. Thanks in advance.










share|improve this question



























    2















    i need some help with configuring my elastic search on magento 2.2.3 and i'm using ES 2.3.



    I login and configure here: Click Stores > Settings > Configuration > Catalog > Catalog > Catalog Search.



    It's on a remote aws server and i know it's configured on port 443 so i changed the port to 443 rather than 9200 and i've changed the Elasticsearch Server Hostname to the correct endpoint.




    • telnet from admin to ES works


    as does curl




    • so not a network / firewall iss

    • Elasticsearch Index Prefix is correct

    • cluster name is correct


    After that i followed these instructions here: https://docs.aws.amazon.com/elasticsearch-service/latest/developerguide/es-gsg-upload-data.html




    • I was able to upload a new search document and then I was able to retrieve it as well. So once again the networking between the two is good.


    Is there a php dependency that i'm missing or a third party magento plugin that needs to be installed to assist? Please help. Thanks in advance.










    share|improve this question

























      2












      2








      2








      i need some help with configuring my elastic search on magento 2.2.3 and i'm using ES 2.3.



      I login and configure here: Click Stores > Settings > Configuration > Catalog > Catalog > Catalog Search.



      It's on a remote aws server and i know it's configured on port 443 so i changed the port to 443 rather than 9200 and i've changed the Elasticsearch Server Hostname to the correct endpoint.




      • telnet from admin to ES works


      as does curl




      • so not a network / firewall iss

      • Elasticsearch Index Prefix is correct

      • cluster name is correct


      After that i followed these instructions here: https://docs.aws.amazon.com/elasticsearch-service/latest/developerguide/es-gsg-upload-data.html




      • I was able to upload a new search document and then I was able to retrieve it as well. So once again the networking between the two is good.


      Is there a php dependency that i'm missing or a third party magento plugin that needs to be installed to assist? Please help. Thanks in advance.










      share|improve this question














      i need some help with configuring my elastic search on magento 2.2.3 and i'm using ES 2.3.



      I login and configure here: Click Stores > Settings > Configuration > Catalog > Catalog > Catalog Search.



      It's on a remote aws server and i know it's configured on port 443 so i changed the port to 443 rather than 9200 and i've changed the Elasticsearch Server Hostname to the correct endpoint.




      • telnet from admin to ES works


      as does curl




      • so not a network / firewall iss

      • Elasticsearch Index Prefix is correct

      • cluster name is correct


      After that i followed these instructions here: https://docs.aws.amazon.com/elasticsearch-service/latest/developerguide/es-gsg-upload-data.html




      • I was able to upload a new search document and then I was able to retrieve it as well. So once again the networking between the two is good.


      Is there a php dependency that i'm missing or a third party magento plugin that needs to be installed to assist? Please help. Thanks in advance.







      magento2.2.3 curl elasticsearch






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked May 24 '18 at 17:37









      SupplementSupplement

      2117




      2117






















          2 Answers
          2






          active

          oldest

          votes


















          0














          After going through the standard magento docs and aws docs we realized it wasn't connecting successfully. We believe it was because magento is sending non-SSL packets to the ElasticSearch server but ES is only listening for (443) SSL. Changing what Nginx was listening for and to proxy AWS Elasticsearch seemed to fix the problem. This may only be a temp. solution. It would be good to talk to magento and see what they recommend.



          If anyone else has any input than that would be great too. Unfortunately it appears in my magento account I can no longer submit tickets so reaching out to magento has become obsolete.



          /var/www/html/vendor/magento/module-elasticsearch



            /**
          * @param array $options
          * @return array
          */
          private function buildConfig($options = )
          {
          $host = preg_replace('/http[s]?:///i', '', $options['hostname']);
          $protocol = parse_url($options['hostname'], PHP_URL_SCHEME);
          if (!$protocol) {
          $protocol = 'http';
          }
          if (!empty($options['port'])) {
          $host .= ':' . $options['port'];
          }
          if (!empty($options['enableAuth']) && ($options['enableAuth'] == 1)) {
          $host = sprintf('%s://%s:%s@%s', $protocol, $options['username'], $options['password'], $host);
          }

          $options['hosts'] = [$host];
          return $options;
          }


          If anyone is interested I can post the Nginx configurations too.






          share|improve this answer































            0














            Unfortunately I also had this problem, I figured the best solution was to use Nginx to proxy HTTP requests internally through to AWS ElasticSearch. The config is:



            server {
            server_name localhost;
            listen 8080;

            location / {
            proxy_pass https://your-amazon-vpc-url-here.es.amazonaws.com;
            proxy_set_header Host $host;
            proxy_redirect off;
            proxy_set_header X-Real-IP $remote_addr;
            proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
            }
            }


            Within Magento2 then I set host as localhost and port as 8080 - works fine.





            share








            New contributor




            Hunter James is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
            Check out our Code of Conduct.




















              Your Answer








              StackExchange.ready(function() {
              var channelOptions = {
              tags: "".split(" "),
              id: "479"
              };
              initTagRenderer("".split(" "), "".split(" "), channelOptions);

              StackExchange.using("externalEditor", function() {
              // Have to fire editor after snippets, if snippets enabled
              if (StackExchange.settings.snippets.snippetsEnabled) {
              StackExchange.using("snippets", function() {
              createEditor();
              });
              }
              else {
              createEditor();
              }
              });

              function createEditor() {
              StackExchange.prepareEditor({
              heartbeatType: 'answer',
              autoActivateHeartbeat: false,
              convertImagesToLinks: false,
              noModals: true,
              showLowRepImageUploadWarning: true,
              reputationToPostImages: null,
              bindNavPrevention: true,
              postfix: "",
              imageUploader: {
              brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
              contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
              allowUrls: true
              },
              onDemand: true,
              discardSelector: ".discard-answer"
              ,immediatelyShowMarkdownHelp:true
              });


              }
              });














              draft saved

              draft discarded


















              StackExchange.ready(
              function () {
              StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f227420%2fmagento-2-and-elasticsearch-errors-connection-failed-test-again%23new-answer', 'question_page');
              }
              );

              Post as a guest















              Required, but never shown

























              2 Answers
              2






              active

              oldest

              votes








              2 Answers
              2






              active

              oldest

              votes









              active

              oldest

              votes






              active

              oldest

              votes









              0














              After going through the standard magento docs and aws docs we realized it wasn't connecting successfully. We believe it was because magento is sending non-SSL packets to the ElasticSearch server but ES is only listening for (443) SSL. Changing what Nginx was listening for and to proxy AWS Elasticsearch seemed to fix the problem. This may only be a temp. solution. It would be good to talk to magento and see what they recommend.



              If anyone else has any input than that would be great too. Unfortunately it appears in my magento account I can no longer submit tickets so reaching out to magento has become obsolete.



              /var/www/html/vendor/magento/module-elasticsearch



                /**
              * @param array $options
              * @return array
              */
              private function buildConfig($options = )
              {
              $host = preg_replace('/http[s]?:///i', '', $options['hostname']);
              $protocol = parse_url($options['hostname'], PHP_URL_SCHEME);
              if (!$protocol) {
              $protocol = 'http';
              }
              if (!empty($options['port'])) {
              $host .= ':' . $options['port'];
              }
              if (!empty($options['enableAuth']) && ($options['enableAuth'] == 1)) {
              $host = sprintf('%s://%s:%s@%s', $protocol, $options['username'], $options['password'], $host);
              }

              $options['hosts'] = [$host];
              return $options;
              }


              If anyone is interested I can post the Nginx configurations too.






              share|improve this answer




























                0














                After going through the standard magento docs and aws docs we realized it wasn't connecting successfully. We believe it was because magento is sending non-SSL packets to the ElasticSearch server but ES is only listening for (443) SSL. Changing what Nginx was listening for and to proxy AWS Elasticsearch seemed to fix the problem. This may only be a temp. solution. It would be good to talk to magento and see what they recommend.



                If anyone else has any input than that would be great too. Unfortunately it appears in my magento account I can no longer submit tickets so reaching out to magento has become obsolete.



                /var/www/html/vendor/magento/module-elasticsearch



                  /**
                * @param array $options
                * @return array
                */
                private function buildConfig($options = )
                {
                $host = preg_replace('/http[s]?:///i', '', $options['hostname']);
                $protocol = parse_url($options['hostname'], PHP_URL_SCHEME);
                if (!$protocol) {
                $protocol = 'http';
                }
                if (!empty($options['port'])) {
                $host .= ':' . $options['port'];
                }
                if (!empty($options['enableAuth']) && ($options['enableAuth'] == 1)) {
                $host = sprintf('%s://%s:%s@%s', $protocol, $options['username'], $options['password'], $host);
                }

                $options['hosts'] = [$host];
                return $options;
                }


                If anyone is interested I can post the Nginx configurations too.






                share|improve this answer


























                  0












                  0








                  0







                  After going through the standard magento docs and aws docs we realized it wasn't connecting successfully. We believe it was because magento is sending non-SSL packets to the ElasticSearch server but ES is only listening for (443) SSL. Changing what Nginx was listening for and to proxy AWS Elasticsearch seemed to fix the problem. This may only be a temp. solution. It would be good to talk to magento and see what they recommend.



                  If anyone else has any input than that would be great too. Unfortunately it appears in my magento account I can no longer submit tickets so reaching out to magento has become obsolete.



                  /var/www/html/vendor/magento/module-elasticsearch



                    /**
                  * @param array $options
                  * @return array
                  */
                  private function buildConfig($options = )
                  {
                  $host = preg_replace('/http[s]?:///i', '', $options['hostname']);
                  $protocol = parse_url($options['hostname'], PHP_URL_SCHEME);
                  if (!$protocol) {
                  $protocol = 'http';
                  }
                  if (!empty($options['port'])) {
                  $host .= ':' . $options['port'];
                  }
                  if (!empty($options['enableAuth']) && ($options['enableAuth'] == 1)) {
                  $host = sprintf('%s://%s:%s@%s', $protocol, $options['username'], $options['password'], $host);
                  }

                  $options['hosts'] = [$host];
                  return $options;
                  }


                  If anyone is interested I can post the Nginx configurations too.






                  share|improve this answer













                  After going through the standard magento docs and aws docs we realized it wasn't connecting successfully. We believe it was because magento is sending non-SSL packets to the ElasticSearch server but ES is only listening for (443) SSL. Changing what Nginx was listening for and to proxy AWS Elasticsearch seemed to fix the problem. This may only be a temp. solution. It would be good to talk to magento and see what they recommend.



                  If anyone else has any input than that would be great too. Unfortunately it appears in my magento account I can no longer submit tickets so reaching out to magento has become obsolete.



                  /var/www/html/vendor/magento/module-elasticsearch



                    /**
                  * @param array $options
                  * @return array
                  */
                  private function buildConfig($options = )
                  {
                  $host = preg_replace('/http[s]?:///i', '', $options['hostname']);
                  $protocol = parse_url($options['hostname'], PHP_URL_SCHEME);
                  if (!$protocol) {
                  $protocol = 'http';
                  }
                  if (!empty($options['port'])) {
                  $host .= ':' . $options['port'];
                  }
                  if (!empty($options['enableAuth']) && ($options['enableAuth'] == 1)) {
                  $host = sprintf('%s://%s:%s@%s', $protocol, $options['username'], $options['password'], $host);
                  }

                  $options['hosts'] = [$host];
                  return $options;
                  }


                  If anyone is interested I can post the Nginx configurations too.







                  share|improve this answer












                  share|improve this answer



                  share|improve this answer










                  answered May 25 '18 at 14:40









                  SupplementSupplement

                  2117




                  2117

























                      0














                      Unfortunately I also had this problem, I figured the best solution was to use Nginx to proxy HTTP requests internally through to AWS ElasticSearch. The config is:



                      server {
                      server_name localhost;
                      listen 8080;

                      location / {
                      proxy_pass https://your-amazon-vpc-url-here.es.amazonaws.com;
                      proxy_set_header Host $host;
                      proxy_redirect off;
                      proxy_set_header X-Real-IP $remote_addr;
                      proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
                      }
                      }


                      Within Magento2 then I set host as localhost and port as 8080 - works fine.





                      share








                      New contributor




                      Hunter James is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                      Check out our Code of Conduct.

























                        0














                        Unfortunately I also had this problem, I figured the best solution was to use Nginx to proxy HTTP requests internally through to AWS ElasticSearch. The config is:



                        server {
                        server_name localhost;
                        listen 8080;

                        location / {
                        proxy_pass https://your-amazon-vpc-url-here.es.amazonaws.com;
                        proxy_set_header Host $host;
                        proxy_redirect off;
                        proxy_set_header X-Real-IP $remote_addr;
                        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
                        }
                        }


                        Within Magento2 then I set host as localhost and port as 8080 - works fine.





                        share








                        New contributor




                        Hunter James is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                        Check out our Code of Conduct.























                          0












                          0








                          0







                          Unfortunately I also had this problem, I figured the best solution was to use Nginx to proxy HTTP requests internally through to AWS ElasticSearch. The config is:



                          server {
                          server_name localhost;
                          listen 8080;

                          location / {
                          proxy_pass https://your-amazon-vpc-url-here.es.amazonaws.com;
                          proxy_set_header Host $host;
                          proxy_redirect off;
                          proxy_set_header X-Real-IP $remote_addr;
                          proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
                          }
                          }


                          Within Magento2 then I set host as localhost and port as 8080 - works fine.





                          share








                          New contributor




                          Hunter James is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                          Check out our Code of Conduct.










                          Unfortunately I also had this problem, I figured the best solution was to use Nginx to proxy HTTP requests internally through to AWS ElasticSearch. The config is:



                          server {
                          server_name localhost;
                          listen 8080;

                          location / {
                          proxy_pass https://your-amazon-vpc-url-here.es.amazonaws.com;
                          proxy_set_header Host $host;
                          proxy_redirect off;
                          proxy_set_header X-Real-IP $remote_addr;
                          proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
                          }
                          }


                          Within Magento2 then I set host as localhost and port as 8080 - works fine.






                          share








                          New contributor




                          Hunter James is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                          Check out our Code of Conduct.








                          share


                          share






                          New contributor




                          Hunter James is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                          Check out our Code of Conduct.









                          answered 9 mins ago









                          Hunter JamesHunter James

                          1




                          1




                          New contributor




                          Hunter James is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                          Check out our Code of Conduct.





                          New contributor





                          Hunter James is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                          Check out our Code of Conduct.






                          Hunter James is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                          Check out our Code of Conduct.






























                              draft saved

                              draft discarded




















































                              Thanks for contributing an answer to Magento Stack Exchange!


                              • Please be sure to answer the question. Provide details and share your research!

                              But avoid



                              • Asking for help, clarification, or responding to other answers.

                              • Making statements based on opinion; back them up with references or personal experience.


                              To learn more, see our tips on writing great answers.




                              draft saved


                              draft discarded














                              StackExchange.ready(
                              function () {
                              StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f227420%2fmagento-2-and-elasticsearch-errors-connection-failed-test-again%23new-answer', 'question_page');
                              }
                              );

                              Post as a guest















                              Required, but never shown





















































                              Required, but never shown














                              Required, but never shown












                              Required, but never shown







                              Required, but never shown

































                              Required, but never shown














                              Required, but never shown












                              Required, but never shown







                              Required, but never shown







                              Popular posts from this blog

                              Magento 2 controller redirect on button click in phtml file

                              Polycentropodidae