BulkIngester: Received `not_x_content_exception` when adding json

In the new BulkIngester, how to add json data?

I have this json:

{
  "time": "2023-04-13T02:44:16.1782763Z",
  "user_id": 1,
  "user_name": "admin",
  "host_name": "localhost:5567",
  "type": "PRODUCT_DELETE",
  "long_asset_id": 9,
  "long_parent_asset_id": 1,
  "path_path": "C:\\datastores\\ds1\\beats_2021+Logo.jpg"
}

I add this to BulkIngester but I get not_x_content_exception

This is how I do it:

 private final BulkIngester<String> bulkIngester = BulkIngester.of(
      b ->
        b.client(esClient)
          .maxOperations(100)
          .flushInterval(flushInterval, TimeUnit.SECONDS)
          .listener(listener);

String jsonPayload = objectMapper.writeValueAsString(
    new MyObject("2023-04-13T02:44:16.1782763Z", 1, "admin", "localhost:5567", "PRODUCT_DELETE", 9, 1, "C:\\datastores\\ds1\\beats_2021+Logo.jpg")

 bulkIngester.add(b-> b.index(idx -> idx.index("product_index").document(jsonPayload )));
);

I receive this error:

BulkResponseItem: {
  "index": {
    "_id": "hsSndIcB_urHloQdKovN",
    "_index": "product_index",
    "status": 400,
    "error": {
      "type": "mapper_parsing_exception",
      "reason": "failed to parse",
      "caused_by": {
        "type": "not_x_content_exception",
        "reason": "Compressor detection can only be called on some xcontent bytes or compressed xcontent bytes"
      }
    },
    "_type": "_doc"
  }
}

No idea why is this happening.
In old BulkProcessor, this works, but when I migrate to new BulkIngester, it fails.

Any ideas is greatly appreciated.

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