G
G
German Zvonchuk2018-10-23 18:05:08
elasticsearch
German Zvonchuk, 2018-10-23 18:05:08

Elasticsearch geohash - how to get data that has been aggregated?

Hello.
Aggregating geo_point points using GeoHash grid Aggregation.
I get GeoHash and the number of points that are aggregated in it.
The question is how to get a list of points that are aggregated within a specific GeoHash?
Sending a request to get a GeoHash.

{
  "aggregations": {
    "filter_agg": {
      "filter": {
        "geo_bounding_box": {
          "ignore_unmapped": true,
          "location": {
            "top_left": "41.098804663542325,49.355824553713035",
            "bottom_right": "39.99393061395733,50.19470905400232"
          }
        }
      },
      "aggregations": {
        "data": {
          "geohash_grid": {
            "field": "location",
            "precision": "6"
          },
          "aggregations": {
            "info": {
              "geo_centroid": {
                "field": "location"
              }
            }
          }
        }
      }
    }
  },
  "size": 0
}

I get a response:
{
  "key": "tp5mwz",
  "doc_count": 734,
  "info": {
    "location": {
      "lat": 40.382942053957585,
      "lon": 49.87214530620226
    },
    "count": 734
  }
},
{
  "key": "tp5my0",
  "doc_count": 583,
  "info": {
    "location": {
      "lat": 40.38779562121931,
      "lon": 49.841050580463424
    },
    "count": 583
  }
}

My task is to get 734 geopoints that are hidden behind the "tp5mwz" geohash.
I would be very grateful if you tell me how to do this?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexey Cheremisin, 2018-10-23
@leahch

You will need to make another request, already with aggregation parameters. Then get your points, everything, without a trace.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question