Getting error while doing msearch in OS, worked good in ES

I have recently started usinf opensearch, earlier I used elasticsearch and my local java library was written accordingly. (The time when AWS lets us create es engine clusters).
Now that I have shifted, I am not able to do Msearch, it shows:
Elasticsearch exception [type=illegal_argument_exception, reason=key [types] is not supported in the metadata section]

Looking further, the class SearchRequest (part of es : 7.7.1) used a types field which is getting initialized as empty array in constructor.
and while using this to do mquery, OS is throwing this error.

The same thing is working fine with ES engine ckuster,
any idea how to solve this?