本文介绍了弹性搜索“未添加请求”批量API错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我正在Postman发布以下内容:



URL POST PUT http: // localhost:9200 / _bulk



请求正文

  {update:{_index:test_people,_type:person,_id:1}} \\\

{doc:{name:年龄:100}} \\\

我已尝试过,没有 \\\
。我总是得到

  {
error:ActionRequestValidationException [验证失败:1:不添加任何请求] ,
状态:500
}

它也做同样的事情使用数据创建:

  {
创建:{
_index: test_people,
_type:person,
_id:1
}
}
{
name
年龄:100
}



更新



我已经在Mac,PC和Linux上尝试过,我不断得到相同的错误。

解决方案

即使我在最后一行有 \\\
,我真的HAD在我的最后一个json行之后有一个完整的回车。



以下工作:

  {update:{_index: test_people,_type:person,_id:1}} \\\

{doc:{name:年龄:100}}

所以在doc行之下需要一个空行。


Trying to get Bulk Update to work on ES 1.0.1.

I am within Postman posting the following:

URL POST or PUT to http://localhost:9200/_bulk

Request Body:

{ "update" : { "_index" : "test_people", "_type" : "person", "_id" : "1" }} \n
{ "doc" : { "name":"hi", "age":100 }} \n

I have tried it with and without the \n. I always get

{
    "error": "ActionRequestValidationException[Validation Failed: 1: no requests added;]",
    "status": 500
}

It also does the same thing on a create using the data:

{
  "create": {
    "_index": "test_people",
    "_type": "person",
    "_id": "1"
  }
}
{
  "name": "hi",
  "age": 100
}

Update

I have tried this on a Mac, PC, and Linux and I am continually getting the same error.

解决方案

Even though i had \n on the last line I literally HAD to have a full carriage return after my last json line.

The following worked:

{ "update" : { "_index" : "test_people", "_type" : "person", "_id" : "1" }} \n
{ "doc" : { "name":"hi", "age":100 }}

So there needs to be an empty line below the "doc" line.

这篇关于弹性搜索“未添加请求”批量API错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-06 16:14