Using elasticsearch-php on Laravel 5 through Shift31/laravel-elasticsearch (provides facade for elasticsearch-php). Hosting an ES instance on Facetflow.
config/elasticsearch.php:
return array(
'hosts' => array(
'https://[email protected]:443'
)
);
WelcomeController.php:
public function elasticsearch()
{
$searchParams['index'] = 'your_index';
$searchParams['size'] = 50;
$searchParams['body']['query']['query_string']['query'] = 'foofield:barstring';
return Es::search($searchParams);
// throws Authentication401Exception exception
}
This returns Authentication401Exception. My guess is the username is not passed to the Facetflow server, but I have not found a way to check if this is true.
The problem does not seem to be in the server's settings, because when I use plain curl, I get a 200 response:
public function justCurl()
{
$ch = curl_init();
// Now set some options (most are optional)
// Set URL to download
curl_setopt($ch, CURLOPT_URL, "https://[email protected]:443");
// Download the given URL, and return output
$output = curl_exec($ch);
// Close the cURL resource, and free system resources
curl_close($ch);
return $output;
// returns 200 response
}
How do I fix this issue?