# Wildcard query is not working

**URL:** https://discuss.elastic.co/t/wildcard-query-is-not-working/17067
**Category:** Elasticsearch
**Created:** [April 17, 2014, 7:55pm UTC](https://discuss.elastic.co/t/wildcard-query-is-not-working/17067 "2014-04-17T19:55:20Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![mohit\_Kumar](https://avatars.discourse-cdn.com/v4/letter/m/c89c15/32.png) [@mohit\_Kumar](https://discuss.elastic.co/u/mohit_Kumar)
#### Post date: [April 17, 2014, 7:55pm UTC](https://discuss.elastic.co/t/wildcard-query-is-not-working/17067/1 "2014-04-17T19:55:20Z")

</div>

hi folks,  
In my document there is a field which contians only URL as it value.  
forexample {"URL" :  
"[http://www.mohit-kumar-yadav.com](http://www.mohit-kumar-yadav.com)\123124343\login\_user.html"  
}  
{"URL" : "[http://www.mohit-kumar-yadav.com](http://www.mohit-kumar-yadav.com)\home\_user.html"}  
how can i search these documents.  
I am using following query :-

1. Curl -XGET '  
[http://localhost:9200/message\_index/message\_indext/\_search?size=0](http://localhost:9200/message_index/message_indext/_search?size=0)'  
-d'{"query":{"wildcard":{"URL":"_mohit-kumar-yadav_"}}}'

no result.. query return zero hits

1. Curl -XGET '  
[http://localhost:9200/message\_index/message\_indext/\_search?size=0](http://localhost:9200/message_index/message_indext/_search?size=0)'  
-d'{"query":{"field":{"URL":"[http://www.mohit-kumar-yadav.com](http://www.mohit-kumar-yadav.com)"}}}'

no result.. query return zero hits

1. Curl -XGET '  
[http://localhost:9200/message\_index/message\_indext/\_search?size=0](http://localhost:9200/message_index/message_indext/_search?size=0)'  
-d'{"fuzzy\_like\_this\_field" : {"URL" : {"like\_text" : "  
[www.mohit-kumar-yadav.com](http://www.mohit-kumar-yadav.com)","max\_query\_terms" : 25}}}'

no result.. query return zero hits

please suggest me where i am doing wrong..

Thanks in advance..!!!

Regrads  
Mohit

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/CAK6eDKeTjswArfEDyzfs1dZ%2BbqSvbJybXb0EfV\_uXSDwXurnig%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CAK6eDKeTjswArfEDyzfs1dZ%2BbqSvbJybXb0EfV_uXSDwXurnig%40mail.gmail.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

### Author: ![dantuff](https://avatars.discourse-cdn.com/v4/letter/d/e79b87/32.png) [@dantuff](https://discuss.elastic.co/u/dantuff)
#### Post date: [April 18, 2014, 10:14am UTC](https://discuss.elastic.co/t/wildcard-query-is-not-working/17067/2 "2014-04-18T10:14:34Z")

</div>

You're setting the size parameter to 0 in your queries so it won't return  
anything. Also, you need to have an copy of the URL value in your index  
that is not analyzed which you can use for your wildcard query. In your  
mapping you need to specify that you want to index the URL value verbatim:

"URL": {  
"type": "string",  
"fields": {  
"untouched": {  
"type": "string",  
"index": "not\_analyzed"  
},  
}  
}

Using the mapping above the URL value will be indexed using default  
standard analyzer, it will also index a verbatim copy of the value as  
specified by the 'untouched' field which you would use in the wildcard  
query:

curl -XGET '[http://localhost:9200/message\_index/message\_indext/\_search](http://localhost:9200/message_index/message_indext/_search)' -d  
'{"query":{"wildcard":{"URL.untouched":"[http://www.mohit-kumar-yadav.com](http://www.mohit-kumar-yadav.com)\*"}}}'

Dan

On Thursday, April 17, 2014 8:55:20 PM UTC+1, Mohit Kumar Yadav wrote:

> hi folks,  
> In my document there is a field which contians only URL as it value.  
> forexample {"URL" : "[http://www.mohit-kumar-yadav.com](http://www.mohit-kumar-yadav.com)\123124343\login\_user.html"  
> }  
> {"URL" : "[http://www.mohit-kumar-yadav.com](http://www.mohit-kumar-yadav.com)\home\_user.html"}  
> how can i search these documents.  
> I am using following query :-
> 
> 1. Curl -XGET '  
> [http://localhost:9200/message\_index/message\_indext/\_search?size=0](http://localhost:9200/message_index/message_indext/_search?size=0)'  
> -d'{"query":{"wildcard":{"URL":"_mohit-kumar-yadav_"}}}'
> 
> no result.. query return zero hits
> 
> 1. Curl -XGET '  
> [http://localhost:9200/message\_index/message\_indext/\_search?size=0](http://localhost:9200/message_index/message_indext/_search?size=0)'  
> -d'{"query":{"field":{"URL":"[http://www.mohit-kumar-yadav.com](http://www.mohit-kumar-yadav.com)"}}}'
> 
> no result.. query return zero hits
> 
> 1. Curl -XGET '  
> [http://localhost:9200/message\_index/message\_indext/\_search?size=0](http://localhost:9200/message_index/message_indext/_search?size=0)'  
> -d'{"fuzzy\_like\_this\_field" : {"URL" : {"like\_text" : "  
> [www.mohit-kumar-yadav.com](http://www.mohit-kumar-yadav.com)","max\_query\_terms" : 25}}}'
> 
> no result.. query return zero hits
> 
> please suggest me where i am doing wrong..
> 
> Thanks in advance..!!!
> 
> Regrads  
> Mohit

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/84f57d26-3072-407c-bcfa-cdb40400788b%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/84f57d26-3072-407c-bcfa-cdb40400788b%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<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 6, 2017, 1:35am UTC](https://discuss.elastic.co/t/wildcard-query-is-not-working/17067/3 "2017-07-06T01:35:05Z")

</div>


