# Elasticsearch python autosuggest script - slow loading

**URL:** <https://discuss.elastic.co/t/elasticsearch-python-autosuggest-script-slow-loading/68075>\
**Category:** Elasticsearch\
**Created:** [December 5, 2016, 5:33pm UTC](https://discuss.elastic.co/t/elasticsearch-python-autosuggest-script-slow-loading/68075 "2016-12-05T17:33:23Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![midget2000x](https://avatars.discourse-cdn.com/v4/letter/m/bbe5ce/32.png) [@midget2000x](https://discuss.elastic.co/u/midget2000x)\
**Post date:** [December 5, 2016, 5:33pm UTC](https://discuss.elastic.co/t/elasticsearch-python-autosuggest-script-slow-loading/68075/1 "2016-12-05T17:33:23Z")

</div>

I'm building a simple autosuggest function as a standalone script (takes text as a URL parameter, returns JSON) using the very excellent elasticsearch-dsl python plugin.

Problem is, the import of the module slows the loading of the script:

```
from elasticsearch import Elasticsearch
from elasticsearch_dsl import Search, Q

```

...making it untenable for use as a traditional CGI for autosuggest (because speed is obviously the key).

Can anyone think of an _easy_-ish way for me to make this stay in memory? Perhaps make a small web app with flask? I'm kind of looking for path-of-least-resistance here 😉

---

<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:** [January 2, 2017, 5:33pm UTC](https://discuss.elastic.co/t/elasticsearch-python-autosuggest-script-slow-loading/68075/2 "2017-01-02T17:33:50Z")

</div>

Closed on January 2, 2017, 5:33pm UTC

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
