BulkRequest with Java API Client missing document part

Hi all,

I am migrating from Elasticsearch high rest client 6.x to Java API client and have encountered an issue with the BulkRequest.

I am creating a json string and sending that in as part of the document part of the request as follows:

       Reader reader = new StringReader(my-json-string);
	JsonData jd = JsonData.from(jsonProvider.createParser(reader), jsonpMapper);
	br.operations(op -> op.index(idx -> idx.index(indexName).id(String.valueOf(e.getId())).document(jd)));	
	reader.close();
				
	Time.Builder tbr = new Time.Builder();
        tbr.time("5m");
        br.timeout(tbr.build());
        BulkRequest request = br.build();
        BulkResponse bulkResponse = esClient.bulk(request);

When I look at my request, it is shown as follows and is missing the document part which I have supplied via the JSON string

BulkRequest: POST /_bulk?timeout=5m [{"index":{"_id":"1","_index":"my-daily-export"}}]

Can someone please point me to what am doing wrong here?

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