Aggregating on geo_point

Is there a way to aggregate on a geo_point field and to receive the actual lat long?
all i managed to do is get the hash geo.
what i did so far:
creating the index

PUT geo_test
{
  "mappings": {
    "sharon_test": {
      "properties": {
        "location": {
          "type": "geo_point"
        }
      }
    }
  }
}

adding X docs with different lat long

POST geo_test/sharon_test
{
  "location": { 
    "lat": 45,
    "lon": -7
  }
}

ran this agg:

GET geo_test/sharon_test/_search
{
  "query": {
    "bool": {
      "must": [
        {
          "match_all": {}
        }
      ]
    }
  },
  "aggs": {
    "locationsAgg": {
      "geohash_grid": {
        "field": "location",
                "precision" : 12
      }
    }
  }
}

i got this result:

{
  "took": 2,
  "timed_out": false,
  "_shards": {
    "total": 5,
    "successful": 5,
    "skipped": 0,
    "failed": 0
  },
  "hits": {
    "total": 2,
    "max_score": 1,
    "hits": [
      {
        "_index": "geo_test",
        "_type": "sharon_test",
        "_id": "fGb4uGEBfEDTRjcEmr6i",
        "_score": 1,
        "_source": {
          "location": {
            "lat": 41.12,
            "lon": -71.34
          }
        }
      },
      {
        "_index": "geo_test",
        "_type": "sharon_test",
        "_id": "oWb4uGEBfEDTRjcE7b6R",
        "_score": 1,
        "_source": {
          "location": {
            "lat": 4,
            "lon": -7
          }
        }
      }
    ]
  },
  "aggregations": {
    "locationsAgg": {
      "buckets": [
        {
          "key": "ebenb8nv8nj9",
          "doc_count": 1
        },
        {
          "key": "drm3btev3e86",
          "doc_count": 1
        }
      ]
    }
  }
}

I want to know if i can get one of the 2:

  1. convert the "key" that is currently representing as a geopoint hash to the sources lat/long
  2. show the lat, long in the aggregation in the first place

Thanks!
P.S
I also tried the other geo aggregations but all they give me is the number of docs that fit my aggs conditions, i need the actual values
E.G
wanted this aggregation to return all the locations i had in my index, but it only returned the count

GET geo_test/sharon_test/_search
{
  "query": {
    "bool": {
      "must": [
        {
          "match_all": {}
        }
      ]
    }
  },
  "aggs": {
    "distanceRanges": {
      "geo_distance": {
        "field": "location",
        "origin": "50.0338, 36.2242 ",
        "unit": "meters",
        "ranges": [
          {
            "key": "All Locations",
            "from": 1
          }
        ]
      }
    }
  }
}

bump.
Anyone?

Is my question that bad that no body can even give a rough " no its impossible" or even "google it yourself its easy" (i did tried to solve it and didnt succeed) ? Please let me know what is wrong with the question that everyone ignores it?
is it too specific? or too basic?
I find it hard to believe no one knows how to approach this or at least give a general direction for what to look for...

May be @nknize can help here?

Thanks for the reply!
Bump

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