我在过滤后汇总结果时遇到问题.我想我走在正确的轨道上,但我觉得我在追逐自己的尾巴.
以下是它的外观:
PUT /my_index
{
"mappings": {
"reporting": {
"properties": {
"events": {
"type": "nested",
"properties": {
"name": { "type": "string", "index" : "not_analyzed" },
"date": { "type": "date" }
}
}
}
}
}
}
Run Code Online (Sandbox Code Playgroud)
所以,我的文档看起来像:
{
"events": [
{ "name": "INSTALL", "date": "2014-11-01" },
{ "name": "UNINSTALL", "date": "2014-11-03" },
{ "name": "INSTALL", "date": "2014-11-04" },
...
]
}
Run Code Online (Sandbox Code Playgroud)
现在,当我索引一些数据时,例如:
PUT /my_index/reporting/1
{
"events": [
{
"name": "INSTALL",
"date": "2014-11-01"
},
{
"name": "UNINSTALL",
"date": "2014-11-05"
}
] …Run Code Online (Sandbox Code Playgroud)