# Search Analyzer Not Working

**URL:** <https://discuss.elastic.co/t/search-analyzer-not-working/12272>\
**Category:** Elasticsearch\
**Created:** [June 5, 2013, 4:30am UTC](https://discuss.elastic.co/t/search-analyzer-not-working/12272 "2013-06-05T04:30:45Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![tarang\_dawer](https://avatars.discourse-cdn.com/v4/letter/t/c0e974/32.png) [@tarang\_dawer](https://discuss.elastic.co/u/tarang_dawer)\
**Post date:** [June 5, 2013, 4:30am UTC](https://discuss.elastic.co/t/search-analyzer-not-working/12272/1 "2013-06-05T04:30:45Z")

</div>

Hi

I am trying to search on URL type field , created a custom analyzer with  
tokenizer as uax\_url\_email , and indexedit with the same.  
i have explicitly specified the "index\_analyzer" and "search\_analyzer"  
fields while creating the mapping, as the same custom analyzer.

As per my understanding , the uax\_url\_email tokenizer , recognizes the  
string as an Email or an URL , but does not breaks it further.  
So , since the whole string is preserved as a single token , wild card  
Queries should work on it.  
They do work in some cases like when i search for  
_[www.englishdictionary.fr](http://www.englishdictionary.fr)_  
but fail when i do a search for _[www.englishdictionary.fr/hann](http://www.englishdictionary.fr/hann)_  
and an Parsing Exception is thrown .

Since i have explicitly specified the "search\_analyzer" as the custom  
analyzer , my query\_string is supposed to be analyzed in the way defined in  
the analyzer specified., i.e any url will not be tokenized by being broken  
into smaller components.

I also checked with the curl Command , to check the fuctioning of the  
custom analyzer, and as expected , it's showing me the complete URL as a  
single token.  
but while searching throgh java API, a parsing exception is being thrown.

I also tried setting the analyzer as "uax\_url\_email1" (custom analyzer's  
name) with the query , and also tried setting analyzeWildcard = false , but  
to no avail , still the query fails.

Below is the link for the Gist  
[https://gist.github.com/F-Torres/5711570](https://gist.github.com/F-Torres/5711570)

1. Please also suggest how to search for wildcards in the URL , if it  
already contains wildcard characters like ? and \* , ( while keeping the URL  
field not analyzed / Keyword Analyzer / Custom Analyzer with uax\_url\_email  
tokenizer )

Exception being thrown : -

org.elasticsearch.action.search.SearchPhaseExecutionException: Failed to  
execute phase [dfs], total failure; shardFailures  
{[27tA5ursT6CQbjmx1FFSsQ][html][1]: SearchParseException[[html][1]:  
from[-1],size[10000]: Parse Failure [Failed to parse source  
[{"size":10000,"query":{"query\_string":{"query":"\*  
[www.englishdictionary.fr/hann\*","fields":["urls"],"analyzer":"uax\_url\_email1"}},"fields":"](http://www.englishdictionary.fr/hann*%22,%22fields%22:%5B%22urls%22%5D,%22analyzer%22:%22uax_url_email1%22%7D%7D,%22fields%22:%22)_"}]]];  
nested: QueryParsingException[[html] Failed to parse query [_  
[www.englishdictionary.fr/hann\*](http://www.englishdictionary.fr/hann*)]]; nested: ParseException[Cannot parse '\*  
[www.englishdictionary.fr/hann\*](http://www.englishdictionary.fr/hann*)': Lexical error at line 1, column 32.  
Encountered: after : "/hann\*"]; nested: TokenMgrError[Lexical error  
at line 1, column 32. Encountered: after : "/hann\*"];  
}{[27tA5ursT6CQbjmx1FFSsQ][html][3]: SearchParseException[[html][3]:  
from[-1],size[10000]: Parse Failure [Failed to parse source  
[{"size":10000,"query":{"query\_string":{"query":"\*  
[www.englishdictionary.fr/hann\*","fields":["urls"],"analyzer":"uax\_url\_email1"}},"fields":"](http://www.englishdictionary.fr/hann*%22,%22fields%22:%5B%22urls%22%5D,%22analyzer%22:%22uax_url_email1%22%7D%7D,%22fields%22:%22)_"}]]];  
nested: QueryParsingException[[html] Failed to parse query [_  
[www.englishdictionary.fr/hann\*](http://www.englishdictionary.fr/hann*)]]; nested: ParseException[Cannot parse '\*  
[www.englishdictionary.fr/hann\*](http://www.englishdictionary.fr/hann*)': Lexical error at line 1, column 32.  
Encountered: after : "/hann\*"]; nested: TokenMgrError[Lexical error  
at line 1, column 32. Encountered: after : "/hann\*"]; }  
at  
org.elasticsearch.action.search.type.TransportSearchTypeAction$BaseAsyncAction.onFirstPhaseResult(TransportSearchTypeAction.java:260)  
at  
org.elasticsearch.action.search.type.TransportSearchTypeAction$BaseAsyncAction$3.onFailure(TransportSearchTypeAction.java:213)  
at  
org.elasticsearch.search.action.SearchServiceTransportAction.sendExecuteDfs(SearchServiceTransportAction.java:110)  
at  
org.elasticsearch.action.search.type.TransportSearchDfsQueryThenFetchAction$AsyncAction.sendExecuteFirstPhase(TransportSearchDfsQueryThenFetchAction.java:86)  
at  
org.elasticsearch.action.search.type.TransportSearchTypeAction$BaseAsyncAction.performFirstPhase(TransportSearchTypeAction.java:205)  
at  
org.elasticsearch.action.search.type.TransportSearchTypeAction$BaseAsyncAction.performFirstPhase(TransportSearchTypeAction.java:192)  
at  
org.elasticsearch.action.search.type.TransportSearchTypeAction$BaseAsyncAction$2.run(TransportSearchTypeAction.java:178)  
at  
java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)  
at  
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)  
at java.lang.Thread.run(Thread.java:662)

Please Help .

--  
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).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<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, 2:32am UTC](https://discuss.elastic.co/t/search-analyzer-not-working/12272/2 "2017-07-06T02:32:54Z")

</div>


