我对Elastic很新,我一直试图弄清楚是否可以根据文档中嵌套字段的总数或数量查询文档。到目前为止我所做的所有研究都会说它不是,但也许有办法解决它?
我知道aggregations但是这些输出总数而不是根据总数更改搜索结果。
例如,我有一组看起来像这样的数据:
{
"records": [
{
"JhseTzYuOF_first": "Liam",
"JhseTzYuOF_last": "McAneny",
"record_activity": [
{
"category": "YfV068",
"comment": "Appeal",
"created": "2015-06-14T21:41:22+10:00",
"value": 15
}
],
"$id": "-Jr8G3YEMjafAvRP1a8I"
},
{
"JhseTzYuOF_first": "Pha-Hai",
"JhseTzYuOF_last": "Nguyen",
"record_activity": [
{
"category": "YfV068",
"comment": "Donated",
"created": "2015-06-14T13:49:23+10:00",
"value": 10
},
{
"category": "YfV068",
"comment": "Donated",
"created": "2015-06-14T13:49:55+10:00",
"value": 15
}
],
"$id": "-Jr8G3Y7JQrBTb-cpFsT"
}
]
}
record_activity
被映射为嵌套,我可以查询它,但我希望我可以做类似的事情:
show all where sum of record_activity.value > 20
如何通过ElasticSearch实现这一目标?