Skip to content

Commit

Permalink
Refactor Elasticsearch search parameters in requests
Browse files Browse the repository at this point in the history
  • Loading branch information
Ismail731404 committed Jan 16, 2025
1 parent e0dfd39 commit 21c3b24
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
2 changes: 1 addition & 1 deletion internals/export/elasticsearch.go
Original file line number Diff line number Diff line change
Expand Up @@ -247,8 +247,8 @@ func ExportFactHitsFull(f engine.Fact) ([]reader.Hit, error) {
for {
response, err := elasticsearch.C().Search().
//Index(indicesStr).
Size(10000).
Request(searchRequest).
Size(10000).
Sort("_shard_doc").
Do(context.Background())
if err != nil {
Expand Down
6 changes: 2 additions & 4 deletions internals/fact/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,11 @@ func ExecuteFact(
indices := FindIndices(f, ti, update)
zap.L().Debug("search", zap.Strings("indices", indices), zap.Any("request", searchRequest))

// overwrite of pagination and size parameters in request
searchRequest.Size = &nhit
searchRequest.From = &offset

response, err := elasticsearch.C().Search().
Index(strings.Join(indices, ",")).
Request(searchRequest).
From(offset).
Size(nhit).
Do(context.Background())
if err != nil {
zap.L().Error("ES Search failed", zap.Error(err))
Expand Down

0 comments on commit 21c3b24

Please sign in to comment.