【问题标题】:how to add query string parameters in ElasticSearch DeleteByQuery java API?如何在 ElasticSearch DeleteByQuery java API 中添加查询字符串参数?
【发布时间】:2018-05-02 03:56:57
【问题描述】:

我使用的是 Elasticsearch 2.3.1 版

我已经安装了 deletebyquery 插件来删除文档,并使用 java API 来删除。

这是我的 java api 请求

DeleteByQueryRequestBuilder deleteRequest = DeleteByQueryRequestBuilder(esType, DeleteByQueryAction.INSTANCE)
        .setIndices(index)
        .setTypes(type);
deleteRequest.setQuery(boolQuery);
DeleteByQueryResponse resp = deleteRequest.get();

我的问题是,如何在java中的Deletebyquery查询请求中添加size、routing等查询字符串参数?这些参数在 doc(https://www.elastic.co/guide/en/elasticsearch/plugins/2.3/delete-by-query-usage.html) 中有提及,但不知道如何在 java api 中添加!

【问题讨论】:

    标签: elasticsearch elasticsearch-plugin elasticsearch-java-api


    【解决方案1】:

    你可以使用:

    deleteRequest.setRouting(routing) // to set routing
    deleteRequest.request().size(size) // to set the size
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-04-16
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多