[英]elasticsearch-php 401 authentication fail
通過Shift31 / laravel-elasticsearch在Laravel 5上使用elasticsearch -php (為elasticsearch -php提供外觀)。 在Facetflow上托管ES實例。
config / elasticsearch.php:
return array(
'hosts' => array(
'https://accessUsername@ilovelasagna.east-us.azr.facetflow.io: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
}
這將返回Authentication401Exception 。 我的猜測是用戶名沒有傳遞給Facetflow服務器,但是我還沒有找到一種檢查方法是否正確。
問題似乎不在於服務器的設置,因為當我使用普通卷曲時,會收到200響應:
public function justCurl()
{
$ch = curl_init();
// Now set some options (most are optional)
// Set URL to download
curl_setopt($ch, CURLOPT_URL, "https://accessUsername@ilovelasagna.east-us.azr.facetflow.io: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
}
如何解決此問題?
Facetflow的快速客戶支持指出了此問題。 主機應被標記為
'https://accessUsername:@ilovelasagna.east-us.azr.facetflow.io:443'
注意accessUsername之后的冒號。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.