Skip to content

Commit

Permalink
6.8.1
Browse files Browse the repository at this point in the history
  • Loading branch information
Sean Whalen committed Jan 22, 2020
1 parent 52eaa32 commit ac25262
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 8 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
6.8.1
-----

- Use `match_phrase` instead of `match` when looking for existing strings in Elasticsearch

6.8.0
-----

Expand Down
2 changes: 1 addition & 1 deletion parsedmarc/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
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:'
Expand Down
12 changes: 6 additions & 6 deletions parsedmarc/elastic.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)))

Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
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"
Expand Down

0 comments on commit ac25262

Please sign in to comment.