# Can we remove trace of data from elastic search query response

**URL:** <https://discuss.elastic.co/t/can-we-remove-trace-of-data-from-elastic-search-query-response/220199>\
**Category:** Elasticsearch\
**Created:** [February 20, 2020, 2:05pm UTC](https://discuss.elastic.co/t/can-we-remove-trace-of-data-from-elastic-search-query-response/220199 "2020-02-20T14:05:28Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Vishal\_Aggarwal](https://avatars.discourse-cdn.com/v4/letter/v/7c8e57/32.png) [@Vishal\_Aggarwal](https://discuss.elastic.co/u/Vishal_Aggarwal)\
**Post date:** [February 20, 2020, 2:05pm UTC](https://discuss.elastic.co/t/can-we-remove-trace-of-data-from-elastic-search-query-response/220199/1 "2020-02-20T14:05:28Z")

</div>

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

Elastic query:

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

```

Elastic query response:

```auto
{
  "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:

```auto
{
    "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.

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [February 20, 2020, 3:22pm UTC](https://discuss.elastic.co/t/can-we-remove-trace-of-data-from-elastic-search-query-response/220199/2 "2020-02-20T15:22:55Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Vishal\_Aggarwal](https://avatars.discourse-cdn.com/v4/letter/v/7c8e57/32.png) [@Vishal\_Aggarwal](https://discuss.elastic.co/u/Vishal_Aggarwal)\
**Post date:** [February 21, 2020, 6:30am UTC](https://discuss.elastic.co/t/can-we-remove-trace-of-data-from-elastic-search-query-response/220199/3 "2020-02-21T06:30:46Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [March 20, 2020, 6:30am UTC](https://discuss.elastic.co/t/can-we-remove-trace-of-data-from-elastic-search-query-response/220199/4 "2020-03-20T06:30:47Z")

</div>

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