Elasticsearch 批量 API 错误
Elasticsearch bulk API error
我在索引 ES 的批量 API 时遇到问题。它一直给我这个错误:
{
"error": "JsonParseException[Unexpected character (',' (code 44)): expected a valid value (number, String, array, object, 'true', 'false' or 'null')\n at [Source: [B@35093fea; line: 1, column: 8]]",
"status": 500
}
注意:我使用的是 Sense 插件
这是我要索引的数据示例
PUT /autocomplete/suggestions/_bulk
{"index": {"_id":"1"}}
{"years": ["1980","1981","1982","1983","1984","1985","1986","1987","1988","1989",
"1990","1991","1992","1993","1994","1995","1996","1997","1998","1999",
"2001","2002","2003","2004","2005","2006","2007","2008","2009","2010",
"2011","2012","2013","2014","2015","2016","2017"], "categories": ["Action","Drama","Suspense","Comedy","Romantic"]}
我的格式有误吗?我错过了什么?
我相信我明白了。我在我的文本编辑器中使用了自动换行,这导致了问题。一旦我取消自动换行并重新复制粘贴,问题就解决了。需要注意换行符等...
我在索引 ES 的批量 API 时遇到问题。它一直给我这个错误:
{
"error": "JsonParseException[Unexpected character (',' (code 44)): expected a valid value (number, String, array, object, 'true', 'false' or 'null')\n at [Source: [B@35093fea; line: 1, column: 8]]",
"status": 500
}
注意:我使用的是 Sense 插件
这是我要索引的数据示例
PUT /autocomplete/suggestions/_bulk
{"index": {"_id":"1"}}
{"years": ["1980","1981","1982","1983","1984","1985","1986","1987","1988","1989",
"1990","1991","1992","1993","1994","1995","1996","1997","1998","1999",
"2001","2002","2003","2004","2005","2006","2007","2008","2009","2010",
"2011","2012","2013","2014","2015","2016","2017"], "categories": ["Action","Drama","Suspense","Comedy","Romantic"]}
我的格式有误吗?我错过了什么?
我相信我明白了。我在我的文本编辑器中使用了自动换行,这导致了问题。一旦我取消自动换行并重新复制粘贴,问题就解决了。需要注意换行符等...