Skip to content

Commit f3c175c

Browse files
author
Hendrik Muhs
authored
[Transform] enhance geobounds test for sparse data case (#72023)
use sparse data for geobounds agg, verifies the fix of #71874, adding debug logging of index requests send by transform
1 parent af1aa5d commit f3c175c

File tree

2 files changed

+19
-2
lines changed

2 files changed

+19
-2
lines changed

x-pack/plugin/transform/qa/single-node-tests/src/javaRestTest/java/org/elasticsearch/xpack/transform/integration/TransformPivotRestIT.java

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1120,7 +1120,12 @@ public void testPivotWithBucketScriptAgg() throws Exception {
11201120
public void testPivotWithGeoBoundsAgg() throws Exception {
11211121
String transformId = "geo_bounds_pivot";
11221122
String transformIndex = "geo_bounds_pivot_reviews";
1123-
setupDataAccessRole(DATA_ACCESS_ROLE, REVIEWS_INDEX_NAME, transformIndex);
1123+
String indexName = "reviews_geo_bounds";
1124+
1125+
// gh#71874 regression test: create some sparse data
1126+
createReviewsIndex(indexName, 1000, "date", false, 5, "location");
1127+
1128+
setupDataAccessRole(DATA_ACCESS_ROLE, indexName, transformIndex);
11241129

11251130
final Request createTransformRequest = createRequestWithAuth(
11261131
"PUT",
@@ -1130,7 +1135,7 @@ public void testPivotWithGeoBoundsAgg() throws Exception {
11301135

11311136
String config = "{"
11321137
+ " \"source\": {\"index\":\""
1133-
+ REVIEWS_INDEX_NAME
1138+
+ indexName
11341139
+ "\"},"
11351140
+ " \"dest\": {\"index\":\""
11361141
+ transformIndex

x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/transforms/TransformIndexer.java

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -896,6 +896,18 @@ private IterationResult<TransformIndexerPosition> processBuckets(final SearchRes
896896
);
897897

898898
List<IndexRequest> indexRequests = indexRequestStream.collect(Collectors.toList());
899+
if (logger.isDebugEnabled()) {
900+
if (indexRequests.isEmpty()) {
901+
logger.debug("[{}] processed buckets, nothing to be indexed", getJobId());
902+
} else {
903+
logger.debug(
904+
"[{}] processed buckets and created [{}] documents to be indexed, 1st document: [{}]",
905+
getJobId(),
906+
indexRequests.size(),
907+
indexRequests.get(0)
908+
);
909+
}
910+
}
899911
IterationResult<TransformIndexerPosition> result = new IterationResult<>(indexRequests, newPosition, indexRequests.isEmpty());
900912

901913
// NOTE: progress is also mutated in onFinish

0 commit comments

Comments
 (0)