类 ElasticOperate

java.lang.Object
cn.warpin.core.database.elastic.ElasticOperate

@Component public class ElasticOperate extends Object
  • 字段详细资料

    • client

      private final co.elastic.clients.elasticsearch.ElasticsearchClient client
  • 构造器详细资料

    • ElasticOperate

      public ElasticOperate()
  • 方法详细资料

    • createOrUpdateDocument

      public <T> co.elastic.clients.elasticsearch.core.IndexResponse createOrUpdateDocument(ElasticParams<T> params)
      创建或更新文档
      类型参数:
      T -
      参数:
      params -
      返回:
      抛出:
      IOException
    • searchDocuments

      public <T> SearchResult<T> searchDocuments(ElasticCondition<T> condition)
      查询文档
      类型参数:
      T -
      参数:
      condition -
      返回:
    • deleteDocument

      public co.elastic.clients.elasticsearch.core.DeleteResponse deleteDocument(String index, String id)
      删除指定文档
      参数:
      index -
      id -
      返回:
      抛出:
      IOException
    • deleteAllDocumentsInIndex

      public co.elastic.clients.elasticsearch.core.DeleteByQueryResponse deleteAllDocumentsInIndex(String index)
      删除索引下所有文档
      参数:
      index -
      返回:
    • deleteIndex

      public boolean deleteIndex(String index)
      删除整个索引
      参数:
      index -
      返回:
      抛出:
      IOException
    • indexExists

      private boolean indexExists(String index) throws IOException
      检测索引是否存在
      参数:
      index -
      返回:
      抛出:
      IOException