Package org.nuxeo.ecm.core.search
Interface SearchClient
- All Superinterfaces:
AutoCloseable
- All Known Implementing Classes:
AbstractSearchClient
,OpenSearchSearchClient
,RepositorySearchClient
Interface used by the SearchService to access an external Search Cluster. The client must take care of the retry
mechanism, in case of failure to process a request or accessing the search backend a SearchClientException must be
raised.
- Since:
- 2025.0
-
Nested Class Summary
Nested Classes -
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionboolean
clearScroll
(SearchScrollContext scrollContext) Explicitly clear the search scroll context, without waiting for the scroll keep alive to timeout.void
close()
void
dropAndInitIndex
(String indexName) Recreate an existing index using the same settings and mapping.void
Drops an index.Returns the supported capabilities.getDocument
(String indexName, String documentId) Returns a Json document representation or null if not found.getDocumentVersion
(String indexName, String documentId) Returns the version which is the timestamp when document was loaded for indexinggetName()
Gets the client name.boolean
hasCapability
(SearchClient.Capability capability) Checks whether the client has the capability.indexDocuments
(BulkIndexingRequest request) Index documents.boolean
isReady()
Is the client ready and the search engine healthy to serve requests.void
Refreshes an index so newly indexed documents are searchable.search
(SearchQuery query) Executes a search query.searchScroll
(SearchScrollContext scrollContext) Iterate on results for a scroll search.
-
Field Details
-
DEFAULT_CLIENT_NAME_PROP
- See Also:
-
-
Method Details
-
getName
String getName()Gets the client name. -
isReady
boolean isReady()Is the client ready and the search engine healthy to serve requests. -
hasCapability
Checks whether the client has the capability. -
getCapabilities
Set<SearchClient.Capability> getCapabilities()Returns the supported capabilities. -
dropIndex
Drops an index. -
dropAndInitIndex
Recreate an existing index using the same settings and mapping. -
indexDocuments
Index documents. Check the response for possible indexing failure.- Throws:
SearchClientException
- when the search backend is not able to process the request after retries.
-
refresh
Refreshes an index so newly indexed documents are searchable. -
getDocument
Returns a Json document representation or null if not found. -
getDocumentVersion
Returns the version which is the timestamp when document was loaded for indexing -
search
Executes a search query. -
searchScroll
Iterate on results for a scroll search. The end of scroll is reached when there is no more hit, i.e.SearchResponse.getHitsCount()
returns0
.- Parameters:
scrollContext
- provided by the previousSearchResponse.getScrollContext()
;
-
clearScroll
Explicitly clear the search scroll context, without waiting for the scroll keep alive to timeout.- Returns:
true
if the context is successfully cleared.
-
close
void close()- Specified by:
close
in interfaceAutoCloseable
-