2016-09-17 23 views
0

我下面這個例子:拒絕訪問試圖創建Solr的配置

https://github.com/watson-developer-cloud/node-sdk/blob/master/examples/retrieve_and_rank_solr.v1.js

但每次我試着上傳設定我得到 「錯誤:未經授權:訪問由於憑據無效被拒絕「。

我已經爲Retrieve和Rank創建了一個API密鑰,還有更多的事情可以管理R & R的憑證嗎?

這裏是我的代碼:

return retrieveInstance.uploadConfigAsync({ 
    cluster_id: clusterId, 
    config_name: watsonConfig.config_name, 
    config_zip_path: (__dirname + "/../../" + watsonConfig.config_path) 
}); 

我成功創建這個API密鑰的集羣。 Schema.zip有這樣的schema.xml

<schema name="simple" version="1.5"> 
<fields> 
    <!-- required --> 
    <field name="_version_" type="long" indexed="true" stored="true"/> 

    <field name="id" type="string" indexed="true" stored="true" required="true" /> 
    <field name="question" type="string" indexed="true" stored="true" required="true" /> 
    <field name="answer" type="string" indexed="true" stored="true" required="true" /> 

    <dynamicField name="*_s" type="string" indexed="true" stored="true" /> 
    <dynamicField name="*_ms" type="string" indexed="true" stored="true" multiValued="true" /> 
    <dynamicField name="*_t" type="string" indexed="true" stored="true" /> 
    <dynamicField name="*_i" type="int" indexed="true" stored="true"/> 
    <dynamicField name="*_mi" type="int" indexed="true" stored="true" multiValued="true"/> 
    <dynamicField name="*_l" type="long" indexed="true" stored="true"/> 
    <dynamicField name="*_b" type="boolean" indexed="true" stored="true"/> 
    <dynamicField name="*_f" type="float" indexed="true" stored="true"/> 
    <dynamicField name="*_d" type="double" indexed="true" stored="true"/> 
</fields> 

<uniqueKey>id</uniqueKey> 

    <types> 
    <fieldType name="string" class="solr.StrField" sortMissingLast="true" /> 
    <fieldType name="boolean" class="solr.BoolField" sortMissingLast="true"/> 
    <fieldType name="int" class="solr.TrieIntField" precisionStep="0" positionIncrementGap="0"/> 
    <fieldType name="float" class="solr.TrieFloatField" precisionStep="0" positionIncrementGap="0"/> 
    <fieldType name="long" class="solr.TrieLongField" precisionStep="0" positionIncrementGap="0"/> 
    <fieldType name="double" class="solr.TrieDoubleField" precisionStep="0" positionIncrementGap="0"/> 
    <fieldType name="date" class="solr.TrieDateField" precisionStep="0" positionIncrementGap="0"/> 
    <fieldType name="uuid" class="solr.UUIDField" indexed="true" /> 
    </types> 
</schema> 
+0

確保您擁有該服務的憑據(它們不是您的bluemix電子郵件和密碼),它們是node-sdk正在使用的憑據。您可以執行'NODE_DEBUG =請求app.js'來檢查您的應用正在進行的HTTP調用。 –

回答

0

關於如何訪問憑據詳情可以在這裏找到:https://www.ibm.com/watson/developercloud/doc/retrieve-rank/tutorial.shtml#credentials

綜上所述,從Bluemix網絡信息中心,如果你點擊你的[R & R服務實例,「服務憑證」選項卡將顯示用戶名和密碼。這些不會是您的IBM ID用戶名或密碼。

screenshot of getting the service credentials

這就是說,如果你已經能夠創建一個集羣,這將表明,你已經得到了有效的憑據。你確定集羣創建成功嗎?您是否可以使用在https://www.ibm.com/watson/developercloud/retrieve-and-rank/api/v1/?curl#list_solr_clusters中描述的curl命令獲取羣集詳細信息來確認這一點?

0

老兄,我遇到了同樣的問題。使用教程中的cranfield-solr-config.zip,並將其原始配置文件(schema.xml ...)替換爲您的配置文件。但不要解壓縮zip文件並再次壓縮!我不知道爲什麼會發生這種情況,但它的確如此...但是它確實...