我有一些关于从elasticsearch查询数据的问题。我想查询数据
具有以下结构:
at Microsoft.Extensions.DependencyModel.DependencyContextLoader.Load(Assembly assembly)
at System.Lazy`1.CreateValue()
at System.Lazy`1.LazyInitValue()
at
我想知道如何得到如下结果:
[
{
name : 'myName',
dailyTasks : [
{
date : '2016-01-01',
task : 'task1'
},
{
date : '2016-01-02',
task : 'task2'
},
{
date : '2016-01-03',
task : 'task3'
}
]
},
{
name : 'myName1',
dailyTasks : [
{
date : '2016-01-01',
task : 'task11'
},
{
date : '2016-01-02',
task : 'task12'
},
{
date : '2016-01-03',
task : 'task13'
}
]
}
]
非常感谢。
答案 0 :(得分:0)
What kind of logic shall the Query have ? It seems like name: myName1 and date <'2016-01-02' ?
{
"query": {
"filtered": {
"filter": {
"bool": {
"should": [
{}
],
"must": [
{ "term": {
"name": "myName"
}
"range": {
"date": {
"gte": "2016-01-01",
"lte": "2016-01-02"
}
}
}
]
}
}
}
}
}