Insert object to nested array

(Martin Blaustein) #1

I'm trying to insert an object to a nested array through the java api, but I get the following error

MapperParsingException[object mapping for [X] tried to parse field [null] as object, but found a concrete value]

doing it through Kibana as shown below the same script works.

Any ideas on how to fix this?

The java code is the following

HashMap<String, Object> params = new HashMap<>();
params.put("object", objectAsString);
Script script = new Script(ScriptType.INLINE, "painless", "", params);
UpdateResponse result = elasticClient.prepareUpdate(indexName, "Type", documentId).setScript(script).execute().actionGet();

Trhough Kibana

POST index/document/id/_update

   "script": {
      "lang": "painless",
      "inline": "",
      "params": {
         "object": {
           "description" : "A second image",
      "height" :  5,
      "weight": 5,
      "name" :  "Test",
      "orientation" :  "Vertical",
       "url" :  "htttp://newurl.jpg",

(system) #2

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.