const client = new elasticsearch.Client({
host: [
{
host: '35.192.45.130//elasticsearch',
auth: 'user:password',
protocol: 'http',
port: 80
}
]
});
//
await client.ping({
// ping usually has a 3000ms timeout
requestTimeout: 1000
}, function (error) {
if (error) {
console.trace('elasticsearch cluster is down!');
} else {
console.log('All is well');
}
});
我不能授权用离子进行弹性搜索。但是有了邮递员,我已经可以登录并做一些操作了。
错误是
对飞行前请求的响应未通过访问控制检查:请求的资源上不存在“访问控制允许来源”头。起源
http://localhost:8100
因此不允许访问。响应的HTTP状态代码为401。