opensearch-java
opensearch-java copied to clipboard
[FEATURE] serialize requests to JSON
Is your feature request related to a problem?
Add a way to easily serialize queries to JSON for logging.
What solution would you like?
IndexRequest<Movie> indexRequest = new IndexRequest.Builder<Movie>()
.index(index)
.id("1")
.document(movie)
.build();
logger.info("JSON: {}", indexRequest.toJson());
Working serialization code here.
Do you have any additional context?
From a Slack discussion in https://opensearch.slack.com/archives/C051XNH62KB/p1690396113772759
Sounds cool. I've seen a few people request this, and it's cleaner than using log4j.