【发布时间】:2015-10-22 13:44:17
【问题描述】:
我的文件看起来像
{
"_id": "56161cb3cbdad2e3b437fdc3",
"_type": "Comunity",
"name": "public",
"data": [
{
"title": "sonder",
"creationDate": "2015-08-22T03:43:28 -03:00",
"quantity": 0
},
{
"title": "vule",
"creationDate": "2014-05-17T12:35:01 -03:00",
"quantity": 0
},
{
"title": "omer",
"creationDate": "2015-01-31T04:54:19 -02:00",
"quantity": 3
},
{
"title": "sonder",
"creationDate": "2014-05-22T05:09:36 -03:00",
"quantity": 3
}
]
}
映射:
comunityDocument": {
"_source": {
"includes": [
"meta.*"
]
},
"properties": {
"doc": {
"dynamic": "false",
"properties": {
"data": {
"type": "nested",
"include_in_parent": true,
"properties": {
"title": {
"type": "string"
},
"creationDate": {
"type": "date",
"format": "dateOptionalTime"
},
"quantity": {
"type": "integer"
}
}
},
"name": {
"type": "string",
"index": "not_analyzed"
}
}
},
"meta": {
"include_in_all": false,
"properties": {
"expiration": {
"type": "long",
"include_in_all": false
},
"flags": {
"type": "long",
"include_in_all": false
},
"id": {
"type": "string",
"include_in_all": false
},
"rev": {
"type": "string",
"include_in_all": false
}
}
}
}
}
还有我的查询
{
"size": 0,
"aggs": {
"filterAgg": {
"filter": {
"nested": {
"path": "comunityDocument.doc.data",
"filter": {
"terms": {
"comunityDocument.doc.data.quantity": [
0
]
}
}
}
}
}
}
}
因此,我必须计算数量等于 0 但我不明白的所有“数据”文档。奇怪的是嵌套聚合有效但嵌套过滤器无效。
【问题讨论】:
-
那是完整的映射吗?
标签: elasticsearch