Wildcard query is not working


(mohit.Kumar) #1

hi folks,
In my document there is a field which contians only URL as it value.
forexample {"URL" :
"http://www.mohit-kumar-yadav.com\123124343\login_user.html"
}
{"URL" : "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'
    -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'
    -d'{"query":{"field":{"URL":"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'
    -d'{"fuzzy_like_this_field" : {"URL" : {"like_text" : "
    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.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/CAK6eDKeTjswArfEDyzfs1dZ%2BbqSvbJybXb0EfV_uXSDwXurnig%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


(Dan Tuffery) #2

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' -d
'{"query":{"wildcard":{"URL.untouched":"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\123124343\login_user.html"
}
{"URL" : "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'
    -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'
    -d'{"query":{"field":{"URL":"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'
    -d'{"fuzzy_like_this_field" : {"URL" : {"like_text" : "
    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.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/84f57d26-3072-407c-bcfa-cdb40400788b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


(system) #3