3

I find an interesting feature called delete by query. How do I use it with jest client?

Thanks!

1 Answer 1

8

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
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.