我正在尝试对 Elasticsearch API 执行 GET 请求 这种形式需要什么
GET /_search
{
"query": {
"more_like_this" : {
"fields" : ["title", "description"],
"like" : "Once upon a time",
"min_term_freq" : 1,
"max_query_terms" : 12
}
}
}
我用了request 但我找不到如何将正文添加到请求中。
有什么帮助吗?
最佳答案
可以查看request(options, callback)的文档
此外,GET
方法不应发送任何正文,请确认它不是 POST
。
request.get('http://localhost:8092/_search', {
json: true,
body: {
"query": {
"more_like_this" : {
"fields" : ["title", "description"],
"like" : "Once upon a time",
"min_term_freq" : 1,
"max_query_terms" : 12
}
}
}
})
关于javascript - 使用 body 执行 Get 请求 - Node js,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51020725/