Interface ElasticsearchDocumentManager
- All Superinterfaces:
AutoCloseable,org.eclipse.jnosql.communication.semistructured.DatabaseManager
DatabaseManager contract for document communication.
This interface extends the standard JNoSQL DatabaseManager operations
with Elasticsearch-native search support. The inherited methods provide the
regular document operations such as insert, update, delete, select, count, and
close, while search(SearchRequest) allows callers to execute a native
Elasticsearch SearchRequest.
The native search method is useful when an application needs Elasticsearch features that are not directly represented by the JNoSQL communication API, such as custom query DSL structures, aggregations, highlighting, sorting, pagination, or other Elasticsearch-specific search capabilities.
Implementations are expected to execute the request against the index managed
by this DatabaseManager and convert the Elasticsearch search hits back
into CommunicationEntity instances.
- See Also:
-
DatabaseManagerSearchRequestCommunicationEntity
-
Method Summary
Methods inherited from interface org.eclipse.jnosql.communication.semistructured.DatabaseManager
close, count, count, delete, deleteAndCount, exists, insert, insert, insert, insert, name, prepare, prepare, query, query, select, selectCursor, singleResult, update, update, update
-
Method Details
-
search
Stream<org.eclipse.jnosql.communication.semistructured.CommunicationEntity> search(co.elastic.clients.elasticsearch.core.SearchRequest request) throws NullPointerException Executes a native Elasticsearch search request and returns the matching documents asCommunicationEntityinstances.This method should be used when the standard JNoSQL
selectAPI is not expressive enough for the required Elasticsearch query. The providedSearchRequestis passed to the Elasticsearch Java client and the resulting hits are converted to JNoSQL communication entities.The request must not be
null. The target index should normally be consistent with the manager's configured index.- Parameters:
request- the native Elasticsearch search request- Returns:
- a stream of entities returned by the Elasticsearch search operation
- Throws:
NullPointerException- when the search request isnullElasticsearchException- when Elasticsearch cannot execute the search
-