Provide support to increase developer productivity in Java when using Elasticsearch. Uses familiar Spring concepts such as a template classes for core API usage and lightweight repository style data access.
Elastic Search provides the Search template API which is a very clean and efficient way to run queries in ElasticSearch.
A search template is a stored search you can run with different variables.
If you use Elasticsearch as a search backend, you can pass user input from a search bar as parameters for a search template. This lets you run searches without exposing Elasticsearch’s query syntax to your users.
If you use Elasticsearch for a custom application, search templates let you change your searches without modifying your app’s code.
I checked both in the documentation and the code and I couldn't find an annotation that supports it.
They idea would be to have something like:
@Repository
public interface SampleDataRepository extends Repository<SampleData, String> {
@SearchTemplateQuery(id="my-search-template")
List<SampleData> findSamples(String queryString, int from, int size);
}
Elastic Search provides the Search template API which is a very clean and efficient way to run queries in ElasticSearch.
I checked both in the documentation and the code and I couldn't find an annotation that supports it.
They idea would be to have something like:
Which translates into this (example taken from the Elasticsearch documentation):
In case it helps, without annotations we have to do it like this: