Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion complaint_search/defaults.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,12 +47,14 @@
"company_response",
"complaint_id",
"complaint_what_happened",
"congressional_district",
"consumer_consent_provided",
"consumer_disputed",
"date_received",
"date_sent_to_company",
"has_narrative",
"issue",
"msa",
"product",
"state",
"submitted_via",
Expand Down Expand Up @@ -93,7 +95,7 @@
]
)

AGG_EXCLUDE_FIELDS = ["zip_code"]
AGG_EXCLUDE_FIELDS = ["congressional_district", "msa", "zip_code"]

CHUNK_SIZE = 512

Expand Down
6 changes: 6 additions & 0 deletions complaint_search/es_builders.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ class BaseBuilder(object):

# Filters for those with string type
_OPTIONAL_FILTERS = (
"congressional_district",
"company",
"company_public_response",
"company_response",
Expand All @@ -68,6 +69,7 @@ class BaseBuilder(object):
"has_narrative",
"issue",
"product",
"msa",
"state",
"submitted_via",
"tags",
Expand Down Expand Up @@ -323,13 +325,15 @@ def build(self):

class AggregationBuilder(BaseBuilder):
_AGG_FIELDS = (
"congressional_district",
"company",
"company_public_response",
"company_response",
"consumer_consent_provided",
"consumer_disputed",
"has_narrative",
"issue",
"msa",
"product",
"state",
"submitted_via",
Expand All @@ -339,6 +343,8 @@ class AggregationBuilder(BaseBuilder):
)

_AGG_SIZE_MAP = {
"congressional_district": AGG_ZIPCODE_DEFAULT, # 26000
"msa": AGG_ZIPCODE_DEFAULT, # 26000
"company.raw": AGG_COMPANY_DEFAULT, # 6500
"state": AGG_STATE_DEFAULT, # 100
"zip_code": AGG_ZIPCODE_DEFAULT, # 26000
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,14 @@
"company_response",
"complaint_id",
"complaint_what_happened",
"congressional_district",
"consumer_consent_provided",
"consumer_disputed",
"date_received",
"date_sent_to_company",
"has_narrative",
"issue",
"msa",
"product",
"state",
"submitted_via",
Expand Down Expand Up @@ -256,4 +258,4 @@
}
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,14 @@
"company_response",
"complaint_id",
"complaint_what_happened",
"congressional_district",
"consumer_consent_provided",
"consumer_disputed",
"date_received",
"date_sent_to_company",
"has_narrative",
"issue",
"msa",
"product",
"state",
"submitted_via",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,14 @@
"company_response",
"complaint_id",
"complaint_what_happened",
"congressional_district",
"consumer_consent_provided",
"consumer_disputed",
"date_received",
"date_sent_to_company",
"has_narrative",
"issue",
"msa",
"product",
"state",
"submitted_via",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,14 @@
"company_response",
"complaint_id",
"complaint_what_happened",
"congressional_district",
"consumer_consent_provided",
"consumer_disputed",
"date_received",
"date_sent_to_company",
"has_narrative",
"issue",
"msa",
"product",
"state",
"submitted_via",
Expand Down Expand Up @@ -364,4 +366,4 @@
}
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,14 @@
"company_response",
"complaint_id",
"complaint_what_happened",
"congressional_district",
"consumer_consent_provided",
"consumer_disputed",
"date_received",
"date_sent_to_company",
"has_narrative",
"issue",
"msa",
"product",
"state",
"submitted_via",
Expand Down Expand Up @@ -122,6 +124,31 @@
}
}
},
"congressional_district": {
"aggs": {
"congressional_district": {
"terms": {
"size": 26000,
"field": "congressional_district"
}
}
},
"filter": {
"bool": {
"must": [
{
"terms": {
"company.raw": [
"Bank 1",
"Second Bank"
]
}
}
],
"must_not": []
}
}
},
"consumer_consent_provided": {
"aggs": {
"consumer_consent_provided": {
Expand Down Expand Up @@ -263,6 +290,31 @@
}
}
},
"msa": {
"aggs": {
"msa": {
"terms": {
"size": 26000,
"field": "msa"
}
}
},
"filter": {
"bool": {
"must": [
{
"terms": {
"company.raw": [
"Bank 1",
"Second Bank"
]
}
}
],
"must_not": []
}
}
},
"state": {
"aggs": {
"state": {
Expand Down Expand Up @@ -389,4 +441,4 @@
}
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,14 @@
"company_response",
"complaint_id",
"complaint_what_happened",
"congressional_district",
"consumer_consent_provided",
"consumer_disputed",
"date_received",
"date_sent_to_company",
"has_narrative",
"issue",
"msa",
"product",
"state",
"submitted_via",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,14 @@
"company_response",
"complaint_id",
"complaint_what_happened",
"congressional_district",
"consumer_consent_provided",
"consumer_disputed",
"date_received",
"date_sent_to_company",
"has_narrative",
"issue",
"msa",
"product",
"state",
"submitted_via",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,14 @@
"company_response",
"complaint_id",
"complaint_what_happened",
"congressional_district",
"consumer_consent_provided",
"consumer_disputed",
"date_received",
"date_sent_to_company",
"has_narrative",
"issue",
"msa",
"product",
"state",
"submitted_via",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,14 @@
"company_response",
"complaint_id",
"complaint_what_happened",
"congressional_district",
"consumer_consent_provided",
"consumer_disputed",
"date_received",
"date_sent_to_company",
"has_narrative",
"issue",
"msa",
"product",
"state",
"submitted_via",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,14 @@
"company_response",
"complaint_id",
"complaint_what_happened",
"congressional_district",
"consumer_consent_provided",
"consumer_disputed",
"date_received",
"date_sent_to_company",
"has_narrative",
"issue",
"msa",
"product",
"state",
"submitted_via",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,14 @@
"company_response",
"complaint_id",
"complaint_what_happened",
"congressional_district",
"consumer_consent_provided",
"consumer_disputed",
"date_received",
"date_sent_to_company",
"has_narrative",
"issue",
"msa",
"product",
"state",
"submitted_via",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,14 @@
"company_response",
"complaint_id",
"complaint_what_happened",
"congressional_district",
"consumer_consent_provided",
"consumer_disputed",
"date_received",
"date_sent_to_company",
"has_narrative",
"issue",
"msa",
"product",
"state",
"submitted_via",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,14 @@
"company_response",
"complaint_id",
"complaint_what_happened",
"congressional_district",
"consumer_consent_provided",
"consumer_disputed",
"date_received",
"date_sent_to_company",
"has_narrative",
"issue",
"msa",
"product",
"state",
"submitted_via",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,14 @@
"company_response",
"complaint_id",
"complaint_what_happened",
"congressional_district",
"consumer_consent_provided",
"consumer_disputed",
"date_received",
"date_sent_to_company",
"has_narrative",
"issue",
"msa",
"product",
"state",
"submitted_via",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,14 @@
"company_response",
"complaint_id",
"complaint_what_happened",
"congressional_district",
"consumer_consent_provided",
"consumer_disputed",
"date_received",
"date_sent_to_company",
"has_narrative",
"issue",
"msa",
"product",
"state",
"submitted_via",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,14 @@
"company_response",
"complaint_id",
"complaint_what_happened",
"congressional_district",
"consumer_consent_provided",
"consumer_disputed",
"date_received",
"date_sent_to_company",
"has_narrative",
"issue",
"msa",
"product",
"state",
"submitted_via",
Expand Down
Loading