Rest api elasticsearch

Hi there,
I manipulate rest api elasticSearch and i get this result:

    {
    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.",
    "[stderr] (ServerService Thread Pool -- 42) ch.qos.logback.core.joran.spi.JoranException: Problem parsing XML document. See previously reported errors."
    ],
    tags: [
    "groked"
    ]}},]}}

My question is how to keep just some specified result like this:

 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.",
        "[stderr] (ServerService Thread Pool -- 42) ch.qos.logback.core.joran.spi.JoranException: Problem parsing XML document. See previously reported errors."
        ]
]}}

Any help is greatly appreciate.

You can use probably response filtering: https://www.elastic.co/guide/en/elasticsearch/reference/5.5/common-options.html#common-options-response-filtering

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.