Type is missing in BulkRequest in elastic search java client version 7.17.20

Hi Team,

We are using Elasticsearch database version 7.10.2 and also Elasticsearch java client - 7.17.20 in pom.xml

Implemented BulkRequest using the new Elasticsearch java client as below:

BulkRequest.Builder bulkRequestBuilder = new BulkRequest.Builder();
audit.es7.org.elasticsearch.action.bulk.BulkRequest re = new audit.es7.org.elasticsearch.action.bulk.BulkRequest();

for (int i = 0; i < bulkSize; i++) {
Product product = new Product();
Product = setBaseFields(Product, id);

IndexOperation<?> updatedIndexOperation = new IndexOperation.Builder<>()
.index(index)
.id(userCreatedAuditEvent.getEventId().toString())
.document(product)
.build();

// Add the updated IndexOperation to the bulk request
bulkRequestBuilder.operations(op -> op.index(updatedIndexOperation));
}

// Execute the bulk request
BulkResponse response = client.bulk(bulkRequestBuilder.build());

Error:
co.elastic.clients.elasticsearch._types.ElasticsearchException: [es/bulk] failed: [action_request_validation_exception] Validation Failed: 1: type is missing;2: type is missing;3: type is missing;4: type is missing;5: type is missing;6: type is missing;7: type is missing;8: type is missing;9: type is missing;10: type is missing;

Could you please suggest some solution on fixing this issue. Thanks!

I think you need to upgrade the server if you want to use the new client.
And anyway you should upgrade to 7.17 or better 8.15.

I am also getting the same issue . Tried with server update also but getting the same issue .
Can u Suggest any fix for this issue . Thanks

You are not the same author as @Radha_G right?
Are you in the same team?

Anyway, could you share a small GitHub repo which reproduces your problem with everything updated to 8.15 as you mentioned?

yes , We are from same team . We are using version 7.17.20 .

Ok i will provide u the repo .

Github Link - visheshvishwakarma/type_error

We are using elastic server 7.10.2 and elastic client 7.17.20 .
Thanks

As I said. You must upgrade the server if you want to use this client.

Ok . Let me try this also . Thankyou so much :slight_smile:

Hi Still not working after upgrading the server to latest .

there is requirement of server 7.10.2 in our project . So is there anyway to support this with client 7.17.20 . Thanks.

No. Please note that your version is too old and did not benefit from all the fixes (including security patches).

Thankyou so much :slight_smile:

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