# Geo Bounds Aggregation on returned documents only

**URL:** <https://discuss.elastic.co/t/geo-bounds-aggregation-on-returned-documents-only/42002>\
**Category:** Elasticsearch\
**Created:** [February 17, 2016, 10:28am UTC](https://discuss.elastic.co/t/geo-bounds-aggregation-on-returned-documents-only/42002 "2016-02-17T10:28:20Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Bjorn\_Grambow](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/bjorn_grambow/32/7879_2.png) [@Bjorn\_Grambow](https://discuss.elastic.co/u/Bjorn_Grambow)\
**Post date:** [February 17, 2016, 10:28am UTC](https://discuss.elastic.co/t/geo-bounds-aggregation-on-returned-documents-only/42002/1 "2016-02-17T10:28:20Z")

</div>

Hi,  
I am trying out elasticsearch for a new version of our Websites. We offer Properties for vacations to rent.  
Each Property has a Geo location property and I was wondering if I can get the Geo Bounds Aggregation to calculate the bounds on only the documents returned depending on the size parameter. I tried the following, but it always gave me the bounds of all documents queried, no matter what the size property is:

```
GET dbtest/listing/_search
{
  
    "from" : 0, "size" : 10,
    "query" : {
       "match_all": {
             
       }
    },
    "aggs" : {
        "viewport" : {
            "geo_bounds" : {
                "field" : "location", 
                "wrap_longitude" : true 
            }
            
        }
    }
}

```

Any help appreciated

Bjorn

---

<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:** [July 5, 2017, 11:15pm UTC](https://discuss.elastic.co/t/geo-bounds-aggregation-on-returned-documents-only/42002/2 "2017-07-05T23:15:46Z")

</div>


