Elasticsearch批量API错误

时间:2016-05-14 20:29:50

标签: elasticsearch indexing sense elasticsearch-bulk-api

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

我的格式错了吗?我错过了什么?

1 个答案:

答案 0 :(得分:1)

我相信我明白了。我在文本编辑器中使用自动换行,这导致了问题。一旦我取消自动换行并重新复制和粘贴,问题就解决了。需要注意换行符等......