Can we remove trace of data from elastic search query response

I want to remove the search trace from elastic query response as below:

Elastic query:

curl -u username:password elasticURL/elastic_index_name/_search?pretty&filter_path=hits.hits._source,agggregations.**.hits.hits._source

Elastic query response:

{
  "hits": {
    "hits": [
    {
        "_source": {
          "column1": "data1",
          "column2": "data2",
        }
    },
    {
        "_source": {
          "column1": "data_1",
          "column2": "data_2",
        }
    }]
  },
  "aggregations":{
    "group_by_type": {
        "buckets": [
            "group_by_abc":{
                "buckets":[
                    "group_by_xyz":{
                        "buckets":{
                            "group_doc":{
                                "hits": {
                                    "hits": [
                                        {
                                            "_source" : {
                                                "column1" : "data1",
                                                "column2" : "data2"
                                            }
                                        },
                                            "_source" : {
                                                "column1" : "data_1",
                                                "column2" : "data_2"
                                            }
                                        }
                                    ]
                                }
                            }
                        }
                    }
                ]
            }
        ]
    }
  }
}

Expected Response:

{
    "hits":[{
        "_source": {
          "column1": "data1",
          "column2": "data2"
        }
    },
    {
        "_source": {
          "column1": "data_1",
          "column2": "data_2"
        }
    }],
    "aggregations":[{
        "_source" : {
            "column1" : "data1",
            "column2" : "data2"
        }},
        {"_source" : {
            "column1" : "data_1",
            "column2" : "data_2"
        }}
    ]
}

I would like to know, whether it is achievable also or not.

Welcome!

It's not from elasticsearch but probably easily doable from your application.

BTW please don't post unformatted code, logs, or configuration as it's very hard to read.

Instead, paste the text and format it with </> icon or pairs of triple backticks (```), and check the preview window to make sure it's properly formatted before posting it. This makes it more likely that your question will receive a useful answer.

Thanks @dadoonet for the input.
I have edited the post as per your suggestion.

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