I find an interesting feature called delete by query. How do I use it with jest client?
Thanks!
You can use the DeleteByQuery
class like shown below:
DeleteByQuery deleteAllUserJohn = new DeleteByQuery.Builder("{\"user\":\"john\"}")
.addIndex("users")
.addType("user")
.build();
client.execute(deleteAllUserJohn);
Also note that if you're running ES 2.x or above, the Delete by query API needs to be installed from a plugin first.
./bin/plugin install delete-by-query