Interface ElasticsearchDocumentManager

All Superinterfaces:
AutoCloseable, org.eclipse.jnosql.communication.semistructured.DatabaseManager

public interface ElasticsearchDocumentManager extends org.eclipse.jnosql.communication.semistructured.DatabaseManager
Elasticsearch-specific 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:
  • DatabaseManager
  • SearchRequest
  • CommunicationEntity
  • Method Summary

    Modifier and Type
    Method
    Description
    Stream<org.eclipse.jnosql.communication.semistructured.CommunicationEntity>
    search(co.elastic.clients.elasticsearch.core.SearchRequest request)
    Executes a native Elasticsearch search request and returns the matching documents as CommunicationEntity instances.

    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 as CommunicationEntity instances.

      This method should be used when the standard JNoSQL select API is not expressive enough for the required Elasticsearch query. The provided SearchRequest is 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 is null
      ElasticsearchException - when Elasticsearch cannot execute the search