Problem migrating from TransportClient to high level rest client

We have been using ES 5.2, and java API with TransportClient. The use case is, our users select an index, and input a JSON query. We use this query with SearchTemplateRequestBuilder to get the response. The code looks like this.

SearchTemplateResponse response =
new SearchTemplateRequestBuilder(esclient)
.setRequest(searchRequest)
.setScript(query)
.setScriptType(ScriptType.INLINE)
.get();
And then we parse response, and create our own handlers for hits/aggregations. Now we intend to upgrade to 6.2 and replace TransportClient with reset client, because of obvious reasons that it is going to die. The high level rest client looks most appropriate, since we can apparently re-use most of our code, but I couldn't find a way to fire a search query using JSON string I have. Would be great if we can get some help with this problem.

The search template API is not yet supported by the high-level REST client. If you need to send a query as a string though, you can do so using the low-level REST client. Though that way you also need to parse back the response yourself.

Otherwise WrapperQueryBuilder may help you when it comes to providing a query in json string, but that's only for the query section of a search request.

Cheers
Luca

Thank you Luca for your reply, the json query is entered by the users, so we can't go with limiting it to query section only. And this would mean effectively I can't use hight-level REST client yet. Could you please let me know when is the expected release date for ES 7 and 8, just wanted to check how much time we have to live with transport client.

Thank you again for clarifications.

I see. Search templates API is in our list of the API that we need to add to the high-level REST client. We will have that certainly before we remove the transport client. We don't have dates set for our future major releases. Quite some things to get done on our end before 7.0 I would say.

Cheers
Luca

That sounds very relieving, think we can wait for search templates API to get inside high-level API.

Think this is last bit on this, where should I look/watch to see updates?

Thank you for your help, and quick replies Luca!

Sorry I meant to post the link, but I forgot :slight_smile: Here is the meta issue with the list of the API and where
we cross off API once we implemented them: https://github.com/elastic/elasticsearch/issues/27205 .

Cool, thanks a lot.

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.