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"
}
}
}
]
}
}
}
}
}
解决方案
这是一个精度问题,改变它解决了这个问题。
推荐阅读
- r - R - Markdown - Highcharter - 减少表格中的绘图大小
- c - 在编译时获取 char ptr 的字符串 len
- swift - Swift 在不同的 Mac 上处理应用程序启动路径的方式是否不同?令人沮丧的不一致
- c# - 如何在空的 ASP.NET Web 应用程序模板中与后端通信?
- vue.js - 从 index.js 访问时,本地存储值变为空
- spring-security - spring-security 5.2 中缺少依赖项 org.bouncycastle
- java - 我希望我的变量 value3 使用循环添加 5 十次。但它只添加一次。如何解决这个问题?
- android - Flutter for iOS 和 Android 中的视频播放功能,我们可以隐藏进度条和跳过功能
- kotlin - 科特林。尝试使用具体类型来解析列表和数组
- php - 如何在 PHP 中设置写入慢速文件系统的超时?