弹性搜索通过查询使用jest删除 [英] Elasticsearch Delete by query using jest

查看:122
本文介绍了弹性搜索通过查询使用jest删除的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我发现一个有趣的功能,称为按查询删除
如何使用 jest客户端

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

谢谢!

推荐答案

您可以使用 DeleteByQuery class ,如下所示:

You can use the DeleteByQuery class like shown below:

    DeleteByQuery deleteAllUserJohn = new DeleteByQuery.Builder("{\"user\":\"john\"}")
            .addIndex("users")
            .addType("user")
            .build();
    client.execute(deleteAllUserJohn);

另请注意,如果您运行ES 2.x或更高版本,由查询API 删除。 / p>

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

这篇关于弹性搜索通过查询使用jest删除的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆