我想将以下 sql 查询提取到 elasticsearch。
Select *
from someTable
Where @timestamp < some_date and @timestamp >= some_other_date
and dst != '-'
然后对返回的文档进行一些聚合。我已经弄清楚了聚合部分,并且效果很好。但是我没有正确过滤文档。我尝试了以下查询,但我得到了带有 dst = '-' 的文档,这些文档依次在聚合中计算。
查询
"query": {
"bool": {
"must_not": {
"term": {
"dst": '-'
}
},
"filter":{
"range":{
"@timestamp":{
"gte":"a date",
"lt": "another date"
}
}
}
}
}
难道我做错了什么。我将大小设置为 0,因为我正在使用聚合(此处未显示)。Elasticsearch ver2.4 和 python elasticsearch 库。
我知道它不起作用,因为聚合结果包含 dst 为“-”的文档中的值