# Elastic simple query with wildcard

**URL:** <https://discuss.elastic.co/t/elastic-simple-query-with-wildcard/276441>\
**Category:** Elasticsearch\
**Created:** [June 19, 2021, 9:42pm UTC](https://discuss.elastic.co/t/elastic-simple-query-with-wildcard/276441 "2021-06-19T21:42:24Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Vinoth\_G](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/vinoth_g/32/90230_2.png) [@Vinoth\_G](https://discuss.elastic.co/u/Vinoth_G)\
**Post date:** [June 19, 2021, 9:42pm UTC](https://discuss.elastic.co/t/elastic-simple-query-with-wildcard/276441/1 "2021-06-19T21:42:24Z")

</div>

I am new to elastic and planning to migrate my application from algolia to elastic cloud.

In algolia after creating an index and writing a document I can search by passing a search query, no need to specify wildcard patterns.  
Question 1: How can achieve above behavior?

Question 2:

i.e  
document data

```auto
{
  "objectID": "005klrWVvNX0RwxxX78O",
  "dn": "Root Vegetables Beetroot",
  "mq": 30,
  "desc" : "blah blah",
  "price": "150"
}

```

I can search for keyword "Veg" for the field "dn" and it will match this record. I dont have to mention wildcard patterns by worrying if pre and post charecters exist by specifying "_Veg_" or "Root\*".  
How can I acheive this simple search effectively?

Also I found one strange behavior,

Below search payload is not working

```auto
{
  "query": {
    "wildcard": {
      "objectID": {
        "value": "005klrWVvN*"
      }
    }
  }
}

```

Below search payload is working,

```auto
{
  "query": {
    "wildcard": {
      "objectID": {
        "value": "005klr*"
      }
    }
  }
}

```

Whats wrong with my first request?

Thank you

---

<div class="post-metadata">

**Author:** ![spinscale](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/spinscale/32/25011_2.png) [@spinscale](https://discuss.elastic.co/u/spinscale)\
**Post date:** [June 21, 2021, 8:42am UTC](https://discuss.elastic.co/t/elastic-simple-query-with-wildcard/276441/2 "2021-06-21T08:42:31Z")

</div>

Hey,

take a look at different ways for indexing data, so that your search is fast, as most of the work is done on index time and not on query time. See the [edge ngram token filter](https://www.elastic.co/guide/en/elasticsearch/reference/7.13/analysis-edgengram-tokenfilter.html)

hope that helps as a start!

--Alex

---

<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 19, 2021, 8:43am UTC](https://discuss.elastic.co/t/elastic-simple-query-with-wildcard/276441/3 "2021-07-19T08:43:30Z")

</div>

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