diff --git a/tools/sigma/backends/elasticsearch.py b/tools/sigma/backends/elasticsearch.py index a723a576..56efadf0 100644 --- a/tools/sigma/backends/elasticsearch.py +++ b/tools/sigma/backends/elasticsearch.py @@ -245,7 +245,9 @@ class ElasticsearchDSLBackend(RulenameCommentMixin, ElasticsearchWildcardHandlin dateField = self.sigmaconfig.config['dateField'] if self.interval: if 'bool' not in self.queries[-1]['query']['constant_score']['filter']: + saved_simple_query = self.queries[-1]['query']['constant_score']['filter'] self.queries[-1]['query']['constant_score']['filter'] = {'bool': {'must': []}} + self.queries[-1]['query']['constant_score']['filter']['bool']['must'].append(saved_simple_query) if 'must' not in self.queries[-1]['query']['constant_score']['filter']['bool']: self.queries[-1]['query']['constant_score']['filter']['bool']['must'] = [] @@ -748,7 +750,7 @@ class ElastalertBackend(MultiRuleOutputMixin, ElasticsearchQuerystringBackend): if idx == agg.aggfunc: funcname = name break - raise NotImplementedError("%s : The '%s' aggregation operator is not yet implemented for this backend"%(self.title, funcname)) + raise NotImplementedError("%s : The '%s' aggregation operator is not yet implemented for this backend"%(self.title, funcname)) def convertLevel(self, level): return {