How to erase ElasticSearch index?

后端 未结 4 1831
轻奢々
轻奢々 2021-02-01 16:57

My unit/integration tests includes tests for search functionality.

My idea is to have empty search index before each test. So, I\'m trying to remove al

4条回答
  •  一生所求
    2021-02-01 17:22

    1. it is not the async call (you can add a listener and avoid actionGet to get the async call)
    2. delete all items via:

      client.prepareDeleteByQuery(indexName).
                  setQuery(QueryBuilders.matchAllQuery()).
                  setTypes(indexType).
                  execute().actionGet();
      
    3. refresh your index to see the changes (only required in unit tests)

提交回复
热议问题