Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
memoriav
Memobase 2020
services
Elasticsearch Services
Search Doc Service
Commits
44bc574c
Commit
44bc574c
authored
Mar 26, 2021
by
Jonas Waeber
Browse files
Fix first scroll not being processed.
parent
eae213bd
Pipeline
#23877
passed with stages
in 5 minutes and 6 seconds
Changes
1
Pipelines
2
Hide whitespace changes
Inline
Side-by-side
src/main/kotlin/helpers/ElasticSearchWrapper.kt
View file @
44bc574c
...
@@ -112,11 +112,6 @@ class ElasticSearchWrapper(
...
@@ -112,11 +112,6 @@ class ElasticSearchWrapper(
var
searchHits
=
searchResponse
.
hits
.
hits
var
searchHits
=
searchResponse
.
hits
.
hits
while
(
searchHits
!=
null
&&
searchHits
.
isNotEmpty
())
{
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
)
{
for
(
hit
in
searchHits
)
{
val
source
=
hit
.
sourceAsString
val
source
=
hit
.
sourceAsString
try
{
try
{
...
@@ -131,6 +126,11 @@ class ElasticSearchWrapper(
...
@@ -131,6 +126,11 @@ class ElasticSearchWrapper(
log
.
error
(
"Unable to parse $source from index $documentsIndex."
)
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
()
val
clearScrollRequest
=
ClearScrollRequest
()
clearScrollRequest
.
addScrollId
(
scrollId
)
clearScrollRequest
.
addScrollId
(
scrollId
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment