Class SearchEngineClient

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

public class SearchEngineClient extends Object implements org.opensearch.client.Client
  • Field Details

    • runner

      protected org.codelibs.opensearch.runner.OpenSearchRunner runner
    • client

      protected org.opensearch.client.Client client
    • settings

      protected Map<String,String> settings
    • indexConfigPath

      protected String indexConfigPath
    • indexConfigList

      protected List<String> indexConfigList
    • configListMap

      protected Map<String,List<String>> configListMap
    • scrollForSearch

      protected String scrollForSearch
    • sizeForDelete

      protected int sizeForDelete
    • scrollForDelete

      protected String scrollForDelete
    • sizeForUpdate

      protected int sizeForUpdate
    • scrollForUpdate

      protected String scrollForUpdate
    • maxConfigSyncStatusRetry

      protected int maxConfigSyncStatusRetry
    • maxEsStatusRetry

      protected int maxEsStatusRetry
    • clusterName

      protected String clusterName
  • Constructor Details

    • SearchEngineClient

      public SearchEngineClient()
  • Method Details

    • addIndexConfig

      public void addIndexConfig(String path)
    • addConfigFile

      public void addConfigFile(String index, String path)
    • setSettings

      public void setSettings(Map<String,String> settings)
    • getStatus

      public String getStatus()
    • setRunner

      public void setRunner(org.codelibs.opensearch.runner.OpenSearchRunner runner)
    • isEmbedded

      public boolean isEmbedded()
    • getInetAddressByName

      protected InetAddress getInetAddressByName(String host)
    • open

      @PostConstruct public void open()
    • createHttpClient

      protected org.opensearch.client.Client createHttpClient(FessConfig fessConfig, String host)
    • existsIndex

      public boolean existsIndex(String indexName)
    • copyDocIndex

      public boolean copyDocIndex(String fromIndex, String toIndex, boolean waitForCompletion)
    • reindex

      public boolean reindex(String fromIndex, String toIndex, boolean waitForCompletion)
    • reindex

      protected boolean reindex(String fromIndex, String toIndex, String source, boolean waitForCompletion)
    • getReindexRequestsPerSecound

      protected String getReindexRequestsPerSecound(FessConfig fessConfig)
    • createIndex

      public boolean createIndex(String index, String indexName)
    • createIndex

      public boolean createIndex(String index, String indexName, String numberOfShards, String autoExpandReplicas, boolean uploadConfig)
    • deleteIndex

      public boolean deleteIndex(String indexName)
    • readIndexSetting

      protected String readIndexSetting(String fesenType, String indexConfigFile, String numberOfShards, String autoExpandReplicas)
    • getResourcePath

      protected String getResourcePath(String basePath, String type, String path)
    • addMapping

      public void addMapping(String index, String docType, String indexName)
    • updateAlias

      public boolean updateAlias(String newIndex)
    • createAlias

      protected void createAlias(String index, String createdIndexName)
    • sendConfigFiles

      protected void sendConfigFiles(String index)
    • generateNewIndexName

      protected String generateNewIndexName(String configIndex)
    • insertBulkData

      protected void insertBulkData(FessConfig fessConfig, String configIndex, String dataPath)
    • waitForYellowStatus

      protected void waitForYellowStatus(FessConfig fessConfig)
    • waitForConfigSyncStatus

      protected void waitForConfigSyncStatus()
    • 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)
    • deleteByQuery

      public long deleteByQuery(String index, org.opensearch.index.query.QueryBuilder queryBuilder)
    • deleteScrollContext

      protected void deleteScrollContext(String scrollId)
    • get

      protected <T> T get(String index, String type, String id, SearchEngineClient.SearchCondition<org.opensearch.action.get.GetRequestBuilder> condition, SearchEngineClient.SearchResult<T,org.opensearch.action.get.GetRequestBuilder,org.opensearch.action.get.GetResponse> searchResult)
    • 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)
    • 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)
    • getDocument

      public org.dbflute.optional.OptionalEntity<Map<String,Object>> getDocument(String index, SearchEngineClient.SearchCondition<org.opensearch.action.search.SearchRequestBuilder> condition)
    • 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)
    • getDocumentList

      public List<Map<String,Object>> getDocumentList(String index, SearchEngineClient.SearchCondition<org.opensearch.action.search.SearchRequestBuilder> condition)
    • 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)
    • update

      public boolean update(String index, String id, String field, Object value)
    • refresh

      public void refresh(String... indices)
    • flush

      public void flush(String... indices)
    • ping

      public PingResponse ping()
    • addAll

      public void addAll(String index, List<Map<String,Object>> docList, BiConsumer<Map<String,Object>,org.opensearch.action.index.IndexRequestBuilder> options)
    • store

      public boolean store(String index, Object obj)
    • delete

      public boolean delete(String index, String id)
    • delete

      public boolean delete(String index, String id, Number seqNo, Number primaryTerm)
    • setIndexConfigPath

      public void setIndexConfigPath(String indexConfigPath)
    • setClusterName

      public void setClusterName(String clusterName)
    • getEngineInfo

      public org.codelibs.fesen.client.EngineInfo getEngineInfo()
    • threadPool

      public org.opensearch.threadpool.ThreadPool threadPool()
      Specified by:
      threadPool in interface org.opensearch.client.OpenSearchClient
    • admin

      public org.opensearch.client.AdminClient admin()
      Specified by:
      admin in interface org.opensearch.client.Client
    • index

      public org.opensearch.action.ActionFuture<org.opensearch.action.index.IndexResponse> index(org.opensearch.action.index.IndexRequest request)
      Specified by:
      index in interface org.opensearch.client.Client
    • index

      public void index(org.opensearch.action.index.IndexRequest request, org.opensearch.action.ActionListener<org.opensearch.action.index.IndexResponse> listener)
      Specified by:
      index in interface org.opensearch.client.Client
    • prepareIndex

      public org.opensearch.action.index.IndexRequestBuilder prepareIndex()
      Specified by:
      prepareIndex in interface org.opensearch.client.Client
    • update

      public org.opensearch.action.ActionFuture<org.opensearch.action.update.UpdateResponse> update(org.opensearch.action.update.UpdateRequest request)
      Specified by:
      update in interface org.opensearch.client.Client
    • update

      public void update(org.opensearch.action.update.UpdateRequest request, org.opensearch.action.ActionListener<org.opensearch.action.update.UpdateResponse> listener)
      Specified by:
      update in interface org.opensearch.client.Client
    • prepareUpdate

      public org.opensearch.action.update.UpdateRequestBuilder prepareUpdate()
      Specified by:
      prepareUpdate in interface org.opensearch.client.Client
    • prepareUpdate

      public org.opensearch.action.update.UpdateRequestBuilder prepareUpdate(String index, String type, String id)
      Specified by:
      prepareUpdate in interface org.opensearch.client.Client
    • prepareIndex

      public org.opensearch.action.index.IndexRequestBuilder prepareIndex(String index, String type)
      Specified by:
      prepareIndex in interface org.opensearch.client.Client
    • prepareIndex

      public org.opensearch.action.index.IndexRequestBuilder prepareIndex(String index, String type, String id)
      Specified by:
      prepareIndex in interface org.opensearch.client.Client
    • delete

      public org.opensearch.action.ActionFuture<org.opensearch.action.delete.DeleteResponse> delete(org.opensearch.action.delete.DeleteRequest request)
      Specified by:
      delete in interface org.opensearch.client.Client
    • delete

      public void delete(org.opensearch.action.delete.DeleteRequest request, org.opensearch.action.ActionListener<org.opensearch.action.delete.DeleteResponse> listener)
      Specified by:
      delete in interface org.opensearch.client.Client
    • prepareDelete

      public org.opensearch.action.delete.DeleteRequestBuilder prepareDelete()
      Specified by:
      prepareDelete in interface org.opensearch.client.Client
    • prepareDelete

      public org.opensearch.action.delete.DeleteRequestBuilder prepareDelete(String index, String type, String id)
      Specified by:
      prepareDelete in interface org.opensearch.client.Client
    • bulk

      public org.opensearch.action.ActionFuture<org.opensearch.action.bulk.BulkResponse> bulk(org.opensearch.action.bulk.BulkRequest request)
      Specified by:
      bulk in interface org.opensearch.client.Client
    • bulk

      public void bulk(org.opensearch.action.bulk.BulkRequest request, org.opensearch.action.ActionListener<org.opensearch.action.bulk.BulkResponse> listener)
      Specified by:
      bulk in interface org.opensearch.client.Client
    • prepareBulk

      public org.opensearch.action.bulk.BulkRequestBuilder prepareBulk()
      Specified by:
      prepareBulk in interface org.opensearch.client.Client
    • get

      public org.opensearch.action.ActionFuture<org.opensearch.action.get.GetResponse> get(org.opensearch.action.get.GetRequest request)
      Specified by:
      get in interface org.opensearch.client.Client
    • get

      public void get(org.opensearch.action.get.GetRequest request, org.opensearch.action.ActionListener<org.opensearch.action.get.GetResponse> listener)
      Specified by:
      get in interface org.opensearch.client.Client
    • prepareGet

      public org.opensearch.action.get.GetRequestBuilder prepareGet()
      Specified by:
      prepareGet in interface org.opensearch.client.Client
    • prepareGet

      public org.opensearch.action.get.GetRequestBuilder prepareGet(String index, String type, String id)
      Specified by:
      prepareGet in interface org.opensearch.client.Client
    • multiGet

      public org.opensearch.action.ActionFuture<org.opensearch.action.get.MultiGetResponse> multiGet(org.opensearch.action.get.MultiGetRequest request)
      Specified by:
      multiGet in interface org.opensearch.client.Client
    • multiGet

      public void multiGet(org.opensearch.action.get.MultiGetRequest request, org.opensearch.action.ActionListener<org.opensearch.action.get.MultiGetResponse> listener)
      Specified by:
      multiGet in interface org.opensearch.client.Client
    • prepareMultiGet

      public org.opensearch.action.get.MultiGetRequestBuilder prepareMultiGet()
      Specified by:
      prepareMultiGet in interface org.opensearch.client.Client
    • search

      public org.opensearch.action.ActionFuture<org.opensearch.action.search.SearchResponse> search(org.opensearch.action.search.SearchRequest request)
      Specified by:
      search in interface org.opensearch.client.Client
    • search

      public void search(org.opensearch.action.search.SearchRequest request, org.opensearch.action.ActionListener<org.opensearch.action.search.SearchResponse> listener)
      Specified by:
      search in interface org.opensearch.client.Client
    • prepareSearch

      public org.opensearch.action.search.SearchRequestBuilder prepareSearch(String... indices)
      Specified by:
      prepareSearch in interface org.opensearch.client.Client
    • searchScroll

      public org.opensearch.action.ActionFuture<org.opensearch.action.search.SearchResponse> searchScroll(org.opensearch.action.search.SearchScrollRequest request)
      Specified by:
      searchScroll in interface org.opensearch.client.Client
    • searchScroll

      public void searchScroll(org.opensearch.action.search.SearchScrollRequest request, org.opensearch.action.ActionListener<org.opensearch.action.search.SearchResponse> listener)
      Specified by:
      searchScroll in interface org.opensearch.client.Client
    • prepareSearchScroll

      public org.opensearch.action.search.SearchScrollRequestBuilder prepareSearchScroll(String scrollId)
      Specified by:
      prepareSearchScroll in interface org.opensearch.client.Client
    • multiSearch

      public org.opensearch.action.ActionFuture<org.opensearch.action.search.MultiSearchResponse> multiSearch(org.opensearch.action.search.MultiSearchRequest request)
      Specified by:
      multiSearch in interface org.opensearch.client.Client
    • multiSearch

      public void multiSearch(org.opensearch.action.search.MultiSearchRequest request, org.opensearch.action.ActionListener<org.opensearch.action.search.MultiSearchResponse> listener)
      Specified by:
      multiSearch in interface org.opensearch.client.Client
    • prepareMultiSearch

      public org.opensearch.action.search.MultiSearchRequestBuilder prepareMultiSearch()
      Specified by:
      prepareMultiSearch in interface org.opensearch.client.Client
    • prepareExplain

      public org.opensearch.action.explain.ExplainRequestBuilder prepareExplain(String index, String type, String id)
      Specified by:
      prepareExplain in interface org.opensearch.client.Client
    • explain

      public org.opensearch.action.ActionFuture<org.opensearch.action.explain.ExplainResponse> explain(org.opensearch.action.explain.ExplainRequest request)
      Specified by:
      explain in interface org.opensearch.client.Client
    • explain

      public void explain(org.opensearch.action.explain.ExplainRequest request, org.opensearch.action.ActionListener<org.opensearch.action.explain.ExplainResponse> listener)
      Specified by:
      explain in interface org.opensearch.client.Client
    • prepareClearScroll

      public org.opensearch.action.search.ClearScrollRequestBuilder prepareClearScroll()
      Specified by:
      prepareClearScroll in interface org.opensearch.client.Client
    • clearScroll

      public org.opensearch.action.ActionFuture<org.opensearch.action.search.ClearScrollResponse> clearScroll(org.opensearch.action.search.ClearScrollRequest request)
      Specified by:
      clearScroll in interface org.opensearch.client.Client
    • clearScroll

      public void clearScroll(org.opensearch.action.search.ClearScrollRequest request, org.opensearch.action.ActionListener<org.opensearch.action.search.ClearScrollResponse> listener)
      Specified by:
      clearScroll in interface org.opensearch.client.Client
    • settings

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

      public org.opensearch.action.ActionFuture<org.opensearch.action.termvectors.TermVectorsResponse> termVectors(org.opensearch.action.termvectors.TermVectorsRequest request)
      Specified by:
      termVectors in interface org.opensearch.client.Client
    • termVectors

      public void termVectors(org.opensearch.action.termvectors.TermVectorsRequest request, org.opensearch.action.ActionListener<org.opensearch.action.termvectors.TermVectorsResponse> listener)
      Specified by:
      termVectors in interface org.opensearch.client.Client
    • prepareTermVectors

      public org.opensearch.action.termvectors.TermVectorsRequestBuilder prepareTermVectors()
      Specified by:
      prepareTermVectors in interface org.opensearch.client.Client
    • prepareTermVectors

      public org.opensearch.action.termvectors.TermVectorsRequestBuilder prepareTermVectors(String index, String type, String id)
      Specified by:
      prepareTermVectors in interface org.opensearch.client.Client
    • multiTermVectors

      public org.opensearch.action.ActionFuture<org.opensearch.action.termvectors.MultiTermVectorsResponse> multiTermVectors(org.opensearch.action.termvectors.MultiTermVectorsRequest request)
      Specified by:
      multiTermVectors in interface org.opensearch.client.Client
    • multiTermVectors

      public void multiTermVectors(org.opensearch.action.termvectors.MultiTermVectorsRequest request, org.opensearch.action.ActionListener<org.opensearch.action.termvectors.MultiTermVectorsResponse> listener)
      Specified by:
      multiTermVectors in interface org.opensearch.client.Client
    • prepareMultiTermVectors

      public org.opensearch.action.termvectors.MultiTermVectorsRequestBuilder prepareMultiTermVectors()
      Specified by:
      prepareMultiTermVectors in interface org.opensearch.client.Client
    • setSizeForUpdate

      public void setSizeForUpdate(int sizeForUpdate)
    • setScrollForUpdate

      public void setScrollForUpdate(String scrollForUpdate)
    • setSizeForDelete

      public void setSizeForDelete(int sizeForDelete)
    • setScrollForDelete

      public void setScrollForDelete(String scrollForDelete)
    • setScrollForSearch

      public void setScrollForSearch(String scrollForSearch)
    • setMaxConfigSyncStatusRetry

      public void setMaxConfigSyncStatusRetry(int maxConfigSyncStatusRetry)
    • setMaxEsStatusRetry

      public void setMaxEsStatusRetry(int maxEsStatusRetry)
    • filterWithHeader

      public org.opensearch.client.Client filterWithHeader(Map<String,String> headers)
      Specified by:
      filterWithHeader in interface org.opensearch.client.Client
    • execute

      public <Request extends org.opensearch.action.ActionRequest, Response extends org.opensearch.action.ActionResponse> org.opensearch.action.ActionFuture<Response> execute(org.opensearch.action.ActionType<Response> action, Request request)
      Specified by:
      execute in interface org.opensearch.client.OpenSearchClient
    • execute

      public <Request extends org.opensearch.action.ActionRequest, Response extends org.opensearch.action.ActionResponse> void execute(org.opensearch.action.ActionType<Response> action, Request request, org.opensearch.action.ActionListener<Response> listener)
      Specified by:
      execute in interface org.opensearch.client.OpenSearchClient
    • prepareFieldCaps

      public org.opensearch.action.fieldcaps.FieldCapabilitiesRequestBuilder prepareFieldCaps(String... indices)
      Specified by:
      prepareFieldCaps in interface org.opensearch.client.Client
    • fieldCaps

      public org.opensearch.action.ActionFuture<org.opensearch.action.fieldcaps.FieldCapabilitiesResponse> fieldCaps(org.opensearch.action.fieldcaps.FieldCapabilitiesRequest request)
      Specified by:
      fieldCaps in interface org.opensearch.client.Client
    • fieldCaps

      public void fieldCaps(org.opensearch.action.fieldcaps.FieldCapabilitiesRequest request, org.opensearch.action.ActionListener<org.opensearch.action.fieldcaps.FieldCapabilitiesResponse> listener)
      Specified by:
      fieldCaps in interface org.opensearch.client.Client
    • prepareBulk

      public org.opensearch.action.bulk.BulkRequestBuilder prepareBulk(String globalIndex, String globalType)
      Specified by:
      prepareBulk in interface org.opensearch.client.Client