618 withjson support method for put index template request
Description
Added "withJson" support for PutIndexTemplateRequest
Issues Resolved
Closes [#618]
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license. For more information on following Developer Certificate of Origin and signing off your commits, please check here.
Yes, that would be great. I will look into that.
@pranishd1 Can you fix merge conflicts please? Also, you might have to run ./gradlew spotlessApply to fix formatting.
This is a lot better! Can we apply this to at least some minimum number of requests, not just put index template? I'd also love a guide (maybe copy from https://github.com/opensearch-project/opensearch-py/pull/542?) and a working sample as part of this PR, please?
Can we also mention in the USER_GUIDE that how to use
withJson?
sure, I will add a section about how to use this to the user guide.
This is a lot better! Can we apply this to at least some minimum number of requests, not just put index template? I'd also love a guide (maybe copy from opensearch-project/opensearch-py#542?) and a working sample as part of this PR, please?
Yeah, sure I will add this to a few other requests. Thanks for the feedback.
@pranishd1 Want to finish this?
@dblock , sorry about the delay. I am in the process of implementing the interface in create, search and delete requests. While doing so, I am stuck at object deserialization process. This method does not cover all the objects.
Thanks for this guys, much needed, do you need any help with this? Also after reading the code I got to know the problem - that as of now we rely on static deserializer which creates a new builder everytime, referring to this code exactly -
public static final JsonpDeserializer<SearchRequest> _DESERIALIZER = ObjectBuilderDeserializer.lazy(
Builder::new,
SearchRequest::setupSearchRequestDeserializer
);
Although some suggestions -
- Can you please also create a method which takes Readable as an argument kind of like
default<T> B withJson(Reader reader) {
........
- Also now that we have default mapper in JsonpUtils, we can use that rather than relying on a specific implementation please refer here .
@Jai2305 looks like the PR hasn't been touched in a long time, so yes, would love it if you could pick it up and finish it!
Note that we added support for a generic interface since which takes/returns raw JSON, so some parts of that may be reusable.