我在索引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"]}

我的格式不对吗?我想念什么?

最佳答案

我相信我知道了。我在文本编辑器中使用自动换行,这会引起问题。一旦我打开自动换行并重新复制和粘贴,问题就解决了。需要注意换行符等...

08-07 21:52