Commit 44bc574c authored by Jonas Waeber's avatar Jonas Waeber
Browse files

Fix first scroll not being processed.

parent eae213bd
Pipeline #23877 passed with stages
in 5 minutes and 6 seconds
......@@ -112,11 +112,6 @@ class ElasticSearchWrapper(
var searchHits = searchResponse.hits.hits
while (searchHits != null && searchHits.isNotEmpty()) {
val scrollRequest = SearchScrollRequest(scrollId)
scrollRequest.scroll(scroll)
searchResponse = client.scroll(scrollRequest, RequestOptions.DEFAULT)
scrollId = searchResponse.scrollId
searchHits = searchResponse.hits.hits
for (hit in searchHits) {
val source = hit.sourceAsString
try {
......@@ -131,6 +126,11 @@ class ElasticSearchWrapper(
log.error("Unable to parse $source from index $documentsIndex.")
}
}
val scrollRequest = SearchScrollRequest(scrollId)
scrollRequest.scroll(scroll)
searchResponse = client.scroll(scrollRequest, RequestOptions.DEFAULT)
scrollId = searchResponse.scrollId
searchHits = searchResponse.hits.hits
}
val clearScrollRequest = ClearScrollRequest()
clearScrollRequest.addScrollId(scrollId)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment