Skip to content

Commit 31cbfe4

Browse files
committed
docs: geneate ES template
Signed-off-by: Otavio Santana <[email protected]>
1 parent 93b9ff8 commit 31cbfe4

File tree

1 file changed

+31
-5
lines changed

1 file changed

+31
-5
lines changed

jnosql-elasticsearch/src/main/java/org/eclipse/jnosql/databases/elasticsearch/mapping/ElasticsearchTemplate.java

Lines changed: 31 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,16 +21,42 @@
2121
import java.util.stream.Stream;
2222

2323
/**
24-
* A {@link DocumentTemplate} to elasticsearch
24+
* An Elasticsearch-specific extension of {@link DocumentTemplate},
25+
* providing a method to perform search queries using {@link SearchRequest}.
26+
*
27+
* This template allows executing Elasticsearch queries and retrieving results
28+
* as a stream of entities mapped by Eclipse JNoSQL.
29+
*
30+
* Example usage:
31+
* <pre>
32+
* {@code
33+
* @Inject
34+
* private ElasticsearchTemplate elasticsearchTemplate;
35+
*
36+
* SearchRequest request = new SearchRequest.Builder()
37+
* .index("documents")
38+
* .query(q -> q.match(m -> m.field("title").query("Eclipse JNoSQL")))
39+
* .build();
40+
*
41+
* Stream<Document> results = elasticsearchTemplate.search(request);
42+
* results.forEach(System.out::println);
43+
* }
44+
* </pre>
45+
*
46+
* @see DocumentTemplate
2547
*/
2648
public interface ElasticsearchTemplate extends DocumentTemplate {
2749

2850
/**
29-
* Find entities from {@link SearchRequest}
51+
* Executes a search query using the provided {@link SearchRequest}.
52+
* The search query should be built using Elasticsearch's client API and passed
53+
* to this method. The results will be mapped to the specified entity type
54+
* and returned as a stream.
3055
*
31-
* @param query the query
32-
* @return the objects from query
33-
* @throws NullPointerException when query is null
56+
* @param <T> the entity type
57+
* @param query the Elasticsearch query request
58+
* @return a stream of entities resulting from the search query
59+
* @throws NullPointerException if the query is null
3460
*/
3561
<T> Stream<T> search(SearchRequest query);
3662
}

0 commit comments

Comments
 (0)