-
Notifications
You must be signed in to change notification settings - Fork 121
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[enrich/demographics] Fix fetching authors with min and max dates
This code fixes fetching all authors with min and max dates. Currently, ElasticSearch and OpenSearch use `composite` aggregation to paginate all buckets. The old query only returns 10000 items and also returns the following warning message: ``` Deprecation: This aggregation creates too many buckets (10001) and will throw an error in future versions. You should update the [search.max_buckets] cluster setting or use the [composite] aggregation to paginate all buckets in multiple requests. ``` Tests added acconrdingly. Signed-off-by: Quan Zhou <[email protected]>
- Loading branch information
Showing
6 changed files
with
391 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 8 additions & 0 deletions
8
releases/unreleased/fix-fetching-authors-with-min-and-max-dates.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
--- | ||
title: Fix fetching authors with min and max dates | ||
category: fixed | ||
author: Quan Zhou <[email protected]> | ||
issue: null | ||
notes: > | ||
The old query only returns 10000 items due to ElasticSearch and | ||
OpenSearch now use `composite` aggregation to paginate all buckets. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
{ | ||
"took" : 2, | ||
"timed_out" : false, | ||
"_shards" : { | ||
"total" : 2, | ||
"successful" : 2, | ||
"skipped" : 0, | ||
"failed" : 0 | ||
}, | ||
"hits" : { | ||
"total" : { | ||
"value" : 10000, | ||
"relation" : "gte" | ||
}, | ||
"max_score" : null, | ||
"hits" : [ ] | ||
}, | ||
"aggregations" : { | ||
"author" : { | ||
"after_key" : { | ||
"author_uuid" : "007a56d0322c518859dde2a0c6ed9143fa141c61" | ||
}, | ||
"buckets" : [ | ||
{ | ||
"key" : { | ||
"author_uuid" : "00032fabbbf033467d7bd307df81b654c0fa53d8" | ||
}, | ||
"doc_count" : 1, | ||
"min" : { | ||
"value" : 1.623225379E12, | ||
"value_as_string" : "2021-06-09T07:56:19.000Z" | ||
}, | ||
"max" : { | ||
"value" : 1.623225379E12, | ||
"value_as_string" : "2021-06-09T07:56:19.000Z" | ||
} | ||
}, | ||
{ | ||
"key" : { | ||
"author_uuid" : "007a56d0322c518859dde2a0c6ed9143fa141c61" | ||
}, | ||
"doc_count" : 1, | ||
"min" : { | ||
"value" : 1.626183289E12, | ||
"value_as_string" : "2021-07-13T13:34:49.000Z" | ||
}, | ||
"max" : { | ||
"value" : 1.626183289E12, | ||
"value_as_string" : "2021-07-13T13:34:49.000Z" | ||
} | ||
} | ||
] | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
{ | ||
"took" : 4, | ||
"timed_out" : false, | ||
"_shards" : { | ||
"total" : 4, | ||
"successful" : 4, | ||
"skipped" : 0, | ||
"failed" : 0 | ||
}, | ||
"hits" : { | ||
"total" : { | ||
"value" : 10000, | ||
"relation" : "gte" | ||
}, | ||
"max_score" : null, | ||
"hits" : [ ] | ||
}, | ||
"aggregations" : { | ||
"author" : { | ||
"after_key" : { | ||
"author_uuid" : "00d36515f739794b941586e5d0a102b5ff3a0cc2" | ||
}, | ||
"buckets" : [ | ||
{ | ||
"key" : { | ||
"author_uuid" : "00cc95a5950523a42c969f15c7c36c4530417f13" | ||
}, | ||
"doc_count" : 1, | ||
"min" : { | ||
"value" : 1.474160034E12, | ||
"value_as_string" : "2016-09-18T00:53:54.000Z" | ||
}, | ||
"max" : { | ||
"value" : 1.474160034E12, | ||
"value_as_string" : "2016-09-18T00:53:54.000Z" | ||
} | ||
}, | ||
{ | ||
"key" : { | ||
"author_uuid" : "00d36515f739794b941586e5d0a102b5ff3a0cc2" | ||
}, | ||
"doc_count" : 1, | ||
"min" : { | ||
"value" : 1.526521972E12, | ||
"value_as_string" : "2018-05-17T01:52:52.000Z" | ||
}, | ||
"max" : { | ||
"value" : 1.526521972E12, | ||
"value_as_string" : "2018-05-17T01:52:52.000Z" | ||
} | ||
} | ||
] | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
{ | ||
"took" : 4, | ||
"timed_out" : false, | ||
"_shards" : { | ||
"total" : 4, | ||
"successful" : 4, | ||
"skipped" : 0, | ||
"failed" : 0 | ||
}, | ||
"hits" : { | ||
"total" : 4, | ||
"max_score" : 0.0, | ||
"hits" : [ ] | ||
}, | ||
"aggregations" : { | ||
"author" : { | ||
"buckets" : [ ] | ||
} | ||
} | ||
} |
Oops, something went wrong.