I have cloned this code on my local. Only instead of pointing to local elastic search, pointing to elasticsearch cloud. And trying to search all using following command:
$ node search_all.js
Getting Error:
retrieving all documents (displaying 20 at a time)...
{ Error: [security_exception] action [indices:data/read/search] requires authentication, with { header={ WWW-Authenticate="Basic realm="security" charset="UTF-8"" } }
at respond (/home/hp/prita/node-elasticsearch/node_modules/elasticsearch/src/lib/transport.js:308:15)
at checkRespForFailure (/home/hp/prita/node-elasticsearch/node_modules/elasticsearch/src/lib/transport.js:267:7)
at HttpConnector. (/home/hp/prita/node-elasticsearch/node_modules/elasticsearch/src/lib/connectors/http.js:165:7)
at IncomingMessage.wrapper (/home/hp/prita/node-elasticsearch/node_modules/lodash/lodash.js:4949:19)
at emitNone (events.js:91:20)
at IncomingMessage.emit (events.js:185:7)
at endReadableNT (_stream_readable.js:974:12)
at _combinedTickCallback (internal/process/next_tick.js:80:11)
at process._tickCallback (internal/process/next_tick.js:104:9)
status: 401,
displayName: 'AuthenticationException',
message: '[security_exception] action [indices:data/read/search] requires authentication, with { header={ WWW-Authenticate="Basic realm=\"security\" charset=\"UTF-8\"" } }',
path: '/library/_search',
query: {},
body:
{ error:
{ root_cause: [Object],
type: 'security_exception',
reason: 'action [indices:data/read/search] requires authentication',
header: [Object] },
status: 401 },
statusCode: 401,
response: '{"error":{"root_cause":[{"type":"security_exception","reason":"action [indices:data/read/search] requires authentication","header":{"WWW-Authenticate":"Basic realm=\"security\" charset=\"UTF-8\""}}],"type":"security_exception","reason":"action [indices:data/read/search] requires authentication","header":{"WWW-Authenticate":"Basic realm=\"security\" charset=\"UTF-8\""}},"status":401}',
wwwAuthenticateDirective: 'Basic realm="security" charset="UTF-8"',
toString: [Function],
toJSON: [Function] }
Hi, have you solved this problem? I have the same :(