Elasticsearch-dsl-py: How to use track_total_hits ?

Created on 9 May 2019  路  5Comments  路  Source: elastic/elasticsearch-dsl-py

The track_total_hits is in ES 7, and so is in this lib doc, but I can鈥檛 figure out to use it

Search(track_total_hit=True)

Throws : Super(Search,self).__init__(**kwargs) got en unexpected keyword

I think it鈥檚 because the super init has no kwargs and only 3 required param but how to use it so ?

Most helpful comment

the proper solution is:

s = Search()
s = s.extra(track_total_hits=True)

Hope this helps!

All 5 comments

Ow I think I get it, I brain myself between elastic and elastic-dsl docs, it's in the basic one that track_total_hit is implemented, I'll try it tomorrow ^^

the proper solution is:

s = Search()
s = s.extra(track_total_hits=True)

Hope this helps!

This should really be mentioned in the docs here (or somewhere else obvious). We spend much too much time wondering why we were only getting a max 10,000 hits

@miff2000 I would accept a PR documenting this.

@sethmlarson I've put in the PR mentioned above. I added under the Hits section instead as it's the hit total that's affected by it

Was this page helpful?
0 / 5 - 0 ratings

Related issues

barseghyanartur picture barseghyanartur  路  4Comments

zahir-koradia picture zahir-koradia  路  3Comments

primoz-k picture primoz-k  路  4Comments

beanaroo picture beanaroo  路  4Comments

MauriJHN picture MauriJHN  路  4Comments