# Issue with Python and Autocompletion

**URL:** <https://discuss.elastic.co/t/issue-with-python-and-autocompletion/16745>\
**Category:** Elasticsearch\
**Created:** [April 1, 2014, 7:54pm UTC](https://discuss.elastic.co/t/issue-with-python-and-autocompletion/16745 "2014-04-01T19:54:19Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![redrubia](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/redrubia/32/1554_2.png) [@redrubia](https://discuss.elastic.co/u/redrubia)\
**Post date:** [April 1, 2014, 7:54pm UTC](https://discuss.elastic.co/t/issue-with-python-and-autocompletion/16745/1 "2014-04-01T19:54:19Z")

</div>

Hi all,

So to begin. I am trying to add around 7.2k documents. No problem there.  
The issue is after I am not able to get any suggestions returned to me. So  
this is how the information is added:

def addVariantToElasticSearch(self,docId, companyId, companyName, parent,companyIndustry  
, variants, count, conn):  
body = { "company":{  
"company\_name": companyName,  
"parent": parent,  
"suggest": { "input": variants,  
"output": companyName,  
"weight": count,  
"payload": {"industry\_id": companyIndustry,  
"no\_of\_jobseekers":count,  
"company\_id": companyId  
}  
}  
}  
}  
res = conn.index(body=body, index="companies", doc\_type="company", id=docId  
)

The mapping and settings is defined as:

def setting():  
return { "settings" : {  
"index": {  
"number\_of\_replicas" : 0,  
"number\_of\_shards": 1  
},  
"analysis" : {  
"analyzer" : {  
"my\_edge\_ngram\_analyzer" : {  
"tokenizer" : "my\_edge\_ngram\_tokenizer",  
"filter":["standard", "lowercase"]  
}  
},  
"tokenizer" : {  
"my\_edge\_ngram\_tokenizer" : {  
"type" : "edgeNGram",  
"min\_gram" : "1",  
"max\_gram" : "5",  
"token\_chars": ["letter", "digit"]  
}  
}  
}  
},  
"mappings": {  
"company" : {  
"properties" : {  
"name" : { "type" : "string" },  
"industy": {"type": "integer"},  
"count" : {"type": "long" },  
"parent": {"type": "string"},  
"suggest" : {  
"type" : "completion",  
"index\_analyzer": "my\_edge\_ngram\_analyzer",  
"search\_analyzer": "my\_edge\_ngram\_analyzer",  
"payloads": True  
}  
}  
}  
}  
}

Index creation:

def createMapping(es):  
settings = setting()  
es.indices.create(index="companies", body=settings)

I call `createMapping` which uses `setting()`, then add each variant -  
surrounded by a try,except -\> causes no issue. I can see all my documents  
added in the browser as well as looking at the status, settings and  
mappings.

But when I use a curl request as below, I get no results. (See curl and  
output beneath)

curl -X POST localhost:9200/companies/\_suggest -d '

{

"company-suggest" : {

```
"text" : "1800", 

```

"completion" : {

quote\> "field" : "suggest"

quote\> }

quote\> }

quote\> }'

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/f866147a-242b-4488-966c-c2d1d405269e%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/f866147a-242b-4488-966c-c2d1d405269e%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [July 6, 2017, 1:38am UTC](https://discuss.elastic.co/t/issue-with-python-and-autocompletion/16745/2 "2017-07-06T01:38:56Z")

</div>


