问题
I find an interesting feature called delete by query. How do I use it with jest client?
Thanks!
回答1:
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
来源:https://stackoverflow.com/questions/34760557/elasticsearch-delete-by-query-using-jest