Skip to content

Commit

Permalink
[Transform] enhance geobounds test for sparse data case (#72023)
Browse files Browse the repository at this point in the history
use sparse data for geobounds agg, verifies the fix of #71874, adding debug
logging of index requests send by transform
  • Loading branch information
Hendrik Muhs committed Apr 22, 2021
1 parent 4ed85fe commit bc9b41f
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1127,7 +1127,12 @@ public void testPivotWithBucketScriptAgg() throws Exception {
public void testPivotWithGeoBoundsAgg() throws Exception {
String transformId = "geo_bounds_pivot";
String transformIndex = "geo_bounds_pivot_reviews";
setupDataAccessRole(DATA_ACCESS_ROLE, REVIEWS_INDEX_NAME, transformIndex);
String indexName = "reviews_geo_bounds";

// gh#71874 regression test: create some sparse data
createReviewsIndex(indexName, 1000, "date", false, 5, "location");

setupDataAccessRole(DATA_ACCESS_ROLE, indexName, transformIndex);

final Request createTransformRequest = createRequestWithAuth(
"PUT",
Expand All @@ -1137,7 +1142,7 @@ public void testPivotWithGeoBoundsAgg() throws Exception {

String config = "{"
+ " \"source\": {\"index\":\""
+ REVIEWS_INDEX_NAME
+ indexName
+ "\"},"
+ " \"dest\": {\"index\":\""
+ transformIndex
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -896,6 +896,18 @@ private IterationResult<TransformIndexerPosition> processBuckets(final SearchRes
);

List<IndexRequest> indexRequests = indexRequestStream.collect(Collectors.toList());
if (logger.isDebugEnabled()) {
if (indexRequests.isEmpty()) {
logger.debug("[{}] processed buckets, nothing to be indexed", getJobId());
} else {
logger.debug(
"[{}] processed buckets and created [{}] documents to be indexed, 1st document: [{}]",
getJobId(),
indexRequests.size(),
indexRequests.get(0)
);
}
}
IterationResult<TransformIndexerPosition> result = new IterationResult<>(indexRequests, newPosition, indexRequests.isEmpty());

// NOTE: progress is also mutated in onFinish
Expand Down

0 comments on commit bc9b41f

Please sign in to comment.