我需要用geo\u边界框构建geotitle\u网格聚合
这是我的密码:
search_query: DslSearch = DslSearch()
enriched_value = {
"aggregations": {
"AggregationGeotileGridBuckets": {
"geotile_grid": {
"field": "location",
"precision": 8,
"size": 10000
}
}
}
}
bucket_builder = search_query.aggs.bucket(
name='My bucket',
agg_type='filter',
**{
"geo_bounding_box": {
"location": {
"top_left": {
"lat": 38.2715027604674,
"lon": -121.925823154605
},
"bottom_right": {
"lat": 37.2876652395326,
"lon": -122.91285484539499
}
}
}
},
**enriched_value
)
但在elasticsearch_dsl库中构建此查询后,我出现了错误:
elasticsearch.exceptions.RequestError: RequestError(400, 'parsing_exception', '[geo_bounding_box] malformed query, expected [END_OBJECT] but found [FIELD_NAME]')
这里是查询。它是建立在:
{
"query": {
"geo_distance": {
"distance": "497668.76297287986m",
"location": {
"lat": 38.99939107394144,
"lon": -124.2156036484375
}
}
},
"aggs": {
"AggregationGeotileGrid": {
"filter": {
"geo_bounding_box": {
"location": {
"top_left": {
"lat": 38.2715027604674,
"lon": -121.925823154605
},
"bottom_right": {
"lat": 37.2876652395326,
"lon": -122.91285484539499
}
}
},
"aggregations": {
"AggregationGeotileGridBuckets": {
"geotile_grid": {
"field": "location",
"precision": 8,
"size": 10000
}
}
}
}
}
},
"size": 0
}
如何使用边界框过滤器构建写聚合查询,以及哪里有错误? 我会感谢你的帮助
您需要链接
AggregationGeotileGrid
和AggregationGeotileGridBuckets
,因此您应该尝试以下方法:相关问题 更多 >
编程相关推荐