How to use "suggest" in elasticsearch pyes?

elasticsearch, python

Solution

Here is my code which runs perfectly.

from elasticsearch import Elasticsearch
es = Elasticsearch()

text = 'ra'
suggDoc = {
           "entity-suggest" : {
                'text' : text,
                "completion" : {
                    "field" : "suggest"
                }
            }
        }

res = es.suggest(body=suggDoc, index="auto_sugg", params=None)
print(res)

I used the same client mentioned on the elasticsearch site here I indexed the data in the elasticsearch index by using `completion suggester` from here

Problem

How to use the "suggest" feature in pyes? Cannot seem to figure it out due to poor documentation. Could someone provide a working example? None of what I tried appears to work. In the docs its listed under query, but using: ``` query = Suggest(fields="fieldname") connectionobject.search(query=query) ```

Original source