# Elasticsearch query\_string doesnt work with \* wildcharacter in the starting

**URL:** <https://discuss.elastic.co/t/elasticsearch-query-string-doesnt-work-with-wildcharacter-in-the-starting/227897>\
**Category:** Elasticsearch\
**Created:** [April 14, 2020, 11:15am UTC](https://discuss.elastic.co/t/elasticsearch-query-string-doesnt-work-with-wildcharacter-in-the-starting/227897 "2020-04-14T11:15:45Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![prematiwari](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/prematiwari/32/61276_2.png) [@prematiwari](https://discuss.elastic.co/u/prematiwari)\
**Post date:** [April 14, 2020, 11:15am UTC](https://discuss.elastic.co/t/elasticsearch-query-string-doesnt-work-with-wildcharacter-in-the-starting/227897/1 "2020-04-14T11:15:45Z")

</div>

Hi,

I am using query\_string to fetch the results for ends with text in a specific field that holds a url.  
So, the query can either be ends with or starts with. The starts with scenario works well with match\_phrase\_prefix.  
For ends with scenario, am using query\_string as given below:

`{"from":0,"size":100,"sort":[],"query": {"bool": {"filter": [{"query_string":{"query":"*http\\://www.xyz.org//example//","default_field": "url"}}],"must_not":[]}}}`

For example the data I have for url field is [http://www.xyz.org/example/3456](http://www.xyz.org/example/3456)

The above query should not fetch any results but it always fetches all records..

Tried using analyze\_wildcard : true but it doesnt work.

Am i missing anything?

---

<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:** [May 12, 2020, 11:15am UTC](https://discuss.elastic.co/t/elasticsearch-query-string-doesnt-work-with-wildcharacter-in-the-starting/227897/2 "2020-05-12T11:15:46Z")

</div>

Closed on May 12, 2020, 11:15am UTC

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