This commit is contained in:
Sean Whalen
2020-01-22 11:50:49 -05:00
parent 52eaa32c3b
commit ac25262385
4 changed files with 13 additions and 8 deletions
+5
View File
@@ -1,3 +1,8 @@
6.8.1
-----
- Use `match_phrase` instead of `match` when looking for existing strings in Elasticsearch
6.8.0
-----
+1 -1
View File
@@ -33,7 +33,7 @@ from parsedmarc.utils import is_outlook_msg, convert_outlook_msg
from parsedmarc.utils import timestamp_to_human, human_timestamp_to_datetime
from parsedmarc.utils import parse_email
__version__ = "6.8.0"
__version__ = "6.8.1"
logging.basicConfig(
format='%(levelname)8s:%(filename)s:%(lineno)d:'
+6 -6
View File
@@ -307,9 +307,9 @@ def save_aggregate_report_to_elasticsearch(aggregate_report,
date_range = [aggregate_report["begin_date"],
aggregate_report["end_date"]]
org_name_query = Q(dict(match=dict(org_name=org_name)))
report_id_query = Q(dict(match=dict(report_id=report_id)))
domain_query = Q(dict(match={"published_policy.domain": domain}))
org_name_query = Q(dict(match_phrase=dict(org_name=org_name)))
report_id_query = Q(dict(match_phrase=dict(report_id=report_id)))
domain_query = Q(dict(match_phrase={"published_policy.domain": domain}))
begin_date_query = Q(dict(match=dict(date_range=begin_date)))
end_date_query = Q(dict(match=dict(date_range=end_date)))
@@ -437,15 +437,15 @@ def save_forensic_report_to_elasticsearch(forensic_report,
subject = None
if "from" in headers:
from_ = headers["from"]
from_query = {"match": {"sample.headers.from": from_}}
from_query = {"match_phrase": {"sample.headers.from": from_}}
q = q & Q(from_query)
if "to" in headers:
to_ = headers["to"]
to_query = {"match": {"sample.headers.to": to_}}
to_query = {"match_phrase": {"sample.headers.to": to_}}
q = q & Q(to_query)
if "subject" in headers:
subject = headers["subject"]
subject_query = {"match": {"sample.headers.subject": subject}}
subject_query = {"match_phrase": {"sample.headers.subject": subject}}
q = q & Q(subject_query)
search.query = q
+1 -1
View File
@@ -14,7 +14,7 @@ from setuptools import setup
from codecs import open
from os import path
__version__ = "6.8.0"
__version__ = "6.8.1"
description = "A Python package and CLI for parsing aggregate and " \
"forensic DMARC reports"