Elasticsearch 使用 jest 通过查询删除

标签 elasticsearch elasticsearch-jest

我发现了一个有趣的功能,叫做 delete by query . 如何将它与 jest client 一起使用?

谢谢!

最佳答案

您可以使用 DeleteByQuery class如下图:

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

另外请注意,如果您运行的是 ES 2.x 或更高版本,Delete by query API需要先从插件安装。

./bin/plugin install delete-by-query

关于Elasticsearch 使用 jest 通过查询删除,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34760557/

相关文章:

amazon-web-services - 尝试查询 AWS ElasticSearch 集群时出现 403 Forbidden

multithreading - LogStash 性能非常低

java - Elasticsearch:如何使产品名称在搜索中比产品描述更重要?

elasticsearch - Elasticsearch:从脚本字段返回空值

java - JestClient 在闲置一段时间后抛出 SocketTimeoutException

java - Mockito 无法模拟此类 JestClient

elasticsearch - 使用 getSourceAsObjectList() 开玩笑映射

elasticsearch - 无痛脚本,以嵌套结构检索最新日期

设置环境变量后 Elasticsearch 报告默认堆内存大小

spring - 如何使用 jest 客户端或传输客户端在 Elasticsearch 中使用三个表单字段进行搜索