我有点怀疑你在刷屏

elasticsearch _bluk 批量导入操作报错。

Elasticsearch | 作者 xiaojianjian | 发布于2017年08月03日 | 阅读数:3802

官方语法:
action_and_meta_data\n
optional_source\n
action_and_meta_data\n
optional_source\n
....
action_and_meta_data\n
optional_source\n
我执行导入操作,加上\n报错:{"took":2,"errors":true,"items":[{"index":{"_index":"test","_type":"testlog","_id":"1","status":400,"error":{"type":"mapper_parsing_exception","reason":"failed to parse","caused_by":{"type":"json_parse_exception","reason":"Unexpected character ('\\' (code 92)): expected a valid value (number, String, array, object, 'true', 'false' or 'null')\n at [Source: org.elasticsearch.common.io.stream.InputStreamStreamInput@25b8faa5; line: 1, column: 47]"}}}},{"index":{"_index":"test","_type":"testlog","_id":"2","status":400,"error":{"type":"mapper_parsing_exception","reason":"failed to parse","caused_by":{"type":"json_parse_exception","reason":"Unexpected character ('\\' (code 92)): expected a valid value (number, String, array, object, 'true', 'false' or 'null')\n at [Source: org.elasticsearch.common.io.stream.InputStreamStreamInput@3b4fbb46; line: 1, column: 47]"}}}}]}
并且数据录不进去。
不加\n数据录进去了,本来4个文档,值录进去3个,也报错:{"took":113,"errors":false,"items":[{"index":{"_index":"test","_type":"testlog","_id":"1","_version":1,"_shards":{"total":2,"successful":1,"failed":0},"status":201}},{"index":{"_index":"test","_type":"testlog","_id":"2","_version":1,"_shards":{"total":2,"successful":1,"failed":0},"status":201}},{"index":{"_index":"test","_type":"testlog","_id":"3","_version":1,"_shards":{"total":2,"successful":1,"failed":0},"status":201}}]}
我的执行语句:curl -XPOST 'losthost:9200/test/testlog/_bulk' -d '
{ "index": { "_id": 1 }}
{ "price" : 10, "test" : "XHDK-A-1293-#fJ3" }
{ "index": { "_id": 2 }}
{ "price" : 20, "test" : "KDKE-B-9947-#kL5" }
{ "index": { "_id": 3 }}
{ "price" : 30, "test" : "JODL-X-1937-#pV7" }
{ "index": { "_id": 4 }}
{ "price" : 30, "test" : "QQPX-R-3956-#aD8" }'
 
 
 
已邀请:

要回复问题请先登录注册