我有一个在本地运行的 ElasticSearch 实例,运行良好。现在我想使用 SQL 查询索引。我使用 NodeJS-Client (v7) 进行了尝试,并且通常通过 REST-Api 进行了尝试。 休息通话:
POST http://localhost:9200/_sql
{
"body": {
"query": "DESCRIBE indexname"
}
}
通过nodeJS:
elasticClient.sql.query({
format: "json",
body: {
query: "DESCRIBE indexname"
}
}).then(result => {
console.log(result);
}).catch(reject => {
console.log(reject);
});
两者都返回相同的错误:
Incorrect HTTP method for uri [/_sql] and method [POST], allowed: [GET, HEAD, PUT, DELETE] status: 405
有人可以帮忙吗? 干杯!
最佳答案
尝试
GET http://localhost:9200/_sql
{
"body": {
"query": "DESCRIBE indexname"
}
}
关于node.js - Elasticsearch SQL 查询不可能,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57149471/