# Search box with ajax results, query with wildcard (but also allow 1-2 typos)

**URL:** <https://discuss.elastic.co/t/search-box-with-ajax-results-query-with-wildcard-but-also-allow-1-2-typos/275032>\
**Category:** Elasticsearch\
**Created:** [June 5, 2021, 1:44pm UTC](https://discuss.elastic.co/t/search-box-with-ajax-results-query-with-wildcard-but-also-allow-1-2-typos/275032 "2021-06-05T13:44:24Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![kiko](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/kiko/32/89385_2.png) [@kiko](https://discuss.elastic.co/u/kiko)\
**Post date:** [June 5, 2021, 1:44pm UTC](https://discuss.elastic.co/t/search-box-with-ajax-results-query-with-wildcard-but-also-allow-1-2-typos/275032/1 "2021-06-05T13:44:24Z")

</div>

Hi I'm trying to create a search box that returns results from Elastic on keypress. The problem is with the documentation warning not to use both fuzzy and wildcard in a query.

Is there an other way to use wildcard and allow for a typo or two?

This is my current query:

```auto
const query = {   
        bool: {
            should: {
                match: {
                    status: "publish"
                }
            },            
            filter: {
                bool: {
                    minimum_should_match: 1,
                    should: [                        
                        {
                            query_string: {
                              fields: [
                                "name"
                              ],
                              query: `${queryString}~2`,     
                              // fuzzy_prefix_length : 3,                         
                            }
                        },                        
                    ]
                }
            },
            // should: [
                
            // ]                                    
        }                
    }        

```

---

<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 3, 2021, 1:44pm UTC](https://discuss.elastic.co/t/search-box-with-ajax-results-query-with-wildcard-but-also-allow-1-2-typos/275032/2 "2021-07-03T13:44:52Z")

</div>

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