opensearch-java icon indicating copy to clipboard operation
opensearch-java copied to clipboard

618 withjson support method for put index template request

Open pranishd1 opened this issue 2 years ago • 9 comments

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.

pranishd1 avatar Oct 07 '23 20:10 pranishd1

Yes, that would be great. I will look into that.

pranishd1 avatar Oct 10 '23 01:10 pranishd1

@pranishd1 Can you fix merge conflicts please? Also, you might have to run ./gradlew spotlessApply to fix formatting.

VachaShah avatar Oct 24 '23 20:10 VachaShah

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?

dblock avatar Nov 02 '23 14:11 dblock

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.

pranishd1 avatar Nov 03 '23 15:11 pranishd1

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 avatar Nov 03 '23 16:11 pranishd1

@pranishd1 Want to finish this?

dblock avatar Dec 04 '23 15:12 dblock

@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.

pranishd1 avatar Dec 05 '23 20:12 pranishd1

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 avatar Jul 26 '24 13:07 Jai2305

@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.

dblock avatar Jul 26 '24 23:07 dblock