elastic / elasticsearch-java

Official Elasticsearch Java Client
Apache License 2.0
8 stars 243 forks source link

How to convert es dsl query to string #367

Open vincentchen007 opened 2 years ago

vincentchen007 commented 2 years ago

Description

Hell team, I need to upgrade my ES version from 7.17 to 8.13. In version 7, I can use to_string to convert an es dsl query to a string type. However, I cannot find any similar method in ES java 8. Could you please help me? Thank you!

charles260 commented 2 years ago

Description

ByteArrayOutputStream baos = new ByteArrayOutputStream(); JsonGenerator generator = transport.jsonpMapper().jsonProvider().createGenerator(baos); searchRequest.serialize(generator, transport.jsonpMapper()); generator.close(); System.out.println(baos);