Elasticsearch-dsl-py: how to suggest query size

Created on 1 Aug 2017  路  2Comments  路  Source: elastic/elasticsearch-dsl-py

s = Search(hosts='localhost:9200')
s = s.suggest('my_sugestion', keyword, completion={ 'field' : 'test' })
# s = s.extra(size=10)  or  s = s.params(size=10) **dosen`t work**
results = response.suggest.my_suggestion

Let me know how to do it.

Thanks.

Most helpful comment

s = Search(hosts='localhost:9200')
s = s.suggest('my_sugestion', keyword, completion={ 'field' : 'test', 'size':100})
results = response.suggest.my_suggestion

Thanks

All 2 comments

The easiest way is to use python's slicing primitives:
s = s[0:100]

s = Search(hosts='localhost:9200')
s = s.suggest('my_sugestion', keyword, completion={ 'field' : 'test', 'size':100})
results = response.suggest.my_suggestion

Thanks

Was this page helpful?
0 / 5 - 0 ratings

Related issues

berinhard picture berinhard  路  3Comments

quasiben picture quasiben  路  4Comments

njoannin picture njoannin  路  3Comments

primoz-k picture primoz-k  路  4Comments

rokcarl picture rokcarl  路  4Comments