Interface OpenSearchClient

All Superinterfaces:
AutoCloseable
All Known Implementing Classes:
OpenSearchRestClient

public interface OpenSearchClient extends AutoCloseable
Since:
9.3
  • Method Details

    • getId

      String getId()
      Returns:
      The client id
    • isReady

      boolean isReady()
      Returns:
      Whether the targeted OpenSearch is ready or not (its status is at least ClusterHealthStatus.YELLOW
      Since:
      2025.0
    • waitForYellowStatus

      boolean waitForYellowStatus(String[] indexNames, Duration timeout)
    • refresh

      void refresh(String indexName)
    • flush

      void flush(String indexName)
    • optimize

      void optimize(String indexName)
    • createIndex

      void createIndex(String indexName, String jsonSettings)
    • indexExists

      boolean indexExists(String indexName)
    • dropIndex

      default void dropIndex(String indexName)
      Drops the index and wait for the action to be effective until 5 minutes.
    • dropIndex

      void dropIndex(String indexName, Duration timeout)
    • createMapping

      void createMapping(String indexName, String jsonMapping)
    • mappingExists

      boolean mappingExists(String indexName)
    • getMapping

      String getMapping(String indexName)
      Returns the mapping from elastic, exposed for testing purposes
      Since:
      2021.17
    • aliasExists

      boolean aliasExists(String aliasName)
    • getFirstIndexForAlias

      String getFirstIndexForAlias(String aliasName)
      Returns the name of the index referenced by the alias. Returns null if the alias does not exists.
    • updateAlias

      void updateAlias(String aliasName, String indexName)
    • index

      org.opensearch.action.index.IndexResponse index(org.opensearch.action.index.IndexRequest request)
    • bulk

      org.opensearch.action.bulk.BulkResponse bulk(org.opensearch.action.bulk.BulkRequest request)
    • get

      org.opensearch.action.get.GetResponse get(org.opensearch.action.get.GetRequest request)
    • search

      org.opensearch.action.search.SearchResponse search(org.opensearch.action.search.SearchRequest request)
    • scroll

      org.opensearch.action.search.SearchResponse scroll(org.opensearch.action.search.SearchScrollRequest request)
    • clearScroll

      org.opensearch.action.search.ClearScrollResponse clearScroll(org.opensearch.action.search.ClearScrollRequest request)