title: spring-data-elasticsearch search template
body: <p>We have a few similar queries and I wanted to do some templating based on parameters. Recently I've found that elastic supports <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/search-template.html" rel="nofollow noreferrer">search templates</a> so I'm wondering whether this is supported by <a href="https://github.com/spring-projects/spring-data-elasticsearch" rel="nofollow noreferrer">spring-data-elasticearch</a>.</p>
  <p>Currently my query looks something like:</p>
  <pre><code>final Query query = new NativeSearchQueryBuilder().addAggregation(aggregationBuilder)
        .withPageable(EmptyPage.INSTANCE)
        .withQuery(queryBuilder)
        .build();
  </code></pre>
  <p>I'm wondering if I can somehow pass the template that I've stored in application and get the result from elastic. Or if I can store the template in elastic and get the result based on parameters.</p>