Hello. I am trying to append a list inside Elasticsearch using the python API. However the data incoming is in JSON-format. My query can take a single string item such as 'Blue' or 'Gimli: Dwarf' however it throws an exception when trying to insert JSON objects to the list.
The existing document is formatted as: content: [<list>]
.
My query is: ''' {"script": {"source": "ctx._source.content.add(params.tag)", "lang": "painless", "params": {"tag": "%s"}} } ''' % doc
The exception thrown is: 'RequestError(400, 'x_content_parse_exception', '[4:31] [script] failed to parse field [params]')'
. This is thrown when the doc variable is '{"Gandalf": "Wizard"}'.
The real data is logging output, but our structure is currently around appending these to a list that can later be parsed. I wish to use the update API to minimize network costs and the need to retrieve and then reindex a doc.
Thanks in advance.