Open
Description
Is your feature request related to a problem?
It is currently not possible to create API objects from JSON data.
What solution would you like?
For example we would like to do something like code below:
InputStream input = this.getClass()
.getResourceAsStream("some-index.json");
CreateIndexRequest req = CreateIndexRequest.of(b -> b
.index("some-index")
.withJson(input)
);
boolean created = client.indices().create(req).acknowledged();
What alternatives have you considered?
This withJson() method is currently supported on all API objects of the elasticsearch java client, and after moving to opensearch we feel this enhancement is greatly needed in opensearch java client too.