Query working in console, throwing malformed query

As in the title - I’m migrating queries from ElasticSearch to OpenSearch. So far queries from ES are mostly working in OS, but for some of them I had to do a little tweaking.

What I came up recently is a strange situation, in which query that works perfectly fine in ES, and also in the OpenSearch console, suddenly when executed using RestHighLevelClient in Java, throws malformed query exception.

I don’t want to start with pasting query here, more I would like to know if anyone had ever similar situation, and could tell me what could be the problem here. RequestOptions being send? OpenSearch config?

ES has bunch of stuff regarding queries which OS doesn’t, if that’s what you’re asking.

Well, I get that - but as I’ve written - it works BOTH on ES and OS console (and ES from low-level client, ES used is VERY old). The only thing is that it is not working while using Java REST HighLevel client. That’s why I’m asking what to potentially check in Java client config/request options that could be causing such behaviour.