异常:
{
"error": {
"root_cause": [
{
"type": "illegal_argument_exception",
"reason": "The msearch request must be terminated by a newline [\n]"
}
],
"type": "illegal_argument_exception",
"reason": "The msearch request must be terminated by a newline [\n]"
},
"status": 400
}
解决方案:
第一步:在headers中将Content-Type设置为application/x-ndjson 第二步:在body中选择raw,text或json都可以(json的话会有一个格式错误)
第三步:最后一行多一个换行(_msearch方法,要求每一行后面都有一个 \n,最后一行也需要)
参考:
https://www.elastic.co/guide/en/elasticsearch/reference/7.1/multi-search-template.html