Print Query in JSON format

Is there a way to print Query object to see their JSON representation? I’m trying to construct some queries and I want to print them locally to check if they look like how I expect them to. I’m using opensearch-java client.

Thanks!

Hey @slvrhwk

Do you mean actually print them out, like on paper? or to view them?

@Gsmitt Print as in view the query’s JSON representation.

Hi @slvrhwk

How to you get the Query object? Is it the Lucene Query object? If yes then you can not get JSON representation for that object (Lucene does not know anything about OpenSearch Query DSL).

Lukáš

It’s the Opensearch Query object.

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