Search code examples
elasticsearchindexingsenseelasticsearch-bulk-api

Elasticsearch bulk API error


I'm having trouble indexing to ES's bulk API. It keeps giving me this error:

{
   "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
}

NOTE: I'm using the Sense plugin

Here is a sample of the data I'm trying to index

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"]}

Is my format wrong? What am I missing?


Solution

  • I believe I figured it out. I was using word wrap in my text editor and that was causing problems. As soon as I took off word wrap and re-copied and pasted, problem solved. Need to be careful about newline characters and such...