File tree Expand file tree Collapse file tree 1 file changed +8
-1
lines changed
x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/transforms/latest Expand file tree Collapse file tree 1 file changed +8
-1
lines changed Original file line number Diff line number Diff line change 1010import org .elasticsearch .ElasticsearchException ;
1111import org .elasticsearch .action .ActionListener ;
1212import org .elasticsearch .client .internal .Client ;
13+ import org .elasticsearch .common .bytes .BytesReference ;
14+ import org .elasticsearch .common .xcontent .XContentHelper ;
1315import org .elasticsearch .index .query .BoolQueryBuilder ;
1416import org .elasticsearch .index .query .QueryBuilders ;
1517import org .elasticsearch .search .aggregations .AggregationBuilders ;
@@ -90,7 +92,12 @@ private static Map<String, Object> convertBucketToDocument(
9092 topHits .getHits ().getHits ().length
9193 );
9294 }
93- Map <String , Object > document = topHits .getHits ().getHits ()[0 ].getSourceAsMap ();
95+
96+ // We don't use #getSourceAsMap here because we don't want to cache the object as we
97+ // only need it here. More over we are modifying the map of maps so we will be holding
98+ // the wrong map.
99+ BytesReference bytes = topHits .getHits ().getHits ()[0 ].getSourceRef ();
100+ Map <String , Object > document = XContentHelper .convertToMap (bytes , true ).v2 ();
94101
95102 // generator to create unique but deterministic document ids, so we
96103 // - do not create duplicates if we re-run after failure
You can’t perform that action at this time.
0 commit comments