0

I need some help in understanding the following things,

  1. I am using composer for elasticsearch php integration. I have created a html page to post form data into elasticsearch. I am trying to access the html page from another pc by changing the localhost ip to the system ip where i have hosted the html page. But i'm getting error.

Fatal error: Uncaught Elasticsearch\Common\Exceptions\NoNodesAvailableException: No alive nodes found in your cluster in C:\xampp\htdocs\Client_portal\vendor\elasticsearch\elasticsearch\src\Elasticsearch\ConnectionPool\StaticNoPingConnectionPool.php:50 Stack trace: #0 C:\xampp\htdocs\Client_portal\vendor\elasticsearch\elasticsearch\src\Elasticsearch\Transport.php(77): Elasticsearch\ConnectionPool\StaticNoPingConnectionPool->nextConnection() #1 C:\xampp\htdocs\Client_portal\vendor\elasticsearch\elasticsearch\src\Elasticsearch\Transport.php(94): Elasticsearch\Transport->getConnection() #2 C:\xampp\htdocs\Client_portal\vendor\elasticsearch\elasticsearch\src\Elasticsearch\Connections\Connection.php(269): Elasticsearch\Transport->performRequest('POST', '/sib_api/_doc', Array, '{"requestid":"#...', Array) #3 C:\xampp\htdocs\Client_portal\vendor\react\promise\src\FulfilledPromise.php(25): Elasticsearch\Connections\Connection->Elasticsearch\Connections{closure}(Array) #4 C:\xampp\htdocs\Client_portal\vendor\guzzlehttp\ringphp\sr in C:\xampp\htdocs\Client_portal\vendor\elasticsearch\elasticsearch\src\Elasticsearch\ConnectionPool\StaticNoPingConnectionPool.php on line 50

  1. To resolve the above issue i tried to call the autoload.php file using the complete path (i.e) http://localhost:8080/client_portal/vendor/autoload.php

But now I am getting another error

Fatal error: Uncaught Error: Class 'Elasticsearch\ClientBuilder' not found in C:\xampp\htdocs\Client_portal\Elastic_api.php:19 Stack trace: #0 {main} thrown in C:\xampp\htdocs\Client_portal\Elastic_api.php on line 19

Could someone help me to resolve this issue... and also guide me how to access my html page from another system without any isssues.

<?php
session_start();

$Engagement = $_SESSION["Engagement"];
$Application = $_SESSION["Application"];
$Priority = $_SESSION["Priority"];
$Requestid = $_SESSION["Requestid"];
$_SESSION["URL"] = $_POST['url'];
$_SESSION["REQ"] = $_POST['request'];
$_SESSION["RES"] = $_POST['response'];
$_SESSION["yn"] = $_POST['YN'];
$_SESSION["START"] = $_POST['start'];
$_SESSION["END"] = $_POST['end'];

if (isset($_POST['Submit2']))
{
 require 'http://localhost:8080/client_portal/vendor/autoload.php';

 $client = Elasticsearch\ClientBuilder::create()->build();

// the above line is where i'm getting the error...

Nicolai Fröhlich
  • 51,330
  • 11
  • 126
  • 130
  • Well ... the message `No alive nodes found in your cluster` is pretty clear. You don't pass any ip and/or port of your elacticsearch instance to the `ClientBuilder` (... at least in the code you've posted). This looks like a simple connection-issue to me. Where is your elasticsearch instance hosted? – Nicolai Fröhlich Aug 03 '19 at 13:08
  • Elasticsearch is hosted locally(localhost) – Purushoth Kumar Aug 05 '19 at 04:51

0 Answers0