Error: Indexing Nested Complex Object (Java High Level Rest Client)

Hi everyone.

I've got the following mapping with nested types:

{
  "mapping": {
    "properties": {
      "caption": {
        "type": "text"
      },
      "category": {
        "type": "text"
      },
      "description": {
        "type": "text"
      },
      "images": {
        "type": "text"
      },
      "outletid": {
        "type": "integer"
      },
      "parentshop": {
        "type": "integer"
      },
      "productid": {
        "type": "text"
      },
      "productname": {
        "type": "text"
      },
      "skus": {
        "type": "nested",
        "properties": {
          "active": {
            "type": "boolean"
          },
          "attributes": {
            "type": "nested",
            "properties": {
              "attributeid": {
                "type": "integer"
              },
              "attributevalue": {
                "type": "text"
              },
              "keyname": {
                "type": "text"
              }
            }
          },
          "currency": {
            "type": "text"
          },
          "image": {
            "type": "text"
          },
          "inventory": {
            "properties": {
              "availability": {
                "type": "text"
              },
              "inventoryid": {
                "type": "integer"
              },
              "quantity": {
                "type": "integer"
              },
              "type": {
                "type": "text"
              }
            }
          },
          "outletid": {
            "type": "integer"
          },
          "parentshop": {
            "type": "integer"
          },
          "price": {
            "type": "integer"
          },
          "productid": {
            "type": "text"
          },
          "skuid": {
            "type": "integer"
          },
          "skuname": {
            "type": "text"
          }
        }
      },
      "type": {
        "type": "text"
      },
      "url": {
        "type": "text"
      }
    }
  }
}

And tried to index the following data:

{"caption":"Fresh Chicken","category":"Frozen Foods","description":"We have been producing high quality, nutritious and hygienic products for our highly valued customers and consumers at affordable prices, since 1983","outletid":4,"parentshop":1,"productid":"SdzKaEaKu5zVF6cUi3eEcBACvJXnlJs0stINvhcNHmAABZRNnSNpicH1kn5GXep9Su8xGbjVC6wa_9kSzc61bpQ_","productname":"Zartech Chicken Nugget 450G","type":"good","url":"","images":["2efd1c1e5bfd7df1fee9bed5919335fd9f4accec92d188c0ed819a337f510dfe","7ca984a384b2052936ba0b581de2e1881ce959ad1a0c0a3dcf71558ed6bda684"],"skus":[{"skuid":6,"parentshop":1,"outletid":4,"productid":"SdzKaEaKu5zVF6cUi3eEcBACvJXnlJs0stINvhcNHmAABZRNnSNpicH1kn5GXep9Su8xGbjVC6wa_9kSzc61bpQ_","skuname":"Zartech Chicken Nugget","currency":"NGN","price":45000,"image":"c0300ae486fefeb9b218fa9dc842cbfc61315e94d6d4a3b7bd88fa85d3c7f36c","active":true,"inventory":{"inventoryid":6,"quantity":300,"type":"finite","availability":"out_of_stock"},"attributes":[{"attributeid":16,"keyname":"weight","attributevalue":"0.45"}]},{"skuid":7,"parentshop":1,"outletid":4,"productid":"SdzKaEaKu5zVF6cUi3eEcBACvJXnlJs0stINvhcNHmAABZRNnSNpicH1kn5GXep9Su8xGbjVC6wa_9kSzc61bpQ_","skuname":"Sparith","currency":"NGN","price":23000,"image":"a6f7707f9c268bd0368ddb9d7a6f077b93b828351713ff48a567b59156d2eb7","active":true,"inventory":{"inventoryid":7,"quantity":340,"type":"finite","availability":"in_stock"},"attributes":[{"attributeid":7,"keyname":"weight","attributevalue":"45"}]}]}

But get this:
java.lang.IllegalArgumentException: cannot write xcontent for unknown value of type class java.util.LinkedHashMap$Entry
at org.elasticsearch.common.xcontent.XContentBuilder.unknownValue(XContentBuilder.java:833)
at org.elasticsearch.common.xcontent.XContentBuilder.value(XContentBuilder.java:924)
at org.elasticsearch.common.xcontent.XContentBuilder.unknownValue(XContentBuilder.java:824)
...
..

Is there something I'm still missing?
Will really appreciate any ideas. Thanks.

Hi guys,
I've narrowed the problem down to the attributes field.
An empty array works but otherwise it fails.

Any ideas? thanks

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