Ich versuche, einen elastischen Index abzufragen, wo das Ergebnis der Abfrage eine Liste der Geohashes mit nur einem übereinstimmenden Dokument ist.Elastic GeoHash Abfrage - Aggregationsfilter
Ich kann eine einfache Liste aller Geo-Hashes erhalten und ihre Dokument zählt die Verwendung von folgenden:
{ "size" : 0, "aggregations" : { "boundingbox" : { "filter" : { "geo_bounding_box" : { "location" : { "top_left" : "34.5, -118.9", "bottom_right" : "33.3, -116." } } }, "aggregations":{ "grid" : { "geohash_grid" : { "field": "location", "precision": 4 } } } } } }
Jedoch habe ich nicht die korrekte Syntax arbeiten können, um die Abfrage zu filtern, in der Nähe kann ich erhalten sind unten:
Dieser schlägt mit 503 org.elasticsearch.search.aggregations.bucket.filter.InternalFilter cannot be cast to org.elasticsearch.search.aggregations.InternalMultiBucketAggregation
"aggregations":{ "grid" : { "geohash_grid" : { "field": "location", "precision": 4 } }, "grid_bucket_filter" : { "bucket_selector" : { "buckets_path" :{ "docCount" : "grid" //Also tried `"docCount" : "doc_count"` }, "script" : "params.docCount == 1" } } }
Dies schlägt mit 400 No aggregation found for path [doc_count]
"aggregations":{ "grid" : { "geohash_grid" : { "field": "location", "precision": 4 } }, "grid_bucket_filter" : { "bucket_selector" : { "buckets_path" :{ "docCount" : "doc_count" }, "script" : "params.docCount > 1" } } }
Wie kann ich auf dem doc_count
in einem geohash rasterbasierten Filter?
Danke, froh, dass es geholfen! – Val