question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

scan() does not give me all hits

See original GitHub issue

Hi! I’m using the scan method to retrieve a large number of search results

s = Search(using=connection, index=index, doc_type="doc")
q = Q({"multi_match": {"query": 'example_search', "fields": ['title', 'body'], "type":"phrase",
                  "minimum_should_match":"100%", "analyzer":'standard'}})
s = s.query(q)
hits = []
for hit in s.scan():
     hits.append({"doc_id": hit.doc_id, "found_term": 'example_search'})

I currently have the impression that the scan search is not returning all hits from my index. I had a look at the documentation of elasticsearch_dsl and elasticsearch but I don’t really understand if there is a parameter I should change or pass (maybe the scrolling parameter?) in order to assure that all hits in all documents will be returned… Any ideas on what might cause the problem?

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
honzakralcommented, Jan 30, 2020

You can only iterate on the returned object once, if you want to iterate again you need to call scan again.

0reactions
davidgacccommented, Jan 30, 2020

@HonzaKral I’m using Search() and scan() inside a function that is returning a result of the records. When I’m trying to iterate for the second time in the result, I’m not getting a result. Only for the first time works. Any ideas?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Music Library Scan doesn't capture all songs - KODI Forum
Hi everyone, i have some strange problem with the music library. If i select "Scan to library" on my music folder, XBMC starts...
Read more >
9 reasons Why Your QR Code is Not Working - Beaconstac blog
Sometimes, scanning the QR Code can give you a warning message like “Please do not scan this QR Code again.”, which means it's...
Read more >
Scanner in Java not working - Stack Overflow
When you type in, say, 5 and then hit Enter, the output is: nextInt() = 5 nextLine() = That is, nextLine() did not...
Read more >
Best practices for querying and scanning data
This section covers some best practices for using Query and Scan operations in Amazon DynamoDB. Performance considerations for scans.
Read more >
How to Scan a QR Code on Android and iOS | Digital Trends
1. Open up the Camera app. 2. If you don't see the QR code icon in your Control Center on iOS, then simply...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found