ELK
[Elasticsearch] "The [index] request must be terminated by a newline [\n]"
코린이예요
2019. 4. 22. 17:19
반응형
postman으로 elasticsearch post 명령어를 날리는데 자꾸 개행 문자 관련 에러가 발생하였다.
{
"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
}
body 부분에서 JSON(application/json) new line이 시작될때 엔터를 쳐서 개행을 만들어줘야 한다.
변경 전
{"index":"classes-*","ignore_unavailable":true,"preference":1555916089901}
{"aggs":{"devId":{"cardinality":{"field":"devId.keyword"}}},"size":0,"_source":{"excludes":[]},"stored_fields":["*"],"script_fields":{},"docvalue_fields":[{"field":"@timestamp","format":"date_time"},{"field":"time","format":"date_time"}],"query":{"bool":{"must":[{"match_all":{}},{"match_all":{}},{"range":{"@timestamp":{"gte":1555340400000,"lte":1555945199000,"format":"epoch_millis"}}}],"filter":[],"should":[],"must_not":[]}},"timeout":"30000ms"}
변경 후
{"index":"classes-*","ignore_unavailable":true,"preference":1555916089901}
{"aggs":{"devId":{"cardinality":{"field":"devId.keyword"}}},"size":0,"_source":{"excludes":[]},"stored_fields":["*"],"script_fields":{},"docvalue_fields":[{"field":"@timestamp","format":"date_time"},{"field":"time","format":"date_time"}],"query":{"bool":{"must":[{"match_all":{}},{"match_all":{}},{"range":{"@timestamp":{"gte":1555340400000,"lte":1555945199000,"format":"epoch_millis"}}}],"filter":[],"should":[],"must_not":[]}},"timeout":"30000ms"}
반응형