2017-06-17 105 views
0

我正在嘗試創建elasticsearch索引並收到超時錯誤。註釋掉的代碼工作正常,所以服務器正在運行並且可以ping通。這裏是我的代碼:嘗試創建elasticsearch索引時出現超時

import * as elasticsearch from "elasticsearch"; 

export const elasticClient = new elasticsearch.Client({ 
    host: 'localhost:9200', 
    log: 'trace', 
    requestTimeout: 30000 
}); 

// elasticClient.ping({ 
// requestTimeout: 30000, 
// }, function (error) { 
// if (error) { 
//  console.error('elasticsearch cluster is down!'); 
// } else { 
//  console.log('All is well'); 
// } 
// }); 

// elasticClient.cluster.health({},function(err:any,resp:any) { 
// console.log("-- Client Health --",resp); 
// }); 

elasticClient.indices.create({ 
    index: 'grr' 
},function(err,resp,status) { 
    if(err) { 
    console.log(err); 
    } 
    else { 
    console.log("create",resp); 
    } 
}); 

以下是錯誤消息:

Elasticsearch INFO: 2017-06-17T02:36:12Z 


Adding connection to http://localhost:9200/ 

Elasticsearch DEBUG: 2017-06-17T02:36:12Z 
    starting request { 
    "method": "PUT", 
    "path": "/grr", 
    "query": {} 
    } 


{ Error: Request Timeout after 30000ms 
    at C:\Users\myname\myproject\node_modules\elasticsearch\src\lib\transport.js:342:15 
    at Timeout.<anonymous> (C:\Users\myname\myproject\node_modules\elasticsearch\src\lib\transport.js:371:7) 
    at ontimeout (timers.js:365:14) 
    at tryOnTimeout (timers.js:237:5) 
    at Timer.listOnTimeout (timers.js:207:5) 
    status: 408, 
    displayName: 'RequestTimeout', 
    message: 'Request Timeout after 30000ms' } 
Elasticsearch TRACE: 2017-06-17T02:36:42Z 
    -> PUT http://localhost:9200/grr 

    <- 0 

我真的在發生的事情的損失。我正在使用elasticsearch.js庫的版本13.1.0

編輯: 我也嘗試使用curl語句(直接從官方網站獲取並修改爲在Windows命令提示符下工作)來創建索引和我有類似的問題,除非它不超時;它只是陷入無限循環。

+0

是否手動發出創建索引工作的請求?什麼版本的ES? – ryanlutgen

+0

5.4.1。我如何手動發出請求?我對這一切都很陌生 – Mike

回答

0

它最終成爲我的Symantec Antivirus!我卸載它,一切正常。

+0

賽門鐵克殺毒軟件可能是最糟糕的一個,就在McAffee旁邊 – ryanlutgen

相關問題