我对Elasticsearch中的百分位数聚合存在疑问。每次执行此查询时,“ valor_medio”,“ area_util_media”,“ area_total_media”聚合给我不同的结果。值之间的差异不大,但是如果查询和数据未更改,则我需要这些值相同。我正在使用以下查询
GET imoveis/_search
{
"size": 0,
"from": 0,
"sort": [
{
"valor": {
"order": "asc"
}
}
],
"aggs": {
"valor_medio": {
"percentiles": {
"field": "valor"
}
},
"area_util_media": {
"percentiles": {
"field": "area_util"
}
},
"area_total_media": {
"percentiles": {
"field": "area_total"
}
},
"imoveis_count": {
"value_count": {
"field": "_id"
}
},
"ids": {
"terms": {
"field": "bairro.id.keyword",
"size": 1000000,
"order": {
"_key": "asc"
}
},
"aggs": {
"valor_medio": {
"percentiles": {
"field": "valor"
}
},
"area_util_media": {
"percentiles": {
"field": "area_util"
}
},
"area_total_media": {
"percentiles": {
"field": "area_total"
}
},
"imoveis_count": {
"value_count": {
"field": "_id"
}
}
}
},
"coordinates": {
"geohash_grid": {
"field": "geohash",
"precision": 4
},
"aggs": {
"centroid": {
"geo_centroid": {
"field": "geohash"
}
},
"top_hit": {
"top_hits": {
"sort": [],
"_source": {
"includes": [
"tipo_imovel",
"geometry",
"id",
"area_construida",
"area_terreno",
"area_total",
"area_util",
"bairro",
"banheiro",
"cidade",
"cidade_uf",
"codigo",
"condominio",
"descricao",
"endereco",
"garagem",
"geohash",
"imobiliaria",
"isparticular",
"lista_fotos",
"nome_corretor",
"numero_corretor",
"opcionais",
"quarto",
"tipo_negocio",
"uf",
"url",
"valor"
]
},
"size": 1
}
}
}
}
},
"query": {
"constant_score": {
"filter": {
"bool": {
"must": [
{
"bool": {
"should": [
{
"geo_shape": {
"geometry": {
"shape": {
"type": "polygon",
"coordinates": [
[
[
-49.10408,
-25.330373
],
[
-49.11644,
-25.466214
],
[
-49.12262,
-25.520756
],
[
-49.148026,
-25.635336
],
[
-49.167938,
-25.685469
],
[
-49.183731,
-25.715786
],
[
-49.192657,
-25.726921
],
[
-49.203644,
-25.734962
],
[
-49.211884,
-25.738674
],
[
-49.240036,
-25.745477
],
[
-49.251022,
-25.746714
],
[
-49.282608,
-25.745477
],
[
-49.32312,
-25.736818
],
[
-49.345093,
-25.726303
],
[
-49.371872,
-25.701557
],
[
-49.405518,
-25.658858
],
[
-49.442596,
-25.599425
],
[
-49.450836,
-25.583943
],
[
-49.470749,
-25.535626
],
[
-49.477615,
-25.510841
],
[
-49.481735,
-25.476133
],
[
-49.481735,
-25.462495
],
[
-49.480362,
-25.453815
],
[
-49.476929,
-25.444515
],
[
-49.468689,
-25.429013
],
[
-49.450836,
-25.410408
],
[
-49.430237,
-25.395521
],
[
-49.352646,
-25.358919
],
[
-49.218063,
-25.306787
],
[
-49.088287,
-25.25898
],
[
-49.10408,
-25.330373
]
]
]
},
"relation": "within"
}
}
}
]
}
},
{
"match": {
"tipo_negocio": "Venda"
}
},
{
"geo_shape": {
"geometry": {
"shape": {
"type": "envelope",
"coordinates": [
[
-49.47322458028794,
-25.795102447042222
],
[
-49.0866431593895,
-25.23243168187146
]
]
},
"relation": "within"
}
}
}
]
}
}
}
}
}
答案 0 :(得分:0)
这是一个精度问题,对其进行更改可以解决问题。