私は問題に悩まされており解決策を見つけられません。 私のnodejsからelasticSearchクエリを使用したいと思います。 問題は、私はそれを郵便配達員からはできますが、ノードからはできません。Node.jsからelasticSearchの検索クエリを正しく作成するにはどうすればよいですか?
http://user:[email protected]_domain:9200/ra_autocomplete/search
そして、私のnodejsアプリから:
var elasticsearch = require('elasticsearch');
var client = new elasticsearch.Client({
host: 'my_domain',
port : 9200,
protocol : 'http',
auth : 'user:psd',
maxRetries : 2
});
そして、
client.search({
index: "ra_autocomplete",
body: {
query: {
m_prefix : {
r_n : {
query : my_var
}
}
}
}
} , function(err, res) {
console.log(err);
console.log(res);
});
私はこのエラーを取得する:
Error: Not Found at respond (my_path\node_modules\elasticsearch\src\lib\transport.js:307:15) at checkRespForFailure (my_path\node_modules\elasticsearch\src\lib\transport.js:266:7) at HttpConnector. (my_path\node_modules\elasticsearch\src\lib\connectors\http.js:159:7) at IncomingMessage.bound (my_path\node_modules\lodash\dist\lodash.js:729:21) at emitNone (events.js:111:20) at IncomingMessage.emit (events.js:208:7) at endReadableNT (_stream_readable.js:1056:12) at _combinedTickCallback (internal/process/next_tick.js:138:11) at process._tickCallback (internal/process/next_tick.js:180:9) status: 404, displayName: 'NotFound', message: 'Not Found', path: '/roads_autocomplete/_search', query: {}, body: '{"query":{"m_prefix":{"r_n":{"query":"montexte a analyser"}}}}', statusCode: 404, response: '\r\n404 Not Found\r\n\r\n
404 Not Found
\r\n
nginx/1.10.3 (Ubuntu)\r\n\r\n\r\n', toString: [Function], toJSON: [Function] }
すべてのヘルプは、問題をいただければ幸いです私が郵便配達員とそれを作ろうとすると、うまくいく。
ありがとうございます。
Infactは、それはということでした。それが動作するように** 'my_domain:9200' **と ** httpAuth:「PSDユーザーの私は**ホストをしなければなりませんでした。ありがとうございました。 – AsmaG