Class SearchEngineClient

java.lang.Object
org.codelibs.fess.opensearch.client.SearchEngineClient
All Implemented Interfaces:
Closeable, AutoCloseable, org.opensearch.common.lease.Releasable, org.opensearch.transport.client.Client, org.opensearch.transport.client.OpenSearchClient

public class SearchEngineClient extends Object implements org.opensearch.transport.client.Client
Client for interacting with OpenSearch search engine. Provides document indexing, searching, and administrative operations.
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static interface 
    Interface for creating entities from search response hits.
    static interface 
    Interface for defining search condition logic.
    static class 
    Builder class for constructing search conditions and parameters.
    static interface 
    Interface for building search results from response data.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    protected org.opensearch.transport.client.Client
    OpenSearch client for executing operations
    protected String
    Name of the search engine cluster
    protected Map<String,List<String>>
    Map of configuration types to their respective configuration files
    protected final List<UnaryOperator<String>>
    List of rewrite rules for document mappings
    protected final List<UnaryOperator<String>>
    List of rewrite rules for document settings
    protected List<String>
    List of index configuration files to load
    protected String
    Path to index configuration resources
    protected int
    Maximum retry attempts for configuration synchronization status checks
    protected int
    Maximum retry attempts for search engine status checks
    protected org.codelibs.opensearch.runner.OpenSearchRunner
    OpenSearch runner for managing the embedded search engine
    protected String
    Scroll timeout for delete operations
    protected String
    Scroll timeout for search operations
    protected String
    Scroll timeout for update operations
    protected Map<String,String>
    Configuration settings for the search engine
    protected int
    Batch size for delete operations
    protected int
    Batch size for update operations
    protected boolean
    Whether to use pipelines for document processing

    Fields inherited from interface org.opensearch.transport.client.Client

    CLIENT_TYPE_SETTING_S
  • Constructor Summary

    Constructors
    Constructor
    Description
    Default constructor.
  • Method Summary

    Modifier and Type
    Method
    Description
    org.opensearch.action.bulk.BulkResponse
    addAll(String index, List<Map<String,Object>> docList, BiConsumer<Map<String,Object>,org.opensearch.action.index.IndexRequestBuilder> options)
    Adds multiple documents to the specified index in bulk.
    void
    addConfigFile(String index, String path)
    Adds a configuration file for a specific index.
    void
    Adds a rewrite rule for document mappings.
    void
    Adds a rewrite rule for document settings.
    void
    Adds an index configuration file path to be loaded.
    void
    addMapping(String index, String docType, String indexName)
    Adds field mappings to an index.
    void
    addMapping(String index, String docType, String indexName, boolean loadBulkData)
    Adds field mappings and optionally loads bulk data for an index.
    org.opensearch.transport.client.AdminClient
    Gets the admin client for cluster and index administration.
    org.opensearch.common.action.ActionFuture<org.opensearch.action.bulk.BulkResponse>
    bulk(org.opensearch.action.bulk.BulkRequest request)
    Executes a bulk request asynchronously.
    void
    bulk(org.opensearch.action.bulk.BulkRequest request, org.opensearch.core.action.ActionListener<org.opensearch.action.bulk.BulkResponse> listener)
    Executes a bulk request asynchronously with a callback.
    org.opensearch.common.action.ActionFuture<org.opensearch.action.search.ClearScrollResponse>
    clearScroll(org.opensearch.action.search.ClearScrollRequest request)
    Clears scroll contexts asynchronously.
    void
    clearScroll(org.opensearch.action.search.ClearScrollRequest request, org.opensearch.core.action.ActionListener<org.opensearch.action.search.ClearScrollResponse> listener)
    Clears scroll contexts asynchronously with a callback.
    void
     
    boolean
    copyDocIndex(String fromIndex, String toIndex, boolean waitForCompletion)
    Copies documents from one index to another with optional transformation.
    protected void
    createAlias(String index, String createdIndexName)
    Creates aliases for a newly created index.
    protected org.opensearch.transport.client.Client
    createHttpClient(org.codelibs.fess.mylasta.direction.FessConfig fessConfig, String host)
    Creates an HTTP client for connecting to the search engine.
    boolean
    createIndex(String index, String indexName)
    Creates a new index with default settings.
    boolean
    createIndex(String index, String indexName, String numberOfShards, String autoExpandReplicas, boolean uploadConfig)
    Creates a new index with specified settings.
    void
    createPit(org.opensearch.action.search.CreatePitRequest createPITRequest, org.opensearch.core.action.ActionListener<org.opensearch.action.search.CreatePitResponse> listener)
    Creates a point-in-time context asynchronously.
    boolean
    delete(String index, String id)
    Deletes a document from the specified index.
    boolean
    delete(String index, String id, Number seqNo, Number primaryTerm)
    Deletes a document from the specified index with optimistic concurrency control.
    org.opensearch.common.action.ActionFuture<org.opensearch.action.delete.DeleteResponse>
    delete(org.opensearch.action.delete.DeleteRequest request)
    Deletes a document asynchronously.
    void
    delete(org.opensearch.action.delete.DeleteRequest request, org.opensearch.core.action.ActionListener<org.opensearch.action.delete.DeleteResponse> listener)
    Deletes a document asynchronously with a callback.
    long
    deleteByQuery(String index, org.opensearch.index.query.QueryBuilder queryBuilder)
    Deletes documents in an index matching a query.
    boolean
    deleteIndex(String indexName)
    Deletes an index from the search engine.
    void
    deletePits(org.opensearch.action.search.DeletePitRequest deletePITRequest, org.opensearch.core.action.ActionListener<org.opensearch.action.search.DeletePitResponse> listener)
    Deletes point-in-time contexts asynchronously.
    protected void
    Deletes a scroll context to free resources.
    <Request extends org.opensearch.action.ActionRequest, Response extends org.opensearch.core.action.ActionResponse>
    org.opensearch.common.action.ActionFuture<Response>
    execute(org.opensearch.action.ActionType<Response> action, Request request)
    Executes an action asynchronously.
    <Request extends org.opensearch.action.ActionRequest, Response extends org.opensearch.core.action.ActionResponse>
    void
    execute(org.opensearch.action.ActionType<Response> action, Request request, org.opensearch.core.action.ActionListener<Response> listener)
    Executes an action asynchronously with a callback.
    boolean
    existsIndex(String indexName)
    Checks if an index exists in the search engine.
    org.opensearch.common.action.ActionFuture<org.opensearch.action.explain.ExplainResponse>
    explain(org.opensearch.action.explain.ExplainRequest request)
    Executes an explain request asynchronously.
    void
    explain(org.opensearch.action.explain.ExplainRequest request, org.opensearch.core.action.ActionListener<org.opensearch.action.explain.ExplainResponse> listener)
    Executes an explain request asynchronously with a callback.
    org.opensearch.common.action.ActionFuture<org.opensearch.action.fieldcaps.FieldCapabilitiesResponse>
    fieldCaps(org.opensearch.action.fieldcaps.FieldCapabilitiesRequest request)
    Gets field capabilities asynchronously.
    void
    fieldCaps(org.opensearch.action.fieldcaps.FieldCapabilitiesRequest request, org.opensearch.core.action.ActionListener<org.opensearch.action.fieldcaps.FieldCapabilitiesResponse> listener)
    Gets field capabilities asynchronously with a callback.
    org.opensearch.transport.client.Client
    Creates a client filtered with additional headers.
    void
    flush(String... indices)
    Flushes the specified indices to ensure data is written to disk.
    void
    Flushes configuration files to the search engine and executes a callback.
    protected String
    Generates a new index name with timestamp suffix.
    protected <T> T
    get(String index, String id, SearchEngineClient.SearchCondition<org.opensearch.action.get.GetRequestBuilder> condition, SearchEngineClient.SearchResult<T,org.opensearch.action.get.GetRequestBuilder,org.opensearch.action.get.GetResponse> searchResult)
    Retrieves a document by ID with custom conditions and result processing.
    org.opensearch.common.action.ActionFuture<org.opensearch.action.get.GetResponse>
    get(org.opensearch.action.get.GetRequest request)
    Gets a document asynchronously.
    void
    get(org.opensearch.action.get.GetRequest request, org.opensearch.core.action.ActionListener<org.opensearch.action.get.GetResponse> listener)
    Gets a document asynchronously with a callback.
    int
    getAliasCount(String indexName)
    Gets the number of aliases attached to the specified index.
    void
    getAllPits(org.opensearch.action.search.GetAllPitNodesRequest getAllPitNodesRequest, org.opensearch.core.action.ActionListener<org.opensearch.action.search.GetAllPitNodesResponse> listener)
    Gets all point-in-time contexts asynchronously.
    protected SearchEngineClient.EntityCreator<Map<String,Object>,org.opensearch.action.search.SearchResponse,org.opensearch.search.SearchHit>
    Gets the default entity creator for converting search hits to maps.
    org.dbflute.optional.OptionalEntity<Map<String,Object>>
    getDocument(String index, SearchEngineClient.SearchCondition<org.opensearch.action.search.SearchRequestBuilder> condition)
    Retrieves a single document matching the search condition.
    protected <T> org.dbflute.optional.OptionalEntity<T>
    getDocument(String index, SearchEngineClient.SearchCondition<org.opensearch.action.search.SearchRequestBuilder> condition, SearchEngineClient.EntityCreator<T,org.opensearch.action.search.SearchResponse,org.opensearch.search.SearchHit> creator)
    Retrieves a single document with custom entity creation.
    long
    Gets the document count of an index.
    getDocumentList(String index, SearchEngineClient.SearchCondition<org.opensearch.action.search.SearchRequestBuilder> condition)
    Retrieves a list of documents matching the search condition.
    protected <T> List<T>
    getDocumentList(String index, SearchEngineClient.SearchCondition<org.opensearch.action.search.SearchRequestBuilder> condition, SearchEngineClient.EntityCreator<T,org.opensearch.action.search.SearchResponse,org.opensearch.search.SearchHit> creator)
    Retrieves a list of documents with custom entity creation.
    org.codelibs.fesen.client.EngineInfo
    Gets information about the search engine.
    protected InetAddress
    Resolves a hostname to an InetAddress.
    protected String
    getReindexRequestsPerSecound(org.codelibs.fess.mylasta.direction.FessConfig fessConfig)
    Calculates the requests per second setting for reindex operations.
    protected String
    getResourcePath(String basePath, String type, String path)
    Gets the resource path for configuration files, checking type-specific variants first.
    Gets the current cluster health status.
    org.opensearch.common.action.ActionFuture<org.opensearch.action.index.IndexResponse>
    index(org.opensearch.action.index.IndexRequest request)
    Indexes a document asynchronously.
    void
    index(org.opensearch.action.index.IndexRequest request, org.opensearch.core.action.ActionListener<org.opensearch.action.index.IndexResponse> listener)
    Indexes a document asynchronously with a callback.
    protected void
    insertBulkData(org.codelibs.fess.mylasta.direction.FessConfig fessConfig, String configIndex, String dataPath)
    Inserts bulk data from a file into an index.
    protected void
    insertBulkData(org.codelibs.fess.mylasta.direction.FessConfig fessConfig, String configIndex, String dataPath, boolean createOnly)
    Inserts bulk data from a file into an index.
    boolean
    Checks if the search engine is running in embedded mode.
    org.opensearch.common.action.ActionFuture<org.opensearch.action.admin.indices.view.ListViewNamesAction.Response>
    listViewNames(org.opensearch.action.admin.indices.view.ListViewNamesAction.Request request)
    Lists view names asynchronously (not implemented).
    void
    listViewNames(org.opensearch.action.admin.indices.view.ListViewNamesAction.Request request, org.opensearch.core.action.ActionListener<org.opensearch.action.admin.indices.view.ListViewNamesAction.Response> listener)
    Lists view names asynchronously (not implemented).
    org.opensearch.common.action.ActionFuture<org.opensearch.action.get.MultiGetResponse>
    multiGet(org.opensearch.action.get.MultiGetRequest request)
    Gets multiple documents asynchronously.
    void
    multiGet(org.opensearch.action.get.MultiGetRequest request, org.opensearch.core.action.ActionListener<org.opensearch.action.get.MultiGetResponse> listener)
    Gets multiple documents asynchronously with a callback.
    org.opensearch.common.action.ActionFuture<org.opensearch.action.search.MultiSearchResponse>
    multiSearch(org.opensearch.action.search.MultiSearchRequest request)
    Executes a multi-search request asynchronously.
    void
    multiSearch(org.opensearch.action.search.MultiSearchRequest request, org.opensearch.core.action.ActionListener<org.opensearch.action.search.MultiSearchResponse> listener)
    Executes a multi-search request asynchronously with a callback.
    org.opensearch.common.action.ActionFuture<org.opensearch.action.termvectors.MultiTermVectorsResponse>
    multiTermVectors(org.opensearch.action.termvectors.MultiTermVectorsRequest request)
    Gets term vectors for multiple documents asynchronously.
    void
    multiTermVectors(org.opensearch.action.termvectors.MultiTermVectorsRequest request, org.opensearch.core.action.ActionListener<org.opensearch.action.termvectors.MultiTermVectorsResponse> listener)
    Gets term vectors for multiple documents asynchronously with a callback.
    void
    Initializes the search engine client and configures indices.
    Pings the search engine cluster to check connectivity and health.
    void
    pitSegments(org.opensearch.action.admin.indices.segments.PitSegmentsRequest pitSegmentsRequest, org.opensearch.core.action.ActionListener<org.opensearch.action.admin.indices.segments.IndicesSegmentResponse> listener)
    Gets point-in-time segments information asynchronously.
    org.opensearch.action.bulk.BulkRequestBuilder
    Prepares a bulk request builder.
    org.opensearch.action.bulk.BulkRequestBuilder
    prepareBulk(String globalIndex)
    Prepares a bulk request builder with a global index.
    org.opensearch.action.search.ClearScrollRequestBuilder
    Prepares a clear scroll request builder.
    org.opensearch.action.delete.DeleteRequestBuilder
    Prepares a delete request builder.
    org.opensearch.action.delete.DeleteRequestBuilder
    Prepares a delete request builder for a specific document.
    org.opensearch.action.explain.ExplainRequestBuilder
    Prepares an explain request builder for a specific document.
    org.opensearch.action.fieldcaps.FieldCapabilitiesRequestBuilder
    Prepares a field capabilities request builder.
    org.opensearch.action.get.GetRequestBuilder
    Prepares a get request builder.
    org.opensearch.action.get.GetRequestBuilder
    prepareGet(String index, String id)
    Prepares a get request builder for a specific document.
    org.opensearch.action.index.IndexRequestBuilder
    Prepares an index request builder.
    org.opensearch.action.index.IndexRequestBuilder
    Prepares an index request builder for a specific index.
    org.opensearch.action.get.MultiGetRequestBuilder
    Prepares a multi-get request builder.
    org.opensearch.action.search.MultiSearchRequestBuilder
    Prepares a multi-search request builder.
    org.opensearch.action.termvectors.MultiTermVectorsRequestBuilder
    Prepares a multi-term vectors request builder.
    org.opensearch.action.search.SearchRequestBuilder
    prepareSearch(String... indices)
    Prepares a search request builder for specific indices.
    org.opensearch.action.search.SearchScrollRequestBuilder
    Prepares a search scroll request builder.
    org.opensearch.action.search.SearchRequestBuilder
    Prepares a stream search request builder for specific indices.
    org.opensearch.action.termvectors.TermVectorsRequestBuilder
    Prepares a term vectors request builder.
    org.opensearch.action.termvectors.TermVectorsRequestBuilder
    Prepares a term vectors request builder for a specific document.
    org.opensearch.action.update.UpdateRequestBuilder
    Prepares an update request builder.
    org.opensearch.action.update.UpdateRequestBuilder
    Prepares an update request builder for a specific document.
    protected String
    readIndexSetting(String fesenType, String indexConfigFile, String numberOfShards, String autoExpandReplicas)
    Reads and processes index settings from configuration file.
    void
    refresh(String... indices)
    Refreshes the specified indices to make recent changes visible for search.
    boolean
    reindex(String fromIndex, String toIndex, boolean waitForCompletion)
    Reindexes documents from one index to another.
    protected boolean
    reindex(String fromIndex, String toIndex, String source, boolean waitForCompletion)
    Performs a reindex operation with custom source configuration.
    boolean
    reindexConfigIndices(boolean loadBulkData, Set<String> targetPrefixes)
    Rebuilds configuration indices with the latest mappings using atomic alias switching.
    <T> long
    scrollSearch(String index, SearchEngineClient.SearchCondition<org.opensearch.action.search.SearchRequestBuilder> condition, SearchEngineClient.EntityCreator<T,org.opensearch.action.search.SearchResponse,org.opensearch.search.SearchHit> creator, BooleanFunction<T> cursor)
    Performs a scroll search with custom entity creation.
    long
    scrollSearch(String index, SearchEngineClient.SearchCondition<org.opensearch.action.search.SearchRequestBuilder> condition, BooleanFunction<Map<String,Object>> cursor)
    Performs a scroll search with default entity creation.
    <T> T
    search(String index, SearchEngineClient.SearchCondition<org.opensearch.action.search.SearchRequestBuilder> condition, SearchEngineClient.SearchResult<T,org.opensearch.action.search.SearchRequestBuilder,org.opensearch.action.search.SearchResponse> searchResult)
    Performs a search with custom conditions and result processing.
    org.opensearch.common.action.ActionFuture<org.opensearch.action.search.SearchResponse>
    search(org.opensearch.action.search.SearchRequest request)
    Executes a search request asynchronously.
    void
    search(org.opensearch.action.search.SearchRequest request, org.opensearch.core.action.ActionListener<org.opensearch.action.search.SearchResponse> listener)
    Executes a search request asynchronously with a callback.
    org.opensearch.common.action.ActionFuture<org.opensearch.action.search.SearchResponse>
    searchScroll(org.opensearch.action.search.SearchScrollRequest request)
    Executes a search scroll request asynchronously.
    void
    searchScroll(org.opensearch.action.search.SearchScrollRequest request, org.opensearch.core.action.ActionListener<org.opensearch.action.search.SearchResponse> listener)
    Executes a search scroll request asynchronously with a callback.
    org.opensearch.common.action.ActionFuture<org.opensearch.action.search.SearchResponse>
    searchView(org.opensearch.action.admin.indices.view.SearchViewAction.Request request)
    Searches a view asynchronously (not implemented).
    void
    searchView(org.opensearch.action.admin.indices.view.SearchViewAction.Request request, org.opensearch.core.action.ActionListener<org.opensearch.action.search.SearchResponse> listener)
    Searches a view asynchronously (not implemented).
    protected void
    Sends configuration files to the search engine for an index.
    void
    setClusterName(String clusterName)
    Sets the name of the search engine cluster.
    void
    setIndexConfigPath(String indexConfigPath)
    Sets the path to index configuration resources.
    void
    setMaxConfigSyncStatusRetry(int maxConfigSyncStatusRetry)
    Sets the maximum retry attempts for configuration synchronization status checks.
    void
    setMaxEsStatusRetry(int maxEsStatusRetry)
    Sets the maximum retry attempts for search engine status checks.
    void
    setRunner(org.codelibs.opensearch.runner.OpenSearchRunner runner)
    Sets the OpenSearch runner for embedded mode.
    void
    setScrollForDelete(String scrollForDelete)
    Sets the scroll timeout for delete operations.
    void
    setScrollForSearch(String scrollForSearch)
    Sets the scroll timeout for search operations.
    void
    setScrollForUpdate(String scrollForUpdate)
    Sets the scroll timeout for update operations.
    void
    Sets the configuration settings for the search engine.
    void
    setSizeForDelete(int sizeForDelete)
    Sets the batch size for delete operations.
    void
    setSizeForUpdate(int sizeForUpdate)
    Sets the batch size for update operations.
    org.opensearch.common.settings.Settings
    Gets the client settings.
    boolean
    store(String index, Object obj)
    Stores a document in the specified index.
    protected boolean
    switchAliases(String configIndex, String oldIndexName, String newIndexName)
    Atomically switches aliases from one index to another.
    org.opensearch.common.action.ActionFuture<org.opensearch.action.termvectors.TermVectorsResponse>
    termVectors(org.opensearch.action.termvectors.TermVectorsRequest request)
    Gets term vectors for a document asynchronously.
    void
    termVectors(org.opensearch.action.termvectors.TermVectorsRequest request, org.opensearch.core.action.ActionListener<org.opensearch.action.termvectors.TermVectorsResponse> listener)
    Gets term vectors for a document asynchronously with a callback.
    org.opensearch.threadpool.ThreadPool
    Gets the thread pool used by the client.
    boolean
    update(String index, String id, String field, Object value)
    Updates a specific field in a document.
    org.opensearch.common.action.ActionFuture<org.opensearch.action.update.UpdateResponse>
    update(org.opensearch.action.update.UpdateRequest request)
    Updates a document asynchronously.
    void
    update(org.opensearch.action.update.UpdateRequest request, org.opensearch.core.action.ActionListener<org.opensearch.action.update.UpdateResponse> listener)
    Updates a document asynchronously with a callback.
    boolean
    updateAlias(String newIndex)
    Updates index aliases to point to a new index.
    protected boolean
    updateByIdWithScript(String index, String id, String field, Object value)
    Updates a document by ID using a script when pipelines are enabled.
    long
    updateByQuery(String index, Function<org.opensearch.action.search.SearchRequestBuilder,org.opensearch.action.search.SearchRequestBuilder> option, BiFunction<org.opensearch.action.update.UpdateRequestBuilder,org.opensearch.search.SearchHit,org.opensearch.action.update.UpdateRequestBuilder> builder)
    Updates documents in an index using a query.
    void
    Enables the use of ingest pipelines for document processing.
    protected void
    Waits for the configuration synchronization service to become available.
    protected void
    waitForYellowStatus(org.codelibs.fess.mylasta.direction.FessConfig fessConfig)
    Waits for the search engine cluster to reach yellow or green status.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface org.opensearch.transport.client.Client

    bulkAsync, clearScrollAsync, deleteAsync, explainAsync, fieldCapsAsync, getAsync, getRemoteClusterClient, indexAsync, listViewNamesAsync, multiGetAsync, multiSearchAsync, multiTermVectorsAsync, searchAsync, searchScrollAsync, searchViewAsync, termVectorsAsync, updateAsync
  • Field Details

    • runner

      protected org.codelibs.opensearch.runner.OpenSearchRunner runner
      OpenSearch runner for managing the embedded search engine
    • client

      protected org.opensearch.transport.client.Client client
      OpenSearch client for executing operations
    • settings

      protected Map<String,String> settings
      Configuration settings for the search engine
    • indexConfigPath

      protected String indexConfigPath
      Path to index configuration resources
    • indexConfigList

      protected List<String> indexConfigList
      List of index configuration files to load
    • configListMap

      protected Map<String,List<String>> configListMap
      Map of configuration types to their respective configuration files
    • scrollForSearch

      protected String scrollForSearch
      Scroll timeout for search operations
    • sizeForDelete

      protected int sizeForDelete
      Batch size for delete operations
    • scrollForDelete

      protected String scrollForDelete
      Scroll timeout for delete operations
    • sizeForUpdate

      protected int sizeForUpdate
      Batch size for update operations
    • scrollForUpdate

      protected String scrollForUpdate
      Scroll timeout for update operations
    • maxConfigSyncStatusRetry

      protected int maxConfigSyncStatusRetry
      Maximum retry attempts for configuration synchronization status checks
    • maxEsStatusRetry

      protected int maxEsStatusRetry
      Maximum retry attempts for search engine status checks
    • clusterName

      protected String clusterName
      Name of the search engine cluster
    • docSettingRewriteRuleList

      protected final List<UnaryOperator<String>> docSettingRewriteRuleList
      List of rewrite rules for document settings
    • docMappingRewriteRuleList

      protected final List<UnaryOperator<String>> docMappingRewriteRuleList
      List of rewrite rules for document mappings
    • usePipeline

      protected boolean usePipeline
      Whether to use pipelines for document processing
  • Constructor Details

    • SearchEngineClient

      public SearchEngineClient()
      Default constructor.
  • Method Details

    • addIndexConfig

      public void addIndexConfig(String path)
      Adds an index configuration file path to be loaded.
      Parameters:
      path - path to the index configuration file
    • addConfigFile

      public void addConfigFile(String index, String path)
      Adds a configuration file for a specific index.
      Parameters:
      index - the index name
      path - path to the configuration file
    • setSettings

      public void setSettings(Map<String,String> settings)
      Sets the configuration settings for the search engine.
      Parameters:
      settings - map of configuration key-value pairs
    • getStatus

      public String getStatus()
      Gets the current cluster health status.
      Returns:
      the cluster health status name
    • setRunner

      public void setRunner(org.codelibs.opensearch.runner.OpenSearchRunner runner)
      Sets the OpenSearch runner for embedded mode.
      Parameters:
      runner - the OpenSearch runner instance
    • isEmbedded

      public boolean isEmbedded()
      Checks if the search engine is running in embedded mode.
      Returns:
      true if running in embedded mode, false otherwise
    • usePipeline

      public void usePipeline()
      Enables the use of ingest pipelines for document processing.
    • getInetAddressByName

      protected InetAddress getInetAddressByName(String host)
      Resolves a hostname to an InetAddress.
      Parameters:
      host - the hostname to resolve
      Returns:
      the resolved InetAddress
      Throws:
      FessSystemException - if hostname resolution fails
    • open

      @PostConstruct public void open()
      Initializes the search engine client and configures indices. Called automatically after dependency injection is complete.
    • createHttpClient

      protected org.opensearch.transport.client.Client createHttpClient(org.codelibs.fess.mylasta.direction.FessConfig fessConfig, String host)
      Creates an HTTP client for connecting to the search engine.
      Parameters:
      fessConfig - the Fess configuration
      host - the search engine host address
      Returns:
      the configured HTTP client
    • existsIndex

      public boolean existsIndex(String indexName)
      Checks if an index exists in the search engine.
      Parameters:
      indexName - the name of the index to check
      Returns:
      true if the index exists, false otherwise
    • getDocumentCount

      public long getDocumentCount(String indexName)
      Gets the document count of an index.
      Parameters:
      indexName - the name of the index
      Returns:
      the number of documents in the index, or -1 if the count could not be retrieved
    • getAliasCount

      public int getAliasCount(String indexName)
      Gets the number of aliases attached to the specified index.
      Parameters:
      indexName - the name of the index
      Returns:
      the number of aliases, or 0 if none found or an error occurred
    • copyDocIndex

      public boolean copyDocIndex(String fromIndex, String toIndex, boolean waitForCompletion)
      Copies documents from one index to another with optional transformation.
      Parameters:
      fromIndex - the source index name
      toIndex - the destination index name
      waitForCompletion - whether to wait for the operation to complete
      Returns:
      true if the copy operation was successful, false otherwise
    • reindex

      public boolean reindex(String fromIndex, String toIndex, boolean waitForCompletion)
      Reindexes documents from one index to another.
      Parameters:
      fromIndex - the source index name
      toIndex - the destination index name
      waitForCompletion - whether to wait for the operation to complete
      Returns:
      true if the reindex operation was successful, false otherwise
    • reindex

      protected boolean reindex(String fromIndex, String toIndex, String source, boolean waitForCompletion)
      Performs a reindex operation with custom source configuration.
      Parameters:
      fromIndex - the source index name
      toIndex - the destination index name
      source - the reindex configuration JSON
      waitForCompletion - whether to wait for the operation to complete
      Returns:
      true if the reindex operation was successful, false otherwise
    • getReindexRequestsPerSecound

      protected String getReindexRequestsPerSecound(org.codelibs.fess.mylasta.direction.FessConfig fessConfig)
      Calculates the requests per second setting for reindex operations.
      Parameters:
      fessConfig - the Fess configuration
      Returns:
      the requests per second value, or null for no limit
    • createIndex

      public boolean createIndex(String index, String indexName)
      Creates a new index with default settings.
      Parameters:
      index - the index configuration name
      indexName - the actual index name to create
      Returns:
      true if the index was created successfully, false otherwise
    • createIndex

      public boolean createIndex(String index, String indexName, String numberOfShards, String autoExpandReplicas, boolean uploadConfig)
      Creates a new index with specified settings.
      Parameters:
      index - the index configuration name
      indexName - the actual index name to create
      numberOfShards - the number of primary shards
      autoExpandReplicas - the auto expand replicas setting
      uploadConfig - whether to upload configuration files
      Returns:
      true if the index was created successfully, false otherwise
    • deleteIndex

      public boolean deleteIndex(String indexName)
      Deletes an index from the search engine.
      Parameters:
      indexName - the name of the index to delete
      Returns:
      true if the index was deleted successfully, false otherwise
    • reindexConfigIndices

      public boolean reindexConfigIndices(boolean loadBulkData, Set<String> targetPrefixes)
      Rebuilds configuration indices with the latest mappings using atomic alias switching. Only indices matching the specified target prefixes are rebuilt. For each index: creates a backup, reindexes data, creates a new index, reindexes from backup, atomically switches aliases, then cleans up old and backup indices.
      Parameters:
      loadBulkData - whether to load default bulk data after rebuilding (using OpType.CREATE to skip existing documents)
      targetPrefixes - the set of index prefixes to rebuild (e.g., "fess_config", "fess_user", "fess_log")
      Returns:
      true if all targeted indices were rebuilt successfully, false if any index rebuild failed
    • switchAliases

      protected boolean switchAliases(String configIndex, String oldIndexName, String newIndexName)
      Atomically switches aliases from one index to another. Reads alias configuration files, removes aliases from the old index, and adds them to the new index in a single atomic operation.
      Parameters:
      configIndex - the index configuration name
      oldIndexName - the current index name to remove aliases from
      newIndexName - the new index name to add aliases to
      Returns:
      true if all aliases were switched successfully, false otherwise
    • readIndexSetting

      protected String readIndexSetting(String fesenType, String indexConfigFile, String numberOfShards, String autoExpandReplicas)
      Reads and processes index settings from configuration file.
      Parameters:
      fesenType - the search engine type
      indexConfigFile - the path to the index configuration file
      numberOfShards - the number of primary shards
      autoExpandReplicas - the auto expand replicas setting
      Returns:
      the processed index settings JSON
    • addDocumentSettingRewriteRule

      public void addDocumentSettingRewriteRule(UnaryOperator<String> rule)
      Adds a rewrite rule for document settings.
      Parameters:
      rule - the rewrite rule to apply to document settings
    • getResourcePath

      protected String getResourcePath(String basePath, String type, String path)
      Gets the resource path for configuration files, checking type-specific variants first.
      Parameters:
      basePath - the base path for resources
      type - the search engine type
      path - the relative path to the resource
      Returns:
      the full resource path
    • addMapping

      public void addMapping(String index, String docType, String indexName)
      Adds field mappings to an index.
      Parameters:
      index - the index configuration name
      docType - the document type
      indexName - the actual index name
    • addMapping

      public void addMapping(String index, String docType, String indexName, boolean loadBulkData)
      Adds field mappings and optionally loads bulk data for an index.
      Parameters:
      index - the index configuration name
      docType - the document type name
      indexName - the actual index name
      loadBulkData - whether to load bulk data after applying mappings
    • addDocumentMappingRewriteRule

      public void addDocumentMappingRewriteRule(UnaryOperator<String> rule)
      Adds a rewrite rule for document mappings.
      Parameters:
      rule - the rewrite rule to apply to document mappings
    • updateAlias

      public boolean updateAlias(String newIndex)
      Updates index aliases to point to a new index.
      Parameters:
      newIndex - the new index to point aliases to
      Returns:
      true if the alias update was successful, false otherwise
    • createAlias

      protected void createAlias(String index, String createdIndexName)
      Creates aliases for a newly created index.
      Parameters:
      index - the index configuration name
      createdIndexName - the actual index name that was created
    • sendConfigFiles

      protected void sendConfigFiles(String index)
      Sends configuration files to the search engine for an index.
      Parameters:
      index - the index configuration name
    • flushConfigFiles

      public void flushConfigFiles(Runnable callback)
      Flushes configuration files to the search engine and executes a callback.
      Parameters:
      callback - the callback to execute after flushing
    • generateNewIndexName

      protected String generateNewIndexName(String configIndex)
      Generates a new index name with timestamp suffix.
      Parameters:
      configIndex - the base index configuration name
      Returns:
      the generated index name with timestamp
    • insertBulkData

      protected void insertBulkData(org.codelibs.fess.mylasta.direction.FessConfig fessConfig, String configIndex, String dataPath)
      Inserts bulk data from a file into an index.
      Parameters:
      fessConfig - the Fess configuration
      configIndex - the target index name
      dataPath - the path to the bulk data file
    • insertBulkData

      protected void insertBulkData(org.codelibs.fess.mylasta.direction.FessConfig fessConfig, String configIndex, String dataPath, boolean createOnly)
      Inserts bulk data from a file into an index.
      Parameters:
      fessConfig - the Fess configuration
      configIndex - the target index name
      dataPath - the path to the bulk data file
      createOnly - if true, uses OpType.CREATE to skip existing documents
    • waitForYellowStatus

      protected void waitForYellowStatus(org.codelibs.fess.mylasta.direction.FessConfig fessConfig)
      Waits for the search engine cluster to reach yellow or green status.
      Parameters:
      fessConfig - the Fess configuration
      Throws:
      org.lastaflute.di.exception.ContainerInitFailureException - if the cluster doesn't become available
    • waitForConfigSyncStatus

      protected void waitForConfigSyncStatus()
      Waits for the configuration synchronization service to become available.
      Throws:
      FessSystemException - if ConfigSync doesn't become available
    • close

      @PreDestroy public void close()
      Specified by:
      close in interface AutoCloseable
      Specified by:
      close in interface Closeable
      Specified by:
      close in interface org.opensearch.common.lease.Releasable
    • updateByQuery

      public long updateByQuery(String index, Function<org.opensearch.action.search.SearchRequestBuilder,org.opensearch.action.search.SearchRequestBuilder> option, BiFunction<org.opensearch.action.update.UpdateRequestBuilder,org.opensearch.search.SearchHit,org.opensearch.action.update.UpdateRequestBuilder> builder)
      Updates documents in an index using a query.
      Parameters:
      index - the index name
      option - function to customize the search request
      builder - function to build update requests from search hits
      Returns:
      the number of documents processed
    • deleteByQuery

      public long deleteByQuery(String index, org.opensearch.index.query.QueryBuilder queryBuilder)
      Deletes documents in an index matching a query.
      Parameters:
      index - the index name
      queryBuilder - the query to match documents for deletion
      Returns:
      the number of documents deleted
    • deleteScrollContext

      protected void deleteScrollContext(String scrollId)
      Deletes a scroll context to free resources.
      Parameters:
      scrollId - the scroll ID to delete
    • get

      protected <T> T get(String index, String id, SearchEngineClient.SearchCondition<org.opensearch.action.get.GetRequestBuilder> condition, SearchEngineClient.SearchResult<T,org.opensearch.action.get.GetRequestBuilder,org.opensearch.action.get.GetResponse> searchResult)
      Retrieves a document by ID with custom conditions and result processing.
      Type Parameters:
      T - the result type
      Parameters:
      index - the index name
      id - the document ID
      condition - the search condition
      searchResult - the result processor
      Returns:
      the processed result
    • search

      public <T> T search(String index, SearchEngineClient.SearchCondition<org.opensearch.action.search.SearchRequestBuilder> condition, SearchEngineClient.SearchResult<T,org.opensearch.action.search.SearchRequestBuilder,org.opensearch.action.search.SearchResponse> searchResult)
      Performs a search with custom conditions and result processing.
      Type Parameters:
      T - the result type
      Parameters:
      index - the index name
      condition - the search condition
      searchResult - the result processor
      Returns:
      the processed search result
      Throws:
      InvalidQueryException - if the query is invalid
    • scrollSearch

      public long scrollSearch(String index, SearchEngineClient.SearchCondition<org.opensearch.action.search.SearchRequestBuilder> condition, BooleanFunction<Map<String,Object>> cursor)
      Performs a scroll search with default entity creation.
      Parameters:
      index - the index name
      condition - the search condition
      cursor - the cursor function to process each hit
      Returns:
      the number of documents processed
      Throws:
      InvalidQueryException - if the query is invalid
    • scrollSearch

      public <T> long scrollSearch(String index, SearchEngineClient.SearchCondition<org.opensearch.action.search.SearchRequestBuilder> condition, SearchEngineClient.EntityCreator<T,org.opensearch.action.search.SearchResponse,org.opensearch.search.SearchHit> creator, BooleanFunction<T> cursor)
      Performs a scroll search with custom entity creation.
      Type Parameters:
      T - the entity type
      Parameters:
      index - the index name
      condition - the search condition
      creator - the entity creator
      cursor - the cursor function to process each entity
      Returns:
      the number of documents processed
      Throws:
      InvalidQueryException - if the query is invalid
    • getDocument

      public org.dbflute.optional.OptionalEntity<Map<String,Object>> getDocument(String index, SearchEngineClient.SearchCondition<org.opensearch.action.search.SearchRequestBuilder> condition)
      Retrieves a single document matching the search condition.
      Parameters:
      index - the index name
      condition - the search condition
      Returns:
      an optional containing the document if found
    • getDocument

      protected <T> org.dbflute.optional.OptionalEntity<T> getDocument(String index, SearchEngineClient.SearchCondition<org.opensearch.action.search.SearchRequestBuilder> condition, SearchEngineClient.EntityCreator<T,org.opensearch.action.search.SearchResponse,org.opensearch.search.SearchHit> creator)
      Retrieves a single document with custom entity creation.
      Type Parameters:
      T - the entity type
      Parameters:
      index - the index name
      condition - the search condition
      creator - the entity creator
      Returns:
      an optional containing the entity if found
    • getDocumentList

      public List<Map<String,Object>> getDocumentList(String index, SearchEngineClient.SearchCondition<org.opensearch.action.search.SearchRequestBuilder> condition)
      Retrieves a list of documents matching the search condition.
      Parameters:
      index - the index name
      condition - the search condition
      Returns:
      a list of documents
    • getDefaultEntityCreator

      protected SearchEngineClient.EntityCreator<Map<String,Object>,org.opensearch.action.search.SearchResponse,org.opensearch.search.SearchHit> getDefaultEntityCreator()
      Gets the default entity creator for converting search hits to maps.
      Returns:
      the default entity creator
    • getDocumentList

      protected <T> List<T> getDocumentList(String index, SearchEngineClient.SearchCondition<org.opensearch.action.search.SearchRequestBuilder> condition, SearchEngineClient.EntityCreator<T,org.opensearch.action.search.SearchResponse,org.opensearch.search.SearchHit> creator)
      Retrieves a list of documents with custom entity creation.
      Type Parameters:
      T - the entity type
      Parameters:
      index - the index name
      condition - the search condition
      creator - the entity creator
      Returns:
      a list of entities
    • update

      public boolean update(String index, String id, String field, Object value)
      Updates a specific field in a document.
      Parameters:
      index - the index name
      id - the document ID
      field - the field name to update
      value - the new field value
      Returns:
      true if the update was successful, false otherwise
      Throws:
      SearchEngineClientException - if the update fails
    • updateByIdWithScript

      protected boolean updateByIdWithScript(String index, String id, String field, Object value)
      Updates a document by ID using a script when pipelines are enabled.
      Parameters:
      index - the index name
      id - the document ID
      field - the field name to update
      value - the new field value
      Returns:
      true if the update was successful, false otherwise
      Throws:
      SearchEngineClientException - if the update fails
    • refresh

      public void refresh(String... indices)
      Refreshes the specified indices to make recent changes visible for search.
      Parameters:
      indices - the indices to refresh
    • flush

      public void flush(String... indices)
      Flushes the specified indices to ensure data is written to disk.
      Parameters:
      indices - the indices to flush
    • ping

      public PingResponse ping()
      Pings the search engine cluster to check connectivity and health.
      Returns:
      the ping response with cluster information
      Throws:
      SearchEngineClientException - if the ping fails
    • addAll

      public org.opensearch.action.bulk.BulkResponse addAll(String index, List<Map<String,Object>> docList, BiConsumer<Map<String,Object>,org.opensearch.action.index.IndexRequestBuilder> options)
      Adds multiple documents to the specified index in bulk.
      Parameters:
      index - the target index
      docList - list of documents to add
      options - callback for customizing index request options
      Returns:
      the bulk response
    • store

      public boolean store(String index, Object obj)
      Stores a document in the specified index.
      Parameters:
      index - the index name
      obj - the document object to store
      Returns:
      true if the document was stored successfully, false otherwise
      Throws:
      SearchEngineClientException - if the store operation fails
    • delete

      public boolean delete(String index, String id)
      Deletes a document from the specified index.
      Parameters:
      index - the index name
      id - the document ID
      Returns:
      true if the document was deleted successfully, false otherwise
    • delete

      public boolean delete(String index, String id, Number seqNo, Number primaryTerm)
      Deletes a document from the specified index with optimistic concurrency control.
      Parameters:
      index - the index name
      id - the document ID
      seqNo - the sequence number for optimistic concurrency control
      primaryTerm - the primary term for optimistic concurrency control
      Returns:
      true if the document was deleted successfully, false otherwise
      Throws:
      SearchEngineClientException - if the delete operation fails
    • setIndexConfigPath

      public void setIndexConfigPath(String indexConfigPath)
      Sets the path to index configuration resources.
      Parameters:
      indexConfigPath - the path to index configuration resources
    • setClusterName

      public void setClusterName(String clusterName)
      Sets the name of the search engine cluster.
      Parameters:
      clusterName - the cluster name
    • getEngineInfo

      public org.codelibs.fesen.client.EngineInfo getEngineInfo()
      Gets information about the search engine.
      Returns:
      the engine information
      Throws:
      SearchEngineClientException - if the client is not an HttpClient
    • threadPool

      public org.opensearch.threadpool.ThreadPool threadPool()
      Gets the thread pool used by the client.
      Specified by:
      threadPool in interface org.opensearch.transport.client.OpenSearchClient
      Returns:
      the thread pool
    • admin

      public org.opensearch.transport.client.AdminClient admin()
      Gets the admin client for cluster and index administration.
      Specified by:
      admin in interface org.opensearch.transport.client.Client
      Returns:
      the admin client
    • index

      public org.opensearch.common.action.ActionFuture<org.opensearch.action.index.IndexResponse> index(org.opensearch.action.index.IndexRequest request)
      Indexes a document asynchronously.
      Specified by:
      index in interface org.opensearch.transport.client.Client
      Parameters:
      request - the index request
      Returns:
      a future for the index response
    • index

      public void index(org.opensearch.action.index.IndexRequest request, org.opensearch.core.action.ActionListener<org.opensearch.action.index.IndexResponse> listener)
      Indexes a document asynchronously with a callback.
      Specified by:
      index in interface org.opensearch.transport.client.Client
      Parameters:
      request - the index request
      listener - the response listener
    • prepareIndex

      public org.opensearch.action.index.IndexRequestBuilder prepareIndex()
      Prepares an index request builder.
      Specified by:
      prepareIndex in interface org.opensearch.transport.client.Client
      Returns:
      the index request builder
    • update

      public org.opensearch.common.action.ActionFuture<org.opensearch.action.update.UpdateResponse> update(org.opensearch.action.update.UpdateRequest request)
      Updates a document asynchronously.
      Specified by:
      update in interface org.opensearch.transport.client.Client
      Parameters:
      request - the update request
      Returns:
      a future for the update response
    • update

      public void update(org.opensearch.action.update.UpdateRequest request, org.opensearch.core.action.ActionListener<org.opensearch.action.update.UpdateResponse> listener)
      Updates a document asynchronously with a callback.
      Specified by:
      update in interface org.opensearch.transport.client.Client
      Parameters:
      request - the update request
      listener - the response listener
    • prepareUpdate

      public org.opensearch.action.update.UpdateRequestBuilder prepareUpdate()
      Prepares an update request builder.
      Specified by:
      prepareUpdate in interface org.opensearch.transport.client.Client
      Returns:
      the update request builder
    • prepareUpdate

      public org.opensearch.action.update.UpdateRequestBuilder prepareUpdate(String index, String id)
      Prepares an update request builder for a specific document.
      Specified by:
      prepareUpdate in interface org.opensearch.transport.client.Client
      Parameters:
      index - the index name
      id - the document ID
      Returns:
      the update request builder
    • prepareIndex

      public org.opensearch.action.index.IndexRequestBuilder prepareIndex(String index)
      Prepares an index request builder for a specific index.
      Specified by:
      prepareIndex in interface org.opensearch.transport.client.Client
      Parameters:
      index - the index name
      Returns:
      the index request builder
    • delete

      public org.opensearch.common.action.ActionFuture<org.opensearch.action.delete.DeleteResponse> delete(org.opensearch.action.delete.DeleteRequest request)
      Deletes a document asynchronously.
      Specified by:
      delete in interface org.opensearch.transport.client.Client
      Parameters:
      request - the delete request
      Returns:
      a future for the delete response
    • delete

      public void delete(org.opensearch.action.delete.DeleteRequest request, org.opensearch.core.action.ActionListener<org.opensearch.action.delete.DeleteResponse> listener)
      Deletes a document asynchronously with a callback.
      Specified by:
      delete in interface org.opensearch.transport.client.Client
      Parameters:
      request - the delete request
      listener - the response listener
    • prepareDelete

      public org.opensearch.action.delete.DeleteRequestBuilder prepareDelete()
      Prepares a delete request builder.
      Specified by:
      prepareDelete in interface org.opensearch.transport.client.Client
      Returns:
      the delete request builder
    • prepareDelete

      public org.opensearch.action.delete.DeleteRequestBuilder prepareDelete(String index, String id)
      Prepares a delete request builder for a specific document.
      Specified by:
      prepareDelete in interface org.opensearch.transport.client.Client
      Parameters:
      index - the index name
      id - the document ID
      Returns:
      the delete request builder
    • bulk

      public org.opensearch.common.action.ActionFuture<org.opensearch.action.bulk.BulkResponse> bulk(org.opensearch.action.bulk.BulkRequest request)
      Executes a bulk request asynchronously.
      Specified by:
      bulk in interface org.opensearch.transport.client.Client
      Parameters:
      request - the bulk request
      Returns:
      a future for the bulk response
    • bulk

      public void bulk(org.opensearch.action.bulk.BulkRequest request, org.opensearch.core.action.ActionListener<org.opensearch.action.bulk.BulkResponse> listener)
      Executes a bulk request asynchronously with a callback.
      Specified by:
      bulk in interface org.opensearch.transport.client.Client
      Parameters:
      request - the bulk request
      listener - the response listener
    • prepareBulk

      public org.opensearch.action.bulk.BulkRequestBuilder prepareBulk()
      Prepares a bulk request builder.
      Specified by:
      prepareBulk in interface org.opensearch.transport.client.Client
      Returns:
      the bulk request builder
    • get

      public org.opensearch.common.action.ActionFuture<org.opensearch.action.get.GetResponse> get(org.opensearch.action.get.GetRequest request)
      Gets a document asynchronously.
      Specified by:
      get in interface org.opensearch.transport.client.Client
      Parameters:
      request - the get request
      Returns:
      a future for the get response
    • get

      public void get(org.opensearch.action.get.GetRequest request, org.opensearch.core.action.ActionListener<org.opensearch.action.get.GetResponse> listener)
      Gets a document asynchronously with a callback.
      Specified by:
      get in interface org.opensearch.transport.client.Client
      Parameters:
      request - the get request
      listener - the response listener
    • prepareGet

      public org.opensearch.action.get.GetRequestBuilder prepareGet()
      Prepares a get request builder.
      Specified by:
      prepareGet in interface org.opensearch.transport.client.Client
      Returns:
      the get request builder
    • prepareGet

      public org.opensearch.action.get.GetRequestBuilder prepareGet(String index, String id)
      Prepares a get request builder for a specific document.
      Specified by:
      prepareGet in interface org.opensearch.transport.client.Client
      Parameters:
      index - the index name
      id - the document ID
      Returns:
      the get request builder
    • multiGet

      public org.opensearch.common.action.ActionFuture<org.opensearch.action.get.MultiGetResponse> multiGet(org.opensearch.action.get.MultiGetRequest request)
      Gets multiple documents asynchronously.
      Specified by:
      multiGet in interface org.opensearch.transport.client.Client
      Parameters:
      request - the multi-get request
      Returns:
      a future for the multi-get response
    • multiGet

      public void multiGet(org.opensearch.action.get.MultiGetRequest request, org.opensearch.core.action.ActionListener<org.opensearch.action.get.MultiGetResponse> listener)
      Gets multiple documents asynchronously with a callback.
      Specified by:
      multiGet in interface org.opensearch.transport.client.Client
      Parameters:
      request - the multi-get request
      listener - the response listener
    • prepareMultiGet

      public org.opensearch.action.get.MultiGetRequestBuilder prepareMultiGet()
      Prepares a multi-get request builder.
      Specified by:
      prepareMultiGet in interface org.opensearch.transport.client.Client
      Returns:
      the multi-get request builder
    • search

      public org.opensearch.common.action.ActionFuture<org.opensearch.action.search.SearchResponse> search(org.opensearch.action.search.SearchRequest request)
      Executes a search request asynchronously.
      Specified by:
      search in interface org.opensearch.transport.client.Client
      Parameters:
      request - the search request
      Returns:
      a future for the search response
    • search

      public void search(org.opensearch.action.search.SearchRequest request, org.opensearch.core.action.ActionListener<org.opensearch.action.search.SearchResponse> listener)
      Executes a search request asynchronously with a callback.
      Specified by:
      search in interface org.opensearch.transport.client.Client
      Parameters:
      request - the search request
      listener - the response listener
    • prepareSearch

      public org.opensearch.action.search.SearchRequestBuilder prepareSearch(String... indices)
      Prepares a search request builder for specific indices.
      Specified by:
      prepareSearch in interface org.opensearch.transport.client.Client
      Parameters:
      indices - the indices to search
      Returns:
      the search request builder
    • prepareStreamSearch

      public org.opensearch.action.search.SearchRequestBuilder prepareStreamSearch(String... indices)
      Prepares a stream search request builder for specific indices.
      Specified by:
      prepareStreamSearch in interface org.opensearch.transport.client.Client
      Parameters:
      indices - the indices to search
      Returns:
      the search request builder
    • searchScroll

      public org.opensearch.common.action.ActionFuture<org.opensearch.action.search.SearchResponse> searchScroll(org.opensearch.action.search.SearchScrollRequest request)
      Executes a search scroll request asynchronously.
      Specified by:
      searchScroll in interface org.opensearch.transport.client.Client
      Parameters:
      request - the search scroll request
      Returns:
      a future for the search response
    • searchScroll

      public void searchScroll(org.opensearch.action.search.SearchScrollRequest request, org.opensearch.core.action.ActionListener<org.opensearch.action.search.SearchResponse> listener)
      Executes a search scroll request asynchronously with a callback.
      Specified by:
      searchScroll in interface org.opensearch.transport.client.Client
      Parameters:
      request - the search scroll request
      listener - the response listener
    • prepareSearchScroll

      public org.opensearch.action.search.SearchScrollRequestBuilder prepareSearchScroll(String scrollId)
      Prepares a search scroll request builder.
      Specified by:
      prepareSearchScroll in interface org.opensearch.transport.client.Client
      Parameters:
      scrollId - the scroll ID
      Returns:
      the search scroll request builder
    • multiSearch

      public org.opensearch.common.action.ActionFuture<org.opensearch.action.search.MultiSearchResponse> multiSearch(org.opensearch.action.search.MultiSearchRequest request)
      Executes a multi-search request asynchronously.
      Specified by:
      multiSearch in interface org.opensearch.transport.client.Client
      Parameters:
      request - the multi-search request
      Returns:
      a future for the multi-search response
    • multiSearch

      public void multiSearch(org.opensearch.action.search.MultiSearchRequest request, org.opensearch.core.action.ActionListener<org.opensearch.action.search.MultiSearchResponse> listener)
      Executes a multi-search request asynchronously with a callback.
      Specified by:
      multiSearch in interface org.opensearch.transport.client.Client
      Parameters:
      request - the multi-search request
      listener - the response listener
    • prepareMultiSearch

      public org.opensearch.action.search.MultiSearchRequestBuilder prepareMultiSearch()
      Prepares a multi-search request builder.
      Specified by:
      prepareMultiSearch in interface org.opensearch.transport.client.Client
      Returns:
      the multi-search request builder
    • prepareExplain

      public org.opensearch.action.explain.ExplainRequestBuilder prepareExplain(String index, String id)
      Prepares an explain request builder for a specific document.
      Specified by:
      prepareExplain in interface org.opensearch.transport.client.Client
      Parameters:
      index - the index name
      id - the document ID
      Returns:
      the explain request builder
    • explain

      public org.opensearch.common.action.ActionFuture<org.opensearch.action.explain.ExplainResponse> explain(org.opensearch.action.explain.ExplainRequest request)
      Executes an explain request asynchronously.
      Specified by:
      explain in interface org.opensearch.transport.client.Client
      Parameters:
      request - the explain request
      Returns:
      a future for the explain response
    • explain

      public void explain(org.opensearch.action.explain.ExplainRequest request, org.opensearch.core.action.ActionListener<org.opensearch.action.explain.ExplainResponse> listener)
      Executes an explain request asynchronously with a callback.
      Specified by:
      explain in interface org.opensearch.transport.client.Client
      Parameters:
      request - the explain request
      listener - the response listener
    • prepareClearScroll

      public org.opensearch.action.search.ClearScrollRequestBuilder prepareClearScroll()
      Prepares a clear scroll request builder.
      Specified by:
      prepareClearScroll in interface org.opensearch.transport.client.Client
      Returns:
      the clear scroll request builder
    • clearScroll

      public org.opensearch.common.action.ActionFuture<org.opensearch.action.search.ClearScrollResponse> clearScroll(org.opensearch.action.search.ClearScrollRequest request)
      Clears scroll contexts asynchronously.
      Specified by:
      clearScroll in interface org.opensearch.transport.client.Client
      Parameters:
      request - the clear scroll request
      Returns:
      a future for the clear scroll response
    • clearScroll

      public void clearScroll(org.opensearch.action.search.ClearScrollRequest request, org.opensearch.core.action.ActionListener<org.opensearch.action.search.ClearScrollResponse> listener)
      Clears scroll contexts asynchronously with a callback.
      Specified by:
      clearScroll in interface org.opensearch.transport.client.Client
      Parameters:
      request - the clear scroll request
      listener - the response listener
    • settings

      public org.opensearch.common.settings.Settings settings()
      Gets the client settings.
      Specified by:
      settings in interface org.opensearch.transport.client.Client
      Returns:
      the client settings
    • termVectors

      public org.opensearch.common.action.ActionFuture<org.opensearch.action.termvectors.TermVectorsResponse> termVectors(org.opensearch.action.termvectors.TermVectorsRequest request)
      Gets term vectors for a document asynchronously.
      Specified by:
      termVectors in interface org.opensearch.transport.client.Client
      Parameters:
      request - the term vectors request
      Returns:
      a future for the term vectors response
    • termVectors

      public void termVectors(org.opensearch.action.termvectors.TermVectorsRequest request, org.opensearch.core.action.ActionListener<org.opensearch.action.termvectors.TermVectorsResponse> listener)
      Gets term vectors for a document asynchronously with a callback.
      Specified by:
      termVectors in interface org.opensearch.transport.client.Client
      Parameters:
      request - the term vectors request
      listener - the response listener
    • prepareTermVectors

      public org.opensearch.action.termvectors.TermVectorsRequestBuilder prepareTermVectors()
      Prepares a term vectors request builder.
      Specified by:
      prepareTermVectors in interface org.opensearch.transport.client.Client
      Returns:
      the term vectors request builder
    • prepareTermVectors

      public org.opensearch.action.termvectors.TermVectorsRequestBuilder prepareTermVectors(String index, String id)
      Prepares a term vectors request builder for a specific document.
      Specified by:
      prepareTermVectors in interface org.opensearch.transport.client.Client
      Parameters:
      index - the index name
      id - the document ID
      Returns:
      the term vectors request builder
    • multiTermVectors

      public org.opensearch.common.action.ActionFuture<org.opensearch.action.termvectors.MultiTermVectorsResponse> multiTermVectors(org.opensearch.action.termvectors.MultiTermVectorsRequest request)
      Gets term vectors for multiple documents asynchronously.
      Specified by:
      multiTermVectors in interface org.opensearch.transport.client.Client
      Parameters:
      request - the multi-term vectors request
      Returns:
      a future for the multi-term vectors response
    • multiTermVectors

      public void multiTermVectors(org.opensearch.action.termvectors.MultiTermVectorsRequest request, org.opensearch.core.action.ActionListener<org.opensearch.action.termvectors.MultiTermVectorsResponse> listener)
      Gets term vectors for multiple documents asynchronously with a callback.
      Specified by:
      multiTermVectors in interface org.opensearch.transport.client.Client
      Parameters:
      request - the multi-term vectors request
      listener - the response listener
    • prepareMultiTermVectors

      public org.opensearch.action.termvectors.MultiTermVectorsRequestBuilder prepareMultiTermVectors()
      Prepares a multi-term vectors request builder.
      Specified by:
      prepareMultiTermVectors in interface org.opensearch.transport.client.Client
      Returns:
      the multi-term vectors request builder
    • setSizeForUpdate

      public void setSizeForUpdate(int sizeForUpdate)
      Sets the batch size for update operations.
      Parameters:
      sizeForUpdate - the batch size for updates
    • setScrollForUpdate

      public void setScrollForUpdate(String scrollForUpdate)
      Sets the scroll timeout for update operations.
      Parameters:
      scrollForUpdate - the scroll timeout string
    • setSizeForDelete

      public void setSizeForDelete(int sizeForDelete)
      Sets the batch size for delete operations.
      Parameters:
      sizeForDelete - the batch size for deletes
    • setScrollForDelete

      public void setScrollForDelete(String scrollForDelete)
      Sets the scroll timeout for delete operations.
      Parameters:
      scrollForDelete - the scroll timeout string
    • setScrollForSearch

      public void setScrollForSearch(String scrollForSearch)
      Sets the scroll timeout for search operations.
      Parameters:
      scrollForSearch - the scroll timeout string
    • setMaxConfigSyncStatusRetry

      public void setMaxConfigSyncStatusRetry(int maxConfigSyncStatusRetry)
      Sets the maximum retry attempts for configuration synchronization status checks.
      Parameters:
      maxConfigSyncStatusRetry - the maximum retry attempts
    • setMaxEsStatusRetry

      public void setMaxEsStatusRetry(int maxEsStatusRetry)
      Sets the maximum retry attempts for search engine status checks.
      Parameters:
      maxEsStatusRetry - the maximum retry attempts
    • filterWithHeader

      public org.opensearch.transport.client.Client filterWithHeader(Map<String,String> headers)
      Creates a client filtered with additional headers.
      Specified by:
      filterWithHeader in interface org.opensearch.transport.client.Client
      Parameters:
      headers - the headers to add to requests
      Returns:
      the filtered client
    • execute

      public <Request extends org.opensearch.action.ActionRequest, Response extends org.opensearch.core.action.ActionResponse> org.opensearch.common.action.ActionFuture<Response> execute(org.opensearch.action.ActionType<Response> action, Request request)
      Executes an action asynchronously.
      Specified by:
      execute in interface org.opensearch.transport.client.OpenSearchClient
      Type Parameters:
      Request - the request type
      Response - the response type
      Parameters:
      action - the action to execute
      request - the action request
      Returns:
      a future for the action response
    • execute

      public <Request extends org.opensearch.action.ActionRequest, Response extends org.opensearch.core.action.ActionResponse> void execute(org.opensearch.action.ActionType<Response> action, Request request, org.opensearch.core.action.ActionListener<Response> listener)
      Executes an action asynchronously with a callback.
      Specified by:
      execute in interface org.opensearch.transport.client.OpenSearchClient
      Type Parameters:
      Request - the request type
      Response - the response type
      Parameters:
      action - the action to execute
      request - the action request
      listener - the response listener
    • prepareFieldCaps

      public org.opensearch.action.fieldcaps.FieldCapabilitiesRequestBuilder prepareFieldCaps(String... indices)
      Prepares a field capabilities request builder.
      Specified by:
      prepareFieldCaps in interface org.opensearch.transport.client.Client
      Parameters:
      indices - the indices to check field capabilities for
      Returns:
      the field capabilities request builder
    • fieldCaps

      public org.opensearch.common.action.ActionFuture<org.opensearch.action.fieldcaps.FieldCapabilitiesResponse> fieldCaps(org.opensearch.action.fieldcaps.FieldCapabilitiesRequest request)
      Gets field capabilities asynchronously.
      Specified by:
      fieldCaps in interface org.opensearch.transport.client.Client
      Parameters:
      request - the field capabilities request
      Returns:
      a future for the field capabilities response
    • fieldCaps

      public void fieldCaps(org.opensearch.action.fieldcaps.FieldCapabilitiesRequest request, org.opensearch.core.action.ActionListener<org.opensearch.action.fieldcaps.FieldCapabilitiesResponse> listener)
      Gets field capabilities asynchronously with a callback.
      Specified by:
      fieldCaps in interface org.opensearch.transport.client.Client
      Parameters:
      request - the field capabilities request
      listener - the response listener
    • prepareBulk

      public org.opensearch.action.bulk.BulkRequestBuilder prepareBulk(String globalIndex)
      Prepares a bulk request builder with a global index.
      Specified by:
      prepareBulk in interface org.opensearch.transport.client.Client
      Parameters:
      globalIndex - the global index for all operations
      Returns:
      the bulk request builder
    • createPit

      public void createPit(org.opensearch.action.search.CreatePitRequest createPITRequest, org.opensearch.core.action.ActionListener<org.opensearch.action.search.CreatePitResponse> listener)
      Creates a point-in-time context asynchronously.
      Specified by:
      createPit in interface org.opensearch.transport.client.Client
      Parameters:
      createPITRequest - the create PIT request
      listener - the response listener
    • deletePits

      public void deletePits(org.opensearch.action.search.DeletePitRequest deletePITRequest, org.opensearch.core.action.ActionListener<org.opensearch.action.search.DeletePitResponse> listener)
      Deletes point-in-time contexts asynchronously.
      Specified by:
      deletePits in interface org.opensearch.transport.client.Client
      Parameters:
      deletePITRequest - the delete PITs request
      listener - the response listener
    • getAllPits

      public void getAllPits(org.opensearch.action.search.GetAllPitNodesRequest getAllPitNodesRequest, org.opensearch.core.action.ActionListener<org.opensearch.action.search.GetAllPitNodesResponse> listener)
      Gets all point-in-time contexts asynchronously.
      Specified by:
      getAllPits in interface org.opensearch.transport.client.Client
      Parameters:
      getAllPitNodesRequest - the get all PITs request
      listener - the response listener
    • pitSegments

      public void pitSegments(org.opensearch.action.admin.indices.segments.PitSegmentsRequest pitSegmentsRequest, org.opensearch.core.action.ActionListener<org.opensearch.action.admin.indices.segments.IndicesSegmentResponse> listener)
      Gets point-in-time segments information asynchronously.
      Specified by:
      pitSegments in interface org.opensearch.transport.client.Client
      Parameters:
      pitSegmentsRequest - the PIT segments request
      listener - the response listener
    • searchView

      public void searchView(org.opensearch.action.admin.indices.view.SearchViewAction.Request request, org.opensearch.core.action.ActionListener<org.opensearch.action.search.SearchResponse> listener)
      Searches a view asynchronously (not implemented).
      Specified by:
      searchView in interface org.opensearch.transport.client.Client
      Parameters:
      request - the search view request
      listener - the response listener
      Throws:
      UnsupportedOperationException - always thrown as this operation is not implemented
    • searchView

      public org.opensearch.common.action.ActionFuture<org.opensearch.action.search.SearchResponse> searchView(org.opensearch.action.admin.indices.view.SearchViewAction.Request request)
      Searches a view asynchronously (not implemented).
      Specified by:
      searchView in interface org.opensearch.transport.client.Client
      Parameters:
      request - the search view request
      Returns:
      never returns as this operation is not implemented
      Throws:
      UnsupportedOperationException - always thrown as this operation is not implemented
    • listViewNames

      public void listViewNames(org.opensearch.action.admin.indices.view.ListViewNamesAction.Request request, org.opensearch.core.action.ActionListener<org.opensearch.action.admin.indices.view.ListViewNamesAction.Response> listener)
      Lists view names asynchronously (not implemented).
      Specified by:
      listViewNames in interface org.opensearch.transport.client.Client
      Parameters:
      request - the list view names request
      listener - the response listener
      Throws:
      UnsupportedOperationException - always thrown as this operation is not implemented
    • listViewNames

      public org.opensearch.common.action.ActionFuture<org.opensearch.action.admin.indices.view.ListViewNamesAction.Response> listViewNames(org.opensearch.action.admin.indices.view.ListViewNamesAction.Request request)
      Lists view names asynchronously (not implemented).
      Specified by:
      listViewNames in interface org.opensearch.transport.client.Client
      Parameters:
      request - the list view names request
      Returns:
      never returns as this operation is not implemented
      Throws:
      UnsupportedOperationException - always thrown as this operation is not implemented