亲,只收二进制

根据_id 进行get请求查询不到数据 一直ResponseException

Elasticsearch | 作者 sky_ | 发布于2021年01月19日 | 阅读数:2208

在kibana进行查询
GET /indexTest/doc/238801848060
返回结果
{
"_index" : "indexTest",
"_type" : "doc",
"_id" : "238801848060",
"found" : false
}

在java 代码中根据restClient.performRequest方式请求一直返回
org.elasticsearch.client.ResponseException: method [GET], host [...], URI [/indexTest/doc/238801848060], status line [HTTP/1.1 404 Not Found]
{"_index":"indexTest","_type":"doc","_id":"238801848060","found":false}
这种根据_id进行查询为空,没有结果的,不应该走异常处理吧
贴出RestClient部分代码
Response get() throws IOException {
...
} else if (exception instanceof ResponseException) {
throw new ResponseException((ResponseException)exception);
}
...
}
已邀请:

JiangJibo - 喊我雷锋

赞同来自:

通过_id 查询,主要你的_id是正确的,那么数据是一定存在的,如果没有查询到数据,就是不正常的。如果你是搜索,没有数据是正常的

要回复问题请先登录注册