# How to do a elasticsearch query search from NodeJS using wildcard and space

**URL:** <https://discuss.elastic.co/t/how-to-do-a-elasticsearch-query-search-from-nodejs-using-wildcard-and-space/137569>\
**Category:** Elasticsearch\
**Created:** [June 27, 2018, 8:26am UTC](https://discuss.elastic.co/t/how-to-do-a-elasticsearch-query-search-from-nodejs-using-wildcard-and-space/137569 "2018-06-27T08:26:45Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [June 27, 2018, 8:45am UTC](https://discuss.elastic.co/t/how-to-do-a-elasticsearch-query-search-from-nodejs-using-wildcard-and-space/137569/2 "2018-06-27T08:45:33Z")

</div>

It depends on how things are indexed basically.

It'd be bette to provide a full recreation script as described in [About the Elasticsearch category](https://discuss.elastic.co/t/about-the-elasticsearch-category/21). It will help to better understand what you are doing. Please, try to keep the example as simple as possible.

A full reproduction script will help readers to understand, reproduce in Kibana Console and if needed fix your problem.

Anyway, I'd definitely not use `wildcard` specifically with something like `*foo*`. As written [in documentation](https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-wildcard-query.html):

> Note that this query can be slow, as it needs to iterate over many terms. In order to prevent extremely slow wildcard queries, a wildcard term should not start with one of the wildcards \* or ?.

---

_[View the full topic](https://discuss.elastic.co/t/how-to-do-a-elasticsearch-query-search-from-nodejs-using-wildcard-and-space/137569)._
