elasticsearch Elasticsearch-使用';搜索后';在我的初始查询中,只要我使用正确的开始时间?
根据文档,对elastic进行初始查询,从中检索排序时间戳。 然后,我使用“searchafter”进行后续查询,每次都更改排序时间戳以检索所需的记录 例如:elasticsearch Elasticsearch-使用';搜索后';在我的初始查询中,只要我使用正确的开始时间?,elasticsearch,search,term,elasticsearch,Search,Term,根据文档,对elastic进行初始查询,从中检索排序时间戳。 然后,我使用“searchafter”进行后续查询,每次都更改排序时间戳以检索所需的记录 例如: `{"query":{"bool":{"must":[{"bool":{"must":[{"bool":{"must":[{"range":{"Timestamp&
`{"query":{"bool":{"must":[{"bool":{"must":[{"bool":{"must":[{"range":{"Timestamp":{"gte":${stUnix},"format": "epoch_millis"}}},{"range":{"Timestamp":{"lte":${endUnix},"format": "epoch_millis"}}}]}}]}}]}},"sort":{"Timestamp": {"order":"asc"}},"size":${dateRadio}, "script_fields" : {
"test1" : {
"script" : {
"lang": "painless",
"source": "doc['InitiatorBytes'].value + doc['ResponderBytes'].value"
}
}
},"_source":{"includes":["*"],"excludes":[]},"from":0}\n`;
在运行这个初始查询之后,我使用响应中的排序时间戳来运行后续查询
`{"query":{"bool":{"must":[{"bool":{"must":[{"bool":{"must":[{"range":{"Timestamp":{"gte":${stUnix},"format": "epoch_millis"}}},{"range":{"Timestamp":{"lte":${endUnix},"format": "epoch_millis"}}}]}}]}}]}},"search_after":[${sortUnix}],"sort":{"Timestamp": {"order":"asc"}},"size":${dateRadio},"_source":{"includes":["*"],"excludes":[]},"from":0}\n`
在上面,我将sortunix变量设置为从初始查询中检索到的排序时间戳。在这两个查询中,我在gte中设置了相同的初始开始时间:“stUnix”
我的问题是,是否可以放弃第一个查询,将初始searchafter'sortunix'变量设置为等于'stunix'变量
我尝试过这样做,但似乎效果不错,但我不确定这是否会影响数据的完整性