# How to remove fields from response

**URL:** <https://discuss.elastic.co/t/how-to-remove-fields-from-response/122518>\
**Category:** Elasticsearch\
**Created:** [March 5, 2018, 1:24pm UTC](https://discuss.elastic.co/t/how-to-remove-fields-from-response/122518 "2018-03-05T13:24:05Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![pazikkamil](https://avatars.discourse-cdn.com/v4/letter/p/8e7dd6/32.png) [@pazikkamil](https://discuss.elastic.co/u/pazikkamil)\
**Post date:** [March 5, 2018, 1:24pm UTC](https://discuss.elastic.co/t/how-to-remove-fields-from-response/122518/1 "2018-03-05T13:24:05Z")

</div>

```
search_month = model.search().query(q_objects)
search_month.aggs.bucket(
        source_month, 'date_histogram', field='date',
        interval=date_ranges[source_month].interval,
    )
response_month = search_month.execute()

```

Unfortunately, it gives me all data from the model - **but how to show only results of aggregations - count of documents ?**

---

<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:** [March 5, 2018, 3:22pm UTC](https://discuss.elastic.co/t/how-to-remove-fields-from-response/122518/2 "2018-03-05T15:22:43Z")

</div>

Set `size` parameter to `0`.

---

<div class="post-metadata">

**Author:** ![pazikkamil](https://avatars.discourse-cdn.com/v4/letter/p/8e7dd6/32.png) [@pazikkamil](https://discuss.elastic.co/u/pazikkamil)\
**Post date:** [March 5, 2018, 4:01pm UTC](https://discuss.elastic.co/t/how-to-remove-fields-from-response/122518/3 "2018-03-05T16:01:51Z")

</div>

Unfortunately looks like cannot use size=0 on **aggregations** with **date\_histogram**. Perhaps its just **elasticsearch\_dsl** python library problem ?

```
TransportError(400, 'illegal_argument_exception', '[date_histogram] unknown field [size], parser not found')
```

---

<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:** [March 5, 2018, 4:31pm UTC](https://discuss.elastic.co/t/how-to-remove-fields-from-response/122518/4 "2018-03-05T16:31:46Z")

</div>

I don't know this client but my guess is that it should be something like:

```auto
.search().query(q_objects).size(0)

```

---

<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:** [April 2, 2018, 4:31pm UTC](https://discuss.elastic.co/t/how-to-remove-fields-from-response/122518/5 "2018-04-02T16:31:53Z")

</div>

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