【问题标题】:Delete_by_query conflicts proceed doesn't work in ElasticSearch 5.1.1 with netty4Delete_by_query 冲突继续在带有 netty4 的 ElasticSearch 5.1.1 中不起作用
【发布时间】:2017-07-12 15:01:00
【问题描述】:

我在 5.1.1 版本中编写了自己的内存中 ElasticSearch 服务器。它可以正常添加文档,但无法删除。

Maven 依赖:

    <dependency>
        <groupId>org.elasticsearch</groupId>
        <artifactId>elasticsearch</artifactId>
        <version>5.1.1</version>
        <scope>test</scope>
    </dependency>
    <dependency>
        <groupId>org.elasticsearch.plugin</groupId>
        <artifactId>transport-netty4-client</artifactId>
        <version>5.1.1</version>
        <scope>test</scope>
    </dependency>

节点设置图:

    settingsMap.put("node.name", nodeName);
    settingsMap.put("path.conf", "target");
    settingsMap.put("path.data", "target");
    settingsMap.put("path.logs", "target");
    settingsMap.put("path.home", "target");
    settingsMap.put("http.type", "netty4");
    settingsMap.put("http.port", httpPort);
    settingsMap.put("transport.tcp.port", httpTransportPort);
    settingsMap.put("transport.type", "netty4");
    settingsMap.put("action.auto_create_index", "false");

一次删除多个文档的方法:

public boolean deleteType() throws IOException, CustomResponseException {
    String query = "{\n" + "  \"query\": {\n" + "    \"match_all\": {}\n" + "  }\n" + "}";
    HttpEntity entity = new NStringEntity(query, ContentType.APPLICATION_JSON);
    Response indexResponse = restClient.performRequest("POST",
            "/" + this.getIndex() + "/" + this.getType() + "/_delete_by_query?conflicts=proceed",
            Collections.<String, String>emptyMap(), entity);
    return processStatusCode(indexResponse.getStatusLine()) == 200;
}

当我运行测试时,我得到了错误:

org.elasticsearch.client.ResponseException: POST http://localhost:9205/testindexer/indexer/_delete_by_query?conflicts=proceed: HTTP/1.1 400 错误请求 {"error":{"root_cause":[{"type":"illegal_argument_exception","re​​ason":"request [/testindexer/indexer/_delete_by_query] 包含无法识别的参数:[conflicts]"}],"type":"非法参数异常","原因":"请求 [/testindexer/indexer/_delete_by_query] 包含无法识别的参数:[冲突]"},"状态":400}

此外,当我在没有冲突的情况下运行它时,我得到的答案是文档已创建。为什么它与此版本的文档中的工作方式不同?

这是我的节点的状态:

{
  "name" : "indexernode",
  "cluster_name" : "elasticsearch",
  "cluster_uuid" : "trP6UQg1SMKVyfR0qTEjYw",
  "version" : {
    "number" : "5.1.1",
    "build_hash" : "5395e21",
    "build_date" : "2016-12-06T12:36:15.409Z",
    "build_snapshot" : false,
    "lucene_version" : "6.3.0"
 },
 "tagline" : "You Know, for Search"
}

【问题讨论】:

    标签: java elasticsearch netty


    【解决方案1】:

    旁注:这不是删除所有索引数据的正确方法,但我想你知道这一点。

    您能否尝试将 restclient 中的参数作为参数而不是 URL 的一部分提供,以确保这不是问题。

    我认为这里的主要问题是,您说您正在运行自己的嵌入式弹性搜索版本(这就是您在内存中的意思)。您是否检查过该版本是否安装了重新索引插件?

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2015-10-04
      • 1970-01-01
      • 2014-11-11
      • 1970-01-01
      • 2016-05-02
      • 1970-01-01
      • 1970-01-01
      • 2015-10-17
      相关资源
      最近更新 更多