Skip to content

Commit

Permalink
Merge pull request #157 from JeffreyMFarley/issue-1115
Browse files Browse the repository at this point in the history
Include aggregation if it is used as a filter
  • Loading branch information
JeffreyMFarley authored Jul 15, 2020
2 parents 8fc250d + 65ff163 commit 768fb54
Show file tree
Hide file tree
Showing 5 changed files with 68 additions and 2 deletions.
6 changes: 4 additions & 2 deletions complaint_search/es_builders.py
Original file line number Diff line number Diff line change
Expand Up @@ -409,8 +409,10 @@ def build(self):

agg_fields = self._AGG_FIELDS
if self.exclude:
agg_fields = [field_name for field_name in self._AGG_FIELDS
if field_name not in self.exclude]
agg_fields = [
field_name for field_name in self._AGG_FIELDS
if field_name not in self.exclude or field_name in self.params
]
for field_name in agg_fields:
aggs[field_name] = self.build_one(field_name)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,22 @@
}
},
"aggs": {
"company": {
"aggs": {
"company": {
"terms": {
"field": "company.raw",
"size": 0
}
}
},
"filter": {
"bool": {
"must": [],
"must_not": []
}
}
},
"company_public_response": {
"aggs": {
"company_public_response": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,22 @@
}
},
"aggs": {
"company": {
"aggs": {
"company": {
"terms": {
"field": "company.raw",
"size": 0
}
}
},
"filter": {
"bool": {
"must": [],
"must_not": []
}
}
},
"company_public_response": {
"aggs": {
"company_public_response": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -364,6 +364,22 @@
"must_not": []
}
}
},
"zip_code": {
"aggs": {
"zip_code": {
"terms": {
"field": "zip_code",
"size": 0
}
}
},
"filter": {
"bool": {
"must": [],
"must_not": []
}
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -390,6 +390,22 @@
"must_not": []
}
}
},
"zip_code": {
"aggs": {
"zip_code": {
"terms": {
"field": "zip_code",
"size": 0
}
}
},
"filter": {
"bool": {
"must": [],
"must_not": []
}
}
}
}
}

0 comments on commit 768fb54

Please sign in to comment.