我将这个结果留在网址:“http:....:
{ took: 48,
timed_out: false,
_shards: {
total: 5,
successful: 5,
failed: 0
},
hits: {
total: 111,
max_score: 1,
hits: [
{
_index: "errors",
_type: "error",
_id: "AV0Sd2dn-sq8yPidLBWo",
_score: 1,
_source: {
date: "16:54:46,215",
path: "c:/logstash.log",
@timestamp: "2017-07-05T11:16:40.560Z",
level: "ERROR",
@version: "1",
host: "User",
message:
"16:54:46,215 ERROR [stderr] (ServerService Thread Pool -- 42) ch.qos.logback.core.joran.spi.JoranException: Problem parsing XML document. See previously reported errors."
我想只检索此结果并将其转换为包含juste的对象列表:日期,级别和消息。
hits: [
{
_index: "errors",
_type: "error",
_id: "AV0Sd2dn-sq8yPidLBWo",
_score: 1,
_source: {
date: "16:54:46,215",
path: "c:/logstash.log",
@timestamp: "2017-07-05T11:16:40.560Z",
level: "ERROR",
@version: "1",
host: "User",
message: [
"16:54:46,215 ERROR [stderr] (ServerService Thread Pool -- 42) ch.qos.logback.core.joran.spi.JoranException: Problem parsing XML document. See previously reported errors."
]}}
---- ---编辑 这是我的班级:
public class Error {
private String date;
private String level;
private String message;
}
所以我想从json的reslt创建一个对象错误。正是来自这个
_source: {
date: "16:54:46,215",
path: "c:/logstash.log",
@timestamp: "2017-07-05T11:16:40.560Z",
level: "ERROR",
@version: "1",
host: "User",
message:
"16:54:46,215 ERROR [stderr] (ServerService Thread Pool -- 42) ch.qos.logback.core.joran.spi.JoranException: Problem parsing XML document. See previously reported errors."
非常感谢任何帮助。