我使用的是elasticsearch 1.7.1。我希望按照下面描述的逻辑获得聚合文档:
response = "200"
AND timestamp >= 2016-01-07T18:00:00.000Z
AND timestamp < 2016-01-15T18:00:00.000Z
AND engine = "01ee20db31911aaedb97c847061ca49a"
AND (
logType = "click1"
OR (
autocomplete = "1"
AND logType = "click2"
)
)
查询是:
{
"aggregations": {
"my_aggs": {
"filter": {
"bool": {
"must": [{
"term": {
"response": "200"
}
}, {
"range": {
"timestamp": {
"from": "2016-01-07T18:00:00.000Z",
"to": "2016-01-15T18:00:00.000Z"
}
}
}, {
"term": {
"engine": "01ee20db31911aaedb97c847061ca49a"
}
}, {
"bool": {
"should": [{
"term": {
"logType": "click1"
}
}, {
"bool": {
"must": [{
"term": {
"autocomplete": "1"
}
}, {
"term": {
"logType": "click2"
}
}]
}
}]
}
}]
}
}
}
}
}
但是我可以看到一些不能显示的结果。例如,我可以看到时间戳= 2015-12-31T12:46:43.000Z或logType =&#34; redirect&#34;的记录。我的查询出了什么问题?
感谢。