【发布时间】:2016-01-27 21:21:08
【问题描述】:
我正在尝试使用插入文档 api 的自动增量 id 功能向我的 elasticsearch 索引发出原始 NodeJS http 请求。
所以这适用于curl:
curl -XPOST http://host:3333/catalog/products -d '{ "hello": "world" }'
但是当我通过这个在 nodejs 中尝试相同的操作时:
var http = require('http');
var options = {
protocol: 'http:',
mehtod: 'PUT',
hostname: 'host',
port: 3333,
path: '/catalog/products/'
}
http.request(options, ...);
它返回这个错误:
No handler found for uri [/catalog/products/] and method [PUT]
但是,如果我将 id 添加到该路径的末尾,它将起作用。这里有什么问题?
【问题讨论】:
标签: elasticsearch