gpt4 book ai didi

java - Delete_by_query冲突继续进行在使用netty4的ElasticSearch 5.1.1中不起作用

转载 作者:行者123 更新时间:2023-12-02 22:29:56 24 4
gpt4 key购买 nike

我已经在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 Bad Request {"error":{"root_cause":[{"type":"illegal_argument_exception","reason":"request [/testindexer/indexer/_delete_by_query] contains unrecognized parameter: [conflicts]"}],"type":"illegal_argument_exception","reason":"request [/testindexer/indexer/_delete_by_query] contains unrecognized parameter: [conflicts]"},"status":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"
}

最佳答案

旁注:这不是删除所有索引数据的正确方法,但是我想您已经知道了。

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

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

关于java - Delete_by_query冲突继续进行在使用netty4的ElasticSearch 5.1.1中不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45061315/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com