Geo Bounds Aggregation on returned documents only


(Björn Grambow) #1

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


(system) #2