# SearchRequest.templateSource was deprecated, how to now?

**URL:** <https://discuss.elastic.co/t/searchrequest-templatesource-was-deprecated-how-to-now/173656>\
**Category:** Elasticsearch\
**Created:** [March 24, 2019, 9:54pm UTC](https://discuss.elastic.co/t/searchrequest-templatesource-was-deprecated-how-to-now/173656 "2019-03-24T21:54:20Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![shachr](https://avatars.discourse-cdn.com/v4/letter/s/7bcc69/32.png) [@shachr](https://discuss.elastic.co/u/shachr)\
**Post date:** [March 24, 2019, 9:54pm UTC](https://discuss.elastic.co/t/searchrequest-templatesource-was-deprecated-how-to-now/173656/1 "2019-03-24T21:54:20Z")

</div>

Im trying to update a 2.3.0 plugin to 6.6.1, and I can't find the new way of executing a template, current code:  
ByteReferece byteRef = ...  
SearchRequest searchRequest = new SearchRequest();  
searchRequest.templateSource(byteRef);  
client.search(searchRequest, new RestStatusToXContentListener\<\>(channel, response));

To shad some light or context on the plugin, it is executing a query on a slightly different DSL that include more information about the request, eventually it needs to executed a templated request that accept a list of parameters that are resolved on the plugin side (es node).

thank you.

---

<div class="post-metadata">

**Author:** ![spinscale](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/spinscale/32/25011_2.png) [@spinscale](https://discuss.elastic.co/u/spinscale)\
**Post date:** [March 25, 2019, 1:57pm UTC](https://discuss.elastic.co/t/searchrequest-templatesource-was-deprecated-how-to-now/173656/2 "2019-03-25T13:57:12Z")

</div>

Have you seen the `SearchTemplateRequest` class? If that is not sufficient maybe you can provide a little bit more background.

--Alex

---

<div class="post-metadata">

**Author:** ![shachr](https://avatars.discourse-cdn.com/v4/letter/s/7bcc69/32.png) [@shachr](https://discuss.elastic.co/u/shachr)\
**Post date:** [March 25, 2019, 4:29pm UTC](https://discuss.elastic.co/t/searchrequest-templatesource-was-deprecated-how-to-now/173656/3 "2019-03-25T16:29:59Z")

</div>

I have seen this class, but its not part of:  
  
org.elasticsearch  
elasticsearch  
6.6.1

so far we haven't used the client dependency explicitly we got a client from the dependency above, are you suggesting we add:  
  
org.elasticsearch.client  
transport  
6.6.1

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [April 22, 2019, 4:30pm UTC](https://discuss.elastic.co/t/searchrequest-templatesource-was-deprecated-how-to-now/173656/4 "2019-04-22T16:30:00Z")

</div>

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