【发布时间】:2018-11-26 12:24:21
【问题描述】:
我正在开发 Elasticsearch Java API,但遇到了奇怪的问题。
下面是存储的数据:
"_index": "my_index",
"_type": "SEC",
"_id": "1111111111111111",
"_score": 0,
"_source": {
"LOG_NO": 2222222222222222
}
我将请求称为如下:
QueryBuilder queryBuilder = QueryBuilders.boolQuery().filter(query);
request.setQuery(queryBuilder);
SearchResponse searchResponse = request.get();
这是搜索响应:
"_index":"my_index",
"_type":"SEC",
"_id":"1111111111111111",
"_score":null,
"_source": {
"LOG_NO":1111111111111111,
}
如您所见,响应的“LOG_NO”应该是“2222222222222222”而不是“1111111111111111”。
参数'query'是QueryBuilder,值如下:
{
"bool": {
"must": [
{
"range": {
"LOG_GEN_TIME": {
"from": "2018-11-01 00:00:00+09:00",
"to": "2018-11-01 23:59:59+09:00",
"include_lower": true,
"include_upper": true,
"boost": 1
}
}
},
{
"bool": {
"must": [
{
"term": {
"ASSET_IP": "xx.xxx.xxx.xxx"
}
},
{
"term": {
"DST_PORT": "xx"
}
}
]
}
}
],
"adjust_pure_negative": true,
"boost": 1
}
}
我不明白是什么问题。
任何 cmets 将不胜感激,谢谢。
-- 为@Val 编辑
"_index": "my_index",
"_type": "SEC",
"_id": "9197340043548295192",
"_score": null,
"_source": {
"ASSET_IP": "xx.xxx.xx.xxx",
"LOG_NO": 9197340043548295200,
"LOG_GEN_TIME": "2018-11-01 23:10:53+09:00",
"SRC_IP": "xx.xxx.xx.xxx",
"SRC_PORT": xx,
"DST_IP": "xx.xxx.xx.xxx",
"DST_PORT": xx,
"DESCRIPTION": "log",
"DST_NATION_CD": "USA",
}
}
这是我希望返回的完整文档,唯一的“LOG_NO”字段有问题。
【问题讨论】:
-
您能显示您发送的查询以及发送方式吗?
-
@Val 添加了参数查询,我不确定“你如何发送它”的确切含义
-
感谢您的查询,您能否显示您希望查询返回的完整文档(即不仅是 LOG_NO 字段)?
-
@Val 添加了完整的文档,很抱歉回复晚了 :)
-
发现了我的问题。谢谢你帮助我@Val
标签: java elasticsearch